merged effects into node structure

This commit is contained in:
itsmattkc
2019-04-12 21:50:52 +10:00
parent 4e4d2b1881
commit b21745f694
127 changed files with 1674 additions and 867 deletions
+11 -11
View File
@@ -29,7 +29,7 @@
#include "ui/menu.h"
#include "panels/panels.h"
EffectUI::EffectUI(Effect* e) :
EffectUI::EffectUI(Node* e) :
effect_(e),
node_parent_(nullptr)
{
@@ -38,7 +38,7 @@ EffectUI::EffectUI(Effect* e) :
QString effect_name;
// If this effect is actually a transition
if (e->meta->type == EFFECT_TYPE_TRANSITION) {
if (e->type() == EFFECT_TYPE_TRANSITION) {
Transition* t = static_cast<Transition*>(e);
@@ -70,17 +70,17 @@ EffectUI::EffectUI(Effect* e) :
// See if the transition is the clip's opening or closing transition and label it accordingly
if (both_selected) {
effect_name = t->name;
effect_name = t->name();
} else if (selected_clip->opening_transition.get() == t) {
effect_name = tr("%1 (Opening)").arg(t->name);
effect_name = tr("%1 (Opening)").arg(t->name());
} else {
effect_name = tr("%1 (Closing)").arg(t->name);
effect_name = tr("%1 (Closing)").arg(t->name());
}
} else {
// Otherwise just set the title normally
effect_name = e->name;
effect_name = e->name();
}
@@ -166,10 +166,10 @@ EffectUI::EffectUI(Effect* e) :
connect(enabled_check, SIGNAL(toggled(bool)), e, SLOT(FieldChanged()));
}
void EffectUI::AddAdditionalEffect(Effect *e)
void EffectUI::AddAdditionalEffect(Node *e)
{
// Ensure this is the same kind of effect and will be fully compatible
Q_ASSERT(e->meta == effect_->meta);
Q_ASSERT(e->id() == effect_->id());
// Add multiple modifer to header label (but only once)
if (additional_effects_.isEmpty()) {
@@ -199,7 +199,7 @@ void EffectUI::AddAdditionalEffect(Effect *e)
}
}
Effect *EffectUI::GetEffect()
Node *EffectUI::GetEffect()
{
return effect_;
}
@@ -228,7 +228,7 @@ int EffectUI::GetRowY(int row, QWidget* mapToWidget) {
void EffectUI::UpdateFromEffect()
{
Effect* effect = GetEffect();
Node* effect = GetEffect();
for (int j=0;j<effect->row_count();j++) {
@@ -327,7 +327,7 @@ void EffectUI::AttachKeyframeNavigationToRow(EffectRow *row, KeyframeNavigator *
}
void EffectUI::show_context_menu(const QPoint& pos) {
if (effect_->meta->type == EFFECT_TYPE_EFFECT) {
if (effect_->type() == EFFECT_TYPE_EFFECT) {
Menu menu;
Clip* c = effect_->parent_clip;
+7 -6
View File
@@ -22,8 +22,9 @@
#define EFFECTUI_H
#include "collapsiblewidget.h"
#include "effects/effect.h"
#include "nodes/node.h"
#include "ui/nodeui.h"
#include "ui/keyframenavigator.h"
/**
* @brief The EffectUI class
@@ -49,7 +50,7 @@ public:
*
* The Effect to make a UI of. It must be a valid object.
*/
EffectUI(Effect* e);
EffectUI(Node* e);
/**
* @brief Attach additional effects to this UI
@@ -62,7 +63,7 @@ public:
*
* The Effect to add to this UI object.
*/
void AddAdditionalEffect(Effect* e);
void AddAdditionalEffect(Node* e);
/**
* @brief Get the primary Effect that this UI object was created for
@@ -71,7 +72,7 @@ public:
*
* The Effect object passed to the constrcutor whe creating this EffectUI.
*/
Effect* GetEffect();
Node* GetEffect();
/**
* @brief Get the Y position of a given row
@@ -175,12 +176,12 @@ private:
/**
* @brief Internal reference to the Effect this object was constructed around.
*/
Effect* effect_;
Node* effect_;
/**
* @brief Internal array of additional Effect objects attached to this UI.
*/
QVector<Effect*> additional_effects_;
QVector<Node*> additional_effects_;
/**
* @brief Layout for UI widgets
+1 -1
View File
@@ -33,7 +33,7 @@
#include "ui/keyframedrawing.h"
#include "undo/undo.h"
#include "undo/undostack.h"
#include "effects/effect.h"
#include "nodes/node.h"
#include "timeline/clip.h"
#include "ui/rectangleselect.h"
#include "ui/menu.h"
+1 -1
View File
@@ -20,7 +20,7 @@
#include "keyframedrawing.h"
#include "effects/effect.h"
#include "nodes/node.h"
#include "timeline/clip.h"
#define KEYFRAME_POINT_COUNT 4
+2 -2
View File
@@ -23,7 +23,7 @@
#include <QMouseEvent>
#include <QtMath>
#include "effects/effect.h"
#include "nodes/node.h"
#include "ui/collapsiblewidget.h"
#include "panels/panels.h"
#include "timeline/clip.h"
@@ -120,7 +120,7 @@ void KeyframeView::paintEvent(QPaintEvent*) {
for (int j=0;j<open_effects_.size();j++) {
EffectUI* container = open_effects_.at(j);
Effect* e = container->GetEffect();
Node* e = container->GetEffect();
if (container->IsExpanded()) {
for (int j=0;j<e->row_count();j++) {
+1 -1
View File
@@ -27,7 +27,7 @@
#include "ui/effectui.h"
class Clip;
class Effect;
class Node;
class EffectRow;
class EffectField;
class TimelineHeader;
+1 -1
View File
@@ -157,7 +157,7 @@ QVector<QRectF> NodeUI::GetNodeSocketRects()
QVector<QRectF> rects;
if (proxy_ != nullptr) {
Effect* e = central_widget_->GetEffect();
Node* e = central_widget_->GetEffect();
for (int i=0;i<e->row_count();i++) {
+1 -1
View File
@@ -49,7 +49,7 @@ TimelineArea::TimelineArea(Timeline* timeline, olive::timeline::Alignment alignm
connect(view_, SIGNAL(requestScrollChange(int)), scrollbar_, SLOT(setValue(int)));
}
void TimelineArea::SetTrackList(Sequence *sequence, Track::Type track_list)
void TimelineArea::SetTrackList(Sequence *sequence, olive::TrackType track_list)
{
if (track_list_ != nullptr) {
disconnect(track_list_, SIGNAL(TrackCountChanged()), this, SLOT(RefreshLabels()));
+1 -1
View File
@@ -14,7 +14,7 @@ class TimelineArea : public QWidget
public:
TimelineArea(Timeline *timeline, olive::timeline::Alignment alignment = olive::timeline::kAlignmentTop);
void SetTrackList(Sequence* sequence, Track::Type track_list);
void SetTrackList(Sequence* sequence, olive::TrackType track_list);
void SetAlignment(olive::timeline::Alignment alignment);
TrackList* track_list();
+19 -19
View File
@@ -56,7 +56,7 @@
#include "ui/focusfilter.h"
#include "dialogs/clippropertiesdialog.h"
#include "global/debug.h"
#include "effects/effect.h"
#include "nodes/node.h"
#include "effects/internal/solideffect.h"
#include "timeline/track.h"
#include "global/math.h"
@@ -143,7 +143,7 @@ void TimelineView::show_context_menu(const QPoint& pos) {
bool audio_clips_are_selected = false;
for (int i=0;i<selected_clips.size();i++) {
if (selected_clips.at(i)->type() == Track::kTypeVideo) {
if (selected_clips.at(i)->type() == olive::kTypeVideo) {
video_clips_are_selected = true;
} else {
audio_clips_are_selected = true;
@@ -611,7 +611,7 @@ void TimelineView::mousePressEvent(QMouseEvent *event) {
// if the user is creating an object
if (ParentTimeline()->creating) {
Track::Type create_type = Track::kTypeVideo;
olive::TrackType create_type = olive::kTypeVideo;
switch (ParentTimeline()->creating_object) {
case olive::timeline::ADD_OBJ_TITLE:
case olive::timeline::ADD_OBJ_SOLID:
@@ -620,7 +620,7 @@ void TimelineView::mousePressEvent(QMouseEvent *event) {
case olive::timeline::ADD_OBJ_TONE:
case olive::timeline::ADD_OBJ_NOISE:
case olive::timeline::ADD_OBJ_AUDIO:
create_type = Track::kTypeAudio;
create_type = olive::kTypeAudio;
break;
}
@@ -1024,24 +1024,24 @@ void TimelineView::mouseReleaseEvent(QMouseEvent *event) {
add.append(c);
ca->append(new AddClipCommand(add));
if (c->type() == Track::kTypeVideo && olive::config.add_default_effects_to_clips) {
// default video effects (before custom effects)
c->effects.append(Effect::Create(c.get(), Effect::GetInternalMeta(EFFECT_INTERNAL_TRANSFORM, EFFECT_TYPE_EFFECT)));
if (c->type() == olive::kTypeVideo && olive::config.add_default_effects_to_clips) {
// default video effects (before custom effects)
c->effects.append(olive::node_library[kTransformEffect]->Create(c.get()));
}
switch (ParentTimeline()->creating_object) {
case olive::timeline::ADD_OBJ_TITLE:
c->set_name(tr("Title"));
c->effects.append(Effect::Create(c.get(), Effect::GetInternalMeta(EFFECT_INTERNAL_RICHTEXT, EFFECT_TYPE_EFFECT)));
c->effects.append(olive::node_library[kRichTextInput]->Create(c.get()));
break;
case olive::timeline::ADD_OBJ_SOLID:
c->set_name(tr("Solid Color"));
c->effects.append(Effect::Create(c.get(), Effect::GetInternalMeta(EFFECT_INTERNAL_SOLID, EFFECT_TYPE_EFFECT)));
c->effects.append(olive::node_library[kSolidInput]->Create(c.get()));
break;
case olive::timeline::ADD_OBJ_BARS:
{
c->set_name(tr("Bars"));
EffectPtr e = Effect::Create(c.get(), Effect::GetInternalMeta(EFFECT_INTERNAL_SOLID, EFFECT_TYPE_EFFECT));
NodePtr e = olive::node_library[kSolidInput]->Create(c.get());
// Auto-select bars
SolidEffect* solid_effect = static_cast<SolidEffect*>(e.get());
@@ -1052,20 +1052,20 @@ void TimelineView::mouseReleaseEvent(QMouseEvent *event) {
break;
case olive::timeline::ADD_OBJ_TONE:
c->set_name(tr("Tone"));
c->effects.append(Effect::Create(c.get(), Effect::GetInternalMeta(EFFECT_INTERNAL_TONE, EFFECT_TYPE_EFFECT)));
c->effects.append(olive::node_library[kToneInput]->Create(c.get()));
break;
case olive::timeline::ADD_OBJ_NOISE:
c->set_name(tr("Noise"));
c->effects.append(Effect::Create(c.get(), Effect::GetInternalMeta(EFFECT_INTERNAL_NOISE, EFFECT_TYPE_EFFECT)));
c->effects.append(olive::node_library[kNoiseInput]->Create(c.get()));
break;
default:
break;
}
if (c->type() == Track::kTypeAudio && olive::config.add_default_effects_to_clips) {
if (c->type() == olive::kTypeAudio && olive::config.add_default_effects_to_clips) {
// default audio effects (after custom effects)
c->effects.append(Effect::Create(c.get(), Effect::GetInternalMeta(EFFECT_INTERNAL_VOLUME, EFFECT_TYPE_EFFECT)));
c->effects.append(Effect::Create(c.get(), Effect::GetInternalMeta(EFFECT_INTERNAL_PAN, EFFECT_TYPE_EFFECT)));
c->effects.append(olive::node_library[kVolumeEffect]->Create(c.get()));
c->effects.append(olive::node_library[kPanEffect]->Create(c.get()));
}
push_undo = true;
@@ -1432,7 +1432,7 @@ void TimelineView::mouseReleaseEvent(QMouseEvent *event) {
ca->append(new AddTransitionCommand(nullptr,
transition->secondary_clip,
transition,
nullptr,
kInvalidNode,
0));
} else {
@@ -1447,7 +1447,7 @@ void TimelineView::mouseReleaseEvent(QMouseEvent *event) {
ca->append(new AddTransitionCommand(nullptr,
transition->secondary_clip,
transition,
nullptr,
kInvalidNode,
0));
}
@@ -2821,7 +2821,7 @@ void TimelineView::draw_transition(QPainter& p, Clip* c, const QRect& clip_rect,
if (draw_text) {
p.setPen(Qt::white);
p.drawText(transition_text_rect, 0, t->meta->name, &transition_text_rect);
p.drawText(transition_text_rect, 0, t->name(), &transition_text_rect);
}
}
p.setPen(Qt::black);
@@ -2920,7 +2920,7 @@ void TimelineView::paintEvent(QPaintEvent*) {
// draw thumbnail/waveform
long media_length = clip->media_length();
if (clip->type() == Track::kTypeVideo) {
if (clip->type() == olive::kTypeVideo) {
// draw thumbnail
int thumb_y = p.fontMetrics().height()+olive::timeline::kClipTextPadding+olive::timeline::kClipTextPadding;
if (thumb_x < width() && thumb_y < height()) {
+1
View File
@@ -63,6 +63,7 @@ extern "C" {
#include "ui/menu.h"
#include "ui/waveform.h"
#include "mainwindow.h"
#include "effects/effectgizmo.h"
const int kTitleActionSafeVertexSize = 84;
+2 -2
View File
@@ -34,7 +34,7 @@
#include "timeline/clip.h"
#include "project/footage.h"
#include "effects/effect.h"
#include "nodes/node.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();
Effect* gizmos;
Node* gizmos;
int drag_start_x;
int drag_start_y;
int gizmo_x_mvmt;