mSizeSet( Vector3::ZERO ),
mTargetSize( Vector3::ZERO ),
mNego( false ),
- mDepth(0u)
+ mDepth(0u),
+ develProp6( 10.0f )
{
}
mDaliProperty( Property::INVALID_INDEX ),
mSizeSet( Vector3::ZERO ),
mTargetSize( Vector3::ZERO ),
- mNego( nego )
+ mNego( nego ),
+ develProp6( 10.0f )
{
}
/**
{
return Property::Value(actorImpl.develProp5);
}
+ case Test::DevelTestCustomActor::Property::DEVEL_TEST_PROPERTY6:
+ {
+ return Property::Value(actorImpl.develProp6);
+ }
}
}
return Property::Value();
DALI_DEVEL_PROPERTY_REGISTRATION( Test, TestCustomActor, "develTestProperty3", VECTOR4, DEVEL_TEST_PROPERTY3)
DALI_DEVEL_PROPERTY_REGISTRATION( Test, TestCustomActor, "develTestProperty4", INTEGER, DEVEL_TEST_PROPERTY4)
DALI_DEVEL_PROPERTY_REGISTRATION( Test, TestCustomActor, "develTestProperty5", FLOAT, DEVEL_TEST_PROPERTY5)
+DALI_DEVEL_PROPERTY_REGISTRATION_READ_ONLY( Test, TestCustomActor, "develTestProperty6", FLOAT, DEVEL_TEST_PROPERTY6)
DALI_TYPE_REGISTRATION_END()
TEST_PROPERTY2 = Test::TestCustomActor::Property::TEST_PROPERTY2,
DEVEL_TEST_PROPERTY3 = TEST_PROPERTY2+1,
DEVEL_TEST_PROPERTY4 = TEST_PROPERTY2+2,
- DEVEL_TEST_PROPERTY5 = TEST_PROPERTY2+3
+ DEVEL_TEST_PROPERTY5 = TEST_PROPERTY2+3,
+ DEVEL_TEST_PROPERTY6 = TEST_PROPERTY2+4
};
} // Namespace Property
Dali::Vector4 develProp3;
int develProp4;
float develProp5;
+ float develProp6;
};
inline TestCustomActor& GetImpl( Test::TestCustomActor& handle )
Actor actor = Actor::New();
Stage::GetCurrent().Add(actor);
+ DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
+
// Build the animation
float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
// Start the animation from 40% progress
animation.PlayFrom( 0.4f );
+ // Target value should be updated straight away
+ DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+
bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
// Start the animation
animation.Play();
+ // Target value should be retrievable straight away
+ DALI_TEST_EQUALS( actor.GetProperty< bool >( index ), finalValue, TEST_LOCATION );
+
bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
// Start the animation
animation.Play();
+ // Target value should be retrievable straight away
+ DALI_TEST_EQUALS( actor.GetProperty< float >( index ), targetValue, TEST_LOCATION );
+
bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
// Start the animation
animation.Play();
+ // Target value should be retrievable straight away
+ DALI_TEST_EQUALS( actor.GetProperty< int >( index ), targetValue, TEST_LOCATION );
+
bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
END_TEST;
}
+int UtcDaliAnimationAnimateByQuaternionP(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+
+ // Register a quaternion property
+ const Quaternion startValue( Degree( 90 ), Vector3::XAXIS );
+ Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ Stage::GetCurrent().Add(actor);
+ DALI_TEST_CHECK( actor.GetProperty< Quaternion >(index) == startValue );
+ DALI_TEST_CHECK( actor.GetCurrentProperty< Quaternion >( index ) == startValue );
+
+ // Build the animation
+ float durationSeconds(2.0f);
+ Animation animation = Animation::New(durationSeconds);
+ const Quaternion relativeValue( Degree( 90 ), Vector3::ZAXIS );
+ const Quaternion finalValue( startValue * relativeValue );
+ animation.AnimateBy(Property(actor, index), relativeValue);
+
+ DALI_TEST_CHECK( actor.GetProperty< Quaternion >(index) == startValue );
+ DALI_TEST_CHECK( actor.GetCurrentProperty< Quaternion >( index ) == startValue );
+
+ // Start the animation
+ animation.Play();
+
+ // Target value should be retrievable straight away
+ DALI_TEST_CHECK( actor.GetProperty< Quaternion >(index) == finalValue );
+
+ application.SendNotification();
+ application.Render( 2000 ); // animation complete
+
+ DALI_TEST_CHECK( actor.GetProperty< Quaternion >(index) == finalValue );
+ DALI_TEST_CHECK( actor.GetCurrentProperty< Quaternion >( index ) == finalValue );
+
+ END_TEST;
+}
+
int UtcDaliAnimationAnimateByVector2P(void)
{
TestApplication application;
// Start the animation
animation.Play();
+ // Target value should be retrievable straight away
+ DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
+
bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
// Start the animation
animation.Play();
+ // Target value should be retrievable straight away
+ DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
+
bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
// Start the animation
animation.Play();
+ // Target value should be retrievable straight away
+ DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
+
bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
// Start the animation
animation.Play();
+ // Target value should be retrievable straight away
+ DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+
bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
END_TEST;
}
+int UtcDaliAnimationAnimateByActorPositionComponentsP(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+ Stage::GetCurrent().Add(actor);
+ DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
+
+ // Build the animation
+ float durationSeconds(1.0f);
+ Animation animation = Animation::New(durationSeconds);
+ Vector3 targetPosition(200.0f, 300.0f, 400.0f);
+ Vector3 relativePosition(targetPosition - Vector3::ZERO);
+ animation.AnimateBy( Property( actor, Actor::Property::POSITION_X ), relativePosition.x );
+ animation.AnimateBy( Property( actor, Actor::Property::POSITION_Y ), relativePosition.y );
+ animation.AnimateBy( Property( actor, Actor::Property::POSITION_Z ), relativePosition.z );
+
+ DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
+
+ // Start the animation
+ animation.Play();
+
+ // Target value should be retrievable straight away
+ DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), targetPosition.x, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), targetPosition.y, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), targetPosition.z, TEST_LOCATION );
+
+ DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION ); // Not changed yet
+
+ application.SendNotification();
+ application.Render( 1000 ); // 1 second progress
+
+ DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
+
+ END_TEST;
+}
+
int UtcDaliAnimationAnimateByActorPositionAlphaFunctionP(void)
{
TestApplication application;
// Start the animation
animation.Play();
+ // Target value should be retrievable straight away
+ DALI_TEST_EQUALS( actor.GetProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians, Vector3::YAXIS), TEST_LOCATION );
+
bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
// Start the animation
animation.Play();
+ // Target value should be retrievable straight away
+ DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
+
bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
END_TEST;
}
+int UtcDaliAnimationAnimateByActorScaleComponentsP(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+ Stage::GetCurrent().Add(actor);
+ DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
+
+ // Build the animation
+ float durationSeconds(1.0f);
+ Animation animation = Animation::New(durationSeconds);
+ Vector3 targetScale(2.0f, 3.0f, 4.0f);
+ Vector3 relativeScale(targetScale - Vector3::ONE);
+ animation.AnimateBy( Property( actor, Actor::Property::SCALE_X ), relativeScale.x );
+ animation.AnimateBy( Property( actor, Actor::Property::SCALE_Y ), relativeScale.y );
+ animation.AnimateBy( Property( actor, Actor::Property::SCALE_Z ), relativeScale.z );
+
+ DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION );
+
+ // Start the animation
+ animation.Play();
+
+ // Target value should be retrievable straight away
+ DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_X ), targetScale.x, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Y ), targetScale.y, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Z ), targetScale.z, TEST_LOCATION );
+
+ DALI_TEST_EQUALS( actor.GetCurrentScale(), Vector3::ONE, TEST_LOCATION ); // Not changed yet
+
+ application.SendNotification();
+ application.Render( 1000 ); // 1 second progress
+
+ DALI_TEST_EQUALS( actor.GetCurrentScale(), targetScale, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliAnimationAnimateByActorColorP(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+ Stage::GetCurrent().Add(actor);
+ DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
+
+ // Build the animation
+ float durationSeconds(1.0f);
+ Animation animation = Animation::New(durationSeconds);
+ Vector4 targetColor( 0.5f, 0.75f, 0.8f, 0.1f );
+ Vector4 relativeColor( targetColor - Color::WHITE );
+ animation.AnimateBy( Property( actor, Actor::Property::COLOR ), relativeColor );
+
+ DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION );
+
+ // Start the animation
+ animation.Play();
+
+ // Target value should be retrievable straight away
+ DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_RED ), targetColor.r, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), targetColor.g, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), targetColor.b, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), targetColor.a, TEST_LOCATION );
+
+ DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION ); // Not changed yet
+
+ application.SendNotification();
+ application.Render( 1000 ); // 1 second progress
+
+ DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliAnimationAnimateByActorColorComponentsP(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+ Stage::GetCurrent().Add(actor);
+ DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
+
+ // Build the animation
+ float durationSeconds(1.0f);
+ Animation animation = Animation::New(durationSeconds);
+ Vector4 targetColor( 0.5f, 0.75f, 0.8f, 0.1f );
+ Vector4 relativeColor( targetColor - Color::WHITE );
+ animation.AnimateBy( Property( actor, Actor::Property::COLOR_RED ), relativeColor.r );
+ animation.AnimateBy( Property( actor, Actor::Property::COLOR_GREEN ), relativeColor.g );
+ animation.AnimateBy( Property( actor, Actor::Property::COLOR_BLUE ), relativeColor.b );
+ animation.AnimateBy( Property( actor, Actor::Property::COLOR_ALPHA ), relativeColor.a );
+
+ DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION );
+
+ // Start the animation
+ animation.Play();
+
+ // Target value should be retrievable straight away
+ DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_RED ), targetColor.r, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), targetColor.g, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), targetColor.b, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), targetColor.a, TEST_LOCATION );
+
+ DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION ); // Not changed yet
+
+ application.SendNotification();
+ application.Render( 1000 ); // 1 second progress
+
+ DALI_TEST_EQUALS( actor.GetCurrentColor(), targetColor, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliAnimationAnimateByActorSizeP(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+ Stage::GetCurrent().Add(actor);
+ DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
+
+ // Build the animation
+ float durationSeconds(1.0f);
+ Animation animation = Animation::New(durationSeconds);
+ Vector3 targetSize( 100.0f, 200.0f, 300.0f );
+ Vector3 relativeSize( targetSize - Vector3::ZERO );
+ animation.AnimateBy( Property( actor, Actor::Property::SIZE ), relativeSize );
+
+ DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
+
+ // Start the animation
+ animation.Play();
+
+ // Target value should be retrievable straight away
+ DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), targetSize.width, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), targetSize.height, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), targetSize.depth, TEST_LOCATION );
+
+ DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION ); // Not changed yet
+
+ application.SendNotification();
+ application.Render( 1000 ); // 1 second progress
+
+ DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliAnimationAnimateByActorSizeComponentsP(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+ Stage::GetCurrent().Add(actor);
+ DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
+
+ // Build the animation
+ float durationSeconds(1.0f);
+ Animation animation = Animation::New(durationSeconds);
+ Vector3 targetSize( 100.0f, 200.0f, 300.0f );
+ Vector3 relativeSize( targetSize - Vector3::ZERO );
+ animation.AnimateBy( Property( actor, Actor::Property::SIZE_WIDTH ), relativeSize.width );
+ animation.AnimateBy( Property( actor, Actor::Property::SIZE_HEIGHT ), relativeSize.height );
+ animation.AnimateBy( Property( actor, Actor::Property::SIZE_DEPTH ), relativeSize.depth );
+
+ DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
+
+ // Start the animation
+ animation.Play();
+
+ // Target value should be retrievable straight away
+ DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), targetSize.width, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), targetSize.height, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), targetSize.depth, TEST_LOCATION );
+
+ DALI_TEST_EQUALS( actor.GetCurrentSize(), Vector3::ZERO, TEST_LOCATION ); // Not changed yet
+
+ application.SendNotification();
+ application.Render( 1000 ); // 1 second progress
+
+ DALI_TEST_EQUALS( actor.GetCurrentSize(), targetSize, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliAnimationAnimateByActorVisibilityP(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+ Stage::GetCurrent().Add(actor);
+ DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
+
+ actor.SetVisible( false );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( actor.IsVisible(), false, TEST_LOCATION );
+
+ // Build the animation
+ float durationSeconds(1.0f);
+ Animation animation = Animation::New(durationSeconds);
+ bool targetVisibility( true );
+ bool relativeVisibility( targetVisibility );
+ animation.AnimateBy( Property( actor, Actor::Property::VISIBLE ), relativeVisibility );
+
+ DALI_TEST_EQUALS( actor.GetProperty< bool >( Actor::Property::VISIBLE ), false, TEST_LOCATION );
+
+ // Start the animation
+ animation.Play();
+
+ // Target value should be retrievable straight away
+ DALI_TEST_EQUALS( actor.GetProperty< bool >( Actor::Property::VISIBLE ), targetVisibility, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.IsVisible(), false, TEST_LOCATION ); // Not changed yet
+
+ application.SendNotification();
+ application.Render( 1000 ); // 1 second progress
+
+ DALI_TEST_EQUALS( actor.IsVisible(), true, TEST_LOCATION );
+
+ END_TEST;
+}
+
int UtcDaliAnimationAnimateToBooleanP(void)
{
TestApplication application;
// Start the animation
animation.Play();
+ // Final key frame value should be retrievable straight away
+ DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), 0.9f, TEST_LOCATION );
+
bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
// Start the animation
animation.Play();
+ // Final key frame value should be retrievable straight away
+ DALI_TEST_EQUALS( actor.GetProperty< bool >( Actor::Property::VISIBLE ), true, TEST_LOCATION );
+
bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
// Start the animation
animation.Play();
+ // Final key frame value should be retrievable straight away
+ DALI_TEST_EQUALS( actor.GetProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Degree( 60 ), Vector3::ZAXIS ), TEST_LOCATION );
+
bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
END_TEST;
}
+
+int UtcDaliAnimationAnimateBetweenIntegerP(void)
+{
+ TestApplication application;
+
+ int startValue(1);
+ Actor actor = Actor::New();
+ const Property::Index index = actor.RegisterProperty("customProperty", startValue );
+ Stage::GetCurrent().Add(actor);
+
+ application.Render();
+ application.SendNotification();
+
+ DALI_TEST_EQUALS( actor.GetProperty< int >( index ), startValue, TEST_LOCATION );
+
+ // Build the animation
+ float durationSeconds(1.0f);
+ Animation animation = Animation::New(durationSeconds);
+
+ KeyFrames keyFrames = KeyFrames::New();
+ keyFrames.Add(0.0f, 10);
+ keyFrames.Add(0.2f, 20);
+ keyFrames.Add(0.4f, 30);
+ keyFrames.Add(0.6f, 40);
+ keyFrames.Add(0.8f, 50);
+ keyFrames.Add(1.0f, 60);
+
+ animation.AnimateBetween( Property(actor, index ), keyFrames );
+
+ // Start the animation
+ animation.Play();
+
+ // Target value should change to the last key-frame's value straight away
+ DALI_TEST_EQUALS( actor.GetProperty< int >( index ), 60, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliAnimationAnimateBetweenVector2P(void)
+{
+ TestApplication application;
+
+ Vector2 startValue( 10.0f, 20.0f );
+ Actor actor = Actor::New();
+ const Property::Index index = actor.RegisterProperty("customProperty", startValue );
+ Stage::GetCurrent().Add(actor);
+
+ application.Render();
+ application.SendNotification();
+
+ DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
+
+ // Build the animation
+ float durationSeconds(1.0f);
+ Animation animation = Animation::New(durationSeconds);
+
+ KeyFrames keyFrames = KeyFrames::New();
+ keyFrames.Add( 0.0f, Vector2( 0.0f, 5.0f ) );
+ keyFrames.Add( 0.2f, Vector2( 30.0f, 25.0f ) );
+ keyFrames.Add( 0.4f, Vector2( 40.0f, 35.0f ) );
+ keyFrames.Add( 0.6f, Vector2( 50.0f, 45.0f ) );
+ keyFrames.Add( 0.8f, Vector2( 60.0f, 55.0f ) );
+ keyFrames.Add( 1.0f, Vector2( 70.0f, 65.0f ) );
+
+ animation.AnimateBetween( Property(actor, index ), keyFrames );
+
+ // Start the animation
+ animation.Play();
+
+ // Target value should change to the last key-frame's value straight away
+ DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), Vector2( 70.0f, 65.0f ), TEST_LOCATION );
+
+ END_TEST;
+}
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
value = actor.GetProperty( Test::DevelTestCustomActor::Property::DEVEL_TEST_PROPERTY5 );
DALI_TEST_EQUALS( value.Get<float>(), 40.0f, 0.001f, TEST_LOCATION );
+ // Get read-only property
+ value = actor.GetProperty( Test::DevelTestCustomActor::Property::DEVEL_TEST_PROPERTY6 );
+ DALI_TEST_EQUALS( value.Get<float>(), 10.0f, 0.001f, TEST_LOCATION );
+
+ // Attempt to set read-only property and then ensure value hasn't changed
+ actor.SetProperty( Test::DevelTestCustomActor::Property::DEVEL_TEST_PROPERTY6, 40.0f );
+ DALI_TEST_EQUALS( value.Get<float>(), 10.0f, 0.001f, TEST_LOCATION );
+
END_TEST;
}
DALI_TEST_EQUALS( task.GetCurrentViewportPosition(), newPosition3, Math::MACHINE_EPSILON_1, TEST_LOCATION );
DALI_TEST_EQUALS( task.GetCurrentProperty< Vector2 >( RenderTask::Property::VIEWPORT_POSITION ), newPosition3, Math::MACHINE_EPSILON_1, TEST_LOCATION );
DALI_TEST_EQUALS( task.GetProperty< Vector2 >( RenderTask::Property::VIEWPORT_POSITION ), newPosition3, Math::MACHINE_EPSILON_1, TEST_LOCATION );
+
+ // Create another animation which animates by a certain value
+ const Vector2 newPosition4( 75.0f, 45.0f );
+ const Vector2 relativePosition( newPosition4 - newPosition3 );
+ animation = Animation::New( 1.0f );
+ animation.AnimateBy( Property( task, RenderTask::Property::VIEWPORT_POSITION ), relativePosition );
+ animation.Play();
+
+ DALI_TEST_EQUALS( task.GetProperty< Vector2 >( RenderTask::Property::VIEWPORT_POSITION ), newPosition4, Math::MACHINE_EPSILON_1, TEST_LOCATION );
+ DALI_TEST_EQUALS( task.GetCurrentProperty< Vector2 >( RenderTask::Property::VIEWPORT_POSITION ), newPosition3, TEST_LOCATION );
+
+ // Perform 1000ms worth of updates at which point animation should have completed.
+ Wait(application, 1000);
+ DALI_TEST_EQUALS( task.GetCurrentViewportPosition(), newPosition4, Math::MACHINE_EPSILON_1, TEST_LOCATION );
+ DALI_TEST_EQUALS( task.GetCurrentProperty< Vector2 >( RenderTask::Property::VIEWPORT_POSITION ), newPosition4, Math::MACHINE_EPSILON_1, TEST_LOCATION );
+ DALI_TEST_EQUALS( task.GetProperty< Vector2 >( RenderTask::Property::VIEWPORT_POSITION ), newPosition4, Math::MACHINE_EPSILON_1, TEST_LOCATION );
+
END_TEST;
}
DALI_TEST_EQUALS( task.GetCurrentProperty< Vector2 >( RenderTask::Property::VIEWPORT_SIZE ), newSize3, Math::MACHINE_EPSILON_1, TEST_LOCATION );
DALI_TEST_EQUALS( task.GetProperty< Vector2 >( RenderTask::Property::VIEWPORT_SIZE ), newSize3, Math::MACHINE_EPSILON_1, TEST_LOCATION );
+ // Create another animation which animates by a certain value
+ const Vector2 newSize4( 75.0f, 45.0f );
+ const Vector2 relativeSize( newSize4 - newSize3 );
+ animation = Animation::New( 1.0f );
+ animation.AnimateBy( Property( task, RenderTask::Property::VIEWPORT_SIZE ), relativeSize );
+ animation.Play();
+
+ DALI_TEST_EQUALS( task.GetProperty< Vector2 >( RenderTask::Property::VIEWPORT_SIZE ), newSize4, Math::MACHINE_EPSILON_1, TEST_LOCATION );
+ DALI_TEST_EQUALS( task.GetCurrentProperty< Vector2 >( RenderTask::Property::VIEWPORT_SIZE ), newSize3, TEST_LOCATION );
+
+ // Perform 1000ms worth of updates at which point animation should have completed.
+ Wait(application, 1000);
+ DALI_TEST_EQUALS( task.GetCurrentViewportSize(), newSize4, Math::MACHINE_EPSILON_1, TEST_LOCATION );
+ DALI_TEST_EQUALS( task.GetCurrentProperty< Vector2 >( RenderTask::Property::VIEWPORT_SIZE ), newSize4, Math::MACHINE_EPSILON_1, TEST_LOCATION );
+ DALI_TEST_EQUALS( task.GetProperty< Vector2 >( RenderTask::Property::VIEWPORT_SIZE ), newSize4, Math::MACHINE_EPSILON_1, TEST_LOCATION );
+
END_TEST;
}
DALI_TEST_EQUALS( task.GetCurrentProperty< Vector4 >( RenderTask::Property::CLEAR_COLOR ), newColor3, Math::MACHINE_EPSILON_1, TEST_LOCATION );
DALI_TEST_EQUALS( task.GetProperty< Vector4 >( RenderTask::Property::CLEAR_COLOR ), newColor3, Math::MACHINE_EPSILON_1, TEST_LOCATION );
+ // Create another animation which animates by a certain value
+ const Vector4 newColor4( 0.45f, 0.35f, 0.25f, 0.1f );
+ const Vector4 relativeColor( newColor4 - newColor3 );
+ animation = Animation::New( 1.0f );
+ animation.AnimateBy( Property( task, RenderTask::Property::CLEAR_COLOR ), relativeColor );
+ animation.Play();
+
+ DALI_TEST_EQUALS( task.GetProperty< Vector4 >( RenderTask::Property::CLEAR_COLOR ), newColor4, Math::MACHINE_EPSILON_10, TEST_LOCATION );
+ DALI_TEST_EQUALS( task.GetCurrentProperty< Vector4 >( RenderTask::Property::CLEAR_COLOR ), newColor3, Math::MACHINE_EPSILON_10, TEST_LOCATION );
+
+ // Perform 1000ms worth of updates at which point animation should have completed.
+ Wait(application, 1000);
+ DALI_TEST_EQUALS( task.GetCurrentProperty< Vector4 >( RenderTask::Property::CLEAR_COLOR ), newColor4, Math::MACHINE_EPSILON_10, TEST_LOCATION );
+ DALI_TEST_EQUALS( task.GetProperty< Vector4 >( RenderTask::Property::CLEAR_COLOR ), newColor4, Math::MACHINE_EPSILON_10, TEST_LOCATION );
+
END_TEST;
}
END_TEST;
}
+int UtcDaliTypeRegistryAnimatablePropertyComponentRegistrationVector2AnimateByP(void)
+{
+ TestApplication application;
+ TypeRegistry typeRegistry = TypeRegistry::Get();
+
+ TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
+ DALI_TEST_CHECK( typeInfo );
+ BaseHandle handle = typeInfo.CreateInstance();
+ DALI_TEST_CHECK( handle );
+ Actor customActor = Actor::DownCast( handle );
+ DALI_TEST_CHECK( customActor );
+
+ const unsigned int index = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX;
+ const unsigned int xComponentIndex = index + 1;
+ const unsigned int yComponentIndex = index + 2;
+ const Vector2 initialValue( 20.0f, 40.0f );
+
+ // Register animatable property & its components
+ AnimatablePropertyRegistration animatableProperty1( customType1, "animatableProp1", index, initialValue );
+ AnimatablePropertyComponentRegistration animatablePropertyComponent1( customType1, "animatableProp1X", xComponentIndex, index, 0 );
+ AnimatablePropertyComponentRegistration animatablePropertyComponent2( customType1, "animatableProp1Y", yComponentIndex, index, 1 );
+
+ // Check the animatable property value
+ DALI_TEST_EQUALS( customActor.GetProperty< Vector2 >( index ), initialValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetProperty< float >( xComponentIndex ), initialValue.x, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetProperty< float >( yComponentIndex ), initialValue.y, TEST_LOCATION );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Check the animatable property current value
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< Vector2 >( index ), initialValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( xComponentIndex ), initialValue.x, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( yComponentIndex ), initialValue.y, TEST_LOCATION );
+
+ // Do an AnimateBy
+ const Vector2 targetValue( 45.0f, 53.0f );
+ const Vector2 relativeValue( targetValue - initialValue );
+
+ Animation animation = Animation::New( 1.0f );
+ animation.AnimateBy( Property( customActor, xComponentIndex ), relativeValue.x );
+ animation.AnimateBy( Property( customActor, yComponentIndex ), relativeValue.y );
+ animation.Play();
+
+ // Target values should change straight away
+ DALI_TEST_EQUALS( customActor.GetProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetProperty< float >( xComponentIndex ), targetValue.x, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetProperty< float >( yComponentIndex ), targetValue.y, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliTypeRegistryAnimatablePropertyComponentRegistrationVector3AnimateByP(void)
+{
+ TestApplication application;
+ TypeRegistry typeRegistry = TypeRegistry::Get();
+
+ TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
+ DALI_TEST_CHECK( typeInfo );
+ BaseHandle handle = typeInfo.CreateInstance();
+ DALI_TEST_CHECK( handle );
+ Actor customActor = Actor::DownCast( handle );
+ DALI_TEST_CHECK( customActor );
+
+ const unsigned int index = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX;
+ const unsigned int xComponentIndex = index + 1;
+ const unsigned int yComponentIndex = index + 2;
+ const unsigned int zComponentIndex = index + 3;
+ const Vector3 initialValue( 20.0f, 40.0f, 50.0f );
+
+ // Register animatable property & its components
+ AnimatablePropertyRegistration animatableProperty1( customType1, "animatableProp1", index, initialValue );
+ AnimatablePropertyComponentRegistration animatablePropertyComponent1( customType1, "animatableProp1X", xComponentIndex, index, 0 );
+ AnimatablePropertyComponentRegistration animatablePropertyComponent2( customType1, "animatableProp1Y", yComponentIndex, index, 1 );
+ AnimatablePropertyComponentRegistration animatablePropertyComponent3( customType1, "animatableProp1Z", zComponentIndex, index, 2 );
+
+ // Check the animatable property value
+ DALI_TEST_EQUALS( customActor.GetProperty< Vector3 >( index ), initialValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetProperty< float >( xComponentIndex ), initialValue.x, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetProperty< float >( yComponentIndex ), initialValue.y, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetProperty< float >( zComponentIndex ), initialValue.z, TEST_LOCATION );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Check the animatable property current value
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< Vector3 >( index ), initialValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( xComponentIndex ), initialValue.x, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( yComponentIndex ), initialValue.y, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( zComponentIndex ), initialValue.z, TEST_LOCATION );
+
+ // Do an AnimateBy
+ const Vector3 targetValue( 45.0f, 53.0f, 25.0f );
+ const Vector3 relativeValue( targetValue - initialValue );
+
+ Animation animation = Animation::New( 1.0f );
+ animation.AnimateBy( Property( customActor, xComponentIndex ), relativeValue.x );
+ animation.AnimateBy( Property( customActor, yComponentIndex ), relativeValue.y );
+ animation.AnimateBy( Property( customActor, zComponentIndex ), relativeValue.z );
+ animation.Play();
+
+ // Target values should change straight away
+ DALI_TEST_EQUALS( customActor.GetProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetProperty< float >( xComponentIndex ), targetValue.x, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetProperty< float >( yComponentIndex ), targetValue.y, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetProperty< float >( zComponentIndex ), targetValue.z, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliTypeRegistryAnimatablePropertyComponentRegistrationVector4AnimateByP(void)
+{
+ TestApplication application;
+ TypeRegistry typeRegistry = TypeRegistry::Get();
+
+ TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
+ DALI_TEST_CHECK( typeInfo );
+ BaseHandle handle = typeInfo.CreateInstance();
+ DALI_TEST_CHECK( handle );
+ Actor customActor = Actor::DownCast( handle );
+ DALI_TEST_CHECK( customActor );
+
+ const unsigned int index = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX;
+ const unsigned int xComponentIndex = index + 1;
+ const unsigned int yComponentIndex = index + 2;
+ const unsigned int zComponentIndex = index + 3;
+ const unsigned int wComponentIndex = index + 4;
+ const Vector4 initialValue( 20.0f, 40.0f, 50.0f, 60.0f );
+
+ // Register animatable property & its components
+ AnimatablePropertyRegistration animatableProperty1( customType1, "animatableProp1", index, initialValue );
+ AnimatablePropertyComponentRegistration animatablePropertyComponent1( customType1, "animatableProp1X", xComponentIndex, index, 0 );
+ AnimatablePropertyComponentRegistration animatablePropertyComponent2( customType1, "animatableProp1Y", yComponentIndex, index, 1 );
+ AnimatablePropertyComponentRegistration animatablePropertyComponent3( customType1, "animatableProp1Z", zComponentIndex, index, 2 );
+ AnimatablePropertyComponentRegistration animatablePropertyComponent4( customType1, "animatableProp1W", wComponentIndex, index, 3 );
+
+ // Check the animatable property value
+ DALI_TEST_EQUALS( customActor.GetProperty< Vector4 >( index ), initialValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetProperty< float >( xComponentIndex ), initialValue.x, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetProperty< float >( yComponentIndex ), initialValue.y, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetProperty< float >( zComponentIndex ), initialValue.z, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetProperty< float >( wComponentIndex ), initialValue.w, TEST_LOCATION );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Check the animatable property current value
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< Vector4 >( index ), initialValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( xComponentIndex ), initialValue.x, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( yComponentIndex ), initialValue.y, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( zComponentIndex ), initialValue.z, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( wComponentIndex ), initialValue.w, TEST_LOCATION );
+
+ // Do an AnimateBy
+ const Vector4 targetValue( 45.0f, 53.0f, 25.0f, 13.0f );
+ const Vector4 relativeValue( targetValue - initialValue );
+
+ Animation animation = Animation::New( 1.0f );
+ animation.AnimateBy( Property( customActor, xComponentIndex ), relativeValue.x );
+ animation.AnimateBy( Property( customActor, yComponentIndex ), relativeValue.y );
+ animation.AnimateBy( Property( customActor, zComponentIndex ), relativeValue.z );
+ animation.AnimateBy( Property( customActor, wComponentIndex ), relativeValue.w );
+ animation.Play();
+
+ // Target values should change straight away
+ DALI_TEST_EQUALS( customActor.GetProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetProperty< float >( xComponentIndex ), targetValue.x, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetProperty< float >( yComponentIndex ), targetValue.y, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetProperty< float >( zComponentIndex ), targetValue.z, TEST_LOCATION );
+ DALI_TEST_EQUALS( customActor.GetProperty< float >( wComponentIndex ), targetValue.w, TEST_LOCATION );
+
+ END_TEST;
+}
+
int UtcDaliTypeRegistryAnimatablePropertyComponentRegistrationN(void)
{
TestApplication application;
#define __DALI_PROPERTY_HELPER_DEVEL_H__
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
DALI_COMPILE_TIME_ASSERT( ( objectNamespace:: develNamespace ::Property::enumIndex - objectNamespace::objectType::PROPERTY_START_INDEX ) == count );
/**
+ * @copydoc DALI_DEVEL_PROPERTY_REGISTRATION_INTERNAL
+ */
+#define DALI_DEVEL_PROPERTY_REGISTRATION_INTERNAL_READ_ONLY( count, typeRegistrationObject, objectNamespace, objectType, develNamespace, text, valueType, enumIndex ) \
+ Dali::PropertyRegistration DALI_TOKEN_PASTE( property, count ) ( typeRegistrationObject, text, objectNamespace:: develNamespace ::Property::enumIndex, Dali::Property::valueType, NULL, &objectType::GetProperty ); \
+ DALI_COMPILE_TIME_ASSERT( ( objectNamespace:: develNamespace ::Property::enumIndex - objectNamespace::objectType::PROPERTY_START_INDEX ) == count );
+
+/**
* @brief These macros are used to define properties for implementations of CustomActor.
*
* These macros should be used when defining devel properties
#define DALI_DEVEL_PROPERTY_REGISTRATION( objectNamespace, objectType, text, valueType, enumIndex ) \
DALI_DEVEL_PROPERTY_REGISTRATION_INTERNAL( __COUNTER__, typeRegistration, objectNamespace, objectType, DALI_TOKEN_PASTE( Devel, objectType ), text, valueType, enumIndex )
+/**
+ * @copydoc DALI_DEVEL_PROPERTY_REGISTRATION
+ *
+ * @note For Read Only properties
+ */
+#define DALI_DEVEL_PROPERTY_REGISTRATION_READ_ONLY( objectNamespace, objectType, text, valueType, enumIndex ) \
+ DALI_DEVEL_PROPERTY_REGISTRATION_INTERNAL_READ_ONLY( __COUNTER__, typeRegistration, objectNamespace, objectType, DALI_TOKEN_PASTE( Devel, objectType ), text, valueType, enumIndex )
+
#endif // __DALI_PROPERTY_HELPER_DEVEL_H__
return value;
}
-void Actor::OnNotifyDefaultPropertyAnimation( Animation& animation, Property::Index index, const Property::Value& value )
+void Actor::OnNotifyDefaultPropertyAnimation( Animation& animation, Property::Index index, const Property::Value& value, Animation::Type animationType )
{
- switch( index )
+ switch( animationType )
{
- case Dali::Actor::Property::SIZE:
+ case Animation::TO:
+ case Animation::BETWEEN:
{
- if( value.Get( mTargetSize ) )
+ switch( index )
{
- // Notify deriving classes
- OnSizeAnimation( animation, mTargetSize );
- }
- break;
- }
+ case Dali::Actor::Property::SIZE:
+ {
+ if( value.Get( mTargetSize ) )
+ {
+ // Notify deriving classes
+ OnSizeAnimation( animation, mTargetSize );
+ }
+ break;
+ }
- case Dali::Actor::Property::SIZE_WIDTH:
- {
- if( value.Get( mTargetSize.width ) )
- {
- // Notify deriving classes
- OnSizeAnimation( animation, mTargetSize );
- }
- break;
- }
+ case Dali::Actor::Property::SIZE_WIDTH:
+ {
+ if( value.Get( mTargetSize.width ) )
+ {
+ // Notify deriving classes
+ OnSizeAnimation( animation, mTargetSize );
+ }
+ break;
+ }
- case Dali::Actor::Property::SIZE_HEIGHT:
- {
- if( value.Get( mTargetSize.height ) )
- {
- // Notify deriving classes
- OnSizeAnimation( animation, mTargetSize );
+ case Dali::Actor::Property::SIZE_HEIGHT:
+ {
+ if( value.Get( mTargetSize.height ) )
+ {
+ // Notify deriving classes
+ OnSizeAnimation( animation, mTargetSize );
+ }
+ break;
+ }
+
+ case Dali::Actor::Property::SIZE_DEPTH:
+ {
+ if( value.Get( mTargetSize.depth ) )
+ {
+ // Notify deriving classes
+ OnSizeAnimation( animation, mTargetSize );
+ }
+ break;
+ }
+
+ case Dali::Actor::Property::POSITION:
+ {
+ value.Get( mTargetPosition );
+ break;
+ }
+
+ case Dali::Actor::Property::POSITION_X:
+ {
+ value.Get( mTargetPosition.x );
+ break;
+ }
+
+ case Dali::Actor::Property::POSITION_Y:
+ {
+ value.Get( mTargetPosition.y );
+ break;
+ }
+
+ case Dali::Actor::Property::POSITION_Z:
+ {
+ value.Get( mTargetPosition.z );
+ break;
+ }
+
+ case Dali::Actor::Property::ORIENTATION:
+ {
+ value.Get( mTargetOrientation );
+ break;
+ }
+
+ case Dali::Actor::Property::SCALE:
+ {
+ value.Get( mTargetScale );
+ break;
+ }
+
+ case Dali::Actor::Property::SCALE_X:
+ {
+ value.Get( mTargetScale.x );
+ break;
+ }
+
+ case Dali::Actor::Property::SCALE_Y:
+ {
+ value.Get( mTargetScale.y );
+ break;
+ }
+
+ case Dali::Actor::Property::SCALE_Z:
+ {
+ value.Get( mTargetScale.z );
+ break;
+ }
+
+ case Dali::Actor::Property::VISIBLE:
+ {
+ SetVisibleInternal( value.Get< bool >(), SendMessage::FALSE );
+ break;
+ }
+
+ case Dali::Actor::Property::COLOR:
+ {
+ value.Get( mTargetColor );
+ break;
+ }
+
+ case Dali::Actor::Property::COLOR_RED:
+ {
+ value.Get( mTargetColor.r );
+ break;
+ }
+
+ case Dali::Actor::Property::COLOR_GREEN:
+ {
+ value.Get( mTargetColor.g );
+ break;
+ }
+
+ case Dali::Actor::Property::COLOR_BLUE:
+ {
+ value.Get( mTargetColor.b );
+ break;
+ }
+
+ case Dali::Actor::Property::COLOR_ALPHA:
+ case Dali::DevelActor::Property::OPACITY:
+ {
+ value.Get( mTargetColor.a );
+ break;
+ }
+
+ default:
+ {
+ // Not an animatable property. Do nothing.
+ break;
+ }
}
break;
}
- case Dali::Actor::Property::SIZE_DEPTH:
+ case Animation::BY:
{
- if( value.Get( mTargetSize.depth ) )
+ switch( index )
{
- // Notify deriving classes
- OnSizeAnimation( animation, mTargetSize );
- }
- break;
- }
+ case Dali::Actor::Property::SIZE:
+ {
+ if( AdjustValue< Vector3 >( mTargetSize, value ) )
+ {
+ // Notify deriving classes
+ OnSizeAnimation( animation, mTargetSize );
+ }
+ break;
+ }
- case Dali::Actor::Property::POSITION:
- {
- value.Get( mTargetPosition );
- break;
- }
+ case Dali::Actor::Property::SIZE_WIDTH:
+ {
+ if( AdjustValue< float >( mTargetSize.width, value ) )
+ {
+ // Notify deriving classes
+ OnSizeAnimation( animation, mTargetSize );
+ }
+ break;
+ }
- case Dali::Actor::Property::POSITION_X:
- {
- value.Get( mTargetPosition.x );
- break;
- }
+ case Dali::Actor::Property::SIZE_HEIGHT:
+ {
+ if( AdjustValue< float >( mTargetSize.height, value ) )
+ {
+ // Notify deriving classes
+ OnSizeAnimation( animation, mTargetSize );
+ }
+ break;
+ }
- case Dali::Actor::Property::POSITION_Y:
- {
- value.Get( mTargetPosition.y );
- break;
- }
+ case Dali::Actor::Property::SIZE_DEPTH:
+ {
+ if( AdjustValue< float >( mTargetSize.depth, value ) )
+ {
+ // Notify deriving classes
+ OnSizeAnimation( animation, mTargetSize );
+ }
+ break;
+ }
- case Dali::Actor::Property::POSITION_Z:
- {
- value.Get( mTargetPosition.z );
- break;
- }
+ case Dali::Actor::Property::POSITION:
+ {
+ AdjustValue< Vector3 >( mTargetPosition, value );
+ break;
+ }
- case Dali::Actor::Property::ORIENTATION:
- {
- value.Get( mTargetOrientation );
- break;
- }
+ case Dali::Actor::Property::POSITION_X:
+ {
+ AdjustValue< float >( mTargetPosition.x, value );
+ break;
+ }
- case Dali::Actor::Property::SCALE:
- {
- value.Get( mTargetScale );
- break;
- }
+ case Dali::Actor::Property::POSITION_Y:
+ {
+ AdjustValue< float >( mTargetPosition.y, value );
+ break;
+ }
- case Dali::Actor::Property::SCALE_X:
- {
- value.Get( mTargetScale.x );
- break;
- }
+ case Dali::Actor::Property::POSITION_Z:
+ {
+ AdjustValue< float >( mTargetPosition.z, value );
+ break;
+ }
- case Dali::Actor::Property::SCALE_Y:
- {
- value.Get( mTargetScale.y );
- break;
- }
+ case Dali::Actor::Property::ORIENTATION:
+ {
+ Quaternion relativeValue;
+ if( value.Get( relativeValue ) )
+ {
+ mTargetOrientation *= relativeValue;
+ }
+ break;
+ }
- case Dali::Actor::Property::SCALE_Z:
- {
- value.Get( mTargetScale.z );
- break;
- }
+ case Dali::Actor::Property::SCALE:
+ {
+ AdjustValue< Vector3 >( mTargetScale, value );
+ break;
+ }
- case Dali::Actor::Property::VISIBLE:
- {
- SetVisibleInternal( value.Get< bool >(), SendMessage::FALSE );
- break;
- }
+ case Dali::Actor::Property::SCALE_X:
+ {
+ AdjustValue< float >( mTargetScale.x, value );
+ break;
+ }
- case Dali::Actor::Property::COLOR:
- {
- value.Get( mTargetColor );
- break;
- }
+ case Dali::Actor::Property::SCALE_Y:
+ {
+ AdjustValue< float >( mTargetScale.y, value );
+ break;
+ }
- case Dali::Actor::Property::COLOR_RED:
- {
- value.Get( mTargetColor.r );
- break;
- }
+ case Dali::Actor::Property::SCALE_Z:
+ {
+ AdjustValue< float >( mTargetScale.z, value );
+ break;
+ }
- case Dali::Actor::Property::COLOR_GREEN:
- {
- value.Get( mTargetColor.g );
- break;
- }
+ case Dali::Actor::Property::VISIBLE:
+ {
+ bool relativeValue = false;
+ if( value.Get( relativeValue ) )
+ {
+ bool visible = mVisible || relativeValue;
+ SetVisibleInternal( visible, SendMessage::FALSE );
+ }
+ break;
+ }
- case Dali::Actor::Property::COLOR_BLUE:
- {
- value.Get( mTargetColor.b );
- break;
- }
+ case Dali::Actor::Property::COLOR:
+ {
+ AdjustValue< Vector4 >( mTargetColor, value );
+ break;
+ }
- case Dali::Actor::Property::COLOR_ALPHA:
- case Dali::DevelActor::Property::OPACITY:
- {
- value.Get( mTargetColor.a );
- break;
- }
+ case Dali::Actor::Property::COLOR_RED:
+ {
+ AdjustValue< float >( mTargetColor.r, value );
+ break;
+ }
- default:
- {
- // Not an animatable property. Do nothing.
+ case Dali::Actor::Property::COLOR_GREEN:
+ {
+ AdjustValue< float >( mTargetColor.g, value );
+ break;
+ }
+
+ case Dali::Actor::Property::COLOR_BLUE:
+ {
+ AdjustValue< float >( mTargetColor.b, value );
+ break;
+ }
+
+ case Dali::Actor::Property::COLOR_ALPHA:
+ case Dali::DevelActor::Property::OPACITY:
+ {
+ AdjustValue< float >( mTargetColor.a, value );
+ break;
+ }
+
+ default:
+ {
+ // Not an animatable property. Do nothing.
+ break;
+ }
+ }
break;
}
}
/**
* @copydoc Dali::Internal::Object::OnNotifyDefaultPropertyAnimation()
*/
- virtual void OnNotifyDefaultPropertyAnimation( Animation& animation, Property::Index index, const Property::Value& value );
+ virtual void OnNotifyDefaultPropertyAnimation( Animation& animation, Property::Index index, const Property::Value& value, Animation::Type animationType );
/**
* @copydoc Dali::Internal::Object::GetPropertyOwner()
#include <dali/public-api/math/radian.h>
#include <dali/internal/event/animation/animation-playlist.h>
#include <dali/internal/event/animation/animator-connector.h>
+#include <dali/internal/event/animation/path-impl.h>
#include <dali/internal/event/common/notification-manager.h>
#include <dali/internal/event/common/property-helper.h>
#include <dali/internal/event/common/stage-impl.h>
mState = Dali::Animation::PLAYING;
- if( mEndAction != EndAction::Discard ) // If the animation is discarded, then we do not want to change the target values
- {
- // Sort according to end time with earlier end times coming first, if the end time is the same, then the connectors are not moved
- std::stable_sort( mConnectorTargetValues.begin(), mConnectorTargetValues.end(), CompareConnectorEndTimes );
-
- // Loop through all connector target values sorted by increasing end time
- ConnectorTargetValuesContainer::const_iterator iter = mConnectorTargetValues.begin();
- const ConnectorTargetValuesContainer::const_iterator endIter = mConnectorTargetValues.end();
- for( ; iter != endIter; ++iter )
- {
- AnimatorConnectorBase* connector = mConnectors[ iter->connectorIndex ];
-
- Object* object = connector->GetObject();
- if( object )
- {
- object->NotifyPropertyAnimation( *this, connector->GetPropertyIndex(), iter->targetValue );
- }
- }
- }
+ NotifyObjects();
// mAnimation is being used in a separate thread; queue a Play message
PlayAnimationMessage( mEventThreadServices, *mAnimation );
mState = Dali::Animation::PLAYING;
+ NotifyObjects();
+
// mAnimation is being used in a separate thread; queue a Play message
PlayAnimationFromMessage( mEventThreadServices, *mAnimation, progress );
}
void Animation::AnimateBy(Property& target, Property::Value& relativeValue, AlphaFunction alpha, TimePeriod period)
{
- Object& object = GetImplementation( target.object );
- const Property::Type targetType = object.GetPropertyType( target.propertyIndex );
+ Object& object = GetImplementation(target.object);
+ const Property::Type targetType = object.GetPropertyType(target.propertyIndex);
const Property::Type destinationType = relativeValue.GetType();
- DALI_ASSERT_ALWAYS( targetType == destinationType && "Animated value and Property type don't match" );
- ExtendDuration( period );
+ if ( object.GetPropertyComponentIndex( target.propertyIndex ) != Property::INVALID_COMPONENT_INDEX )
+ {
+ DALI_ASSERT_ALWAYS(Property::FLOAT == destinationType && "Animated value and Property type don't match");
+ }
+ else
+ {
+ DALI_ASSERT_ALWAYS(targetType == destinationType && "Animated value and Property type don't match");
+ }
+
+ ExtendDuration(period);
+
+ // Store data to later notify the object that its property is being animated
+ ConnectorTargetValues connectorPair;
+ connectorPair.targetValue = relativeValue;
+ connectorPair.connectorIndex = mConnectors.Count();
+ connectorPair.timePeriod = period;
+ connectorPair.animatorType = Animation::BY;
+ mConnectorTargetValues.push_back( connectorPair );
switch ( targetType )
{
connectorPair.targetValue = destinationValue;
connectorPair.connectorIndex = mConnectors.Count();
connectorPair.timePeriod = period;
+ connectorPair.animatorType = Animation::TO;
mConnectorTargetValues.push_back( connectorPair );
switch ( destinationType )
ExtendDuration( period );
+ // Store data to later notify the object that its property is being animated
+ ConnectorTargetValues connectorPair;
+ connectorPair.targetValue = keyFrames.GetLastKeyFrameValue();
+ connectorPair.connectorIndex = mConnectors.Count();
+ connectorPair.timePeriod = period;
+ connectorPair.animatorType = BETWEEN;
+ mConnectorTargetValues.push_back( connectorPair );
+
switch(keyFrames.GetType())
{
case Dali::Property::BOOLEAN:
return ( ( lhs.timePeriod.delaySeconds + lhs.timePeriod.durationSeconds ) < ( rhs.timePeriod.delaySeconds + rhs.timePeriod.durationSeconds ) );
}
+void Animation::NotifyObjects()
+{
+ if( mEndAction != EndAction::Discard ) // If the animation is discarded, then we do not want to change the target values
+ {
+ // Sort according to end time with earlier end times coming first, if the end time is the same, then the connectors are not moved
+ std::stable_sort( mConnectorTargetValues.begin(), mConnectorTargetValues.end(), CompareConnectorEndTimes );
+
+ // Loop through all connector target values sorted by increasing end time
+ ConnectorTargetValuesContainer::const_iterator iter = mConnectorTargetValues.begin();
+ const ConnectorTargetValuesContainer::const_iterator endIter = mConnectorTargetValues.end();
+ for( ; iter != endIter; ++iter )
+ {
+ AnimatorConnectorBase* connector = mConnectors[ iter->connectorIndex ];
+
+ Object* object = connector->GetObject();
+ if( object )
+ {
+ object->NotifyPropertyAnimation( *this, connector->GetPropertyIndex(), iter->targetValue, iter->animatorType );
+ }
+ }
+ }
+}
+
} // namespace Internal
} // namespace Dali
#include <dali/public-api/object/ref-object.h>
#include <dali/public-api/animation/animation.h>
#include <dali/public-api/object/base-object.h>
-#include <dali/internal/event/animation/animator-connector-base.h>
+#include <dali/devel-api/common/owner-container.h>
#include <dali/internal/event/animation/key-frames-impl.h>
-#include <dali/internal/event/animation/path-impl.h>
+#include <dali/internal/event/common/event-thread-services.h>
namespace Dali
{
class Actor;
class Animation;
class AnimationPlaylist;
+class AnimatorConnectorBase;
class Object;
+class Path;
typedef IntrusivePtr<Animation> AnimationPtr;
typedef std::vector<AnimationPtr> AnimationContainer;
{
public:
+ enum Type
+ {
+ TO, ///< Animating TO the given value
+ BY, ///< Animating BY the given value
+ BETWEEN ///< Animating BETWEEN key-frames
+ };
+
typedef Dali::Animation::EndAction EndAction;
typedef Dali::Animation::Interpolation Interpolation;
ConnectorTargetValues()
: targetValue(),
timePeriod( 0.0f ),
- connectorIndex( 0 )
+ connectorIndex( 0 ),
+ animatorType( TO )
{
}
Property::Value targetValue;
TimePeriod timePeriod;
unsigned int connectorIndex;
+ Animation::Type animatorType;
};
private:
*/
static bool CompareConnectorEndTimes( const ConnectorTargetValues& lhs, const ConnectorTargetValues& rhs );
+ /**
+ * Notifies all the objects whose properties are being animated.
+ */
+ void NotifyObjects();
+
private:
const SceneGraph::Animation* mAnimation;
Dali::Animation::AnimationSignalType mFinishedSignal;
+ typedef OwnerContainer< AnimatorConnectorBase* > AnimatorConnectorContainer;
AnimatorConnectorContainer mConnectors; ///< Owned by the Animation
typedef std::vector< ConnectorTargetValues > ConnectorTargetValuesContainer;
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// INTERNAL INCLUDES
#include <dali/public-api/common/vector-wrapper.h>
-#include <dali/devel-api/common/set-wrapper.h>
#include <dali/internal/event/animation/animation-impl.h>
#define __DALI_INTERNAL_ANIMATOR_CONNECTOR_BASE_H__
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// INTERNAL INCLUDES
#include <dali/internal/event/common/object-impl.h>
-#include <dali/internal/common/owner-pointer.h>
-#include <dali/devel-api/common/owner-container.h>
#include <dali/public-api/animation/alpha-function.h>
#include <dali/public-api/animation/time-period.h>
#include <dali/public-api/common/dali-common.h>
{
class Animation;
-class AnimatorConnectorBase;
-
-typedef OwnerPointer<AnimatorConnectorBase> AnimatorConnectorPtr;
-
-typedef OwnerContainer< AnimatorConnectorBase* > AnimatorConnectorContainer;
-
-typedef AnimatorConnectorContainer::Iterator AnimatorConnectorIter;
-typedef AnimatorConnectorContainer::ConstIterator AnimatorConnectorConstIter;
/**
* An abstract base class for animator connectors.
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
return mKeyFrames.Get();
}
+Property::Value KeyFrames::GetLastKeyFrameValue() const
+{
+ Property::Value value;
+
+ unsigned int noOfKeyFrames = mKeyFrames->GetNumberOfKeyFrames();
+ if( noOfKeyFrames )
+ {
+ mKeyFrames->GetKeyFrameAsValue( noOfKeyFrames - 1, value );
+ }
+
+ return value;
+}
+
} // Internal
} // Dali
#define __DALI_INTERNAL_KEY_FRAMES_H__
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
KeyFrameSpec* GetKeyFramesBase() const;
+ /**
+ * Return the value of the last key frame.
+ */
+ Dali::Property::Value GetLastKeyFrameValue() const;
+
private:
Dali::Property::Type mType; // Type of the specialization
IntrusivePtr<KeyFrameSpec> mKeyFrames; // Pointer to the specialized key frame object
virtual unsigned int GetNumberOfKeyFrames() const = 0;
+ /**
+ * Get the key frame value as a Property::Value.
+ * @param[in] index The index of the key frame to fetch
+ * @param[out] value The value of the given key frame
+ */
+ virtual void GetKeyFrameAsValue( unsigned int index, Property::Value& value ) = 0;
+
protected:
/**
}
/**
+ * @copydoc KeyFrameSpec::GetKeyFrameAsValue()
+ */
+ virtual void GetKeyFrameAsValue( unsigned int index, Property::Value& value )
+ {
+ value = mPVs[index].mValue;
+ }
+
+ /**
* Return whether the progress is valid for the range of keyframes. (The first
* keyframe doesn't have to start at 0, and the last doesn't have to end at 1.0)
* @param[in] progress The progress to test
}
}
-void Object::NotifyPropertyAnimation( Animation& animation, Property::Index index, const Property::Value& value )
+void Object::NotifyPropertyAnimation( Animation& animation, Property::Index index, const Property::Value& value, Animation::Type animationType )
{
if ( index < DEFAULT_PROPERTY_MAX_COUNT )
{
- OnNotifyDefaultPropertyAnimation( animation, index, value );
+ OnNotifyDefaultPropertyAnimation( animation, index, value, animationType );
}
- else if ( ( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX ) )
+ else
{
- AnimatablePropertyMetadata* animatableProperty = FindAnimatableProperty( index );
- if( animatableProperty )
+ PropertyMetadata* propertyMetadata = NULL;
+ if( ( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX ) )
{
- // update the cached property value
- animatableProperty->SetPropertyValue( value );
+ propertyMetadata = FindAnimatableProperty( index );
}
- }
- else
- {
- CustomPropertyMetadata* custom = FindCustomProperty( index );
- if( custom && custom->IsAnimatable() )
+ else
{
- // update the cached property value
- custom->SetPropertyValue( value );
+ CustomPropertyMetadata* custom = FindCustomProperty( index );
+ if( custom && custom->IsAnimatable() )
+ {
+ propertyMetadata = custom;
+ }
+ }
+
+ if( propertyMetadata )
+ {
+ switch( animationType )
+ {
+ case Animation::TO:
+ case Animation::BETWEEN:
+ {
+ // Update the cached property value
+ propertyMetadata->SetPropertyValue( value );
+ break;
+ }
+ case Animation::BY:
+ {
+ // Adjust the cached property value
+ propertyMetadata->AdjustPropertyValueBy( value );
+ break;
+ }
+ }
}
}
}
#include <dali/public-api/object/property-input.h>
#include <dali/public-api/object/property-notification.h>
#include <dali/devel-api/common/owner-container.h>
+#include <dali/internal/event/animation/animation-impl.h>
#include <dali/internal/event/common/event-thread-services.h>
#include <dali/internal/event/common/property-input-impl.h>
#include <dali/internal/event/common/property-metadata.h>
namespace Internal
{
-class Animation;
class ConstraintBase;
class EventThreadServices;
class Handle;
* @param[in] animation The animation animating the property.
* @param[in] index The index of the property.
* @param[in] value The value of the property after the animation.
+ * @param[in] animationType Whether the property value given is the target or a relative value.
*/
- void NotifyPropertyAnimation( Animation& animation, Property::Index index, const Property::Value& value );
+ void NotifyPropertyAnimation( Animation& animation, Property::Index index, const Property::Value& value, Animation::Type animationType );
/******************************** Uniform Mappings ********************************/
* @param[in] animation The animation animating the property.
* @param[in] index The index of the property.
* @param[in] value The value of the property after the animation.
+ * @param[in] animationType Whether the property value given is the target or a relative value.
*/
- virtual void OnNotifyDefaultPropertyAnimation( Animation& animation, Property::Index index, const Property::Value& value )
+ virtual void OnNotifyDefaultPropertyAnimation( Animation& animation, Property::Index index, const Property::Value& value, Animation::Type propertyChangeType )
{ }
/**
#define DALI_PROPERTY_HELPER_H
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
bool CompareTokens( const char * first, const char * second, size_t& size );
+
+/**
+ * @brief Helper to adjust the current value of a variable from the given property-value
+ * @param[in] currentValue The current value of the property
+ * @param[in] value The relative value as a Property::Value
+ * @return true if value adjusted, false otherwise
+ */
+template< typename PropertyType >
+bool AdjustValue( PropertyType& currentValue, const Property::Value& value )
+{
+ PropertyType relativeValue;
+ if( value.Get( relativeValue ) )
+ {
+ currentValue += relativeValue;
+ return true;
+ }
+ return false;
+}
+
} // namespace Internal
} // namespace Dali
#include <dali/internal/event/common/property-metadata.h>
// INTERNAL INCLUDES
+#include <dali/public-api/math/quaternion.h>
#include <dali/public-api/math/vector2.h>
#include <dali/public-api/math/vector3.h>
#include <dali/public-api/math/vector4.h>
namespace Internal
{
+namespace
+{
+
+/// Helper to adjust the property value by an amount specified in another property-value
+template < typename PropertyType >
+inline void AdjustProperty( Property::Value& currentPropertyValue, const Property::Value& relativePropertyValue )
+{
+ PropertyType currentValue;
+ PropertyType relativeValue;
+ if( currentPropertyValue.Get( currentValue ) && relativePropertyValue.Get( relativeValue ) )
+ {
+ currentPropertyValue = currentValue + relativeValue;
+ }
+}
+
+} // unnamed namespace
+
void PropertyMetadata::SetPropertyValue( const Property::Value& propertyValue )
{
switch ( GetType() )
return propertyValue;
}
+void PropertyMetadata::AdjustPropertyValueBy( const Property::Value& relativePropertyValue )
+{
+ switch ( GetType() )
+ {
+ case Property::NONE:
+ case Property::RECTANGLE:
+ case Property::STRING:
+ case Property::ARRAY:
+ case Property::MAP:
+ case Property::MATRIX:
+ case Property::MATRIX3:
+ {
+ // Not animated
+ break;
+ }
+
+ case Property::BOOLEAN:
+ {
+ bool currentValue = false;
+ bool relativeValue = false;
+ if( value.Get( currentValue ) && relativePropertyValue.Get( relativeValue ) )
+ {
+ value = currentValue || relativeValue;
+ }
+ break;
+ }
+
+ case Property::INTEGER:
+ {
+ AdjustProperty< int >( value, relativePropertyValue );
+ break;
+ }
+
+ case Property::FLOAT:
+ {
+ AdjustProperty< float >( value, relativePropertyValue );
+ break;
+ }
+
+ case Property::ROTATION:
+ {
+ Quaternion currentValue;
+ Quaternion relativeValue;
+ if( value.Get( currentValue ) && relativePropertyValue.Get( relativeValue ) )
+ {
+ value = currentValue * relativeValue;
+ }
+ break;
+ }
+
+ case Property::VECTOR2:
+ {
+ if( componentIndex == Property::INVALID_COMPONENT_INDEX )
+ {
+ AdjustProperty< Vector2 >( value, relativePropertyValue );
+ }
+ else
+ {
+ Vector2 vector2Value;
+ value.Get( vector2Value );
+
+ if( componentIndex == 0 )
+ {
+ vector2Value.x += relativePropertyValue.Get< float >();
+ }
+ else if( componentIndex == 1 )
+ {
+ vector2Value.y += relativePropertyValue.Get< float >();
+ }
+
+ value = vector2Value;
+ }
+
+ break;
+ }
+
+ case Property::VECTOR3:
+ {
+ if( componentIndex == Property::INVALID_COMPONENT_INDEX )
+ {
+ AdjustProperty< Vector3 >( value, relativePropertyValue );
+ }
+ else
+ {
+ Vector3 vector3Value;
+ value.Get( vector3Value );
+
+ if( componentIndex == 0 )
+ {
+ vector3Value.x += relativePropertyValue.Get< float >();
+ }
+ else if( componentIndex == 1 )
+ {
+ vector3Value.y += relativePropertyValue.Get< float >();
+ }
+ else if( componentIndex == 2 )
+ {
+ vector3Value.z += relativePropertyValue.Get< float >();
+ }
+
+ value = vector3Value;
+ }
+ break;
+ }
+
+ case Property::VECTOR4:
+ {
+ if( componentIndex == Property::INVALID_COMPONENT_INDEX )
+ {
+ AdjustProperty< Vector4 >( value, relativePropertyValue );
+ }
+ else
+ {
+ Vector4 vector4Value;
+ value.Get( vector4Value );
+
+ if( componentIndex == 0 )
+ {
+ vector4Value.x += relativePropertyValue.Get< float >();
+ }
+ else if( componentIndex == 1 )
+ {
+ vector4Value.y += relativePropertyValue.Get< float >();
+ }
+ else if( componentIndex == 2 )
+ {
+ vector4Value.z += relativePropertyValue.Get< float >();
+ }
+ else if( componentIndex == 3 )
+ {
+ vector4Value.w += relativePropertyValue.Get< float >();
+ }
+
+ value = vector4Value;
+ }
+ break;
+ }
+ }
+}
+
} // namespace Internal
} // namespace Dali
*/
Property::Value GetPropertyValue() const;
+ /**
+ * Modifies the stored value by the relativeValue.
+ * @param[in] relativeValue The value to change by.
+ */
+ void AdjustPropertyValueBy( const Property::Value& relativeValue );
+
protected:
/**
return value;
}
-void RenderTask::OnNotifyDefaultPropertyAnimation( Animation& animation, Property::Index index, const Property::Value& value )
+void RenderTask::OnNotifyDefaultPropertyAnimation( Animation& animation, Property::Index index, const Property::Value& value, Animation::Type animationType )
{
- switch ( index )
+ switch( animationType )
{
- case Dali::RenderTask::Property::VIEWPORT_POSITION:
+ case Animation::TO:
+ case Animation::BETWEEN:
{
- value.Get( mViewportPosition );
- break;
- }
- case Dali::RenderTask::Property::VIEWPORT_SIZE:
- {
- value.Get( mViewportSize );
- break;
- }
- case Dali::RenderTask::Property::CLEAR_COLOR:
- {
- value.Get( mClearColor );
+ switch ( index )
+ {
+ case Dali::RenderTask::Property::VIEWPORT_POSITION:
+ {
+ value.Get( mViewportPosition );
+ break;
+ }
+ case Dali::RenderTask::Property::VIEWPORT_SIZE:
+ {
+ value.Get( mViewportSize );
+ break;
+ }
+ case Dali::RenderTask::Property::CLEAR_COLOR:
+ {
+ value.Get( mClearColor );
+ break;
+ }
+ case Dali::RenderTask::Property::REQUIRES_SYNC:
+ default:
+ {
+ // Nothing to do as not animatable
+ break;
+ }
+ }
break;
}
- case Dali::RenderTask::Property::REQUIRES_SYNC:
- default:
+
+ case Animation::BY:
{
- // Nothing to do as not animatable
+ switch ( index )
+ {
+ case Dali::RenderTask::Property::VIEWPORT_POSITION:
+ {
+ AdjustValue< Vector2 >( mViewportPosition, value );
+ break;
+ }
+ case Dali::RenderTask::Property::VIEWPORT_SIZE:
+ {
+ AdjustValue< Vector2 >( mViewportSize, value );
+ break;
+ }
+ case Dali::RenderTask::Property::CLEAR_COLOR:
+ {
+ AdjustValue< Vector4 >( mClearColor, value );
+ break;
+ }
+ case Dali::RenderTask::Property::REQUIRES_SYNC:
+ default:
+ {
+ // Nothing to do as not animatable
+ break;
+ }
+ }
break;
}
}
/**
* @copydoc Dali::Internal::Object::OnNotifyDefaultPropertyAnimation()
*/
- virtual void OnNotifyDefaultPropertyAnimation( Animation& animation, Property::Index index, const Property::Value& value );
+ virtual void OnNotifyDefaultPropertyAnimation( Animation& animation, Property::Index index, const Property::Value& value, Animation::Type animationType );
/**
* @copydoc Dali::Internal::Object::GetSceneObject()
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/**
* Rebuild the Layer::colorRenderables and overlayRenderables members,
* including only renderers which are included in the current render-task.
- * Returns true if all renderers have finished acquiring resources.
*
* @param[in] updateBufferIndex The current update buffer index.
* @param[in] node The current node of the scene-graph.
* Note: ClippingId is passed by reference, so it is permanently modified when traversing back up the tree for uniqueness.
* @param[in] clippingDepth The current clipping depth
*/
-bool AddRenderablesForTask( BufferIndex updateBufferIndex,
+void AddRenderablesForTask( BufferIndex updateBufferIndex,
Node& node,
Layer& currentLayer,
RenderTask& renderTask,
uint32_t& currentClippingId,
uint32_t clippingDepth )
{
- bool resourcesFinished = true;
-
// Short-circuit for invisible nodes
if( !node.IsVisible( updateBufferIndex ) )
{
- return resourcesFinished;
+ return;
}
// Check whether node is exclusive to a different render-task
const RenderTask* exclusiveTo = node.GetExclusiveRenderTask();
if( exclusiveTo && ( exclusiveTo != &renderTask ) )
{
- return resourcesFinished;
+ return;
}
// Assume all children go to this layer (if this node is a layer).
for( unsigned int i = 0; i < count; ++i )
{
SceneGraph::Renderer* renderer = node.GetRendererAt( i );
- bool ready = false;
- bool complete = false;
- renderer->GetReadyAndComplete( ready, complete );
-
- DALI_LOG_INFO( gRenderTaskLogFilter, Debug::General, "Testing renderable:%p ready:%s complete:%s\n", renderer, ready ? "T" : "F", complete ? "T" : "F" );
-
- resourcesFinished &= complete;
- if( ready ) // IE. should be rendered (all resources are available)
+ // Normal is the more-likely draw mode to occur.
+ if( DALI_LIKELY( inheritedDrawMode == DrawMode::NORMAL ) )
{
- // Normal is the more-likely draw mode to occur.
- if( DALI_LIKELY( inheritedDrawMode == DrawMode::NORMAL ) )
- {
- layer->colorRenderables.PushBack( Renderable( &node, renderer ) );
- }
- else
- {
- layer->overlayRenderables.PushBack( Renderable( &node, renderer ) );
- }
+ layer->colorRenderables.PushBack( Renderable( &node, renderer ) );
+ }
+ else
+ {
+ layer->overlayRenderables.PushBack( Renderable( &node, renderer ) );
}
}
for( NodeIter iter = children.Begin(); iter != endIter; ++iter )
{
Node& child = **iter;
- bool childResourcesComplete = AddRenderablesForTask( updateBufferIndex, child, *layer, renderTask, inheritedDrawMode, currentClippingId, clippingDepth );
- resourcesFinished &= childResourcesComplete;
+ AddRenderablesForTask( updateBufferIndex, child, *layer, renderTask, inheritedDrawMode, currentClippingId, clippingDepth );
}
-
- return resourcesFinished;
}
} // Anonymous namespace.
continue;
}
- bool resourcesFinished = false;
if( renderTask.IsRenderRequired() )
{
size_t layerCount( sortedLayers.size() );
sortedLayers[i]->ClearRenderables();
}
- resourcesFinished = AddRenderablesForTask( updateBufferIndex,
- *sourceNode,
- *layer,
- renderTask,
- sourceNode->GetDrawMode(),
- clippingId,
- 0u );
-
- renderTask.SetResourcesFinished( resourcesFinished );
+ AddRenderablesForTask( updateBufferIndex,
+ *sourceNode,
+ *layer,
+ renderTask,
+ sourceNode->GetDrawMode(),
+ clippingId,
+ 0u );
// If the clipping Id is still 0 after adding all Renderables, there is no clipping required for this RenderTaskList.
hasClippingNodes = clippingId != 0u;
hasClippingNodes,
instructions );
}
- else
- {
- renderTask.SetResourcesFinished( resourcesFinished );
- }
}
DALI_LOG_INFO( gRenderTaskLogFilter, Debug::General, "RenderTaskProcessor::Process() Onscreen\n" );
continue;
}
- bool resourcesFinished = false;
if( renderTask.IsRenderRequired() )
{
size_t layerCount( sortedLayers.size() );
sortedLayers[i]->ClearRenderables();
}
- resourcesFinished = AddRenderablesForTask( updateBufferIndex,
- *sourceNode,
- *layer,
- renderTask,
- sourceNode->GetDrawMode(),
- clippingId,
- 0u );
+ AddRenderablesForTask( updateBufferIndex,
+ *sourceNode,
+ *layer,
+ renderTask,
+ sourceNode->GetDrawMode(),
+ clippingId,
+ 0u );
// If the clipping Id is still 0 after adding all Renderables, there is no clipping required for this RenderTaskList.
hasClippingNodes = clippingId != 0;
hasClippingNodes,
instructions );
}
-
- renderTask.SetResourcesFinished( resourcesFinished );
}
}
// INTERNAL INCLUDES
#include <dali/public-api/common/stage.h>
-#include <dali/devel-api/common/set-wrapper.h>
#include <dali/devel-api/common/owner-container.h>
#include <dali/devel-api/threading/mutex.h>
// INTERNAL INCLUDES
#include <dali/public-api/actors/actor-enumerations.h>
#include <dali/public-api/actors/draw-mode.h>
-#include <dali/devel-api/common/set-wrapper.h>
#include <dali/public-api/math/quaternion.h>
#include <dali/public-api/math/math-utils.h>
#include <dali/public-api/math/vector3.h>
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
return required;
}
-void RenderTask::SetResourcesFinished( bool resourcesFinished )
-{
- // resourcesFinished tells us that this render task will render to its FBO
- mResourcesFinished = resourcesFinished;
-}
-
// Called every frame regardless of whether render was required.
// If render was not required, ignore resourcesFinished.
void RenderTask::UpdateState()
{
- TASK_LOG_FMT( Debug::General, "(mResourcesFinished:%s) FC:%d State:%s RR:%d\n", mResourcesFinished?"T":"F", mFrameCounter, STATE_STRING(mState), mRefreshRate );
+ TASK_LOG_FMT( Debug::General, "FC:%d State:%s RR:%d\n", mFrameCounter, STATE_STRING(mState), mRefreshRate );
switch( mState )
{
{
if( mFrameCounter == 0 )
{
- if( mResourcesFinished )
- {
- ++mFrameCounter; // Only start skipping frames when resources are loaded
- }
+ ++mFrameCounter; // Only start skipping frames when resources are loaded
}
else // Continue counting to skip frames
{
case RENDER_ONCE_WAITING_FOR_RESOURCES:
{
- if( mResourcesFinished )
- {
- mState = RENDERED_ONCE;
- }
+ mState = RENDERED_ONCE;
}
break;
mClearEnabled ? &GetClearColor( updateBufferIndex ) : NULL );
if( mRequiresSync &&
- mRefreshRate == Dali::RenderTask::REFRESH_ONCE &&
- mResourcesFinished )
+ mRefreshRate == Dali::RenderTask::REFRESH_ONCE )
{
// create tracker if one doesn't yet exist.
if( !mRenderSyncTracker )
mCameraNode( NULL ),
mCamera( NULL ),
mFrameBuffer(0),
- mResourcesFinished( false ),
mWaitingToRender( false ),
mNotifyTrigger( false ),
mExclusive( Dali::RenderTask::DEFAULT_EXCLUSIVE ),
#define __DALI_INTERNAL_SCENE_GRAPH_RENDER_TASK_H__
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
bool IsRenderRequired();
/**
- * Set whether all resources were available when the render-task was processed
- * @param[in] resourcesComplete True if the resources of the source tree are completely loaded.
- */
- void SetResourcesFinished( bool resourcesFinished );
-
- /**
* Process a frame. This method is called each frame for every ready render task, regardless
* of whether it needs to render (so that the frame counter can be updated).
*/
SceneGraph::Camera* mCamera;
Render::FrameBuffer* mFrameBuffer;
- bool mResourcesFinished:1; ///< True if all resources were available when the render-task was processed
bool mWaitingToRender:1; ///< True when an render once to FBO is waiting
bool mNotifyTrigger:1; ///< True if a render once render task has finished renderering
bool mExclusive: 1; ///< Whether the render task has exclusive access to the source actor (node in the scene graph implementation).
mBlendMode( BlendMode::AUTO ),
mDepthWriteMode( DepthWriteMode::AUTO ),
mDepthTestMode( DepthTestMode::AUTO ),
- mResourcesReady( false ),
- mFinishedResourceAcquisition( false ),
mPremultipledAlphaEnabled( false ),
mDepthIndex( 0 )
{
void Renderer::PrepareRender( BufferIndex updateBufferIndex )
{
- mResourcesReady = false;
- mFinishedResourceAcquisition = false;
-
- // Can only be considered ready when all the scene graph objects are connected to the renderer
- if( mGeometry && mShader )
- {
- mResourcesReady = true;
- mFinishedResourceAcquisition = true;
- }
-
if( mRegenerateUniformMap > UNIFORM_MAP_READY )
{
- DALI_ASSERT_DEBUG( mGeometry != NULL && "No geometry available in PrepareRender()" );
- DALI_ASSERT_DEBUG( mShader != NULL && "No shader available in PrepareRender()" );
-
if( mRegenerateUniformMap == REGENERATE_UNIFORM_MAP)
{
CollectedUniformMap& localMap = mCollectedUniformMap[ updateBufferIndex ];
{
typedef MessageValue1< Render::Renderer, Render::Geometry* > DerivedType;
unsigned int* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) );
-
new (slot) DerivedType( mRenderer, &Render::Renderer::SetGeometry, mGeometry );
}
return mCollectedUniformMap[bufferIndex];
}
-void Renderer::GetReadyAndComplete( bool& ready, bool& complete ) const
-{
- ready = mResourcesReady;
- complete = mFinishedResourceAcquisition;
-}
-
Renderer::Opacity Renderer::GetOpacity( BufferIndex updateBufferIndex, const Node& node ) const
{
Renderer::Opacity opacity = Renderer::OPAQUE;
Render::Renderer& GetRenderer();
/**
- * Check whether the renderer has been marked as ready to render
- * ready means that renderer has all resources and should produce correct result
- * complete means all resources have finished loading
- * It's possible that renderer is complete but not ready,
- * for example in case of resource load failed
- * @param[out] ready TRUE if the renderer has resources to render
- * @param[out] complete TRUE if the renderer resources are complete
- */
- void GetReadyAndComplete( bool& ready, bool& complete ) const;
-
- /**
* Query whether the renderer is fully opaque, fully transparent or transparent.
* @param[in] updateBufferIndex The current update buffer index.
* @return OPAQUE if fully opaque, TRANSPARENT if fully transparent and TRANSLUCENT if in between
DepthTestMode::Type mDepthTestMode:2; ///< Local copy of the depth test mode
bool mUniformMapChanged[2]; ///< Records if the uniform map has been altered this frame
- bool mResourcesReady; ///< Set during the Update algorithm; true if the renderer has resources ready for the current frame.
- bool mFinishedResourceAcquisition; ///< Set during DoPrepareResources; true if ready & all resource acquisition has finished (successfully or otherwise)
bool mPremultipledAlphaEnabled:1; ///< Flag indicating whether the Pre-multiplied Alpha Blending is required
public:
int mDepthIndex; ///< Used only in PrepareRenderInstructions
+
};
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/public-api/animation/time-period.h>
#include <dali/internal/event/actors/actor-impl.h>
#include <dali/internal/event/animation/animation-impl.h>
+#include <dali/internal/event/animation/path-impl.h>
namespace Dali
{
const unsigned int CORE_MAJOR_VERSION = 1;
const unsigned int CORE_MINOR_VERSION = 2;
-const unsigned int CORE_MICRO_VERSION = 41;
+const unsigned int CORE_MICRO_VERSION = 42;
const char * const CORE_BUILD_DATE = __DATE__ " " __TIME__;
#ifndef EMSCRIPTEN
Name: dali
Summary: The OpenGLES Canvas Core Library
-Version: 1.2.41
+Version: 1.2.42
Release: 1
Group: System/Libraries
License: Apache-2.0 and BSD-3-Clause and MIT