keyframeview: implemented transforming keyframe times to and from sequence time

Since the node graph can have transform cross nodes, input keyframes may occur
at a different times requiring transforming between sequence time and media
time. This commit implements such a mechanism in all UI classes that need it.
This commit is contained in:
itsmattkc
2020-03-26 19:17:46 +11:00
parent 592171cc31
commit 3399227b3a
27 changed files with 389 additions and 144 deletions
+5
View File
@@ -18,6 +18,11 @@ void CurvePanel::SetInput(NodeInput *input)
static_cast<CurveWidget*>(GetTimeBasedWidget())->SetInput(input);
}
void CurvePanel::SetTimeTarget(Node *target)
{
static_cast<CurveWidget*>(GetTimeBasedWidget())->SetTimeTarget(target);
}
void CurvePanel::IncreaseTrackHeight()
{
CurveWidget* c = static_cast<CurveWidget*>(GetTimeBasedWidget());
+2
View File
@@ -13,6 +13,8 @@ public:
public slots:
void SetInput(NodeInput* input);
void SetTimeTarget(Node* target);
virtual void IncreaseTrackHeight() override;
virtual void DecreaseTrackHeight() override;
+23 -17
View File
@@ -26,7 +26,8 @@ PanelManager* PanelManager::instance_ = nullptr;
PanelManager::PanelManager(QObject *parent) :
QObject(parent),
locked_(false)
locked_(false),
last_focused_panel_(nullptr)
{
}
@@ -106,26 +107,31 @@ void PanelManager::FocusChanged(QWidget *old, QWidget *now)
// Use dynamic_cast to test if this object is a PanelWidget
panel_cast_test = dynamic_cast<PanelWidget*>(parent);
if (panel_cast_test != nullptr) {
// If so, bump this to the top of the focus history
if (panel_cast_test) {
int panel_index = focus_history_.indexOf(panel_cast_test);
if (last_focused_panel_ != panel_cast_test) {
// If so, bump this to the top of the focus history
int panel_index = focus_history_.indexOf(panel_cast_test);
// Force the old panel to repaint (if there is one) so it hides its border
if (!focus_history_.isEmpty()) {
focus_history_.first()->SetBorderVisible(false);
// Disable highlight border on old panel
if (!focus_history_.isEmpty()) {
focus_history_.first()->SetBorderVisible(false);
}
// Enable new border's highlight
panel_cast_test->SetBorderVisible(true);
// If it's not in the focus history, prepend it, otherwise move it
if (panel_index == -1) {
focus_history_.prepend(panel_cast_test);
} else {
focus_history_.move(panel_index, 0);
}
last_focused_panel_ = panel_cast_test;
emit FocusedPanelChanged(panel_cast_test);
}
// If it's not in the focus history, prepend it, otherwise move it
if (panel_index == -1) {
focus_history_.prepend(panel_cast_test);
} else {
focus_history_.move(panel_index, 0);
}
// Force the panel to repaint so it shows a border
panel_cast_test->SetBorderVisible(true);
break;
}
+14
View File
@@ -131,6 +131,12 @@ public slots:
*/
void SetPanelsLocked(bool locked);
signals:
/**
* @brief Signal emitted when the currently focused panel changes
*/
void FocusedPanelChanged(PanelWidget* panel);
private:
/**
* @brief History array for traversing through (see MostRecentlyFocused())
@@ -146,6 +152,14 @@ private:
* @brief PanelManager singleton instance
*/
static PanelManager* instance_;
/**
* @brief The last panel that was focused
*
* Stored to prevent emitting FocusedPanelChanged() multiple times for the same panel
*/
PanelWidget* last_focused_panel_;
};
template<class T>
+1
View File
@@ -28,6 +28,7 @@ ParamPanel::ParamPanel(QWidget* parent) :
NodeParamView* view = new NodeParamView();
connect(view, &NodeParamView::SelectedInputChanged, this, &ParamPanel::SelectedInputChanged);
connect(view, &NodeParamView::TimeTargetChanged, this, &ParamPanel::TimeTargetChanged);
SetTimeBasedWidget(view);
Retranslate();
+2
View File
@@ -36,6 +36,8 @@ public slots:
signals:
void SelectedInputChanged(NodeInput* input);
void TimeTargetChanged(Node* node);
protected:
virtual void Retranslate() override;