#include <dali/internal/event/render-tasks/render-task-list-impl.h>
#include <dali/internal/event/common/property-helper.h>
#include <dali/internal/event/common/stage-impl.h>
+#include <dali/internal/event/common/type-info-impl.h>
#include <dali/internal/event/actor-attachments/actor-attachment-impl.h>
#include <dali/internal/event/animation/constraint-impl.h>
#include <dali/internal/event/common/projection.h>
if ( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX && index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )
{
AnimatablePropertyMetadata* animatable = FindAnimatableProperty( index );
+ if( !animatable )
+ {
+ const TypeInfo* typeInfo( GetTypeInfo() );
+ if ( typeInfo )
+ {
+ if( Property::INVALID_INDEX != RegisterSceneGraphProperty( typeInfo->GetPropertyName( index ), index, Property::Value( typeInfo->GetPropertyType( index ) ) ) )
+ {
+ animatable = FindAnimatableProperty( index );
+ }
+ }
+ }
DALI_ASSERT_ALWAYS( animatable && "Property index is invalid" );
+
property = animatable->GetSceneGraphProperty();
}
else if ( index >= DEFAULT_PROPERTY_MAX_COUNT )
if ( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX && index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )
{
AnimatablePropertyMetadata* animatable = FindAnimatableProperty( index );
+ if( !animatable )
+ {
+ const TypeInfo* typeInfo( GetTypeInfo() );
+ if ( typeInfo )
+ {
+ if( Property::INVALID_INDEX != RegisterSceneGraphProperty( typeInfo->GetPropertyName( index ), index, Property::Value( typeInfo->GetPropertyType( index ) ) ) )
+ {
+ animatable = FindAnimatableProperty( index );
+ }
+ }
+ }
DALI_ASSERT_ALWAYS( animatable && "Property index is invalid" );
+
property = animatable->GetSceneGraphProperty();
}
else if ( index >= DEFAULT_PROPERTY_MAX_COUNT )
if(!animatableProperty)
{
const TypeInfo* typeInfo( GetTypeInfo() );
- if (typeInfo && Property::INVALID_INDEX == RegisterSceneGraphProperty(typeInfo->GetPropertyName(index), index, propertyValue))
+ if (!typeInfo)
{
- DALI_LOG_ERROR("Cannot register property\n");
+ DALI_LOG_ERROR("Cannot find property index\n");
}
- else
+ else if ( Property::INVALID_INDEX == RegisterSceneGraphProperty( typeInfo->GetPropertyName( index ), index, propertyValue ) )
{
- DALI_LOG_ERROR("Cannot find property index\n");
+ DALI_LOG_ERROR("Cannot register property\n");
}
}
else
}
else
{
- mAnimatableProperties.PushBack( new AnimatablePropertyMetadata( propertyValue.GetType(), property ) );
+ mAnimatableProperties.PushBack( new AnimatablePropertyMetadata( index, propertyValue.GetType(), property ) );
}
// queue a message to add the property
{
DALI_ASSERT_ALWAYS( false && "Property notification added to event side only property." );
}
+ else if ( ( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX ) )
+ {
+ // check whether the animatable property is registered already, if not then register one.
+ AnimatablePropertyMetadata* animatable = FindAnimatableProperty( index );
+ if( !animatable )
+ {
+ const TypeInfo* typeInfo( GetTypeInfo() );
+ if ( typeInfo )
+ {
+ if( Property::INVALID_INDEX != RegisterSceneGraphProperty( typeInfo->GetPropertyName( index ), index, Property::Value( typeInfo->GetPropertyType( index ) ) ) )
+ {
+ animatable = FindAnimatableProperty( index );
+ }
+ }
+ }
+ DALI_ASSERT_ALWAYS( animatable && "Property index is invalid" );
+ }
else if ( mCustomProperties.Count() > 0 )
{
CustomPropertyMetadata* custom = FindCustomProperty( index );
AnimatablePropertyMetadata* Object::FindAnimatableProperty( Property::Index index ) const
{
- AnimatablePropertyMetadata* property( NULL );
- int arrayIndex = index - ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX;
- if( arrayIndex >= 0 )
+ for ( int arrayIndex = 0; arrayIndex < (int)mAnimatableProperties.Count(); arrayIndex++ )
{
- if( arrayIndex < (int)mAnimatableProperties.Count() )
+ AnimatablePropertyMetadata* property = static_cast<AnimatablePropertyMetadata*>( mAnimatableProperties[ arrayIndex ] );
+ if( property->index == index )
{
- property = static_cast<AnimatablePropertyMetadata*>(mAnimatableProperties[ arrayIndex ]);
+ return property;
}
}
- return property;
+ return NULL;
}
} // namespace Internal
*/
AnimatablePropertyMetadata* FindAnimatableProperty( Property::Index index ) const;
+ /**
+ * Helper to register a scene-graph property
+ * @param [in] name The name of the property.
+ * @param [in] index The index of the property
+ * @param [in] value The value of the property.
+ * @return The index of the registered property or Property::INVALID_INDEX if registration failed.
+ */
+ Property::Index RegisterSceneGraphProperty(const std::string& name, Property::Index index, const Property::Value& propertyValue) const;
+
private: // Default property extensions for derived classes
/**
*/
virtual void SetSceneGraphProperty( Property::Index index, const PropertyMetadata& entry, const Property::Value& value );
- /**
- * Helper to register a scene-graph property
- * @param [in] name The name of the property.
- * @param [in] index The index of the property
- * @param [in] value The value of the property.
- * @return The index of the registered property or Property::INVALID_INDEX if registration failed.
- */
- Property::Index RegisterSceneGraphProperty(const std::string& name, Property::Index index, const Property::Value& propertyValue) const;
-
protected:
/**
* Get the event thread services object - used for sending messages to the scene graph
/**
* Constructor for metadata of animatable property
+ * @param [in] newIndex The index of the animatable property.
+ * @param [in] newType The type ID of the animatable property.
* @param [in] newProperty A pointer to the scene-graph owned property.
*/
- AnimatablePropertyMetadata( Property::Type newType,
+ AnimatablePropertyMetadata( Property::Index newIndex,
+ Property::Type newType,
const SceneGraph::PropertyBase* newProperty )
+ : index(newIndex)
{
type = newType;
mProperty = newProperty;
/**
* Constructor for metadata of animatable property
+ * @param [in] newIndex The index of the animatable property.
* @param [in] newValue The value of the scene-graph owned property.
*/
- AnimatablePropertyMetadata( Property::Value newValue )
+ AnimatablePropertyMetadata( Property::Index newIndex,
+ Property::Value newValue )
+ : index(newIndex)
{
type = newValue.GetType();
value = newValue;
return true ;
}
+ Property::Index index; ///< The index of the property
+
private:
// Not implemented
DALI_COMPILE_TIME_ASSERT( ( Toolkit::objectType::Property::enumIndex - Toolkit::objectType::PROPERTY_START_INDEX ) == count );
#define DALI_ANIMATABLE_PROPERTY_REGISTRATION_INTERNAL( count, typeRegistrationObject, objectType, text, valueType, enumIndex) \
- AnimatablePropertyRegistration DALI_TOKEN_PASTE( property, count ) ( typeRegistrationObject, text, Toolkit::objectType::AnimatableProperty::enumIndex, Property::valueType );
+ AnimatablePropertyRegistration DALI_TOKEN_PASTE( property, count ) ( typeRegistrationObject, text, Toolkit::objectType::Property::enumIndex, Property::valueType );
#define DALI_SIGNAL_REGISTRATION_INTERNAL( count, typeRegistrationObject, objectType, text, textVariable ) \
const char* const textVariable = text; \