/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
END_TEST;
}
+int UtcDaliAnimationKeyFramesSetKeyFrameP(void)
+{
+ TestApplication application;
+
+ float inputTime = 0.6f;
+ Vector4 inputValue = Vector4(0.0f, 0.0f, 0.0f, 0.3f);
+
+ KeyFrames keyFrames = KeyFrames::New();
+ keyFrames.Add(0.0f, Vector4(0.0f, 0.0f, 0.0f, 0.6f));
+ keyFrames.Add(inputTime, inputValue);
+ keyFrames.Add(1.0f, Vector4(0.0f, 0.0f, 0.0f, 0.8f));
+
+ float outputTime;
+ Property::Value outputValue;
+
+ DevelKeyFrames::GetKeyFrame(keyFrames, 3, outputTime, outputValue);
+
+ DALI_TEST_EQUALS(outputValue.GetType(), Property::Type::NONE, TEST_LOCATION);
+
+ DevelKeyFrames::GetKeyFrame(keyFrames, 1, outputTime, outputValue);
+
+ DALI_TEST_EQUALS(outputTime, inputTime, TEST_LOCATION);
+ DALI_TEST_EQUALS(outputValue.GetType(), Property::Type::VECTOR4, TEST_LOCATION);
+ DALI_TEST_EQUALS(outputValue.Get<Vector4>(), inputValue, TEST_LOCATION);
+
+ Vector4 newValue = Vector4(1.0f, 0.2f, 0.6f, 0.9f);
+
+ DevelKeyFrames::SetKeyFrameValue(keyFrames, 1, newValue);
+
+ DevelKeyFrames::GetKeyFrame(keyFrames, 1, outputTime, outputValue);
+
+ DALI_TEST_EQUALS(outputTime, inputTime, TEST_LOCATION);
+ DALI_TEST_EQUALS(outputValue.GetType(), Property::Type::VECTOR4, TEST_LOCATION);
+ DALI_TEST_EQUALS(outputValue.Get<Vector4>(), newValue, TEST_LOCATION);
+
+ END_TEST;
+}
+
int UtcDaliAnimationAnimateBetweenActorColorAlphaP(void)
{
TestApplication application;
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
GetImplementation(keyFrames).GetKeyFrame(index, time, value);
}
+void SetKeyFrameValue(KeyFrames keyFrames, std::size_t index, const Property::Value& value)
+{
+ GetImplementation(keyFrames).SetKeyFrameValue(index, value);
+}
+
} // namespace DevelKeyFrames
} // namespace Dali
#define DALI_KEY_FRAMES_DEVEL_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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_CORE_API void GetKeyFrame(KeyFrames keyFrames, std::size_t index, float& time, Property::Value& value);
+/**
+ * Set a key frame.
+ * @param[in] keyFrames The KeyFrames object to perform this operation on
+ * @param[in] index The index of the key frame to set
+ * @param[in] value The value of the given key frame
+ */
+DALI_CORE_API void SetKeyFrameValue(KeyFrames keyFrames, std::size_t index, const Property::Value& value);
+
} // namespace DevelKeyFrames
} // namespace Dali
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
}
}
+void KeyFrames::SetKeyFrameValue(std::size_t index, const Property::Value& value)
+{
+ if(index < mKeyFrames->GetNumberOfKeyFrames())
+ {
+ mKeyFrames->SetKeyFrameValue(index, value);
+ }
+}
+
} // namespace Internal
} // namespace Dali
#define DALI_INTERNAL_KEY_FRAMES_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
*/
void GetKeyFrame(std::size_t index, float& time, Property::Value& value) const;
+ /**
+ * @copydoc Dali::DevelKeyFrames::SetKeyFrameValue()
+ */
+ void SetKeyFrameValue(std::size_t index, const Property::Value& value);
+
private:
Dali::Property::Type mType{Property::NONE}; // Type of the specialization
std::unique_ptr<KeyFrameSpec> mKeyFrames; // Pointer to the specialized key frame object
* @param[out] value The value of the given key frame
*/
virtual void GetKeyFrameAsValue(std::size_t index, float& time, Property::Value& value) const = 0;
+
+ /**
+ * Set the key frame value as a Property::Value.
+ * @param[in] index The index of the key frame to set
+ * @param[in] value The value of the given key frame
+ */
+ virtual void SetKeyFrameValue(std::size_t index, const Property::Value& value) = 0;
};
/**
value = element.mValue;
}
+ /**
+ * @copydoc KeyFrameSpec::SetKeyFrameValue()
+ */
+ void SetKeyFrameValue(std::size_t index, const Property::Value& value) override
+ {
+ auto& element = mChannel.mValues[index];
+ element.mValue = value.Get<V>();
+ }
+
/**
* 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)