Files
oak-editor/app/widget/nodeparamview/nodeparamviewwidgetbridge.h
T
itsmattkc 53ae25a7cb nodes: optimize node graph changes by only updating from inputs that changed
A huge optimization that ensures only the parts of a node graph that have
changed get pushed to the renderer. For thread-safety, the node graph is
copied elsewhere so that users can make changes asynchronously and the graph
can update when its threads are ready. Up until now, if an input value changed,
every node's values would be re-copied, or worse, if a connection was changed,
the entire graph would be recopied. This has been negligible in testing since
we've been largely testing with small graphs, but for massive projects, it's
important that this be as optimized as possible.
2020-04-26 04:16:15 +10:00

80 lines
1.9 KiB
C++

/***
Olive - Non-Linear Video Editor
Copyright (C) 2019 Olive Team
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef NODEPARAMVIEWWIDGETBRIDGE_H
#define NODEPARAMVIEWWIDGETBRIDGE_H
#include <QObject>
#include "node/input.h"
#include "widget/keyframeview/timetargetobject.h"
#include "widget/slider/sliderbase.h"
OLIVE_NAMESPACE_ENTER
class NodeParamViewWidgetBridge : public QObject, public TimeTargetObject
{
Q_OBJECT
public:
NodeParamViewWidgetBridge(NodeInput* input, QObject* parent);
void SetTime(const rational& time);
const QList<QWidget*>& widgets() const;
private:
void CreateWidgets();
void SetInputValue(const QVariant& value, int track);
void SetInputValueInternal(const QVariant& value, int track, QUndoCommand* command);
void ProcessSlider(SliderBase* slider, const QVariant& value);
void CreateSliders(int count);
void UpdateWidgetValues();
rational GetCurrentTimeAsNodeTime() const;
NodeInput* input_;
QList<QWidget*> widgets_;
rational time_;
bool dragging_;
bool drag_created_keyframe_;
QVariant drag_old_value_;
NodeKeyframePtr dragging_keyframe_;
private slots:
void WidgetCallback();
void InputValueChanged(const TimeRange& range);
void PropertyChanged(const QString& key, const QVariant& value);
};
OLIVE_NAMESPACE_EXIT
#endif // NODEPARAMVIEWWIDGETBRIDGE_H