Update timeline when editing a submodel.

This commit is contained in:
Leonardo Zide 2018-05-06 18:26:17 -07:00
parent 25751889cc
commit d408d97fc1
4 changed files with 16 additions and 26 deletions

View file

@ -1182,8 +1182,8 @@ lcCommand gCommands[LC_NUM_COMMANDS] =
// LC_PIECE_VIEW_SELECTED_MODEL
{
QT_TRANSLATE_NOOP("Action", "Piece.ViewSelectedModel"),
QT_TRANSLATE_NOOP("Menu", "View Selected Model"),
QT_TRANSLATE_NOOP("Status", "View the model referenced by the selected piece"),
QT_TRANSLATE_NOOP("Menu", "Open Selected Model"),
QT_TRANSLATE_NOOP("Status", "Open the model referenced by the selected piece in a new tab"),
QT_TRANSLATE_NOOP("Shortcut", "")
},
// LC_PIECE_MOVE_SELECTION_TO_MODEL
@ -1298,13 +1298,6 @@ lcCommand gCommands[LC_NUM_COMMANDS] =
QT_TRANSLATE_NOOP("Status", "Display the properties of the current submodel"),
QT_TRANSLATE_NOOP("Shortcut", "")
},
// LC_MODEL_EDIT_FOCUS
{
QT_TRANSLATE_NOOP("Action", "Model.SwitchToFocus"),
QT_TRANSLATE_NOOP("Menu", "Switch to Submodel"),
QT_TRANSLATE_NOOP("Status", "Switch to the submodel corresponding to the piece with focus"),
QT_TRANSLATE_NOOP("Shortcut", "")
},
// LC_MODEL_LIST
{
QT_TRANSLATE_NOOP("Action", "Model.List"),

View file

@ -199,7 +199,6 @@ enum lcCommandId
LC_PIECE_SHOW_LATER,
LC_MODEL_NEW,
LC_MODEL_PROPERTIES,
LC_MODEL_EDIT_FOCUS,
LC_MODEL_LIST,
LC_MODEL_FIRST,
LC_MODEL_01 = LC_MODEL_FIRST,

View file

@ -515,10 +515,10 @@ void lcMainWindow::CreateMenus()
PieceMenu->addAction(mActions[LC_PIECE_RESET_PIVOT_POINT]);
PieceMenu->addAction(mActions[LC_PIECE_REMOVE_KEY_FRAMES]);
PieceMenu->addSeparator();
PieceMenu->addAction(mActions[LC_PIECE_EDIT_SELECTED_SUBMODEL]);
PieceMenu->addAction(mActions[LC_PIECE_VIEW_SELECTED_MODEL]);
PieceMenu->addAction(mActions[LC_PIECE_INLINE_SELECTED_MODELS]);
PieceMenu->addAction(mActions[LC_PIECE_MOVE_SELECTION_TO_MODEL]);
PieceMenu->addAction(mActions[LC_PIECE_EDIT_SELECTED_SUBMODEL]);
PieceMenu->addSeparator();
PieceMenu->addAction(mActions[LC_PIECE_GROUP]);
PieceMenu->addAction(mActions[LC_PIECE_UNGROUP]);
@ -2863,10 +2863,6 @@ void lcMainWindow::HandleCommand(lcCommandId CommandId)
lcGetActiveModel()->ShowPropertiesDialog();
break;
case LC_MODEL_EDIT_FOCUS:
SetModelFromFocus();
break;
case LC_MODEL_LIST:
lcGetActiveProject()->ShowModelListDialog();
break;

View file

@ -1,7 +1,6 @@
#include "lc_global.h"
#include "lc_timelinewidget.h"
#include "lc_model.h"
#include "project.h"
#include "piece.h"
#include "pieceinf.h"
#include "lc_mainwindow.h"
@ -32,7 +31,7 @@ void lcTimelineWidget::CustomMenuRequested(QPoint Pos)
{
QMenu* Menu = new QMenu(this);
lcObject* FocusObject = lcGetActiveModel()->GetFocusObject();
lcObject* FocusObject = gMainWindow->GetActiveModel()->GetFocusObject();
if (FocusObject && FocusObject->IsPiece())
{
@ -40,7 +39,9 @@ void lcTimelineWidget::CustomMenuRequested(QPoint Pos)
if (Piece->mPieceInfo->IsModel())
{
Menu->addAction(gMainWindow->mActions[LC_MODEL_EDIT_FOCUS]);
Menu->addAction(gMainWindow->mActions[LC_PIECE_EDIT_SELECTED_SUBMODEL]);
Menu->addAction(gMainWindow->mActions[LC_PIECE_VIEW_SELECTED_MODEL]);
Menu->addAction(gMainWindow->mActions[LC_PIECE_INLINE_SELECTED_MODELS]);
Menu->addSeparator();
}
}
@ -65,17 +66,18 @@ void lcTimelineWidget::Update(bool Clear, bool UpdateItems)
if (mIgnoreUpdates)
return;
lcModel* Model = lcGetActiveModel();
lcModel* Model = gMainWindow->GetActiveModel();
bool Blocked = blockSignals(true);
if (!Model)
{
mItems.clear();
clear();
blockSignals(Blocked);
return;
}
bool Blocked = blockSignals(true);
if (Clear)
{
mItems.clear();
@ -275,7 +277,7 @@ void lcTimelineWidget::InsertStep()
if (Step == -1)
return;
lcGetActiveModel()->InsertStep(Step + 1);
gMainWindow->GetActiveModel()->InsertStep(Step + 1);
}
void lcTimelineWidget::RemoveStep()
@ -293,7 +295,7 @@ void lcTimelineWidget::RemoveStep()
if (Step == -1)
return;
lcGetActiveModel()->RemoveStep(Step + 1);
gMainWindow->GetActiveModel()->RemoveStep(Step + 1);
}
void lcTimelineWidget::MoveSelection()
@ -342,7 +344,7 @@ void lcTimelineWidget::SetCurrentStep()
if (Step == -1)
return;
lcGetActiveModel()->SetCurrentStep(Step + 1);
gMainWindow->GetActiveModel()->SetCurrentStep(Step + 1);
}
void lcTimelineWidget::ItemSelectionChanged()
@ -368,7 +370,7 @@ void lcTimelineWidget::ItemSelectionChanged()
bool Blocked = blockSignals(true);
mIgnoreUpdates = true;
lcModel* Model = lcGetActiveModel();
lcModel* Model = gMainWindow->GetActiveModel();
if (LastStep > Model->GetCurrentStep())
Model->SetCurrentStep(LastStep);
Model->SetSelectionAndFocus(Selection, CurrentPiece, LC_PIECE_SECTION_POSITION, false);
@ -416,6 +418,6 @@ void lcTimelineWidget::UpdateModel()
}
mIgnoreUpdates = true;
lcGetActiveModel()->SetPieceSteps(PieceSteps);
gMainWindow->GetActiveModel()->SetPieceSteps(PieceSteps);
mIgnoreUpdates = false;
}