Refactored lcObjectKeyArray::RemoveAll.

This commit is contained in:
Leonardo Zide 2023-12-27 10:21:25 -08:00
parent ec2a9bce87
commit 2990afba08
5 changed files with 19 additions and 57 deletions

View file

@ -591,14 +591,9 @@ void lcCamera::DrawInterface(lcContext* Context, const lcScene& Scene) const
void lcCamera::RemoveKeyFrames() void lcCamera::RemoveKeyFrames()
{ {
mPositionKeys.RemoveAll(); mPositionKeys.Reset(mPosition);
mPositionKeys.ChangeKey(mPosition, 1, true); mTargetPositionKeys.Reset(mTargetPosition);
mUpVectorKeys.Reset(mUpVector);
mTargetPositionKeys.RemoveAll();
mTargetPositionKeys.ChangeKey(mTargetPosition, 1, true);
mUpVectorKeys.RemoveAll();
mUpVectorKeys.ChangeKey(mUpVector, 1, true);
} }
void lcCamera::RayTest(lcObjectRayTest& ObjectRayTest) const void lcCamera::RayTest(lcObjectRayTest& ObjectRayTest) const

View file

@ -43,8 +43,6 @@ lcLight::lcLight(const lcVector3& Position, lcLightType LightType)
void lcLight::UpdateLightType() void lcLight::UpdateLightType()
{ {
mSizeKeys.RemoveAll();
switch (mLightType) switch (mLightType)
{ {
case lcLightType::Point: case lcLightType::Point:
@ -67,7 +65,7 @@ void lcLight::UpdateLightType()
break; break;
} }
mSizeKeys.ChangeKey(mSize, 1, true); mSizeKeys.Reset(mSize);
} }
QString lcLight::GetLightTypeString(lcLightType LightType) QString lcLight::GetLightTypeString(lcLightType LightType)
@ -1077,43 +1075,15 @@ void lcLight::DrawCone(lcContext* Context, float TargetDistance) const
void lcLight::RemoveKeyFrames() void lcLight::RemoveKeyFrames()
{ {
mPositionKeys.RemoveAll(); mPositionKeys.Reset(mWorldMatrix.GetTranslation());
mPositionKeys.ChangeKey(mWorldMatrix.GetTranslation(), 1, true); mRotationKeys.Reset(lcMatrix33(mWorldMatrix));
mColorKeys.Reset(mColor);
mRotationKeys.RemoveAll(); mSpotConeAngleKeys.Reset(mSpotConeAngle);
mRotationKeys.ChangeKey(lcMatrix33(mWorldMatrix), 1, true); mSpotPenumbraAngleKeys.Reset(mSpotPenumbraAngle);
mSpotTightnessKeys.Reset(mSpotTightness);
mColorKeys.RemoveAll(); mAreaGridKeys.Reset(mAreaGrid);
mColorKeys.ChangeKey(mColor, 1, true); mSizeKeys.Reset(mSize);
mPowerKeys.Reset(mPower);
mSpotConeAngleKeys.RemoveAll(); mAttenuationDistanceKeys.Reset(mAttenuationDistance);
mSpotConeAngleKeys.ChangeKey(mSpotConeAngle, 1, false); mAttenuationPowerKeys.Reset(mAttenuationPower);
mSpotPenumbraAngleKeys.RemoveAll();
mSpotPenumbraAngleKeys.ChangeKey(mSpotPenumbraAngle, 1, true);
mSpotTightnessKeys.RemoveAll();
mSpotTightnessKeys.ChangeKey(mSpotTightness, 1, true);
mAreaGridKeys.RemoveAll();
mAreaGridKeys.ChangeKey(mAreaGrid, 1, true);
mSizeKeys.RemoveAll();
mSizeKeys.ChangeKey(mSize, 1, true);
mPowerKeys.RemoveAll();
mPowerKeys.ChangeKey(mPower, 1, true);
mAttenuationDistanceKeys.RemoveAll();
mAttenuationDistanceKeys.ChangeKey(mAttenuationDistance, 1, true);
mAttenuationPowerKeys.RemoveAll();
mAttenuationPowerKeys.ChangeKey(mAttenuationPower, 1, true);
}
bool lcLight::Setup(int LightIndex)
{
Q_UNUSED(LightIndex);
return true;
} }

View file

@ -312,7 +312,6 @@ public:
void UpdatePosition(lcStep Step); void UpdatePosition(lcStep Step);
void MoveSelected(lcStep Step, bool AddKey, const lcVector3& Distance, bool FirstMove); void MoveSelected(lcStep Step, bool AddKey, const lcVector3& Distance, bool FirstMove);
void Rotate(lcStep Step, bool AddKey, const lcMatrix33& RotationMatrix, const lcVector3& Center, const lcMatrix33& RotationFrame); void Rotate(lcStep Step, bool AddKey, const lcMatrix33& RotationMatrix, const lcVector3& Center, const lcMatrix33& RotationFrame);
bool Setup(int LightIndex);
void CreateName(const lcArray<lcLight*>& Lights); void CreateName(const lcArray<lcLight*>& Lights);
lcMatrix44 mWorldMatrix; lcMatrix44 mWorldMatrix;

View file

@ -31,9 +31,10 @@ public:
return mKeys.empty(); return mKeys.empty();
} }
void RemoveAll() void Reset(const T& Value)
{ {
mKeys.clear(); mKeys.clear();
ChangeKey(Value, 1, true);
} }
void SaveKeysLDraw(QTextStream& Stream, const char* ObjectName, const char* VariableName) const; void SaveKeysLDraw(QTextStream& Stream, const char* ObjectName, const char* VariableName) const;

View file

@ -659,11 +659,8 @@ void lcPiece::DrawInterface(lcContext* Context, const lcScene& Scene) const
void lcPiece::RemoveKeyFrames() void lcPiece::RemoveKeyFrames()
{ {
mPositionKeys.RemoveAll(); mPositionKeys.Reset(mModelWorld.GetTranslation());
mPositionKeys.ChangeKey(mModelWorld.GetTranslation(), 1, true); mRotationKeys.Reset(lcMatrix33(mModelWorld));
mRotationKeys.RemoveAll();
mRotationKeys.ChangeKey(lcMatrix33(mModelWorld), 1, true);
} }
void lcPiece::AddMainModelRenderMeshes(lcScene* Scene, bool Highlight, bool Fade) const void lcPiece::AddMainModelRenderMeshes(lcScene* Scene, bool Highlight, bool Fade) const