From c58531af65db38a9ae0a3c965db48bfa422ffcab Mon Sep 17 00:00:00 2001 From: seungho baek Date: Thu, 14 Sep 2023 18:43:11 +0900 Subject: [PATCH] [Tizen] Property Notify for orientation changes This reverts commit 32b356a3961bde786c7bb964942a4b30303291dc. Change-Id: Ided1c2b79e11f0ed4a00d834478726ff9fa4d062 --- .../update/common/property-condition-step-functions.cpp | 15 +++++++++++++++ .../update/common/property-condition-step-functions.h | 9 +++++++++ .../common/property-condition-variable-step-functions.cpp | 15 +++++++++++++++ .../common/property-condition-variable-step-functions.h | 9 +++++++++ dali/public-api/object/property-conditions.h | 2 ++ 5 files changed, 50 insertions(+) diff --git a/dali/internal/update/common/property-condition-step-functions.cpp b/dali/internal/update/common/property-condition-step-functions.cpp index 9076a8a..8674b0b 100644 --- a/dali/internal/update/common/property-condition-step-functions.cpp +++ b/dali/internal/update/common/property-condition-step-functions.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include namespace Dali @@ -70,6 +71,11 @@ ConditionFunction Step::GetFunction(Property::Type valueType) function = EvalVector4; break; } + case Property::ROTATION: + { + function = EvalQuaternion; + break; + } default: { function = EvalDefault; @@ -161,6 +167,15 @@ bool Step::EvalVector4(const Dali::PropertyInput& value, PropertyNotification::R return Evaluate(propertyValue, arg); } +bool Step::EvalQuaternion(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg) +{ + Quaternion propertyValue = value.GetQuaternion(); + // TODO : Make some meaningfule calculation here + Vector4 v = propertyValue.EulerAngles(); + const float checkValue = v.LengthSquared(); + return Evaluate(checkValue, arg); +} + bool Step::EvalDefault(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg) { return false; diff --git a/dali/internal/update/common/property-condition-step-functions.h b/dali/internal/update/common/property-condition-step-functions.h index 57fe42c..7f5dc5d 100644 --- a/dali/internal/update/common/property-condition-step-functions.h +++ b/dali/internal/update/common/property-condition-step-functions.h @@ -39,6 +39,7 @@ namespace SceneGraph * Vector2 => 2 dimensional length of vector has stepped arg1 amount from arg0. * Vector3 => 3 dimensional length of vector has stepped arg1 amount from arg0. * Vector4 => 4 dimensional length of vector has stepped arg1 amount from arg0. + * Quaternion => sum of rotation angle and axis changes has stepped arg1 amount from arg0 * Default => return false. */ class Step @@ -113,6 +114,14 @@ private: static bool EvalVector4(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg); /** + * Checks if Quaternion is Outside + * @param[in] value The value being examined. + * @param[in] arg The supplied arguments for the condition. + * @return Condition result (true if condition met, false if not) + */ + static bool EvalQuaternion(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg); + + /** * Default check for other types. * @param[in] value The value being examined. * @param[in] arg The supplied arguments for the condition. diff --git a/dali/internal/update/common/property-condition-variable-step-functions.cpp b/dali/internal/update/common/property-condition-variable-step-functions.cpp index e194329..8f61c7a 100644 --- a/dali/internal/update/common/property-condition-variable-step-functions.cpp +++ b/dali/internal/update/common/property-condition-variable-step-functions.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include namespace Dali @@ -67,6 +68,11 @@ ConditionFunction VariableStep::GetFunction(Property::Type valueType) function = EvalVector4; break; } + case Property::ROTATION: + { + function = EvalQuaternion; + break; + } default: { function = EvalDefault; @@ -172,6 +178,15 @@ bool VariableStep::EvalVector4(const Dali::PropertyInput& value, PropertyNotific return Evaluate(propertyValue, arg); } +bool VariableStep::EvalQuaternion(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg) +{ + Quaternion propertyValue = value.GetQuaternion(); + // TODO : Make some meaningfule calculation here + Vector4 v = propertyValue.EulerAngles(); + const float checkValue = v.LengthSquared(); + return Evaluate(checkValue, arg); +} + bool VariableStep::EvalDefault(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg) { return false; diff --git a/dali/internal/update/common/property-condition-variable-step-functions.h b/dali/internal/update/common/property-condition-variable-step-functions.h index 16c7640..d404e1b 100644 --- a/dali/internal/update/common/property-condition-variable-step-functions.h +++ b/dali/internal/update/common/property-condition-variable-step-functions.h @@ -39,6 +39,7 @@ namespace SceneGraph * Vector2 => 2 dimensional length of vector has stepped arg1 amount from arg0. * Vector3 => 3 dimensional length of vector has stepped arg1 amount from arg0. * Vector4 => 4 dimensional length of vector has stepped arg1 amount from arg0. + * Quaternion => sum of rotation angle and axis changes has stepped arg1 amount from arg0 * Default => return false. */ class VariableStep @@ -99,6 +100,14 @@ private: static bool EvalVector4(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg); /** + * Checks if Quaternion is Outside + * @param[in] value The value being examined. + * @param[in] arg The supplied arguments for the condition. + * @return Condition result (true if condition met, false if not) + */ + static bool EvalQuaternion(const Dali::PropertyInput& value, PropertyNotification::RawArgumentContainer& arg); + + /** * Default check for other types. * @param[in] value The value being examined. * @param[in] arg The supplied arguments for the condition. diff --git a/dali/public-api/object/property-conditions.h b/dali/public-api/object/property-conditions.h index a3f39e9..99ec9b7 100644 --- a/dali/public-api/object/property-conditions.h +++ b/dali/public-api/object/property-conditions.h @@ -178,6 +178,7 @@ DALI_CORE_API PropertyCondition OutsideCondition(float arg0, float arg1); * vector2 (the 2D length) * vector3 (the 3D length) * vector4 (the 4D length) + * quaternion (the radian of rotation and axis) * @SINCE_1_0.0 * @param[in] stepAmount The step size required to trigger condition * @param[in] initialValue The initial value to step from @@ -193,6 +194,7 @@ DALI_CORE_API PropertyCondition StepCondition(float stepAmount, float initialVal * vector2 (the 2D length) * vector3 (the 3D length) * vector4 (the 4D length) + * quaternion (the radian of rotation and axis) * @SINCE_1_0.0 * @param[in] steps List of values to receive notifications for as a property crosses them * @return A property condition function object -- 2.7.4