diff --git a/common/camera.cpp b/common/camera.cpp index ca820514..d2414485 100644 --- a/common/camera.cpp +++ b/common/camera.cpp @@ -591,14 +591,9 @@ void lcCamera::DrawInterface(lcContext* Context, const lcScene& Scene) const void lcCamera::RemoveKeyFrames() { - mPositionKeys.RemoveAll(); - mPositionKeys.ChangeKey(mPosition, 1, true); - - mTargetPositionKeys.RemoveAll(); - mTargetPositionKeys.ChangeKey(mTargetPosition, 1, true); - - mUpVectorKeys.RemoveAll(); - mUpVectorKeys.ChangeKey(mUpVector, 1, true); + mPositionKeys.Reset(mPosition); + mTargetPositionKeys.Reset(mTargetPosition); + mUpVectorKeys.Reset(mUpVector); } void lcCamera::RayTest(lcObjectRayTest& ObjectRayTest) const diff --git a/common/light.cpp b/common/light.cpp index 82ed4288..eb89d514 100644 --- a/common/light.cpp +++ b/common/light.cpp @@ -43,8 +43,6 @@ lcLight::lcLight(const lcVector3& Position, lcLightType LightType) void lcLight::UpdateLightType() { - mSizeKeys.RemoveAll(); - switch (mLightType) { case lcLightType::Point: @@ -67,7 +65,7 @@ void lcLight::UpdateLightType() break; } - mSizeKeys.ChangeKey(mSize, 1, true); + mSizeKeys.Reset(mSize); } QString lcLight::GetLightTypeString(lcLightType LightType) @@ -1077,43 +1075,15 @@ void lcLight::DrawCone(lcContext* Context, float TargetDistance) const void lcLight::RemoveKeyFrames() { - mPositionKeys.RemoveAll(); - mPositionKeys.ChangeKey(mWorldMatrix.GetTranslation(), 1, true); - - mRotationKeys.RemoveAll(); - mRotationKeys.ChangeKey(lcMatrix33(mWorldMatrix), 1, true); - - mColorKeys.RemoveAll(); - mColorKeys.ChangeKey(mColor, 1, true); - - mSpotConeAngleKeys.RemoveAll(); - mSpotConeAngleKeys.ChangeKey(mSpotConeAngle, 1, false); - - 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; + mPositionKeys.Reset(mWorldMatrix.GetTranslation()); + mRotationKeys.Reset(lcMatrix33(mWorldMatrix)); + mColorKeys.Reset(mColor); + mSpotConeAngleKeys.Reset(mSpotConeAngle); + mSpotPenumbraAngleKeys.Reset(mSpotPenumbraAngle); + mSpotTightnessKeys.Reset(mSpotTightness); + mAreaGridKeys.Reset(mAreaGrid); + mSizeKeys.Reset(mSize); + mPowerKeys.Reset(mPower); + mAttenuationDistanceKeys.Reset(mAttenuationDistance); + mAttenuationPowerKeys.Reset(mAttenuationPower); } diff --git a/common/light.h b/common/light.h index 32d80a0a..fc9a685b 100644 --- a/common/light.h +++ b/common/light.h @@ -312,7 +312,6 @@ public: void UpdatePosition(lcStep Step); 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); - bool Setup(int LightIndex); void CreateName(const lcArray& Lights); lcMatrix44 mWorldMatrix; diff --git a/common/object.h b/common/object.h index 92af6cd2..1c69634c 100644 --- a/common/object.h +++ b/common/object.h @@ -31,9 +31,10 @@ public: return mKeys.empty(); } - void RemoveAll() + void Reset(const T& Value) { mKeys.clear(); + ChangeKey(Value, 1, true); } void SaveKeysLDraw(QTextStream& Stream, const char* ObjectName, const char* VariableName) const; diff --git a/common/piece.cpp b/common/piece.cpp index 89cee77e..90c6059e 100644 --- a/common/piece.cpp +++ b/common/piece.cpp @@ -659,11 +659,8 @@ void lcPiece::DrawInterface(lcContext* Context, const lcScene& Scene) const void lcPiece::RemoveKeyFrames() { - mPositionKeys.RemoveAll(); - mPositionKeys.ChangeKey(mModelWorld.GetTranslation(), 1, true); - - mRotationKeys.RemoveAll(); - mRotationKeys.ChangeKey(lcMatrix33(mModelWorld), 1, true); + mPositionKeys.Reset(mModelWorld.GetTranslation()); + mRotationKeys.Reset(lcMatrix33(mModelWorld)); } void lcPiece::AddMainModelRenderMeshes(lcScene* Scene, bool Highlight, bool Fade) const