+ DALI_ASSERT_ALWAYS(mParser.GetRoot() && "Builder script not loaded");
+
+ //Search the pathConstrainer in the LUT
+ size_t count( mPathConstrainerLut.size() );
+ for( size_t i(0); i!=count; ++i )
+ {
+ if( mPathConstrainerLut[i].name == name )
+ {
+ //PathConstrainer has already been created
+ return mPathConstrainerLut[i].pathConstrainer;
+ }
+ }
+
+ //Create a new PathConstrainer
+ PathConstrainer ret;
+ if( OptionalChild constrainers = IsChild( *mParser.GetRoot(), "constrainers") )
+ {
+ if( OptionalChild pathConstrainer = IsChild( *constrainers, name ) )
+ {
+ OptionalString constrainerType(IsString(IsChild(*pathConstrainer, "type")));
+ if(!constrainerType)
+ {
+ DALI_SCRIPT_WARNING("Constrainer type not specified for constrainer '%s'\n", name.c_str() );
+ }
+ else if( *constrainerType == "PathConstrainer")
+ {
+ //points property
+ if( OptionalChild pointsProperty = IsChild( *pathConstrainer, "points") )
+ {
+ Dali::Property::Value points(Property::ARRAY);
+ if( SetPropertyFromNode( *pointsProperty, Property::ARRAY, points ) )
+ {
+ ret = PathConstrainer::New();
+ ret.SetProperty( PathConstrainer::Property::POINTS, points);
+
+ //controlPoints property
+ if( OptionalChild pointsProperty = IsChild( *pathConstrainer, "controlPoints") )
+ {
+ Dali::Property::Value points(Property::ARRAY);
+ if( SetPropertyFromNode( *pointsProperty, Property::ARRAY, points ) )
+ {
+ ret.SetProperty( PathConstrainer::Property::CONTROL_POINTS, points);
+ }
+
+ //Forward vector
+ OptionalVector3 forward( IsVector3( IsChild(*pathConstrainer, "forward" ) ) );
+ if( forward )
+ {
+ ret.SetProperty( PathConstrainer::Property::FORWARD, *forward);
+ }
+
+ //Add the new constrainer to the vector of PathConstrainer
+ PathConstrainerEntry entry = {name,ret};
+ mPathConstrainerLut.push_back( entry );
+ }
+ else
+ {
+ //Control points not specified
+ DALI_SCRIPT_WARNING("Control points not specified for pathConstrainer '%s'\n", name.c_str() );
+ }
+ }
+ }
+ else
+ {
+ //Interpolation points not specified
+ DALI_SCRIPT_WARNING("Interpolation points not specified for pathConstrainer '%s'\n", name.c_str() );
+ }
+ }
+ else
+ {
+ DALI_SCRIPT_WARNING("Constrainer '%s' is not a PathConstrainer\n", name.c_str() );
+ }
+ }
+ }
+
+ return ret;