2 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://floralicense.org/license/
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
19 #include <dali/integration-api/debug.h>
20 #include <dali/public-api/scripting/scripting.h>
23 #include <dali-toolkit/internal/builder/builder-get-is.inl.h>
34 using namespace Dali::Scripting;
37 * Handles special case actor configuration (anything thats not already a property)
40 Actor SetupActor( const TreeNode& child, Actor& actor )
42 DALI_ASSERT_ALWAYS( actor && "Empty actor handle" );
44 // we allow enums strings for parent-origin and anchor-point but as with the current json
45 // strings always succeed if they exist then check its not vector. If they are Vec3s then
46 // this has already been set as a generic property.
47 if( !IsVector3( child, "parent-origin") )
49 if( OptionalVector3 v = IsVector3(child, "parent-origin") )
51 actor.SetParentOrigin( *v );
53 else if( OptionalString origin = IsString(child, "parent-origin") )
55 actor.SetParentOrigin( GetAnchorConstant(*origin) );
59 if( !IsVector3(child, "anchor-point") )
61 if( OptionalVector3 v = IsVector3(child, "anchor-point") )
63 actor.SetAnchorPoint( *v );
65 else if( OptionalString anchor = IsString(child, "anchor-point") )
67 actor.SetAnchorPoint( GetAnchorConstant(*anchor) );
74 } // namespace Internal
76 } // namespace Toolkit