refactored some classes
This commit is contained in:
+8
-8
@@ -29,7 +29,7 @@
|
||||
#include "ui/menu.h"
|
||||
#include "panels/panels.h"
|
||||
|
||||
EffectUI::EffectUI(Node* e) :
|
||||
EffectUI::EffectUI(OldEffectNode* e) :
|
||||
effect_(e)
|
||||
{
|
||||
Q_ASSERT(e != nullptr);
|
||||
@@ -107,7 +107,7 @@ EffectUI::EffectUI(Node* e) :
|
||||
keyframe_navigators_.resize(e->row_count());
|
||||
|
||||
for (int i=0;i<e->row_count();i++) {
|
||||
EffectRow* row = e->row(i);
|
||||
NodeIO* row = e->row(i);
|
||||
|
||||
ClickableLabel* row_label = new ClickableLabel(row->name());
|
||||
connect(row_label, SIGNAL(clicked()), row, SLOT(FocusRow()));
|
||||
@@ -165,7 +165,7 @@ EffectUI::EffectUI(Node* e) :
|
||||
connect(enabled_check, SIGNAL(toggled(bool)), e, SLOT(FieldChanged()));
|
||||
}
|
||||
|
||||
void EffectUI::AddAdditionalEffect(Node *e)
|
||||
void EffectUI::AddAdditionalEffect(OldEffectNode *e)
|
||||
{
|
||||
// Ensure this is the same kind of effect and will be fully compatible
|
||||
Q_ASSERT(e->id() == effect_->id());
|
||||
@@ -183,7 +183,7 @@ void EffectUI::AddAdditionalEffect(Node *e)
|
||||
// Attach this UI's widgets to the additional effect
|
||||
for (int i=0;i<effect_->row_count();i++) {
|
||||
|
||||
EffectRow* row = effect_->row(i);
|
||||
NodeIO* row = effect_->row(i);
|
||||
|
||||
// Attach existing keyframe navigator to this effect's row
|
||||
AttachKeyframeNavigationToRow(e->row(i), keyframe_navigators_.at(i));
|
||||
@@ -198,7 +198,7 @@ void EffectUI::AddAdditionalEffect(Node *e)
|
||||
}
|
||||
}
|
||||
|
||||
Node *EffectUI::GetEffect()
|
||||
OldEffectNode *EffectUI::GetEffect()
|
||||
{
|
||||
return effect_;
|
||||
}
|
||||
@@ -227,11 +227,11 @@ int EffectUI::GetRowY(int row, QWidget* mapToWidget) {
|
||||
|
||||
void EffectUI::UpdateFromEffect()
|
||||
{
|
||||
Node* effect = GetEffect();
|
||||
OldEffectNode* effect = GetEffect();
|
||||
|
||||
for (int j=0;j<effect->row_count();j++) {
|
||||
|
||||
EffectRow* row = effect->row(j);
|
||||
NodeIO* row = effect->row(j);
|
||||
|
||||
for (int k=0;k<row->FieldCount();k++) {
|
||||
EffectField* field = row->Field(k);
|
||||
@@ -286,7 +286,7 @@ QWidget *EffectUI::Widget(int row, int field)
|
||||
return widgets_.at(row).at(field);
|
||||
}
|
||||
|
||||
void EffectUI::AttachKeyframeNavigationToRow(EffectRow *row, KeyframeNavigator *nav)
|
||||
void EffectUI::AttachKeyframeNavigationToRow(NodeIO *row, KeyframeNavigator *nav)
|
||||
{
|
||||
if (nav == nullptr) {
|
||||
return;
|
||||
|
||||
+7
-7
@@ -22,7 +22,7 @@
|
||||
#define EFFECTUI_H
|
||||
|
||||
#include "collapsiblewidget.h"
|
||||
#include "nodes/node.h"
|
||||
#include "nodes/oldeffectnode.h"
|
||||
#include "ui/nodeui.h"
|
||||
#include "ui/keyframenavigator.h"
|
||||
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
*
|
||||
* The Effect to make a UI of. It must be a valid object.
|
||||
*/
|
||||
EffectUI(Node* e);
|
||||
EffectUI(OldEffectNode* e);
|
||||
|
||||
/**
|
||||
* @brief Attach additional effects to this UI
|
||||
@@ -63,7 +63,7 @@ public:
|
||||
*
|
||||
* The Effect to add to this UI object.
|
||||
*/
|
||||
void AddAdditionalEffect(Node* e);
|
||||
void AddAdditionalEffect(OldEffectNode* e);
|
||||
|
||||
/**
|
||||
* @brief Get the primary Effect that this UI object was created for
|
||||
@@ -72,7 +72,7 @@ public:
|
||||
*
|
||||
* The Effect object passed to the constructor when creating this EffectUI.
|
||||
*/
|
||||
Node* GetEffect();
|
||||
OldEffectNode* GetEffect();
|
||||
|
||||
/**
|
||||
* @brief Get the Y position of a given row
|
||||
@@ -172,12 +172,12 @@ private:
|
||||
/**
|
||||
* @brief Internal reference to the Effect this object was constructed around.
|
||||
*/
|
||||
Node* effect_;
|
||||
OldEffectNode* effect_;
|
||||
|
||||
/**
|
||||
* @brief Internal array of additional Effect objects attached to this UI.
|
||||
*/
|
||||
QVector<Node*> additional_effects_;
|
||||
QVector<OldEffectNode*> additional_effects_;
|
||||
|
||||
/**
|
||||
* @brief Layout for UI widgets
|
||||
@@ -212,7 +212,7 @@ private:
|
||||
*
|
||||
* The KeyframeNavigator object.
|
||||
*/
|
||||
void AttachKeyframeNavigationToRow(EffectRow* row, KeyframeNavigator* nav);
|
||||
void AttachKeyframeNavigationToRow(NodeIO* row, KeyframeNavigator* nav);
|
||||
private slots:
|
||||
/**
|
||||
* @brief Slot for titlebar's right-click signal to show a context menu for extra Effect functions.
|
||||
|
||||
+2
-2
@@ -33,7 +33,7 @@
|
||||
#include "ui/keyframedrawing.h"
|
||||
#include "undo/undo.h"
|
||||
#include "undo/undostack.h"
|
||||
#include "nodes/node.h"
|
||||
#include "nodes/oldeffectnode.h"
|
||||
#include "timeline/clip.h"
|
||||
#include "ui/rectangleselect.h"
|
||||
#include "ui/menu.h"
|
||||
@@ -821,7 +821,7 @@ void GraphView::wheelEvent(QWheelEvent *event) {
|
||||
}
|
||||
}
|
||||
|
||||
void GraphView::set_row(EffectRow *r) {
|
||||
void GraphView::set_row(NodeIO *r) {
|
||||
if (row != r) {
|
||||
selected_keys.clear();
|
||||
selected_keys_fields.clear();
|
||||
|
||||
+3
-3
@@ -24,7 +24,7 @@
|
||||
#include <QWidget>
|
||||
#include <QVector>
|
||||
|
||||
#include "effects/effectrow.h"
|
||||
#include "nodes/nodeio.h"
|
||||
#include "effects/effectfields.h"
|
||||
|
||||
QColor get_curve_color(int index, int length);
|
||||
@@ -40,7 +40,7 @@ public:
|
||||
void mouseReleaseEvent(QMouseEvent *event);
|
||||
void wheelEvent(QWheelEvent *event);
|
||||
|
||||
void set_row(EffectRow* r);
|
||||
void set_row(NodeIO* r);
|
||||
|
||||
void set_selected_keyframe_type(int type);
|
||||
void set_field_visibility(int field, bool b);
|
||||
@@ -95,7 +95,7 @@ private:
|
||||
void draw_lines(QPainter &p, bool vert);
|
||||
void draw_line_text(QPainter &p, bool vert, int line_no, int line_pos, int next_line_pos);
|
||||
|
||||
EffectRow* row;
|
||||
NodeIO* row;
|
||||
|
||||
bool rect_select;
|
||||
int rect_select_x;
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
#include "keyframedrawing.h"
|
||||
|
||||
#include "nodes/node.h"
|
||||
#include "nodes/oldeffectnode.h"
|
||||
#include "timeline/clip.h"
|
||||
|
||||
#define KEYFRAME_POINT_COUNT 4
|
||||
@@ -54,7 +54,7 @@ void draw_keyframe(QPainter &p, int type, int x, int y, bool darker, int r, int
|
||||
}
|
||||
|
||||
// adjusts keyframe's internal time (in clip time) to timeline time
|
||||
long adjust_row_keyframe(EffectRow* row, long time, long visible_in) {
|
||||
long adjust_row_keyframe(NodeIO* row, long time, long visible_in) {
|
||||
return time
|
||||
- row->GetParentEffect()->parent_clip->clip_in()
|
||||
+ (row->GetParentEffect()->parent_clip->timeline_in() - visible_in);
|
||||
|
||||
@@ -26,9 +26,9 @@
|
||||
#define KEYFRAME_SIZE 6
|
||||
#define KEYFRAME_COLOR 160
|
||||
|
||||
class EffectRow;
|
||||
class NodeIO;
|
||||
|
||||
void draw_keyframe(QPainter &p, int type, int x, int y, bool darker, int r = KEYFRAME_COLOR, int g = KEYFRAME_COLOR, int b = KEYFRAME_COLOR);
|
||||
long adjust_row_keyframe(EffectRow* row, long time, long visible_in);
|
||||
long adjust_row_keyframe(NodeIO* row, long time, long visible_in);
|
||||
|
||||
#endif // KEYFRAMEDRAWING_H
|
||||
|
||||
+5
-5
@@ -23,7 +23,7 @@
|
||||
#include <QMouseEvent>
|
||||
#include <QtMath>
|
||||
|
||||
#include "nodes/node.h"
|
||||
#include "nodes/oldeffectnode.h"
|
||||
#include "ui/collapsiblewidget.h"
|
||||
#include "panels/panels.h"
|
||||
#include "timeline/clip.h"
|
||||
@@ -120,11 +120,11 @@ void KeyframeView::paintEvent(QPaintEvent*) {
|
||||
for (int j=0;j<open_effects_.size();j++) {
|
||||
|
||||
EffectUI* container = open_effects_.at(j);
|
||||
Node* e = container->GetEffect();
|
||||
OldEffectNode* e = container->GetEffect();
|
||||
|
||||
if (container->IsExpanded()) {
|
||||
for (int j=0;j<e->row_count();j++) {
|
||||
EffectRow* row = e->row(j);
|
||||
NodeIO* row = e->row(j);
|
||||
|
||||
int keyframe_y = container->GetRowY(j, this);
|
||||
|
||||
@@ -254,7 +254,7 @@ void KeyframeView::mousePressEvent(QMouseEvent *event) {
|
||||
long frame_max = getFrameFromScreenPoint(panel_effect_controls->zoom, mouse_x+KEYFRAME_SIZE);
|
||||
for (int i=0;i<rowY.size();i++) {
|
||||
if (mouse_y > rowY.at(i)-KEYFRAME_SIZE-KEYFRAME_SIZE && mouse_y < rowY.at(i)+KEYFRAME_SIZE+KEYFRAME_SIZE) {
|
||||
EffectRow* row = rows.at(i);
|
||||
NodeIO* row = rows.at(i);
|
||||
|
||||
row->FocusRow();
|
||||
|
||||
@@ -358,7 +358,7 @@ void KeyframeView::mouseMoveEvent(QMouseEvent* event) {
|
||||
|
||||
for (int i=0;i<rowY.size();i++) {
|
||||
if (rowY.at(i) >= min_row && rowY.at(i) <= max_row) {
|
||||
EffectRow* row = rows.at(i);
|
||||
NodeIO* row = rows.at(i);
|
||||
for (int k=0;k<row->FieldCount();k++) {
|
||||
EffectField* field = row->Field(k);
|
||||
for (int j=0;j<field->keyframes.size();j++) {
|
||||
|
||||
+3
-3
@@ -27,8 +27,8 @@
|
||||
#include "ui/effectui.h"
|
||||
|
||||
class Clip;
|
||||
class Node;
|
||||
class EffectRow;
|
||||
class OldEffectNode;
|
||||
class NodeIO;
|
||||
class EffectField;
|
||||
class TimelineHeader;
|
||||
|
||||
@@ -57,7 +57,7 @@ private:
|
||||
QVector<EffectField*> selected_fields;
|
||||
QVector<int> selected_keyframes;
|
||||
QVector<int> rowY;
|
||||
QVector<EffectRow*> rows;
|
||||
QVector<NodeIO*> rows;
|
||||
QVector<long> old_key_vals;
|
||||
void mousePressEvent(QMouseEvent* event);
|
||||
void mouseMoveEvent(QMouseEvent* event);
|
||||
|
||||
+14
-14
@@ -32,7 +32,7 @@ void NodeUI::AddToScene(QGraphicsScene *scene)
|
||||
scene->addItem(this);
|
||||
}
|
||||
|
||||
void NodeUI::SetNode(Node *n)
|
||||
void NodeUI::SetNode(OldEffectNode *n)
|
||||
{
|
||||
node_ = n;
|
||||
|
||||
@@ -51,7 +51,7 @@ void NodeUI::SetNode(Node *n)
|
||||
setRect(rectangle);
|
||||
}
|
||||
|
||||
Node *NodeUI::GetNode()
|
||||
OldEffectNode *NodeUI::GetNode()
|
||||
{
|
||||
return node_;
|
||||
}
|
||||
@@ -135,9 +135,9 @@ void NodeUI::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||
|
||||
// If this node is the edge's "input", then we'll drag that instead of creating a new edge
|
||||
|
||||
EffectRow* other_row = e->output();
|
||||
NodeIO* other_row = e->output();
|
||||
|
||||
Node* other_node = other_row->GetParentEffect();
|
||||
OldEffectNode* other_node = other_row->GetParentEffect();
|
||||
|
||||
int other_row_index = other_node->IndexOfRow(other_row);
|
||||
|
||||
@@ -149,7 +149,7 @@ void NodeUI::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||
drag_source_ = other_row;
|
||||
|
||||
// Disconnect the existing edge, and treat our dynamic one as an edit of that one
|
||||
EffectRow::DisconnectEdge(edges.last());
|
||||
NodeIO::DisconnectEdge(edges.last());
|
||||
|
||||
|
||||
|
||||
@@ -202,15 +202,15 @@ void NodeUI::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
||||
|
||||
// If so, see if the two rows can be connected
|
||||
|
||||
EffectRow* local_row = drag_source_;
|
||||
EffectRow* remote_row = mouse_node->GetRowFromIndex(i);
|
||||
NodeIO* local_row = drag_source_;
|
||||
NodeIO* remote_row = mouse_node->GetRowFromIndex(i);
|
||||
|
||||
// Ensure one is an input and one is an output and whether their data types are compatible
|
||||
if (local_row->IsNodeInput() != remote_row->IsNodeInput()) {
|
||||
|
||||
// Determine which row is the input and which row is the output
|
||||
EffectRow* input_row = (local_row->IsNodeInput()) ? local_row : remote_row;
|
||||
EffectRow* output_row = (local_row->IsNodeInput()) ? remote_row : local_row;
|
||||
NodeIO* input_row = (local_row->IsNodeInput()) ? local_row : remote_row;
|
||||
NodeIO* output_row = (local_row->IsNodeInput()) ? remote_row : local_row;
|
||||
|
||||
if (input_row->CanAcceptDataType(output_row->OutputDataType())) {
|
||||
// This is a valid connection
|
||||
@@ -257,7 +257,7 @@ void NodeUI::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||
event->accept();
|
||||
|
||||
if (drag_destination_ != nullptr) {
|
||||
EffectRow::ConnectEdge(drag_source_, drag_destination_);
|
||||
NodeIO::ConnectEdge(drag_source_, drag_destination_);
|
||||
}
|
||||
} else {
|
||||
QGraphicsItem::mouseReleaseEvent(event);
|
||||
@@ -269,11 +269,11 @@ QVector<QRectF> NodeUI::GetNodeSocketRects()
|
||||
QVector<QRectF> rects;
|
||||
|
||||
if (node_ != nullptr) {
|
||||
Node* e = node_;
|
||||
OldEffectNode* e = node_;
|
||||
|
||||
for (int i=0;i<e->row_count();i++) {
|
||||
|
||||
EffectRow* row = e->row(i);
|
||||
NodeIO* row = e->row(i);
|
||||
|
||||
if (row->IsNodeInput() || row->IsNodeOutput()) {
|
||||
qreal x = (row->IsNodeOutput()) ? rect().right() - kNodePlugSize : rect().x();
|
||||
@@ -290,7 +290,7 @@ QVector<QRectF> NodeUI::GetNodeSocketRects()
|
||||
return rects;
|
||||
}
|
||||
|
||||
EffectRow *NodeUI::GetRowFromIndex(int i)
|
||||
NodeIO *NodeUI::GetRowFromIndex(int i)
|
||||
{
|
||||
if (node_ != nullptr && i < node_->row_count()) {
|
||||
return node_->row(i);
|
||||
@@ -298,7 +298,7 @@ EffectRow *NodeUI::GetRowFromIndex(int i)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
NodeUI *NodeUI::FindUIFromNode(Node* n)
|
||||
NodeUI *NodeUI::FindUIFromNode(OldEffectNode* n)
|
||||
{
|
||||
QList<QGraphicsItem*> all_items = scene()->items();
|
||||
|
||||
|
||||
+9
-9
@@ -5,9 +5,9 @@
|
||||
#include <QGraphicsItem>
|
||||
|
||||
class EffectUI;
|
||||
class EffectRow;
|
||||
class NodeIO;
|
||||
class NodeEdge;
|
||||
class Node;
|
||||
class OldEffectNode;
|
||||
|
||||
class NodeUI : public QGraphicsRectItem {
|
||||
public:
|
||||
@@ -15,8 +15,8 @@ public:
|
||||
|
||||
void AddToScene(QGraphicsScene* scene);
|
||||
//void Resize(const QSize& s);
|
||||
void SetNode(Node* n);
|
||||
Node* GetNode();
|
||||
void SetNode(OldEffectNode* n);
|
||||
OldEffectNode* GetNode();
|
||||
|
||||
QVector<QRectF> GetNodeSocketRects();
|
||||
|
||||
@@ -28,16 +28,16 @@ protected:
|
||||
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
|
||||
|
||||
private:
|
||||
EffectRow *GetRowFromIndex(int i);
|
||||
NodeUI* FindUIFromNode(Node* n);
|
||||
NodeIO *GetRowFromIndex(int i);
|
||||
NodeUI* FindUIFromNode(OldEffectNode* n);
|
||||
int GetRowY(int index);
|
||||
|
||||
Node* node_;
|
||||
OldEffectNode* node_;
|
||||
|
||||
QGraphicsPathItem* drag_line_;
|
||||
QPointF drag_line_start_;
|
||||
EffectRow* drag_source_;
|
||||
EffectRow* drag_destination_;
|
||||
NodeIO* drag_source_;
|
||||
NodeIO* drag_destination_;
|
||||
QPainterPath drag_path_;
|
||||
|
||||
int clicked_socket_;
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
#include <QDebug>
|
||||
|
||||
#include "ui/menu.h"
|
||||
#include "nodes/node.h"
|
||||
#include "nodes/oldeffectnode.h"
|
||||
|
||||
NodeView::NodeView(QGraphicsScene *scene, QWidget *parent) :
|
||||
QGraphicsView(scene, parent),
|
||||
|
||||
+2
-2
@@ -56,7 +56,7 @@
|
||||
#include "ui/focusfilter.h"
|
||||
#include "dialogs/clippropertiesdialog.h"
|
||||
#include "global/debug.h"
|
||||
#include "nodes/node.h"
|
||||
#include "nodes/oldeffectnode.h"
|
||||
#include "effects/internal/solideffect.h"
|
||||
#include "timeline/track.h"
|
||||
#include "global/math.h"
|
||||
@@ -1042,7 +1042,7 @@ void TimelineView::mouseReleaseEvent(QMouseEvent *event) {
|
||||
case olive::timeline::ADD_OBJ_BARS:
|
||||
{
|
||||
c->set_name(tr("Bars"));
|
||||
NodePtr e = olive::node_library[kSolidInput]->Create(c.get());
|
||||
OldEffectNodePtr e = olive::node_library[kSolidInput]->Create(c.get());
|
||||
|
||||
// Auto-select bars
|
||||
SolidEffect* solid_effect = static_cast<SolidEffect*>(e.get());
|
||||
|
||||
+2
-2
@@ -34,7 +34,7 @@
|
||||
|
||||
#include "timeline/clip.h"
|
||||
#include "project/footage.h"
|
||||
#include "nodes/node.h"
|
||||
#include "nodes/oldeffectnode.h"
|
||||
#include "ui/viewerwindow.h"
|
||||
#include "ui/viewercontainer.h"
|
||||
#include "rendering/renderthread.h"
|
||||
@@ -84,7 +84,7 @@ private:
|
||||
bool dragging;
|
||||
void seek_from_click(int x);
|
||||
QMatrix4x4 get_matrix();
|
||||
Node* gizmos;
|
||||
OldEffectNode* gizmos;
|
||||
int drag_start_x;
|
||||
int drag_start_y;
|
||||
int gizmo_x_mvmt;
|
||||
|
||||
Reference in New Issue
Block a user