Scripting: Fix cut&paste typo
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / builder / builder-actor.cpp
1 //
2 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
3 //
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
7 //
8 //     http://floralicense.org/license/
9 //
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.
15 //
16
17 // EXTERNAL INCLUDES
18 #include <string>
19 #include <dali/integration-api/debug.h>
20 #include <dali/public-api/scripting/scripting.h>
21
22 // INTERNAL INCLUDES
23 #include <dali-toolkit/internal/builder/builder-get-is.inl.h>
24
25 namespace Dali
26 {
27
28 namespace Toolkit
29 {
30
31 namespace Internal
32 {
33
34 using namespace Dali::Scripting;
35
36 /*
37  * Handles special case actor configuration (anything thats not already a property)
38  *
39  */
40 Actor SetupActor( const TreeNode& child, Actor& actor )
41 {
42   DALI_ASSERT_ALWAYS( actor && "Empty actor handle" );
43
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") )
48   {
49     if( OptionalVector3 v = IsVector3(child, "parent-origin") )
50     {
51       actor.SetParentOrigin( *v );
52     }
53     else if( OptionalString origin = IsString(child, "parent-origin") )
54     {
55       actor.SetParentOrigin( GetAnchorConstant(*origin) );
56     }
57   }
58
59   if( !IsVector3(child, "anchor-point") )
60   {
61     if( OptionalVector3 v = IsVector3(child, "anchor-point") )
62     {
63       actor.SetAnchorPoint( *v );
64     }
65     else if( OptionalString anchor = IsString(child, "anchor-point") )
66     {
67       actor.SetAnchorPoint( GetAnchorConstant(*anchor) );
68     }
69   }
70
71   return actor;
72 }
73
74 } // namespace Internal
75
76 } // namespace Toolkit
77
78 } // namespace Dali