Thanks, I’m now trying with a different approach, based on node names as I could iterate through the children of the node.
However I’m facing a weird issue, I have probably overlooked something, but it seems the Node cannot find an existing child when loading:
void PODAnimationController::SetAnimationControllersAttr( const VariantVector& value )
{
animationControllers_.Clear();
for( unsigned i = 0; i < value.Size(); i++ )
{
Node* node = node_->GetChild( value[i].GetString() , true );
if( node )
{
AnimationController* controller = node->GetComponent<AnimationController>();
if( controller )
animationControllers_.Push( controller );
else
URHO3D_LOGERROR( "PODAnimationController::SetAnimationControllersAttr: value is not AnimationController type!" );
}
else
{
URHO3D_LOGERROR( "PODAnimationController::SetAnimationControllersAttr: Node \"" + value[i].GetString() + "\" not found in children of \"" + node_->GetName() + "\"!" );
continue;
}
}
}
void PODAnimationController::RegisterObject( Context* context )
{
context->RegisterFactory<PODAnimationController>();
URHO3D_MIXED_ACCESSOR_ATTRIBUTE( "AnimationControllers", GetAnimationControllersAttr, SetAnimationControllersAttr, VariantVector, Variant::emptyVariantVector, AM_DEFAULT );
}
While it’s able to find it through AngelScript:
Any help is welcome.
EDIT:
I’ve just found that node_->GetChildren().Size();
returns 0, considering this, where am I supposed to load my data while making sure that the children are already in there?
EDIT 1:
Solved: I just needed to assign the child names in the above function to a Vector<String>
and move the children related part to ApplyAttributes()
.