mirror of
https://github.com/leozide/leocad
synced 2024-11-16 07:47:27 +01:00
Added option to remove key frames from selected objects.
This commit is contained in:
parent
35eb41217a
commit
51bbdb9b97
12 changed files with 86 additions and 1 deletions
|
@ -634,6 +634,18 @@ void lcCamera::DrawInterface(lcContext* Context) const
|
|||
}
|
||||
}
|
||||
|
||||
void lcCamera::RemoveKeyFrames()
|
||||
{
|
||||
mPositionKeys.RemoveAll();
|
||||
ChangeKey(mPositionKeys, mPosition, 1, true);
|
||||
|
||||
mTargetPositionKeys.RemoveAll();
|
||||
ChangeKey(mTargetPositionKeys, mTargetPosition, 1, true);
|
||||
|
||||
mUpVectorKeys.RemoveAll();
|
||||
ChangeKey(mUpVectorKeys, mUpVector, 1, true);
|
||||
}
|
||||
|
||||
void lcCamera::RayTest(lcObjectRayTest& ObjectRayTest) const
|
||||
{
|
||||
lcVector3 Min = lcVector3(-LC_CAMERA_POSITION_EDGE, -LC_CAMERA_POSITION_EDGE, -LC_CAMERA_POSITION_EDGE);
|
||||
|
|
|
@ -262,6 +262,7 @@ public:
|
|||
virtual void RayTest(lcObjectRayTest& ObjectRayTest) const override;
|
||||
virtual void BoxTest(lcObjectBoxTest& ObjectBoxTest) const override;
|
||||
virtual void DrawInterface(lcContext* Context) const override;
|
||||
virtual void RemoveKeyFrames() override;
|
||||
|
||||
void InsertTime(lcStep Start, lcStep Time);
|
||||
void RemoveTime(lcStep Start, lcStep Time);
|
||||
|
|
|
@ -1060,6 +1060,13 @@ lcCommand gCommands[LC_NUM_COMMANDS] =
|
|||
QT_TRANSLATE_NOOP("Status", "Reset the pivot point of the selected pieces to their origin"),
|
||||
QT_TRANSLATE_NOOP("Shortcut", "")
|
||||
},
|
||||
// LC_PIECE_REMOVE_KEY_FRAMES
|
||||
{
|
||||
QT_TRANSLATE_NOOP("Action", "Piece.RemoveKeyFrames"),
|
||||
QT_TRANSLATE_NOOP("Menu", "Remove &Key Frames"),
|
||||
QT_TRANSLATE_NOOP("Status", "Remove all key frames from the selected pieces"),
|
||||
QT_TRANSLATE_NOOP("Shortcut", "")
|
||||
},
|
||||
// LC_PIECE_CONTROL_POINT_INSERT
|
||||
{
|
||||
QT_TRANSLATE_NOOP("Action", "Piece.ControlPoint.Insert"),
|
||||
|
|
|
@ -165,6 +165,7 @@ enum lcCommandId
|
|||
LC_PIECE_DELETE,
|
||||
LC_PIECE_DUPLICATE,
|
||||
LC_PIECE_RESET_PIVOT_POINT,
|
||||
LC_PIECE_REMOVE_KEY_FRAMES,
|
||||
LC_PIECE_CONTROL_POINT_INSERT,
|
||||
LC_PIECE_CONTROL_POINT_REMOVE,
|
||||
LC_PIECE_MOVE_PLUSX,
|
||||
|
|
|
@ -510,9 +510,10 @@ void lcMainWindow::CreateMenus()
|
|||
PieceMenu->addAction(mActions[LC_PIECE_INSERT]);
|
||||
PieceMenu->addAction(mActions[LC_PIECE_DELETE]);
|
||||
PieceMenu->addAction(mActions[LC_PIECE_DUPLICATE]);
|
||||
PieceMenu->addAction(mActions[LC_PIECE_RESET_PIVOT_POINT]);
|
||||
PieceMenu->addAction(mActions[LC_PIECE_ARRAY]);
|
||||
PieceMenu->addAction(mActions[LC_PIECE_MINIFIG_WIZARD]);
|
||||
PieceMenu->addAction(mActions[LC_PIECE_RESET_PIVOT_POINT]);
|
||||
PieceMenu->addAction(mActions[LC_PIECE_REMOVE_KEY_FRAMES]);
|
||||
PieceMenu->addSeparator();
|
||||
PieceMenu->addAction(mActions[LC_PIECE_VIEW_SELECTED_MODEL]);
|
||||
PieceMenu->addAction(mActions[LC_PIECE_INLINE_SELECTED_MODELS]);
|
||||
|
@ -1782,6 +1783,7 @@ void lcMainWindow::UpdateSelectedObjects(bool SelectionChanged)
|
|||
mActions[LC_PIECE_DELETE]->setEnabled(Flags & LC_SEL_SELECTED);
|
||||
mActions[LC_PIECE_DUPLICATE]->setEnabled(Flags & LC_SEL_SELECTED);
|
||||
mActions[LC_PIECE_RESET_PIVOT_POINT]->setEnabled(Flags & LC_SEL_SELECTED);
|
||||
mActions[LC_PIECE_REMOVE_KEY_FRAMES]->setEnabled(Flags & LC_SEL_SELECTED);
|
||||
mActions[LC_PIECE_ARRAY]->setEnabled(Flags & LC_SEL_PIECE);
|
||||
mActions[LC_PIECE_CONTROL_POINT_INSERT]->setEnabled(Flags & LC_SEL_CAN_ADD_CONTROL_POINT);
|
||||
mActions[LC_PIECE_CONTROL_POINT_REMOVE]->setEnabled(Flags & LC_SEL_CAN_REMOVE_CONTROL_POINT);
|
||||
|
@ -2523,6 +2525,10 @@ void lcMainWindow::HandleCommand(lcCommandId CommandId)
|
|||
lcGetActiveModel()->ResetSelectedPiecesPivotPoint();
|
||||
break;
|
||||
|
||||
case LC_PIECE_REMOVE_KEY_FRAMES:
|
||||
lcGetActiveModel()->RemoveSelectedPiecesKeyFrames();
|
||||
break;
|
||||
|
||||
case LC_PIECE_CONTROL_POINT_INSERT:
|
||||
lcGetActiveModel()->InsertControlPoint();
|
||||
break;
|
||||
|
|
|
@ -2152,6 +2152,24 @@ void lcModel::ResetSelectedPiecesPivotPoint()
|
|||
gMainWindow->UpdateAllViews();
|
||||
}
|
||||
|
||||
void lcModel::RemoveSelectedPiecesKeyFrames()
|
||||
{
|
||||
for (lcPiece* Piece : mPieces)
|
||||
if (Piece->IsSelected())
|
||||
Piece->RemoveKeyFrames();
|
||||
|
||||
for (lcCamera* Camera : mCameras)
|
||||
if (Camera->IsSelected())
|
||||
Camera->RemoveKeyFrames();
|
||||
|
||||
for (lcLight* Light : mLights)
|
||||
if (Light->IsSelected())
|
||||
Light->RemoveKeyFrames();
|
||||
|
||||
gMainWindow->UpdateAllViews();
|
||||
SaveCheckpoint(tr("Removing Key Frames"));
|
||||
}
|
||||
|
||||
void lcModel::InsertControlPoint()
|
||||
{
|
||||
lcObject* Focus = GetFocusObject();
|
||||
|
|
|
@ -190,6 +190,7 @@ public:
|
|||
void DeleteAllCameras();
|
||||
void DeleteSelectedObjects();
|
||||
void ResetSelectedPiecesPivotPoint();
|
||||
void RemoveSelectedPiecesKeyFrames();
|
||||
void InsertControlPoint();
|
||||
void RemoveFocusedControlPoint();
|
||||
void ShowSelectedPiecesEarlier();
|
||||
|
|
|
@ -524,6 +524,33 @@ void lcLight::DrawPointLight(lcContext* Context) const
|
|||
Context->DrawIndexedPrimitives(GL_TRIANGLES, NumIndices, GL_UNSIGNED_SHORT, 0);
|
||||
}
|
||||
|
||||
void lcLight::RemoveKeyFrames()
|
||||
{
|
||||
mPositionKeys.RemoveAll();
|
||||
ChangeKey(mPositionKeys, mPosition, 1, true);
|
||||
|
||||
mTargetPositionKeys.RemoveAll();
|
||||
ChangeKey(mTargetPositionKeys, mTargetPosition, 1, true);
|
||||
|
||||
mAmbientColorKeys.RemoveAll();
|
||||
ChangeKey(mAmbientColorKeys, mAmbientColor, 1, true);
|
||||
|
||||
mDiffuseColorKeys.RemoveAll();
|
||||
ChangeKey(mDiffuseColorKeys, mDiffuseColor, 1, true);
|
||||
|
||||
mSpecularColorKeys.RemoveAll();
|
||||
ChangeKey(mSpecularColorKeys, mSpecularColor, 1, true);
|
||||
|
||||
mAttenuationKeys.RemoveAll();
|
||||
ChangeKey(mAttenuationKeys, mAttenuation, 1, true);
|
||||
|
||||
mSpotCutoffKeys.RemoveAll();
|
||||
ChangeKey(mSpotCutoffKeys, mSpotCutoff, 1, true);
|
||||
|
||||
mSpotExponentKeys.RemoveAll();
|
||||
ChangeKey(mSpotExponentKeys, mSpotExponent, 1, true);
|
||||
}
|
||||
|
||||
bool lcLight::Setup(int LightIndex)
|
||||
{
|
||||
Q_UNUSED(LightIndex);
|
||||
|
|
|
@ -178,6 +178,7 @@ public:
|
|||
virtual void RayTest(lcObjectRayTest& ObjectRayTest) const override;
|
||||
virtual void BoxTest(lcObjectBoxTest& ObjectBoxTest) const override;
|
||||
virtual void DrawInterface(lcContext* Context) const override;
|
||||
virtual void RemoveKeyFrames() override;
|
||||
|
||||
void InsertTime(lcStep Start, lcStep Time);
|
||||
void RemoveTime(lcStep Start, lcStep Time);
|
||||
|
|
|
@ -95,6 +95,7 @@ public:
|
|||
virtual void RayTest(lcObjectRayTest& ObjectRayTest) const = 0;
|
||||
virtual void BoxTest(lcObjectBoxTest& ObjectBoxTest) const = 0;
|
||||
virtual void DrawInterface(lcContext* Context) const = 0;
|
||||
virtual void RemoveKeyFrames() = 0;
|
||||
virtual const char* GetName() const = 0;
|
||||
|
||||
protected:
|
||||
|
|
|
@ -637,6 +637,15 @@ void lcPiece::DrawInterface(lcContext* Context) const
|
|||
}
|
||||
}
|
||||
|
||||
void lcPiece::RemoveKeyFrames()
|
||||
{
|
||||
mPositionKeys.RemoveAll();
|
||||
ChangeKey(mPositionKeys, mModelWorld.GetTranslation(), 1, true);
|
||||
|
||||
mRotationKeys.RemoveAll();
|
||||
ChangeKey(mRotationKeys, lcMatrix33(mModelWorld), 1, true);
|
||||
}
|
||||
|
||||
void lcPiece::AddRenderMeshes(lcScene& Scene, bool DrawInterface, bool Highlight) const
|
||||
{
|
||||
bool Focused, Selected;
|
||||
|
|
|
@ -344,6 +344,7 @@ public:
|
|||
virtual void RayTest(lcObjectRayTest& ObjectRayTest) const override;
|
||||
virtual void BoxTest(lcObjectBoxTest& ObjectBoxTest) const override;
|
||||
virtual void DrawInterface(lcContext* Context) const override;
|
||||
virtual void RemoveKeyFrames() override;
|
||||
|
||||
void AddRenderMeshes(lcScene& Scene, bool DrawInterface, bool Highlight) const;
|
||||
void SubModelAddRenderMeshes(lcScene& Scene, const lcMatrix44& WorldMatrix, int DefaultColorIndex, bool Focused, bool Selected) const;
|
||||
|
|
Loading…
Reference in a new issue