finished moving field data retrieving to row

This commit is contained in:
itsmattkc
2019-04-11 00:02:50 +10:00
parent 14ae903000
commit d3bc1d4f06
78 changed files with 1189 additions and 676 deletions
+2 -4
View File
@@ -24,14 +24,12 @@
#include <QtMath>
AudioNoiseEffect::AudioNoiseEffect(Clip* c, const EffectMeta *em) : Effect(c, em) {
EffectRow* amount_row = new EffectRow(this, tr("Amount"));
amount_val = new DoubleField(amount_row, "amount");
amount_val = new DoubleInput(this, "amount", tr("Amount"));
amount_val->SetMinimum(0);
amount_val->SetDefault(20);
amount_val->SetMaximum(100);
EffectRow* mix_row = new EffectRow(this, tr("Mix"));
mix_val = new BoolField(mix_row, "mix");
mix_val = new BoolInput(this, "mix", tr("Mix"));
mix_val->SetValueAt(0, true);
}
+2 -2
View File
@@ -34,8 +34,8 @@ public:
int channel_count,
int type) override;
DoubleField* amount_val;
BoolField* mix_val;
DoubleInput* amount_val;
BoolInput* mix_val;
};
#endif // AUDIONOISEEFFECT_H
+17 -29
View File
@@ -27,54 +27,42 @@
CornerPinEffect::CornerPinEffect(Clip* c, const EffectMeta *em) : Effect(c, em) {
SetFlags(Effect::CoordsFlag | Effect::ShaderFlag);
EffectRow* top_left = new EffectRow(this, tr("Top Left"));
top_left_x = new DoubleField(top_left, "topleftx");
top_left_y = new DoubleField(top_left, "toplefty");
top_left = new Vec2Input(this, "topleft", tr("Top Left"));
EffectRow* top_right = new EffectRow(this, tr("Top Right"));
top_right_x = new DoubleField(top_right, "toprightx");
top_right_y = new DoubleField(top_right, "toprighty");
top_right = new Vec2Input(this, "topright", tr("Top Right"));
EffectRow* bottom_left = new EffectRow(this, tr("Bottom Left"));
bottom_left_x = new DoubleField(bottom_left, "bottomleftx");
bottom_left_y = new DoubleField(bottom_left, "bottomlefty");
bottom_left = new Vec2Input(this, "bottomleft", tr("Bottom Left"));
EffectRow* bottom_right = new EffectRow(this, tr("Bottom Right"));
bottom_right_x = new DoubleField(bottom_right, "bottomrightx");
bottom_right_y = new DoubleField(bottom_right, "bottomrighty");
bottom_right = new Vec2Input(this, "bottomright", tr("Bottom Right"));
EffectRow* perspective_row = new EffectRow(this, tr("Perspective"));
perspective = new BoolField(perspective_row, "perspective");
perspective = new BoolInput(this, "perspective", tr("Perspective"));
perspective->SetValueAt(0, true);
top_left_gizmo = add_gizmo(GIZMO_TYPE_DOT);
top_left_gizmo->x_field1 = top_left_x;
top_left_gizmo->y_field1 = top_left_y;
top_left_gizmo->x_field1 = static_cast<DoubleField*>(top_left->Field(0));
top_left_gizmo->y_field1 = static_cast<DoubleField*>(top_left->Field(1));
top_right_gizmo = add_gizmo(GIZMO_TYPE_DOT);
top_right_gizmo->x_field1 = top_right_x;
top_right_gizmo->y_field1 = top_right_y;
top_right_gizmo->x_field1 = static_cast<DoubleField*>(top_right->Field(0));
top_right_gizmo->y_field1 = static_cast<DoubleField*>(top_right->Field(1));
bottom_left_gizmo = add_gizmo(GIZMO_TYPE_DOT);
bottom_left_gizmo->x_field1 = bottom_left_x;
bottom_left_gizmo->y_field1 = bottom_left_y;
bottom_left_gizmo->x_field1 = static_cast<DoubleField*>(bottom_left->Field(0));
bottom_left_gizmo->y_field1 = static_cast<DoubleField*>(bottom_left->Field(1));
bottom_right_gizmo = add_gizmo(GIZMO_TYPE_DOT);
bottom_right_gizmo->x_field1 = bottom_right_x;
bottom_right_gizmo->y_field1 = bottom_right_y;
bottom_right_gizmo->x_field1 = static_cast<DoubleField*>(bottom_right->Field(0));
bottom_right_gizmo->y_field1 = static_cast<DoubleField*>(bottom_right->Field(1));
shader_vert_path_ = "cornerpin.vert";
shader_frag_path_ = "cornerpin.frag";
}
void CornerPinEffect::process_coords(double timecode, GLTextureCoords &coords, int) {
coords.vertex_top_left += QVector3D(top_left_x->GetDoubleAt(timecode), top_left_y->GetDoubleAt(timecode), 0.0f);
coords.vertex_top_right += QVector3D(top_right_x->GetDoubleAt(timecode), top_right_y->GetDoubleAt(timecode), 0.0f);
coords.vertex_bottom_left += QVector3D(bottom_left_x->GetDoubleAt(timecode), bottom_left_y->GetDoubleAt(timecode), 0.0f);
coords.vertex_bottom_right += QVector3D(bottom_right_x->GetDoubleAt(timecode), bottom_right_y->GetDoubleAt(timecode), 0.0f);
coords.vertex_top_left += top_left->GetVector2DAt(timecode);
coords.vertex_top_right += top_right->GetVector2DAt(timecode);
coords.vertex_bottom_left += bottom_left->GetVector2DAt(timecode);
coords.vertex_bottom_right += bottom_right->GetVector2DAt(timecode);
}
void CornerPinEffect::process_shader(double timecode, GLTextureCoords &coords, int) {
+6 -9
View File
@@ -31,15 +31,12 @@ public:
void process_shader(double timecode, GLTextureCoords& coords, int iterations);
void gizmo_draw(double timecode, GLTextureCoords& coords);
private:
DoubleField* top_left_x;
DoubleField* top_left_y;
DoubleField* top_right_x;
DoubleField* top_right_y;
DoubleField* bottom_left_x;
DoubleField* bottom_left_y;
DoubleField* bottom_right_x;
DoubleField* bottom_right_y;
BoolField* perspective;
Vec2Input* top_left;
Vec2Input* top_right;
Vec2Input* bottom_left;
Vec2Input* bottom_right;
BoolInput* perspective;
EffectGizmo* top_left_gizmo;
EffectGizmo* top_right_gizmo;
+1 -2
View File
@@ -26,8 +26,7 @@ enum FillType {
};
FillLeftRightEffect::FillLeftRightEffect(Clip* c, const EffectMeta *em) : Effect(c, em) {
EffectRow* type_row = new EffectRow(this, tr("Type"));
fill_type = new ComboField(type_row, "type");
fill_type = new ComboInput(this, "type", tr("Type"));
fill_type->AddItem(tr("Fill Left with Right"), FILL_TYPE_LEFT);
fill_type->AddItem(tr("Fill Right with Left"), FILL_TYPE_RIGHT);
}
+1 -1
View File
@@ -34,7 +34,7 @@ public:
int channel_count,
int type) override;
private:
ComboField* fill_type;
ComboInput* fill_type;
};
#endif // FILLLEFTRIGHTEFFECT_H
+1 -2
View File
@@ -29,8 +29,7 @@
#include "ui/collapsiblewidget.h"
PanEffect::PanEffect(Clip* c, const EffectMeta *em) : Effect(c, em) {
EffectRow* pan_row = new EffectRow(this, tr("Pan"));
pan_val = new DoubleField(pan_row, "pan");
pan_val = new DoubleInput(this, "pan", tr("Pan"));
pan_val->SetMinimum(-100);
pan_val->SetDefault(0);
pan_val->SetMaximum(100);
+1 -1
View File
@@ -34,7 +34,7 @@ public:
int channel_count,
int type) override;
DoubleField* pan_val;
DoubleInput* pan_val;
};
#endif // PANEFFECT_H
+20 -42
View File
@@ -39,60 +39,38 @@ RichTextEffect::RichTextEffect(Clip *c, const EffectMeta *em) :
{
SetFlags(Effect::SuperimposeFlag);
EffectRow* text_row = new EffectRow(this, tr("Text"));
text_val = new StringField(text_row, "text");
text_val->SetColumnSpan(2);
text_val = new StringInput(this, "text", tr("Text"));
EffectRow* padding_row = new EffectRow(this, tr("Padding"));
padding_field = new DoubleField(padding_row, "padding");
padding_field->SetColumnSpan(2);
padding_field = new DoubleInput(this, "padding", tr("Padding"));
EffectRow* position_row = new EffectRow(this, tr("Position"));
position_x = new DoubleField(position_row, "posx");
position_y = new DoubleField(position_row, "posy");
position = new Vec2Input(this, "pos", tr("Position"));
EffectRow* vertical_align_row = new EffectRow(this, tr("Vertical Align:"));
vertical_align = new ComboField(vertical_align_row, "valign");
vertical_align = new ComboInput(this, "valign", tr("Vertical Align:"));
vertical_align->AddItem(tr("Top"), Qt::AlignTop);
vertical_align->AddItem(tr("Center"), Qt::AlignCenter);
vertical_align->AddItem(tr("Bottom"), Qt::AlignBottom);
vertical_align->SetValueAt(0, Qt::AlignCenter);
vertical_align->SetColumnSpan(2);
EffectRow* autoscroll_row = new EffectRow(this, tr("Auto-Scroll"));
autoscroll = new ComboField(autoscroll_row, "autoscroll");
autoscroll = new ComboInput(this, "autoscroll", tr("Auto-Scroll"));
autoscroll->AddItem(tr("Off"), SCROLL_OFF);
autoscroll->AddItem(tr("Up"), SCROLL_UP);
autoscroll->AddItem(tr("Down"), SCROLL_DOWN);
autoscroll->AddItem(tr("Left"), SCROLL_LEFT);
autoscroll->AddItem(tr("Right"), SCROLL_RIGHT);
autoscroll->SetColumnSpan(2);
EffectRow* shadow_row = new EffectRow(this, tr("Shadow"));
shadow_bool = new BoolField(shadow_row, "shadow");
shadow_bool->SetColumnSpan(2);
shadow_bool = new BoolInput(this, "shadow", tr("Shadow"));
EffectRow* shadow_color_row = new EffectRow(this, tr("Shadow Color"));
shadow_color = new ColorField(shadow_color_row, "shadowcolor");
shadow_color->SetColumnSpan(2);
shadow_color = new ColorInput(this, "shadowcolor", tr("Shadow Color"));
EffectRow* shadow_angle_row = new EffectRow(this, tr("Shadow Angle"));
shadow_angle = new DoubleField(shadow_angle_row, "shadowangle");
shadow_angle->SetColumnSpan(2);
shadow_angle = new DoubleInput(this, "shadowangle", tr("Shadow Angle"));
EffectRow* shadow_distance_row = new EffectRow(this, tr("Shadow Distance"));
shadow_distance = new DoubleField(shadow_distance_row, "shadowdistance");
shadow_distance->SetColumnSpan(2);
shadow_distance = new DoubleInput(this, "shadowdistance", tr("Shadow Distance"));
shadow_distance->SetMinimum(0);
EffectRow* shadow_softness_row = new EffectRow(this, tr("Shadow Softness"));
shadow_softness = new DoubleField(shadow_softness_row, "shadowsoftness");
shadow_softness->SetColumnSpan(2);
shadow_softness = new DoubleInput(this, "shadowsoftness", tr("Shadow Softness"));
shadow_softness->SetMinimum(0);
EffectRow* shadow_opacity_row = new EffectRow(this, tr("Shadow Opacity"));
shadow_opacity = new DoubleField(shadow_opacity_row, "shadowopacity");
shadow_opacity->SetColumnSpan(2);
shadow_opacity = new DoubleInput(this, "shadowopacity", tr("Shadow Opacity"));
shadow_opacity->SetMinimum(0);
shadow_opacity->SetMaximum(100);
@@ -120,8 +98,8 @@ void RichTextEffect::redraw(double timecode)
td.setHtml(text_val->GetStringAt(timecode));
td.setTextWidth(width);
int translate_x = qRound(position_x->GetDoubleAt(timecode) + padding);
int translate_y = qRound(position_y->GetDoubleAt(timecode) + padding);
QPoint translation = position->GetVector2DAt(timecode).toPoint();
translation += {padding, padding};
int doc_height = qRound(td.size().height());
@@ -138,9 +116,9 @@ void RichTextEffect::redraw(double timecode)
// If we're not auto-scrolling the vertical direction, respect the vertical alignment
if (vertical_align->GetValueAt(timecode).toInt() == Qt::AlignCenter) {
translate_y += height / 2 - doc_height / 2;
translation.setY(translation.y() + height / 2 - doc_height / 2);
} else if (vertical_align->GetValueAt(timecode).toInt() == Qt::AlignBottom) {
translate_y += height - doc_height;
translation.setY(translation.y() + height - doc_height);
}
// Check if we are autoscrolling
@@ -151,7 +129,7 @@ void RichTextEffect::redraw(double timecode)
}
int doc_width = qRound(td.size().width());
translate_x += qRound(-doc_width + (img.width() + doc_width) * scroll_progress);
translation.setX(translation.x() + qRound(-doc_width + (img.width() + doc_width) * scroll_progress));
}
} else if (auto_scroll_dir == SCROLL_UP || auto_scroll_dir == SCROLL_DOWN) {
@@ -162,13 +140,13 @@ void RichTextEffect::redraw(double timecode)
scroll_progress = 1.0 - scroll_progress;
}
translate_y += qRound(-doc_height + (img.height() + doc_height)*scroll_progress);
translation.setY(translation.y() + qRound(-doc_height + (img.height() + doc_height)*scroll_progress));
}
QRect clip_rect = img.rect();
clip_rect.translate(-translate_x, -translate_y);
p.translate(translate_x, translate_y);
clip_rect.translate(-translation);
p.translate(translation);
img.fill(Qt::transparent);
@@ -208,5 +186,5 @@ void RichTextEffect::redraw(double timecode)
bool RichTextEffect::AlwaysUpdate()
{
return autoscroll->GetValueAt(autoscroll->Now()).toInt() != SCROLL_OFF;
return autoscroll->GetValueAt(Now()).toInt() != SCROLL_OFF;
}
+11 -12
View File
@@ -31,19 +31,18 @@ public:
protected:
virtual bool AlwaysUpdate() override;
private:
StringField* text_val;
DoubleField* padding_field;
DoubleField* position_x;
DoubleField* position_y;
ComboField* vertical_align;
ComboField* autoscroll;
StringInput* text_val;
DoubleInput* padding_field;
Vec2Input* position;
ComboInput* vertical_align;
ComboInput* autoscroll;
BoolField* shadow_bool;
DoubleField* shadow_angle;
DoubleField* shadow_distance;
ColorField* shadow_color;
DoubleField* shadow_softness;
DoubleField* shadow_opacity;
BoolInput* shadow_bool;
DoubleInput* shadow_angle;
DoubleInput* shadow_distance;
ColorInput* shadow_color;
DoubleInput* shadow_softness;
DoubleInput* shadow_opacity;
};
#endif // RICHTEXTEFFECT_H
+3 -6
View File
@@ -35,18 +35,15 @@
ShakeEffect::ShakeEffect(Clip* c, const EffectMeta *em) : Effect(c, em) {
SetFlags(Effect::CoordsFlag);
EffectRow* intensity_row = new EffectRow(this, tr("Intensity"));
intensity_val = new DoubleField(intensity_row, "intensity");
intensity_val = new DoubleInput(this, "intensity", tr("Intensity"));
intensity_val->SetMinimum(0);
intensity_val->SetDefault(25);
EffectRow* rotation_row = new EffectRow(this, tr("Rotation"));
rotation_val = new DoubleField(rotation_row, "rotation");
rotation_val = new DoubleInput(this, "rotation", tr("Rotation"));
rotation_val->SetMinimum(0);
rotation_val->SetDefault(10);
EffectRow* frequency_row = new EffectRow(this, tr("Frequency"));
frequency_val = new DoubleField(frequency_row, "frequency");
frequency_val = new DoubleInput(this, "frequency", tr("Frequency"));
frequency_val->SetMinimum(0);
frequency_val->SetDefault(5);
+3 -3
View File
@@ -31,9 +31,9 @@ public:
ShakeEffect(Clip* c, const EffectMeta* em);
virtual void process_coords(double timecode, GLTextureCoords& coords, int data) override;
DoubleField* intensity_val;
DoubleField* rotation_val;
DoubleField* frequency_val;
DoubleInput* intensity_val;
DoubleInput* rotation_val;
DoubleInput* frequency_val;
private:
double random_vals[RANDOM_VAL_SIZE];
};
+4 -8
View File
@@ -40,24 +40,20 @@ SolidEffect::SolidEffect(Clip* c, const EffectMeta* em) :
SetFlags(Effect::SuperimposeFlag);
// Field for solid type
EffectRow* type_row = new EffectRow(this, tr("Type"));
solid_type = new ComboField(type_row, "type");
solid_type = new ComboInput(this, "type", tr("Type"));
solid_type->AddItem(tr("Solid Color"), SOLID_TYPE_COLOR);
solid_type->AddItem(tr("SMPTE Bars"), SOLID_TYPE_BARS);
solid_type->AddItem(tr("Checkerboard"), SOLID_TYPE_CHECKERBOARD);
EffectRow* opacity_row = new EffectRow(this, tr("Opacity"));
opacity_field = new DoubleField(opacity_row, "opacity");
opacity_field = new DoubleInput(this, "opacity", tr("Opacity"));
opacity_field->SetMinimum(0);
opacity_field->SetDefault(100);
opacity_field->SetMaximum(100);
EffectRow* solid_color_row = new EffectRow(this, tr("Color"));
solid_color_field = new ColorField(solid_color_row, "color");
solid_color_field = new ColorInput(this, "color", tr("Color"));
solid_color_field->SetValueAt(0, QColor(Qt::red));
EffectRow* checkerboard_size = new EffectRow(this, tr("Checkerboard Size"));
checkerboard_size_field = new DoubleField(checkerboard_size, "checker_size");
checkerboard_size_field = new DoubleInput(this, "checker_size", tr("Checkerboard Size"));
checkerboard_size_field->SetMinimum(1);
checkerboard_size_field->SetDefault(10);
+4 -4
View File
@@ -41,10 +41,10 @@ public:
private slots:
void ui_update(const QVariant &d);
private:
ComboField* solid_type;
ColorField* solid_color_field;
DoubleField* opacity_field;
DoubleField* checkerboard_size_field;
ComboInput* solid_type;
ColorInput* solid_color_field;
DoubleInput* opacity_field;
DoubleInput* checkerboard_size_field;
};
#endif // SOLIDEFFECT_H
+19 -52
View File
@@ -47,85 +47,52 @@ TextEffect::TextEffect(Clip* c, const EffectMeta* em) :
{
SetFlags(Effect::SuperimposeFlag);
EffectRow* text_field = new EffectRow(this, tr("Text"));
text_val = new StringField(text_field, "text", false);
text_val->SetColumnSpan(2);
text_val = new StringInput(this, "text", tr("Text"), false);
EffectRow* font_row = new EffectRow(this, tr("Font"));
set_font_combobox = new FontField(font_row, "font");
set_font_combobox->SetColumnSpan(2);
set_font_combobox = new FontInput(this, "font", tr("Font"));
EffectRow* size_row = new EffectRow(this, tr("Size"));
size_val = new DoubleField(size_row, "size");
size_val = new DoubleInput(this, "size", tr("Size"));
size_val->SetMinimum(0);
size_val->SetColumnSpan(2);
EffectRow* color_row = new EffectRow(this, tr("Color"));
set_color_button = new ColorField(color_row, "color");
set_color_button->SetColumnSpan(2);
set_color_button = new ColorInput(this, "color", tr("Color"));
EffectRow* alignment_row = new EffectRow(this, tr("Alignment"));
halign_field = new ComboField(alignment_row, "halign");
halign_field = new ComboInput(this, "halign", tr("Horizontal Alignment"));
halign_field->AddItem(tr("Left"), Qt::AlignLeft);
halign_field->AddItem(tr("Center"), Qt::AlignHCenter);
halign_field->AddItem(tr("Right"), Qt::AlignRight);
halign_field->AddItem(tr("Justify"), Qt::AlignJustify);
valign_field = new ComboField(alignment_row, "valign");
valign_field = new ComboInput(this, "valign", tr("Vertical Alignment"));
valign_field->AddItem(tr("Top"), Qt::AlignTop);
valign_field->AddItem(tr("Center"), Qt::AlignVCenter);
valign_field->AddItem(tr("Bottom"), Qt::AlignBottom);
EffectRow* word_wrap_row = new EffectRow(this, tr("Word Wrap"));
word_wrap_field = new BoolField(word_wrap_row, "wordwrap");
word_wrap_field->SetColumnSpan(2);
word_wrap_field = new BoolInput(this, "wordwrap", tr("Word Wrap"));
EffectRow* padding_row = new EffectRow(this, tr("Padding"));
padding_field = new DoubleField(padding_row, "padding");
padding_field->SetColumnSpan(2);
padding_field = new DoubleInput(this, "padding", tr("Padding"));
EffectRow* position_row = new EffectRow(this, tr("Position"));
position_x = new DoubleField(position_row, "posx");
position_y = new DoubleField(position_row, "posy");
position = new Vec2Input(this, "pos", tr("Position"));
EffectRow* outline_row = new EffectRow(this, tr("Outline"));
outline_bool = new BoolField(outline_row, "outline");
outline_bool->SetColumnSpan(2);
outline_bool = new BoolInput(this, "outline", tr("Outline"));
EffectRow* outline_color_row = new EffectRow(this, tr("Outline Color"));
outline_color = new ColorField(outline_color_row, "outlinecolor");
outline_color->SetColumnSpan(2);
outline_color = new ColorInput(this, "outlinecolor", tr("Outline Color"));
EffectRow* outline_width_row = new EffectRow(this, tr("Outline Width"));
outline_width = new DoubleField(outline_width_row, "outlinewidth");
outline_width->SetColumnSpan(2);
outline_width = new DoubleInput(this, "outlinewidth", tr("Outline Width"));
outline_width->SetMinimum(0);
EffectRow* shadow_row = new EffectRow(this, tr("Shadow"));
shadow_bool = new BoolField(shadow_row, "shadow");
shadow_bool->SetColumnSpan(2);
shadow_bool = new BoolInput(this, "shadow", tr("Shadow"));
EffectRow* shadow_color_row = new EffectRow(this, tr("Shadow Color"));
shadow_color = new ColorField(shadow_color_row, "shadowcolor");
shadow_color->SetColumnSpan(2);
shadow_color = new ColorInput(this, "shadowcolor", tr("Shadow Color"));
EffectRow* shadow_angle_row = new EffectRow(this, tr("Shadow Angle"));
shadow_angle = new DoubleField(shadow_angle_row, "shadowangle");
shadow_angle->SetColumnSpan(2);
shadow_angle = new DoubleInput(this, "shadowangle", tr("Shadow Angle"));
EffectRow* shadow_distance_row = new EffectRow(this, tr("Shadow Distance"));
shadow_distance = new DoubleField(shadow_distance_row, "shadowdistance");
shadow_distance->SetColumnSpan(2);
shadow_distance = new DoubleInput(this, "shadowdistance", tr("Shadow Distance"));
shadow_distance->SetMinimum(0);
EffectRow* shadow_softness_row = new EffectRow(this, tr("Shadow Softness"));
shadow_softness = new DoubleField(shadow_softness_row, "shadowsoftness");
shadow_softness->SetColumnSpan(2);
shadow_softness = new DoubleInput(this, "shadowsoftness", tr("Shadow Softness"));
shadow_softness->SetMinimum(0);
EffectRow* shadow_opacity_row = new EffectRow(this, tr("Shadow Opacity"));
shadow_opacity = new DoubleField(shadow_opacity_row, "shadowopacity");
shadow_opacity->SetColumnSpan(2);
shadow_opacity = new DoubleInput(this, "shadowopacity", tr("Shadow Opacity"));
shadow_opacity->SetMinimum(0);
shadow_opacity->SetMaximum(100);
@@ -252,7 +219,7 @@ void TextEffect::redraw(double timecode) {
path.addText(text_x, text_y, font, lines.at(i));
}
path.translate(position_x->GetDoubleAt(timecode) + padding, position_y->GetDoubleAt(timecode) + padding);
path.translate(position->GetVector2DAt(timecode).toPointF() + QPointF(padding, padding));
// draw software shadow
if (shadow_bool->GetBoolAt(timecode)) {
+18 -19
View File
@@ -37,27 +37,26 @@ private slots:
private:
QFont font;
StringField* text_val;
DoubleField* size_val;
ColorField* set_color_button;
FontField* set_font_combobox;
ComboField* halign_field;
ComboField* valign_field;
BoolField* word_wrap_field;
DoubleField* padding_field;
DoubleField* position_x;
DoubleField* position_y;
StringInput* text_val;
DoubleInput* size_val;
ColorInput* set_color_button;
FontInput* set_font_combobox;
ComboInput* halign_field;
ComboInput* valign_field;
BoolInput* word_wrap_field;
DoubleInput* padding_field;
Vec2Input* position;
BoolField* outline_bool;
DoubleField* outline_width;
ColorField* outline_color;
BoolInput* outline_bool;
DoubleInput* outline_width;
ColorInput* outline_color;
BoolField* shadow_bool;
DoubleField* shadow_angle;
DoubleField* shadow_distance;
ColorField* shadow_color;
DoubleField* shadow_softness;
DoubleField* shadow_opacity;
BoolInput* shadow_bool;
DoubleInput* shadow_angle;
DoubleInput* shadow_distance;
ColorInput* shadow_color;
DoubleInput* shadow_softness;
DoubleInput* shadow_opacity;
};
+12 -25
View File
@@ -47,43 +47,31 @@ TimecodeEffect::TimecodeEffect(Clip* c, const EffectMeta* em) :
{
SetFlags(Effect::SuperimposeFlag);
EffectRow* tc_row = new EffectRow(this, tr("Timecode"));
tc_select = new ComboField(tc_row, "tc_selector");
tc_select = new ComboInput(this, "tc_selector", tr("Timecode"));
tc_select->AddItem(tr("Sequence"), true);
tc_select->AddItem(tr("Media"), false);
tc_select->SetValueAt(0, true);
EffectRow* scale_row = new EffectRow(this, tr("Scale"));
scale_val = new DoubleField(scale_row, "scale");
scale_val->SetColumnSpan(2);
scale_val = new DoubleInput(this, "scale", tr("Scale"));
scale_val->SetMinimum(1);
scale_val->SetDefault(100);
scale_val->SetMaximum(1000);
EffectRow* color_row = new EffectRow(this, tr("Color"));
color_val = new ColorField(color_row, "color");
color_val->SetColumnSpan(2);
color_val = new ColorInput(this, "color", tr("Color"));
color_val->SetValueAt(0, QColor(Qt::white));
EffectRow* color_bg_row = new EffectRow(this, tr("Background Color"));
color_bg_val = new ColorField(color_bg_row, "bgcolor");
color_bg_val->SetColumnSpan(2);
color_bg_val = new ColorInput(this, "bgcolor", tr("Background Color"));
color_bg_val->SetValueAt(0, QColor(Qt::black));
EffectRow* bg_alpha_row = new EffectRow(this, tr("Background Opacity"));
bg_alpha = new DoubleField(bg_alpha_row, "bgalpha");
bg_alpha->SetColumnSpan(2);
bg_alpha = new DoubleInput(this, "bgalpha", tr("Background Opacity"));
bg_alpha->SetMinimum(0);
bg_alpha->SetDefault(50);
bg_alpha->SetMaximum(100);
EffectRow* offset_row = new EffectRow(this, tr("Offset"));
offset_x_val = new DoubleField(offset_row, "offsetx");
offset_y_val = new DoubleField(offset_row, "offsety");
offset_val = new Vec2Input(this, "offset", tr("Offset"));
offset_val->SetDefault(0);
EffectRow* prepent_text_row = new EffectRow(this, tr("Prepend"));
prepend_text = new StringField(prepent_text_row, "prepend", false);
prepend_text->SetColumnSpan(2);
prepend_text = new StringInput(this, "prepend", tr("Prepend"), false);
}
@@ -116,18 +104,17 @@ void TimecodeEffect::redraw(double timecode) {
QPainterPath path;
int text_x, text_y, rect_y, offset_x, offset_y;
int text_x, text_y, rect_y;
int text_height = fm.height();
int text_width = fm.width(display_timecode);
QColor background_color = color_bg_val->GetColorAt(timecode);
int alpha_val = qCeil(bg_alpha->GetDoubleAt(timecode)*2.55);
background_color.setAlpha(alpha_val);
offset_x = int(offset_x_val->GetDoubleAt(timecode));
offset_y = int(offset_y_val->GetDoubleAt(timecode));
QVector2D offset = offset_val->GetVector2DAt(timecode);
text_x = offset_x + (width/2) - (text_width/2);
text_y = offset_y + height - height/10;
text_x = offset.x() + (width/2) - (text_width/2);
text_y = offset.y() + height - height/10;
rect_y = text_y + fm.descent() - text_height;
path.addText(text_x, text_y, font, display_timecode);
+7 -8
View File
@@ -31,14 +31,13 @@ class TimecodeEffect : public Effect {
public:
TimecodeEffect(Clip* c, const EffectMeta *em);
virtual void redraw(double timecode) override;
DoubleField* scale_val;
ColorField* color_val;
ColorField* color_bg_val;
DoubleField* bg_alpha;
DoubleField* offset_x_val;
DoubleField* offset_y_val;
StringField* prepend_text;
ComboField* tc_select;
DoubleInput* scale_val;
ColorInput* color_val;
ColorInput* color_bg_val;
DoubleInput* bg_alpha;
Vec2Input* offset_val;
StringInput* prepend_text;
ComboInput* tc_select;
protected:
virtual bool AlwaysUpdate() override;
+4 -8
View File
@@ -28,24 +28,20 @@
#include "timeline/sequence.h"
ToneEffect::ToneEffect(Clip* c, const EffectMeta *em) : Effect(c, em), sinX(INT_MIN) {
EffectRow* type_row = new EffectRow(this, tr("Type"));
type_val = new ComboField(type_row, "type");
type_val = new ComboInput(this, "type", tr("Type"));
type_val->AddItem(tr("Sine"), TONE_TYPE_SINE);
EffectRow* frequency_row = new EffectRow(this, tr("Frequency"));
freq_val = new DoubleField(frequency_row, "frequency");
freq_val = new DoubleInput(this, "frequency", tr("Frequency"));
freq_val->SetMinimum(20);
freq_val->SetMaximum(20000);
freq_val->SetDefault(1000);
EffectRow* amount_row = new EffectRow(this, tr("Amount"));
amount_val = new DoubleField(amount_row, "amount");
amount_val = new DoubleInput(this, "amount", tr("Amount"));
amount_val->SetMinimum(0);
amount_val->SetMaximum(100);
amount_val->SetDefault(25);
EffectRow* mix_row = new EffectRow(this, tr("Mix"));
mix_val = new BoolField(mix_row, "mix");
mix_val = new BoolInput(this, "mix", tr("Mix"));
mix_val->SetValueAt(0, true);
}
+4 -4
View File
@@ -34,10 +34,10 @@ public:
int channel_count,
int type) override;
ComboField* type_val;
DoubleField* freq_val;
DoubleField* amount_val;
BoolField* mix_val;
ComboInput* type_val;
DoubleInput* freq_val;
DoubleInput* amount_val;
BoolInput* mix_val;
private:
int sinX;
};
+45 -78
View File
@@ -46,116 +46,86 @@
TransformEffect::TransformEffect(Clip* c, const EffectMeta* em) : Effect(c, em) {
SetFlags(Effect::CoordsFlag);
EffectRow* position_row = new EffectRow(this, tr("Position"));
position = new Vec2Input(this, "pos", tr("Position"));
position_x = new DoubleField(position_row, "posx"); // position X
position_y = new DoubleField(position_row, "posy"); // position Y
scale = new Vec2Input(this, "scale", tr("Scale"));
scale->SetMinimum(0);
scale->SetDefault(100);
EffectRow* scale_row = new EffectRow(this, tr("Scale"));
uniform_scale_field = new BoolInput(this, "uniformscale", tr("Uniform Scale"));
connect(uniform_scale_field, SIGNAL(Toggled(bool)), scale, SLOT(SetSingleValueMode(bool)));
uniform_scale_field->SetValueAt(0, true);
// scale X (and Y is uniform scale is selected)
scale_x = new DoubleField(scale_row, "scalex");
scale_x->SetMinimum(0);
rotation = new DoubleInput(this, "rotation", tr("Rotation"));
// scale Y (disabled if uniform scale is selected)
scale_y = new DoubleField(scale_row, "scaley");
scale_y->SetMinimum(0);
EffectRow* uniform_scale_row = new EffectRow(this, tr("Uniform Scale"));
uniform_scale_field = new BoolField(uniform_scale_row, "uniformscale"); // uniform scale option
EffectRow* rotation_row = new EffectRow(this, tr("Rotation"));
rotation = new DoubleField(rotation_row, "rotation");
EffectRow* anchor_point_row = new EffectRow(this, tr("Anchor Point"));
anchor_x_box = new DoubleField(anchor_point_row, "anchorx"); // anchor point X
anchor_y_box = new DoubleField(anchor_point_row, "anchory"); // anchor point Y
EffectRow* opacity_row = new EffectRow(this, tr("Opacity"));
anchor_point = new Vec2Input(this, "anchor", tr("Anchor Point"));
anchor_point->SetDefault(0);
// opacity
opacity = new DoubleField(opacity_row, "opacity");
opacity = new DoubleInput(this, "opacity", tr("Opacity"));
opacity->SetMinimum(0);
opacity->SetMaximum(100);
EffectRow* blend_mode_row = new EffectRow(this, tr("Blend Mode"));
// blend mode
blend_mode_box = new ComboField(blend_mode_row, "blendmode");
blend_mode_box->SetColumnSpan(2);
blend_mode_box->AddItem(tr("Normal"), -1);
opacity->SetDefault(100);
// set up gizmos
top_left_gizmo = add_gizmo(GIZMO_TYPE_DOT);
top_left_gizmo->set_cursor(Qt::SizeFDiagCursor);
top_left_gizmo->x_field1 = scale_x;
top_left_gizmo->x_field1 = static_cast<DoubleField*>(scale->Field(0));
top_center_gizmo = add_gizmo(GIZMO_TYPE_DOT);
top_center_gizmo->set_cursor(Qt::SizeVerCursor);
top_center_gizmo->y_field1 = scale_x;
top_center_gizmo->y_field1 = static_cast<DoubleField*>(scale->Field(0));
top_right_gizmo = add_gizmo(GIZMO_TYPE_DOT);
top_right_gizmo->set_cursor(Qt::SizeBDiagCursor);
top_right_gizmo->x_field1 = scale_x;
top_right_gizmo->x_field1 = static_cast<DoubleField*>(scale->Field(0));
bottom_left_gizmo = add_gizmo(GIZMO_TYPE_DOT);
bottom_left_gizmo->set_cursor(Qt::SizeBDiagCursor);
bottom_left_gizmo->x_field1 = scale_x;
bottom_left_gizmo->x_field1 = static_cast<DoubleField*>(scale->Field(0));
bottom_center_gizmo = add_gizmo(GIZMO_TYPE_DOT);
bottom_center_gizmo->set_cursor(Qt::SizeVerCursor);
bottom_center_gizmo->y_field1 = scale_x;
bottom_center_gizmo->y_field1 = static_cast<DoubleField*>(scale->Field(0));
bottom_right_gizmo = add_gizmo(GIZMO_TYPE_DOT);
bottom_right_gizmo->set_cursor(Qt::SizeFDiagCursor);
bottom_right_gizmo->x_field1 = scale_x;
bottom_right_gizmo->x_field1 = static_cast<DoubleField*>(scale->Field(0));
left_center_gizmo = add_gizmo(GIZMO_TYPE_DOT);
left_center_gizmo->set_cursor(Qt::SizeHorCursor);
left_center_gizmo->x_field1 = scale_x;
left_center_gizmo->x_field1 = static_cast<DoubleField*>(scale->Field(0));
right_center_gizmo = add_gizmo(GIZMO_TYPE_DOT);
right_center_gizmo->set_cursor(Qt::SizeHorCursor);
right_center_gizmo->x_field1 = scale_x;
right_center_gizmo->x_field1 = static_cast<DoubleField*>(scale->Field(0));
anchor_gizmo = add_gizmo(GIZMO_TYPE_TARGET);
anchor_gizmo->set_cursor(Qt::SizeAllCursor);
anchor_gizmo->x_field1 = anchor_x_box;
anchor_gizmo->y_field1 = anchor_y_box;
anchor_gizmo->x_field2 = position_x;
anchor_gizmo->y_field2 = position_y;
anchor_gizmo->x_field1 = static_cast<DoubleField*>(anchor_point->Field(0));
anchor_gizmo->y_field1 = static_cast<DoubleField*>(anchor_point->Field(1));
anchor_gizmo->x_field2 = static_cast<DoubleField*>(position->Field(0));
anchor_gizmo->y_field2 = static_cast<DoubleField*>(position->Field(1));
rotate_gizmo = add_gizmo(GIZMO_TYPE_DOT);
rotate_gizmo->color = Qt::green;
rotate_gizmo->set_cursor(Qt::SizeAllCursor);
rotate_gizmo->x_field1 = rotation;
rotate_gizmo->x_field1 = static_cast<DoubleField*>(rotation->Field(0));
rect_gizmo = add_gizmo(GIZMO_TYPE_POLY);
rect_gizmo->x_field1 = position_x;
rect_gizmo->y_field1 = position_y;
rect_gizmo->x_field1 = static_cast<DoubleField*>(position->Field(0));
rect_gizmo->y_field1 = static_cast<DoubleField*>(position->Field(1));
connect(uniform_scale_field, SIGNAL(Toggled(bool)), this, SLOT(toggle_uniform_scale(bool)));
// set defaults
uniform_scale_field->SetValueAt(0, true);
blend_mode_box->SetValueAt(0, -1);
anchor_x_box->SetDefault(0);
anchor_y_box->SetDefault(0);
opacity->SetDefault(100);
scale_x->SetDefault(100);
scale_y->SetDefault(100);
refresh();
}
void TransformEffect::refresh() {
if (parent_clip != nullptr && parent_clip->track()->sequence() != nullptr) {
position_x->SetDefault(parent_clip->track()->sequence()->width/2);
position_y->SetDefault(parent_clip->track()->sequence()->height/2);
position->SetDefault({float(parent_clip->track()->sequence()->width)*0.5f,
float(parent_clip->track()->sequence()->height)*0.5f});
double x_percent_multipler = 200.0 / parent_clip->track()->sequence()->width;
double y_percent_multipler = 200.0 / parent_clip->track()->sequence()->height;
@@ -178,7 +148,10 @@ void TransformEffect::refresh() {
}
void TransformEffect::toggle_uniform_scale(bool enabled) {
scale_y->SetEnabled(!enabled);
scale->SetSingleValueMode(enabled);
DoubleField* scale_x = static_cast<DoubleField*>(scale->Field(0));
DoubleField* scale_y = static_cast<DoubleField*>(scale->Field(1));
top_center_gizmo->y_field1 = enabled ? scale_x : scale_y;
bottom_center_gizmo->y_field1 = enabled ? scale_x : scale_y;
@@ -190,29 +163,23 @@ void TransformEffect::toggle_uniform_scale(bool enabled) {
void TransformEffect::process_coords(double timecode, GLTextureCoords& coords, int) {
// position
coords.matrix.translate(position_x->GetDoubleAt(timecode)-(parent_clip->track()->sequence()->width/2),
position_y->GetDoubleAt(timecode)-(parent_clip->track()->sequence()->height/2),
0);
coords.matrix.translate(position->GetVector2DAt(timecode)
- QVector2D(parent_clip->track()->sequence()->width*0.5f,
parent_clip->track()->sequence()->height*0.5f));
// anchor point
int anchor_x_offset = qRound(anchor_x_box->GetDoubleAt(timecode));
int anchor_y_offset = qRound(anchor_y_box->GetDoubleAt(timecode));
QVector2D anchor_val = anchor_point->GetVector2DAt(timecode);
coords.vertex_top_left -= QVector3D(anchor_x_offset, anchor_y_offset, 0.0f);
coords.vertex_top_right -= QVector3D(anchor_x_offset, anchor_y_offset, 0.0f);
coords.vertex_bottom_left -= QVector3D(anchor_x_offset, anchor_y_offset, 0.0f);
coords.vertex_bottom_right -= QVector3D(anchor_x_offset, anchor_y_offset, 0.0f);
coords.vertex_top_left -= anchor_val;
coords.vertex_top_right -= anchor_val;
coords.vertex_bottom_left -= anchor_val;
coords.vertex_bottom_right -= anchor_val;
// rotation
coords.matrix.rotate(QQuaternion::fromEulerAngles(0, 0, rotation->GetDoubleAt(timecode)));
// scale
double sx = scale_x->GetDoubleAt(timecode)*0.01;
double sy = (uniform_scale_field->GetBoolAt(timecode)) ? sx : scale_y->GetDoubleAt(timecode)*0.01;
coords.matrix.scale(sx, sy);
// blend mode
coords.blendmode = blend_mode_box->GetValueAt(timecode).toInt();
coords.matrix.scale(scale->GetVector2DAt(timecode)*0.01);
// opacity
coords.opacity *= float(opacity->GetDoubleAt(timecode)*0.01);
@@ -239,9 +206,9 @@ void TransformEffect::gizmo_draw(double, GLTextureCoords& coords) {
rotate_gizmo->world_pos[0] = QVector3D(
float_lerp(top_center_gizmo->world_pos[0].x(), bottom_center_gizmo->world_pos[0].x(), 0.5f),
float_lerp(top_center_gizmo->world_pos[0].y(), bottom_center_gizmo->world_pos[0].y(), -0.1f),
0.0f
);
float_lerp(top_center_gizmo->world_pos[0].y(), bottom_center_gizmo->world_pos[0].y(), -0.1f),
0.0f
);
rect_gizmo->world_pos[0] = coords.vertex_top_left;
rect_gizmo->world_pos[1] = coords.vertex_top_right;
+8 -10
View File
@@ -31,19 +31,17 @@ public:
virtual void process_coords(double timecode, GLTextureCoords& coords, int data) override;
virtual void gizmo_draw(double timecode, GLTextureCoords& coords) override;
public slots:
void toggle_uniform_scale(bool enabled);
private:
DoubleField* position_x;
DoubleField* position_y;
DoubleField* scale_x;
DoubleField* scale_y;
BoolField* uniform_scale_field;
DoubleField* rotation;
DoubleField* anchor_x_box;
DoubleField* anchor_y_box;
DoubleField* opacity;
ComboField* blend_mode_box;
Vec2Input* position;
Vec2Input* scale;
BoolInput* uniform_scale_field;
DoubleInput* rotation;
Vec2Input* anchor_point;
DoubleInput* opacity;
EffectGizmo* top_left_gizmo;
EffectGizmo* top_center_gizmo;
+1 -2
View File
@@ -34,9 +34,8 @@ VoidEffect::VoidEffect(Clip* c, const QString& n) : Effect(c, nullptr) {
} else {
display_name = n;
}
EffectRow* row = new EffectRow(this, tr("Missing Effect"), false, false);
new LabelField(row, display_name);
new LabelWidget(this, tr("Missing Effect"), display_name);
name = display_name;
+1 -2
View File
@@ -29,8 +29,7 @@
#include "ui/collapsiblewidget.h"
VolumeEffect::VolumeEffect(Clip* c, const EffectMeta *em) : Effect(c, em) {
EffectRow* volume_row = new EffectRow(this, tr("Volume"));
volume_val = new DoubleField(volume_row, "volume");
volume_val = new DoubleInput(this, "volume", tr("Volume"));
// set defaults
volume_val->SetDefault(1);
+1 -1
View File
@@ -34,7 +34,7 @@ public:
int channel_count,
int type) override;
DoubleField* volume_val;
DoubleInput* volume_val;
};
#endif // VOLUMEEFFECT_H
+2 -5
View File
@@ -236,13 +236,10 @@ VSTHost::VSTHost(Clip* c, const EffectMeta *em) :
{
plugin = nullptr;
EffectRow* file_row = new EffectRow(this, tr("Plugin"), true, false);
file_field = new FileField(file_row, "filename");
file_field = new FileInput(this, "filename", tr("Plugin"), true, false);
connect(file_field, SIGNAL(Changed()), this, SLOT(change_plugin()), Qt::QueuedConnection);
EffectRow* interface_row = new EffectRow(this, tr("Interface"), false, false);
show_interface_btn = new ButtonField(interface_row, tr("Show"));
show_interface_btn = new ButtonWidget(this, tr("Interface"), tr("Show"));
show_interface_btn->SetCheckable(true);
show_interface_btn->SetEnabled(false);
connect(show_interface_btn, SIGNAL(Toggled(bool)), this, SLOT(show_interface(bool)));
+2 -2
View File
@@ -65,8 +65,8 @@ private slots:
void uncheck_show_button();
void change_plugin();
private:
FileField* file_field;
ButtonField* show_interface_btn;
FileInput* file_field;
ButtonWidget* show_interface_btn;
void loadPlugin();
void freePlugin();