2 * Copyright (c) 2015 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.
19 #include <dali/devel-api/scripting/scripting.h>
22 #include <dali/public-api/actors/actor.h>
23 #include <dali/public-api/images/resource-image.h>
24 #include <dali/public-api/object/type-registry.h>
25 #include <dali/public-api/object/property-array.h>
26 #include <dali/internal/common/image-attributes.h>
27 #include <dali/internal/event/images/resource-image-impl.h>
28 #include <dali/internal/event/images/frame-buffer-image-impl.h>
29 #include <dali/internal/event/images/buffer-image-impl.h>
30 #include <dali/internal/event/effects/shader-effect-impl.h>
41 // Tables used here for converting strings to the enumerations and vice versa
47 const AnchorValue ANCHOR_CONSTANT_TABLE[] =
49 { "TOP_LEFT", ParentOrigin::TOP_LEFT },
50 { "TOP_CENTER", ParentOrigin::TOP_CENTER },
51 { "TOP_RIGHT", ParentOrigin::TOP_RIGHT },
52 { "CENTER_LEFT", ParentOrigin::CENTER_LEFT },
53 { "CENTER", ParentOrigin::CENTER },
54 { "CENTER_RIGHT", ParentOrigin::CENTER_RIGHT },
55 { "BOTTOM_LEFT", ParentOrigin::BOTTOM_LEFT },
56 { "BOTTOM_CENTER", ParentOrigin::BOTTOM_CENTER },
57 { "BOTTOM_RIGHT", ParentOrigin::BOTTOM_RIGHT },
59 const unsigned int ANCHOR_CONSTANT_TABLE_COUNT = sizeof( ANCHOR_CONSTANT_TABLE ) / sizeof( ANCHOR_CONSTANT_TABLE[0] );
61 const StringEnum COLOR_MODE_TABLE[] =
63 { "USE_OWN_COLOR", USE_OWN_COLOR },
64 { "USE_PARENT_COLOR", USE_PARENT_COLOR },
65 { "USE_OWN_MULTIPLY_PARENT_COLOR", USE_OWN_MULTIPLY_PARENT_COLOR },
66 { "USE_OWN_MULTIPLY_PARENT_ALPHA", USE_OWN_MULTIPLY_PARENT_ALPHA },
68 const unsigned int COLOR_MODE_TABLE_COUNT = sizeof( COLOR_MODE_TABLE ) / sizeof( COLOR_MODE_TABLE[0] );
70 const StringEnum POSITION_INHERITANCE_MODE_TABLE[] =
72 { "INHERIT_PARENT_POSITION", INHERIT_PARENT_POSITION },
73 { "USE_PARENT_POSITION", USE_PARENT_POSITION },
74 { "USE_PARENT_POSITION_PLUS_LOCAL_POSITION", USE_PARENT_POSITION_PLUS_LOCAL_POSITION },
75 { "DONT_INHERIT_POSITION", DONT_INHERIT_POSITION },
77 const unsigned int POSITION_INHERITANCE_MODE_TABLE_COUNT = sizeof( POSITION_INHERITANCE_MODE_TABLE ) / sizeof( POSITION_INHERITANCE_MODE_TABLE[0] );
79 const StringEnum DRAW_MODE_TABLE[] =
81 { "NORMAL", DrawMode::NORMAL },
82 { "OVERLAY_2D", DrawMode::OVERLAY_2D },
83 { "STENCIL", DrawMode::STENCIL },
85 const unsigned int DRAW_MODE_TABLE_COUNT = sizeof( DRAW_MODE_TABLE ) / sizeof( DRAW_MODE_TABLE[0] );
87 const StringEnum IMAGE_LOAD_POLICY_TABLE[] =
89 { "IMMEDIATE", ResourceImage::IMMEDIATE },
90 { "ON_DEMAND", ResourceImage::ON_DEMAND },
92 const unsigned int IMAGE_LOAD_POLICY_TABLE_COUNT = sizeof( IMAGE_LOAD_POLICY_TABLE ) / sizeof( IMAGE_LOAD_POLICY_TABLE[0] );
94 const StringEnum IMAGE_RELEASE_POLICY_TABLE[] =
96 { "UNUSED", Image::UNUSED },
97 { "NEVER", Image::NEVER },
99 const unsigned int IMAGE_RELEASE_POLICY_TABLE_COUNT = sizeof( IMAGE_RELEASE_POLICY_TABLE ) / sizeof( IMAGE_RELEASE_POLICY_TABLE[0] );
101 const StringEnum PIXEL_FORMAT_TABLE[] =
105 { "LA88", Pixel::LA88 },
106 { "RGB565", Pixel::RGB565 },
107 { "BGR565", Pixel::BGR565 },
108 { "RGBA4444", Pixel::RGBA4444 },
109 { "BGRA4444", Pixel::BGRA4444 },
110 { "RGBA5551", Pixel::RGBA5551 },
111 { "BGRA5551", Pixel::BGRA5551 },
112 { "RGB888", Pixel::RGB888 },
113 { "RGB8888", Pixel::RGB8888 },
114 { "BGR8888", Pixel::BGR8888 },
115 { "RGBA8888", Pixel::RGBA8888 },
116 { "BGRA8888", Pixel::BGRA8888 },
117 { "COMPRESSED_R11_EAC", Pixel::COMPRESSED_R11_EAC },
118 { "COMPRESSED_SIGNED_R11_EAC", Pixel::COMPRESSED_SIGNED_R11_EAC },
119 { "COMPRESSED_SIGNED_RG11_EAC", Pixel::COMPRESSED_SIGNED_RG11_EAC },
120 { "COMPRESSED_RG11_EAC", Pixel::COMPRESSED_RG11_EAC },
121 { "COMPRESSED_RGB8_ETC2", Pixel::COMPRESSED_RGB8_ETC2 },
122 { "COMPRESSED_SRGB8_ETC2", Pixel::COMPRESSED_SRGB8_ETC2 },
123 { "COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2", Pixel::COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 },
124 { "COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2", Pixel::COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 },
125 { "COMPRESSED_RGBA8_ETC2_EAC", Pixel::COMPRESSED_RGBA8_ETC2_EAC },
126 { "COMPRESSED_SRGB8_ALPHA8_ETC2_EAC", Pixel::COMPRESSED_SRGB8_ALPHA8_ETC2_EAC },
127 { "COMPRESSED_RGB8_ETC1", Pixel::COMPRESSED_RGB8_ETC1 },
128 { "COMPRESSED_RGB_PVRTC_4BPPV1", Pixel::COMPRESSED_RGB_PVRTC_4BPPV1 },
130 const unsigned int PIXEL_FORMAT_TABLE_COUNT = sizeof( PIXEL_FORMAT_TABLE ) / sizeof( PIXEL_FORMAT_TABLE[0] );
132 const StringEnum IMAGE_FITTING_MODE_TABLE[] =
134 { "SHRINK_TO_FIT", FittingMode::SHRINK_TO_FIT },
135 { "SCALE_TO_FILL", FittingMode::SCALE_TO_FILL },
136 { "FIT_WIDTH", FittingMode::FIT_WIDTH },
137 { "FIT_HEIGHT", FittingMode::FIT_HEIGHT },
139 const unsigned int IMAGE_FITTING_MODE_TABLE_COUNT = sizeof( IMAGE_FITTING_MODE_TABLE ) / sizeof( IMAGE_FITTING_MODE_TABLE[0] );
141 const StringEnum IMAGE_SAMPLING_MODE_TABLE[] =
143 { "BOX", SamplingMode::BOX },
144 { "NEAREST", SamplingMode::NEAREST },
145 { "LINEAR", SamplingMode::LINEAR },
146 { "BOX_THEN_NEAREST", SamplingMode::BOX_THEN_NEAREST },
147 { "BOX_THEN_LINEAR", SamplingMode::BOX_THEN_LINEAR },
148 { "NO_FILTER", SamplingMode::NO_FILTER },
149 { "DONT_CARE", SamplingMode::DONT_CARE },
151 const unsigned int IMAGE_SAMPLING_MODE_TABLE_COUNT = sizeof( IMAGE_SAMPLING_MODE_TABLE ) / sizeof( IMAGE_SAMPLING_MODE_TABLE[0] );
153 const char* ImageTypeName[] = { "ResourceImage", "FrameBufferImage", "BufferImage" };
154 enum ImageType { RESOURCE_IMAGE, FRAME_BUFFER_IMAGE, BUFFER_IMAGE };
155 const unsigned int imageTypeCount = sizeof( ImageTypeName ) / sizeof( const char* );
157 bool CompareEnums( const char * a, const char * b, size_t& size )
160 while( ( *a != '\0' ) && ( *b != '\0' ) && ( *a != ',') && ( *b != ',') )
166 if( ( ( ca == '-' ) || ( ca == '_') ) &&
167 ( ( cb == '-' ) || ( cb == '_') ) )
174 if( ( 'A' <= ca ) && ( ca <= 'Z') )
176 ca = ca + ( 'a' - 'A' );
179 if( ( 'A' <= cb ) && ( cb <= 'Z') )
181 cb = cb + ( 'a' - 'A' );
193 // enums can be comma separated so check ends and comma
194 if( ( ( *a == '\0' ) && ( *b == '\0' ) ) ||
195 ( ( *a == '\0' ) && ( *b == ',' ) ) ||
196 ( ( *a == ',' ) && ( *b == '\0' ) ) )
204 } // unnamed namespace
206 bool EnumStringToInteger( const char * const value, const StringEnum* const enumTable, unsigned int tableCount, unsigned int& integerEnum )
208 unsigned int ret = 0;
213 if( value && enumTable && tableCount )
215 const char* pValue = value;
221 const StringEnum* table = enumTable;
223 for ( unsigned int i = 0; i < tableCount; ++i )
225 if( CompareEnums( pValue, table->string, size ) )
238 // allow comma separated or'd value
239 if( *(pValue+size) == ',' )
253 DALI_LOG_ERROR( "Unknown enumeration string %s\n", value );
258 unsigned int FindEnumIndex( const char* value, const StringEnum* table, unsigned int tableCount )
260 unsigned int index = 0;
262 for ( unsigned int i = 0; i < tableCount; ++i, ++index )
264 size_t sizeIgnored = 0;
265 if( CompareEnums( value, table->string, sizeIgnored ) )
274 DALI_LOG_ERROR( "Unknown enumeration string %s\n", value );
279 ColorMode GetColorMode( const std::string& value )
281 // return default on error
282 ColorMode mode( USE_OWN_MULTIPLY_PARENT_ALPHA );
283 GetEnumeration< ColorMode >( value.c_str(), COLOR_MODE_TABLE, COLOR_MODE_TABLE_COUNT, mode );
288 std::string GetColorMode( ColorMode value )
290 const char* name = GetEnumerationName< ColorMode >( value, COLOR_MODE_TABLE, COLOR_MODE_TABLE_COUNT );
293 return std::string( name );
295 return std::string();
298 PositionInheritanceMode GetPositionInheritanceMode( const std::string& value )
300 // return default on error
301 PositionInheritanceMode mode( INHERIT_PARENT_POSITION );
302 GetEnumeration< PositionInheritanceMode >( value.c_str(), POSITION_INHERITANCE_MODE_TABLE, POSITION_INHERITANCE_MODE_TABLE_COUNT, mode );
307 std::string GetPositionInheritanceMode( PositionInheritanceMode value )
309 const char* name = GetEnumerationName< PositionInheritanceMode >( value, POSITION_INHERITANCE_MODE_TABLE, POSITION_INHERITANCE_MODE_TABLE_COUNT );
312 return std::string( name );
314 return std::string();
318 DrawMode::Type GetDrawMode( const std::string& value )
320 // return default on error
321 DrawMode::Type mode( DrawMode::NORMAL );
322 GetEnumeration< DrawMode::Type >( value.c_str(), DRAW_MODE_TABLE, DRAW_MODE_TABLE_COUNT, mode );
327 std::string GetDrawMode( DrawMode::Type value )
329 const char* name = GetEnumerationName< DrawMode::Type >( value, DRAW_MODE_TABLE, DRAW_MODE_TABLE_COUNT );
332 return std::string( name );
334 return std::string();
338 Vector3 GetAnchorConstant( const std::string& value )
340 for( unsigned int i = 0; i < ANCHOR_CONSTANT_TABLE_COUNT; ++i )
342 size_t sizeIgnored = 0;
343 if( CompareEnums( value.c_str(), ANCHOR_CONSTANT_TABLE[ i ].name, sizeIgnored ) )
345 return ANCHOR_CONSTANT_TABLE[ i ].value;
352 Image NewImage( const Property::Value& property )
356 std::string filename;
357 ResourceImage::LoadPolicy loadPolicy = Dali::Internal::IMAGE_LOAD_POLICY_DEFAULT;
358 Image::ReleasePolicy releasePolicy = Dali::Internal::IMAGE_RELEASE_POLICY_DEFAULT;
359 Internal::ImageAttributes attributes = Internal::ImageAttributes::New();
361 const Property::Map* map = property.GetMap();
362 ImageType imageType = RESOURCE_IMAGE; // default to resource image
365 // first check the type as it determines, which other parameters are needed
366 const Property::Value* value = map->Find( "type" );
371 for( unsigned int i = 0; i < imageTypeCount; ++i )
373 if( 0 == type.compare( ImageTypeName[ i ] ) )
375 imageType = static_cast<ImageType>( i );
381 // filename is only needed for resource images
382 if( RESOURCE_IMAGE == imageType )
384 const Property::Value* value = map->Find( "filename" );
387 value->Get( filename );
389 // if empty file, no need to go further
390 if( filename.size() == 0 )
392 DALI_LOG_ERROR( "No filename\n" );
397 value = map->Find( "loadPolicy" );
401 value->Get( policy );
402 // keep default value on error
403 GetEnumeration< ResourceImage::LoadPolicy >( policy.c_str(), IMAGE_LOAD_POLICY_TABLE, IMAGE_LOAD_POLICY_TABLE_COUNT, loadPolicy );
406 value = map->Find( "releasePolicy" );
410 value->Get( policy );
411 // keep default value on error
412 GetEnumeration< Image::ReleasePolicy >( policy.c_str(), IMAGE_RELEASE_POLICY_TABLE, IMAGE_RELEASE_POLICY_TABLE_COUNT, releasePolicy );
415 // Width and height can be set individually. Dali derives the unspecified
416 // dimension from the aspect ratio of the raw image.
417 int width = 0, height = 0;
419 value = map->Find( "width" );
422 // handle floats and integer the same for json script
423 if( value->GetType() == Property::FLOAT )
425 width = static_cast<unsigned int>( value->Get<float>() );
432 value = map->Find( "height" );
435 if( value->GetType() == Property::FLOAT )
437 height = static_cast<int>( value->Get<float>() );
441 value->Get( height );
444 attributes.SetSize( width, height );
446 Pixel::Format pixelFormat = Pixel::RGBA8888;
447 value = map->Find( "pixelFormat" );
451 value->Get( format );
452 GetEnumeration< Pixel::Format >( format.c_str(), PIXEL_FORMAT_TABLE, PIXEL_FORMAT_TABLE_COUNT, pixelFormat );
455 value = map->Find( "fittingMode" );
459 value->Get( fitting );
460 FittingMode::Type mode;
461 if( GetEnumeration< FittingMode::Type >( fitting.c_str(), IMAGE_FITTING_MODE_TABLE, IMAGE_FITTING_MODE_TABLE_COUNT, mode ) )
463 attributes.SetScalingMode( mode );
467 value = map->Find( "samplingMode" );
470 std::string sampling;
471 value->Get( sampling );
472 SamplingMode::Type mode;
473 if( GetEnumeration< SamplingMode::Type >( sampling.c_str(), IMAGE_SAMPLING_MODE_TABLE, IMAGE_SAMPLING_MODE_TABLE_COUNT, mode ) )
475 attributes.SetFilterMode( mode );
479 value = map->Find( "orientation" );
482 bool b = value->Get<bool>();
483 attributes.SetOrientationCorrection( b );
488 case RESOURCE_IMAGE :
490 ret = ResourceImage::New( filename, loadPolicy, releasePolicy,
491 ImageDimensions( attributes.GetSize().x, attributes.GetSize().y ),
492 attributes.GetScalingMode(), attributes.GetFilterMode(), attributes.GetOrientationCorrection() );
497 ret = BufferImage::New( attributes.GetWidth(),
498 attributes.GetHeight(),
503 case FRAME_BUFFER_IMAGE :
505 ret = FrameBufferImage::New( attributes.GetWidth(),
506 attributes.GetHeight(),
516 } // Image NewImage( Property::Value map )
519 ShaderEffect NewShaderEffect( const Property::Value& property )
521 Internal::ShaderEffectPtr ret;
523 const Property::Map* map = property.GetMap();
526 ret = Internal::ShaderEffect::New( Dali::ShaderEffect::HINT_NONE ); // hint can be reset if in map
528 const Property::Value* value = map->Find( "program" );
531 Property::Index index = ret->GetPropertyIndex( "program" );
532 ret->SetProperty( index, *value );
535 for( unsigned int i = 0; i < map->Count(); ++i )
537 const std::string& key = map->GetKey( i );
538 if( key != "program" )
540 Property::Index index = ret->GetPropertyIndex( key );
542 const Property::Value& value = map->GetValue( i );
543 if( Property::INVALID_INDEX != index )
545 ret->SetProperty( index, value );
549 // if its not a property then register it as a uniform (making a custom property)
550 if( value.GetType() == Property::INTEGER )
552 // valid uniforms are floats, vec3's etc so we recast if the user accidentally
553 // set as integer. Note the map could have come from json script.
554 Property::Value asFloat( static_cast<float>( value.Get<int>() ) );
555 ret->SetUniform( key, asFloat, Dali::ShaderEffect::COORDINATE_TYPE_DEFAULT );
559 ret->SetUniform( key, value, Dali::ShaderEffect::COORDINATE_TYPE_DEFAULT );
566 return Dali::ShaderEffect(ret.Get());
570 Actor NewActor( const Property::Map& map )
574 // First find type and create Actor
575 Property::Value* typeValue = map.Find( "type" );
578 TypeInfo type = TypeRegistry::Get().GetTypeInfo( typeValue->Get< std::string >() );
581 handle = type.CreateInstance();
587 DALI_LOG_ERROR( "Actor type not provided\n" );
591 Actor actor( Actor::DownCast( handle ) );
595 // Now set the properties, or create children
596 for ( unsigned int i = 0, mapCount = map.Count(); i < mapCount; ++i )
598 const StringValuePair& pair( map.GetPair( i ) );
599 const std::string& key( pair.first );
605 const Property::Value& value( pair.second );
607 if ( key == "actors" )
610 Property::Array actorArray = value.Get< Property::Array >();
611 for ( Property::Array::SizeType i = 0; i < actorArray.Size(); ++i)
613 actor.Add( NewActor( actorArray[i].Get< Property::Map >() ) );
616 else if( key == "parentOrigin" )
618 // Parent Origin can be a string constant as well as a Vector3
620 const Property::Type type( value.GetType() );
621 if ( type == Property::VECTOR3 )
623 actor.SetParentOrigin( value.Get< Vector3 >() );
625 else if( type == Property::STRING )
627 actor.SetParentOrigin( GetAnchorConstant( value.Get< std::string >() ) );
630 else if( key == "anchorPoint" )
632 // Anchor Point can be a string constant as well as a Vector3
634 const Property::Type type( value.GetType() );
635 if ( type == Property::VECTOR3 )
637 actor.SetAnchorPoint( value.Get< Vector3 >() );
639 else if( type == Property::STRING )
641 actor.SetAnchorPoint( GetAnchorConstant( value.Get< std::string >() ) );
646 Property::Index index( actor.GetPropertyIndex( key ) );
648 if ( index != Property::INVALID_INDEX )
650 actor.SetProperty( index, value );
659 void CreatePropertyMap( Actor actor, Property::Map& map )
665 map[ "type" ] = actor.GetTypeName();
667 // Default properties
668 Property::IndexContainer indices;
669 actor.GetPropertyIndices( indices );
670 const Property::IndexContainer::ConstIterator endIter = indices.End();
672 for ( Property::IndexContainer::Iterator iter = indices.Begin(); iter != endIter; ++iter )
674 map[ actor.GetPropertyName( *iter ) ] = actor.GetProperty( *iter );
678 unsigned int childCount( actor.GetChildCount() );
681 Property::Array childArray;
682 for ( unsigned int child = 0; child < childCount; ++child )
684 Property::Map childMap;
685 CreatePropertyMap( actor.GetChildAt( child ), childMap );
686 childArray.PushBack( childMap );
688 map[ "actors" ] = childArray;
693 void CreatePropertyMap( Image image, Property::Map& map )
699 std::string imageType( "ResourceImage" );
701 // Get Type - cannot use TypeRegistry as Image is not an Object and thus, not registered
702 BufferImage bufferImage = BufferImage::DownCast( image );
705 imageType = "BufferImage";
706 map[ "pixelFormat" ] = GetEnumerationName< Pixel::Format >( bufferImage.GetPixelFormat(), PIXEL_FORMAT_TABLE, PIXEL_FORMAT_TABLE_COUNT );
708 else if ( FrameBufferImage::DownCast( image ) )
710 imageType = "FrameBufferImage";
713 map[ "type" ] = imageType;
714 map[ "releasePolicy" ] = GetEnumerationName< Image::ReleasePolicy >( image.GetReleasePolicy(), IMAGE_RELEASE_POLICY_TABLE, IMAGE_RELEASE_POLICY_TABLE_COUNT );
716 ResourceImage resourceImage = ResourceImage::DownCast( image );
719 map[ "filename" ] = resourceImage.GetUrl();
720 map[ "loadPolicy" ] = GetEnumerationName< ResourceImage::LoadPolicy >( resourceImage.GetLoadPolicy(), IMAGE_LOAD_POLICY_TABLE, IMAGE_LOAD_POLICY_TABLE_COUNT );
723 int width( image.GetWidth() );
724 int height( image.GetHeight() );
726 if ( width && height )
728 map[ "width" ] = width;
729 map[ "height" ] = height;
734 void NewAnimation( const Property::Map& map, Dali::AnimationData& outputAnimationData )
736 // Note: Builder cannot currently pass generic Property::Maps "{" that are nested, so currently we can only have one AnimateTo per animation.
737 Dali::AnimationData::AnimationDataElement* element = new Dali::AnimationData::AnimationDataElement();
738 element->alphaFunction = AlphaFunction::LINEAR;
739 element->timePeriodDelay = 0.0f;
740 element->timePeriodDuration = 1.0f;
742 // Now set the properties, or create children
743 for( unsigned int i = 0, animationMapCount = map.Count(); i < animationMapCount; ++i )
745 const StringValuePair& pair( map.GetPair( i ) );
746 const std::string& key( pair.first );
747 const Property::Value& value( pair.second );
751 element->actor = value.Get< std::string >();
753 else if( key == "property" )
755 element->property = value.Get< std::string >();
757 else if( key == "value" )
759 element->value = value;
761 else if( key == "alphaFunction" )
763 std::string alphaFunctionValue = value.Get< std::string >();
765 if( alphaFunctionValue == "LINEAR" )
767 element->alphaFunction = AlphaFunction::LINEAR;
769 else if( alphaFunctionValue == "REVERSE" )
771 element->alphaFunction = AlphaFunction::REVERSE;
773 else if( alphaFunctionValue == "EASE_IN_SQUARE" )
775 element->alphaFunction = AlphaFunction::EASE_IN_SQUARE;
777 else if( alphaFunctionValue == "EASE_OUT_SQUARE" )
779 element->alphaFunction = AlphaFunction::EASE_OUT_SQUARE;
781 else if( alphaFunctionValue == "EASE_IN" )
783 element->alphaFunction = AlphaFunction::EASE_IN;
785 else if( alphaFunctionValue == "EASE_OUT" )
787 element->alphaFunction = AlphaFunction::EASE_OUT;
789 else if( alphaFunctionValue == "EASE_IN_OUT" )
791 element->alphaFunction = AlphaFunction::EASE_IN_OUT;
793 else if( alphaFunctionValue == "EASE_IN_SINE" )
795 element->alphaFunction = AlphaFunction::EASE_IN_SINE;
797 else if( alphaFunctionValue == "EASE_OUT_SINE" )
799 element->alphaFunction = AlphaFunction::EASE_OUT_SINE;
801 else if( alphaFunctionValue == "EASE_IN_OUT_SINE" )
803 element->alphaFunction = AlphaFunction::EASE_IN_OUT_SINE;
805 else if( alphaFunctionValue == "BOUNCE" )
807 element->alphaFunction = AlphaFunction::BOUNCE;
809 else if( alphaFunctionValue == "SIN" )
811 element->alphaFunction = AlphaFunction::SIN;
813 else if( alphaFunctionValue == "EASE_OUT_BACK" )
815 element->alphaFunction = AlphaFunction::EASE_OUT_BACK;
818 else if( key == "timePeriod" )
820 Property::Array timeArray = value.Get< Property::Array >();
822 // TODO: Builder treats "{" within a Property::Map as a Property::Array.
823 // This means there is no key to determine what the values belong to.
824 if( timeArray.Size() >= 2 )
826 element->timePeriodDelay = timeArray[0].Get< float >();
827 element->timePeriodDuration = timeArray[1].Get< float >();
832 outputAnimationData.Add( element );
835 } // namespace scripting