2 * Copyright (c) 2016 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/devel-api/scripting/scripting.h>
24 #include <dali-toolkit/internal/builder/replacement.h>
25 #include <dali-toolkit/internal/builder/builder-impl.h>
36 using namespace Dali::Scripting;
37 extern void DeterminePropertyFromNode( const TreeNode& node, Property::Value& value, const Replacement& constant );
40 * Handles special case actor configuration (anything thats not already a property)
43 Actor SetupActor( const TreeNode& child, Actor& actor, const Replacement& constant )
45 DALI_ASSERT_ALWAYS( actor && "Empty actor handle" );
47 // we allow enums strings for parent-origin and anchor-point but as with the current json
48 // strings always succeed if they exist then check its not vector. If they are Vec3s then
49 // this has already been set as a generic property.
50 if( !IsVector3( child, "parentOrigin") )
52 if( OptionalVector3 v = constant.IsVector3( IsChild(child, "parentOrigin") ) )
54 actor.SetParentOrigin( *v );
56 else if( OptionalString origin = constant.IsString( IsChild(child, "parentOrigin") ) )
58 actor.SetParentOrigin( GetAnchorConstant(*origin) );
62 if( !IsVector3(child, "anchorPoint") )
64 if( OptionalVector3 v = constant.IsVector3( IsChild(child, "anchorPoint") ) )
66 actor.SetAnchorPoint( *v );
68 else if( OptionalString anchor = constant.IsString( IsChild(child, "anchorPoint") ) )
70 actor.SetAnchorPoint( GetAnchorConstant(*anchor) );
77 } // namespace Internal
79 } // namespace Toolkit