コード例 #1
0
ファイル: ComponentGroup.cpp プロジェクト: katik/naali
bool ComponentGroup::AddComponent(ComponentPtr comp)
{
    PROFILE(ComponentGroup_AddComponent);
    //Check if the component have already added to component group or it's name or type are different for the component group.
    if(ContainsComponent(comp) || comp->Name() != name_ || comp->TypeName() != typeName_) 
        return false;
    components_.push_back(ComponentWeakPtr(comp));
    editor_->AddNewComponent(comp);
    return true;
}
コード例 #2
0
ファイル: ComponentGroup.cpp プロジェクト: katik/naali
ComponentGroup::ComponentGroup(ComponentPtr component, ECComponentEditor *editor, bool isDynamic):
    editor_(editor),
    isDynamic_(isDynamic)
{
    assert(component);
    // No point to add component to editor cause it's already added in ECBrowser's AddNewComponentToGroup mehtod.
    if(component)
    {
        components_.push_back(ComponentWeakPtr(component));
        name_ = component->Name();
        typeName_ = component->TypeName();
    }
}
コード例 #3
0
void LineEditPropertyFactory::ComponentAdded(QtProperty * /*property*/, IComponent *comp)
{
    assert(comp);
    if(!comp)
        return;

    QList<ComponentWeakPtr>::iterator iter = components_.begin();
    for(; iter != components_.end(); ++iter)
        if ((*iter).lock().get() == comp)
            return;

    components_.push_back(ComponentWeakPtr(comp->ParentEntity()->GetComponent(comp->TypeName(), comp->Name())));
}
コード例 #4
0
boost::any ComponentTreeModel::getParent(const boost::any& node) const
{
    try
    {
        ComponentWeakPtr TheComponent = boost::any_cast<ComponentWeakPtr>(node);
        if(TheComponent != NULL &&
            TheComponent != getInternalRootComponent() &&
            TheComponent->getParentContainer() != NULL)
        {
            return boost::any(ComponentWeakPtr(dynamic_cast<Component*>(TheComponent->getParentContainer())));
        }
    }
    catch(boost::bad_any_cast &)
    {
    }
    return boost::any();
}
コード例 #5
0
boost::any ComponentTreeModel::getChild(const boost::any& parent, const UInt32& index) const
{
    try
    {
		ComponentContainerRefPtr TheContainer = dynamic_pointer_cast<ComponentContainer>(boost::any_cast<ComponentWeakPtr>(parent));
        if(TheContainer != NULL &&
           TheContainer->getMFChildren()->size() > index)
        {
            return boost::any(ComponentWeakPtr(TheContainer->getChildren(index)));
        }
        else
        {
            return boost::any();
        }
    }
    catch(boost::bad_any_cast &)
    {
        return boost::any();
    }
}
コード例 #6
0
boost::any ComponentTreeModel::getRoot(void) const
{
    return boost::any(ComponentWeakPtr(getInternalRootComponent()));
}