2 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0
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.
20 #include <dali/integration-api/debug.h>
21 #include <dali/public-api/scripting/scripting.h>
24 #include <dali-toolkit/internal/builder/builder-get-is.inl.h>
35 using namespace Dali::Scripting;
38 * Handles special case actor configuration (anything thats not already a property)
41 Actor SetupActor( const TreeNode& child, Actor& actor )
43 DALI_ASSERT_ALWAYS( actor && "Empty actor handle" );
45 // we allow enums strings for parent-origin and anchor-point but as with the current json
46 // strings always succeed if they exist then check its not vector. If they are Vec3s then
47 // this has already been set as a generic property.
48 if( !IsVector3( child, "parent-origin") )
50 if( OptionalVector3 v = IsVector3(child, "parent-origin") )
52 actor.SetParentOrigin( *v );
54 else if( OptionalString origin = IsString(child, "parent-origin") )
56 actor.SetParentOrigin( GetAnchorConstant(*origin) );
60 if( !IsVector3(child, "anchor-point") )
62 if( OptionalVector3 v = IsVector3(child, "anchor-point") )
64 actor.SetAnchorPoint( *v );
66 else if( OptionalString anchor = IsString(child, "anchor-point") )
68 actor.SetAnchorPoint( GetAnchorConstant(*anchor) );
75 } // namespace Internal
77 } // namespace Toolkit