move trackview changes to another branch
This commit is contained in:
@@ -695,7 +695,7 @@ public:
|
||||
//! Rotate entity node.
|
||||
virtual void SetRotate(float time, const Quat& quat) = 0;
|
||||
//! Scale entity node.
|
||||
virtual void SetScale(float time, const float scale) = 0;
|
||||
virtual void SetScale(float time, const Vec3& scale) = 0;
|
||||
|
||||
//! Compute and return the offset which brings the current position to the given position
|
||||
virtual Vec3 GetOffsetPosition(const Vec3& position) { return position - GetPos(); }
|
||||
@@ -707,7 +707,7 @@ public:
|
||||
//! Get entity rotation at specified time.
|
||||
virtual Quat GetRotate(float time) = 0;
|
||||
//! Get current entity scale.
|
||||
virtual float GetScale() = 0;
|
||||
virtual Vec3 GetScale() = 0;
|
||||
|
||||
// General Set param.
|
||||
// Set float/vec3/vec4 parameter at given time.
|
||||
|
||||
@@ -1869,7 +1869,7 @@ void CTrackViewAnimNode::SetPos(const Vec3& position)
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CTrackViewAnimNode::SetScale(float scale)
|
||||
void CTrackViewAnimNode::SetScale(const Vec3& scale)
|
||||
{
|
||||
CTrackViewTrack* track = GetTrackForParameter(AnimParamType::Scale);
|
||||
|
||||
@@ -2012,9 +2012,9 @@ void CTrackViewAnimNode::SetPosRotScaleTracksDefaultValues(bool positionAllowed,
|
||||
}
|
||||
if (scaleAllowed)
|
||||
{
|
||||
float scale = 1.0f;
|
||||
AZ::TransformBus::EventResult(scale, entityId, &AZ::TransformBus::Events::GetWorldUniformScale);
|
||||
m_animNode->SetScale(time, scale);
|
||||
AZ::Vector3 scale = AZ::Vector3::CreateOne();
|
||||
AZ::TransformBus::EventResult(scale, entityId, &AZ::TransformBus::Events::GetWorldScale);
|
||||
m_animNode->SetScale(time, AZVec3ToLYVec3(scale));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2482,11 +2482,11 @@ Quat CTrackViewAnimNode::GetTransformDelegateRotation(const Quat& baseRotation)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
Vec3 CTrackViewAnimNode::GetTransformDelegateScale(const Vec3& baseScale) const
|
||||
{
|
||||
float scale = GetScale();
|
||||
const Vec3 scale = GetScale();
|
||||
|
||||
return Vec3(CheckTrackAnimated(AnimParamType::ScaleX) ? scale : baseScale.x,
|
||||
CheckTrackAnimated(AnimParamType::ScaleY) ? scale : baseScale.y,
|
||||
CheckTrackAnimated(AnimParamType::ScaleZ) ? scale : baseScale.z);
|
||||
return Vec3(CheckTrackAnimated(AnimParamType::ScaleX) ? scale.x : baseScale.x,
|
||||
CheckTrackAnimated(AnimParamType::ScaleY) ? scale.y : baseScale.y,
|
||||
CheckTrackAnimated(AnimParamType::ScaleZ) ? scale.z : baseScale.z);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -2504,7 +2504,7 @@ void CTrackViewAnimNode::SetTransformDelegateRotation(const Quat& rotation)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CTrackViewAnimNode::SetTransformDelegateScale(const Vec3& scale)
|
||||
{
|
||||
SetScale(scale.x);
|
||||
SetScale(scale);
|
||||
}
|
||||
|
||||
bool CTrackViewAnimNode::IsTransformAnimParamTypeDelegated(const AnimParamType animParamType) const
|
||||
|
||||
@@ -182,8 +182,8 @@ public:
|
||||
// Rotation/Position & Scale
|
||||
void SetPos(const Vec3& position);
|
||||
Vec3 GetPos() const { return m_animNode->GetPos(); }
|
||||
void SetScale(float scale);
|
||||
float GetScale() const { return m_animNode->GetScale(); }
|
||||
void SetScale(const Vec3& scale);
|
||||
Vec3 GetScale() const { return m_animNode->GetScale(); }
|
||||
void SetRotation(const Quat& rotation);
|
||||
Quat GetRotation() const { return m_animNode->GetRotate(); }
|
||||
Quat GetRotation(float time) const { return m_animNode != nullptr ? m_animNode->GetRotate(time) : Quat(0,0,0,0); }
|
||||
|
||||
@@ -825,10 +825,10 @@ void CTrackViewSequence::SyncSelectedTracksToBase()
|
||||
{
|
||||
const Vec3 position = pAnimNode->GetPos();
|
||||
const Quat rotation = pAnimNode->GetRotation();
|
||||
const float scale = pAnimNode->GetScale();
|
||||
const Vec3 scale = pAnimNode->GetScale();
|
||||
|
||||
AZ::Transform transform = AZ::Transform::CreateIdentity();
|
||||
transform.SetUniformScale(scale);
|
||||
transform.SetScale(LYVec3ToAZVec3(scale));
|
||||
transform.SetRotation(LYQuaternionToAZQuaternion(rotation));
|
||||
transform.SetTranslation(LYVec3ToAZVec3(position));
|
||||
|
||||
@@ -870,7 +870,7 @@ void CTrackViewSequence::SyncSelectedTracksFromBase()
|
||||
|
||||
pAnimNode->SetPos(AZVec3ToLYVec3(transform.GetTranslation()));
|
||||
pAnimNode->SetRotation(AZQuaternionToLYQuaternion(transform.GetRotation()));
|
||||
pAnimNode->SetScale(transform.GetUniformScale());
|
||||
pAnimNode->SetScale(AZVec3ToLYVec3(transform.GetScale()));
|
||||
|
||||
bNothingWasSynced = false;
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ Quat CAnimAzEntityNode::GetRotate(float time)
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CAnimAzEntityNode::SetScale(float time, float scale)
|
||||
void CAnimAzEntityNode::SetScale(float time, const Vec3& scale)
|
||||
{
|
||||
CAnimComponentNode* transformComponent = GetTransformComponentNode();
|
||||
if (transformComponent)
|
||||
@@ -198,7 +198,7 @@ void CAnimAzEntityNode::SetScale(float time, float scale)
|
||||
}
|
||||
}
|
||||
|
||||
float CAnimAzEntityNode::GetScale()
|
||||
Vec3 CAnimAzEntityNode::GetScale()
|
||||
{
|
||||
CAnimComponentNode* transformComponent = GetTransformComponentNode();
|
||||
if (transformComponent)
|
||||
@@ -206,7 +206,7 @@ float CAnimAzEntityNode::GetScale()
|
||||
return transformComponent->GetScale();
|
||||
}
|
||||
|
||||
return 0.0f;
|
||||
return Vec3(.0f, .0f, .0f);
|
||||
}
|
||||
|
||||
Vec3 CAnimAzEntityNode::GetOffsetPosition(const Vec3& position)
|
||||
|
||||
@@ -57,14 +57,14 @@ public:
|
||||
|
||||
void SetPos(float time, const Vec3& pos) override;
|
||||
void SetRotate(float time, const Quat& quat) override;
|
||||
void SetScale(float time, float scale) override;
|
||||
void SetScale(float time, const Vec3& scale) override;
|
||||
|
||||
Vec3 GetOffsetPosition(const Vec3& position) override;
|
||||
|
||||
Vec3 GetPos() override;
|
||||
Quat GetRotate() override;
|
||||
Quat GetRotate(float time) override;
|
||||
float GetScale() override;
|
||||
Vec3 GetScale() override;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void Serialize(XmlNodeRef& xmlNode, bool bLoading, bool bLoadEmptyTracks);
|
||||
|
||||
@@ -341,10 +341,10 @@ void CAnimComponentNode::ConvertBetweenWorldAndLocalRotation(Quat& rotation, ETr
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CAnimComponentNode::ConvertBetweenWorldAndLocalScale(float& scale, ETransformSpaceConversionDirection conversionDirection) const
|
||||
void CAnimComponentNode::ConvertBetweenWorldAndLocalScale(Vec3& scale, ETransformSpaceConversionDirection conversionDirection) const
|
||||
{
|
||||
AZ::Transform parentTransform = AZ::Transform::Identity();
|
||||
AZ::Transform scaleTransform = AZ::Transform::CreateUniformScale(scale);
|
||||
AZ::Transform scaleTransform = AZ::Transform::CreateScale(AZ::Vector3(scale.x, scale.y, scale.z));
|
||||
|
||||
GetParentWorldTransform(parentTransform);
|
||||
if (conversionDirection == eTransformConverstionDirection_toLocalSpace)
|
||||
@@ -353,7 +353,8 @@ void CAnimComponentNode::ConvertBetweenWorldAndLocalScale(float& scale, ETransfo
|
||||
}
|
||||
scaleTransform = parentTransform * scaleTransform;
|
||||
|
||||
scale = scaleTransform.GetUniformScale();
|
||||
AZ::Vector3 vScale = scaleTransform.GetScale();
|
||||
scale.Set(vScale.GetX(), vScale.GetY(), vScale.GetZ());
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -456,7 +457,7 @@ Quat CAnimComponentNode::GetRotate()
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CAnimComponentNode::SetScale(float time, float scale)
|
||||
void CAnimComponentNode::SetScale(float time, const Vec3& scale)
|
||||
{
|
||||
if (m_componentTypeId == AZ::Uuid(AZ::EditorTransformComponentTypeId) || m_componentTypeId == AzFramework::TransformComponent::TYPEINFO_Uuid())
|
||||
{
|
||||
@@ -467,7 +468,7 @@ void CAnimComponentNode::SetScale(float time, float scale)
|
||||
{
|
||||
// Scale is in World space, even if the entity is parented - because Component Entity AZ::Transforms do not correctly set
|
||||
// CBaseObject parenting, so we convert it to Local space here. This should probably be fixed, but for now, we explicitly change from World to Local space here.
|
||||
float localScale = scale;
|
||||
Vec3 localScale(scale);
|
||||
ConvertBetweenWorldAndLocalScale(localScale, eTransformConverstionDirection_toLocalSpace);
|
||||
scaleTrack->SetValue(time, localScale, bDefault);
|
||||
}
|
||||
@@ -479,15 +480,15 @@ void CAnimComponentNode::SetScale(float time, float scale)
|
||||
}
|
||||
}
|
||||
|
||||
float CAnimComponentNode::GetScale()
|
||||
Vec3 CAnimComponentNode::GetScale()
|
||||
{
|
||||
Maestro::SequenceComponentRequests::AnimatablePropertyAddress animatableAddress(m_componentId, "Scale");
|
||||
Maestro::SequenceComponentRequests::AnimatedFloatValue scaleValue(0.0f);
|
||||
Maestro::SequenceComponentRequests::AnimatedVector3Value scaleValue(AZ::Vector3::CreateZero());
|
||||
Maestro::SequenceComponentRequestBus::Event(m_pSequence->GetSequenceEntityId(), &Maestro::SequenceComponentRequestBus::Events::GetAnimatedPropertyValue, scaleValue, GetParentAzEntityId(), animatableAddress);
|
||||
|
||||
// Always return World scale because Component Entity AZ::Transforms do not correctly set
|
||||
// CBaseObject parenting. This should probably be fixed, but for now, we explicitly change from Local to World space here.
|
||||
float worldScale = scaleValue.GetFloatValue();
|
||||
Vec3 worldScale(scaleValue.GetVector3Value());
|
||||
ConvertBetweenWorldAndLocalScale(worldScale, eTransformConverstionDirection_toWorldSpace);
|
||||
|
||||
return worldScale;
|
||||
|
||||
@@ -71,12 +71,12 @@ public:
|
||||
|
||||
void SetPos(float time, const Vec3& pos) override;
|
||||
void SetRotate(float time, const Quat& quat) override;
|
||||
void SetScale(float time, float scale) override;
|
||||
void SetScale(float time, const Vec3& scale) override;
|
||||
|
||||
Vec3 GetPos() override;
|
||||
Quat GetRotate() override;
|
||||
Quat GetRotate(float time) override;
|
||||
float GetScale() override;
|
||||
Vec3 GetScale() override;
|
||||
|
||||
void Activate(bool bActivate) override;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -128,7 +128,7 @@ private:
|
||||
void GetParentWorldTransform(AZ::Transform& retTransform) const;
|
||||
void ConvertBetweenWorldAndLocalPosition(Vec3& position, ETransformSpaceConversionDirection conversionDirection) const;
|
||||
void ConvertBetweenWorldAndLocalRotation(Quat& rotation, ETransformSpaceConversionDirection conversionDirection) const;
|
||||
void ConvertBetweenWorldAndLocalScale(float& scale, ETransformSpaceConversionDirection conversionDirection) const;
|
||||
void ConvertBetweenWorldAndLocalScale(Vec3& scale, ETransformSpaceConversionDirection conversionDirection) const;
|
||||
|
||||
// Utility function to query the units for a track and set the track multiplier if needed. Returns true if track multiplier was set.
|
||||
bool SetTrackMultiplier(IAnimTrack* track) const;
|
||||
|
||||
@@ -79,12 +79,12 @@ public:
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void SetPos([[maybe_unused]] float time, [[maybe_unused]] const Vec3& pos) override {};
|
||||
void SetRotate([[maybe_unused]] float time, [[maybe_unused]] const Quat& quat) override {};
|
||||
void SetScale([[maybe_unused]] float time, [[maybe_unused]] const float scale) override {};
|
||||
void SetScale([[maybe_unused]] float time, [[maybe_unused]] const Vec3& scale) override {};
|
||||
|
||||
Vec3 GetPos() override { return Vec3(0, 0, 0); };
|
||||
Quat GetRotate() override { return Quat(0, 0, 0, 0); };
|
||||
Quat GetRotate(float /*time*/) override { return Quat(0, 0, 0, 0); };
|
||||
float GetScale() override { return 0.0f; };
|
||||
Vec3 GetScale() override { return Vec3(0, 0, 0); };
|
||||
|
||||
virtual Matrix34 GetReferenceMatrix() const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user