diff --git a/app/widget/nodeparamview/CMakeLists.txt b/app/widget/nodeparamview/CMakeLists.txt
index 393759ba4..58f5320e4 100644
--- a/app/widget/nodeparamview/CMakeLists.txt
+++ b/app/widget/nodeparamview/CMakeLists.txt
@@ -18,6 +18,8 @@ set(OLIVE_SOURCES
${OLIVE_SOURCES}
widget/nodeparamview/nodeparamview.h
widget/nodeparamview/nodeparamview.cpp
+ widget/nodeparamview/nodeparamviewarraywidget.h
+ widget/nodeparamview/nodeparamviewarraywidget.cpp
widget/nodeparamview/nodeparamviewconnectedlabel.h
widget/nodeparamview/nodeparamviewconnectedlabel.cpp
widget/nodeparamview/nodeparamviewitem.h
diff --git a/app/widget/nodeparamview/nodeparamviewarraywidget.cpp b/app/widget/nodeparamview/nodeparamviewarraywidget.cpp
new file mode 100644
index 000000000..46418bb92
--- /dev/null
+++ b/app/widget/nodeparamview/nodeparamviewarraywidget.cpp
@@ -0,0 +1,55 @@
+/***
+
+ 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 .
+
+***/
+
+#include "nodeparamviewarraywidget.h"
+
+#include
+
+OLIVE_NAMESPACE_ENTER
+
+NodeParamViewArrayWidget::NodeParamViewArrayWidget(NodeInputArray* array, QWidget* parent) :
+ QWidget(parent),
+ array_(array)
+{
+ QHBoxLayout* layout = new QHBoxLayout(this);
+
+ count_lbl_ = new QLabel();
+ layout->addWidget(count_lbl_, 1);
+
+ plus_btn_ = new QPushButton(tr("+"));
+ layout->addWidget(plus_btn_);
+
+ connect(plus_btn_, &QPushButton::clicked, this, &NodeParamViewArrayWidget::AddElement);
+ connect(array_, &NodeInputArray::SizeChanged, this, &NodeParamViewArrayWidget::UpdateCounter);
+
+ UpdateCounter();
+}
+
+void NodeParamViewArrayWidget::UpdateCounter()
+{
+ count_lbl_->setText(tr("%1 elements").arg(array_->GetSize()));
+}
+
+void NodeParamViewArrayWidget::AddElement()
+{
+ array_->Append();
+}
+
+OLIVE_NAMESPACE_EXIT
diff --git a/app/widget/nodeparamview/nodeparamviewarraywidget.h b/app/widget/nodeparamview/nodeparamviewarraywidget.h
new file mode 100644
index 000000000..e99455140
--- /dev/null
+++ b/app/widget/nodeparamview/nodeparamviewarraywidget.h
@@ -0,0 +1,54 @@
+/***
+
+ 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 .
+
+***/
+
+#ifndef NODEPARAMVIEWARRAYWIDGET_H
+#define NODEPARAMVIEWARRAYWIDGET_H
+
+#include
+#include
+#include
+
+#include "node/inputarray.h"
+
+OLIVE_NAMESPACE_ENTER
+
+class NodeParamViewArrayWidget : public QWidget
+{
+ Q_OBJECT
+public:
+ NodeParamViewArrayWidget(NodeInputArray* array, QWidget* parent = nullptr);
+
+private:
+ NodeInputArray* array_;
+
+ QLabel* count_lbl_;
+
+ QPushButton* plus_btn_;
+
+private slots:
+ void UpdateCounter();
+
+ void AddElement();
+
+};
+
+OLIVE_NAMESPACE_EXIT
+
+#endif // NODEPARAMVIEWARRAYWIDGET_H
diff --git a/app/widget/nodeparamview/nodeparamviewwidgetbridge.cpp b/app/widget/nodeparamview/nodeparamviewwidgetbridge.cpp
index aaf1fefba..963245417 100644
--- a/app/widget/nodeparamview/nodeparamviewwidgetbridge.cpp
+++ b/app/widget/nodeparamview/nodeparamviewwidgetbridge.cpp
@@ -29,6 +29,7 @@
#include "core.h"
#include "node/node.h"
+#include "nodeparamviewarraywidget.h"
#include "nodeparamviewundo.h"
#include "project/item/sequence/sequence.h"
#include "undo/undostack.h"
@@ -67,113 +68,122 @@ const QList &NodeParamViewWidgetBridge::widgets() const
void NodeParamViewWidgetBridge::CreateWidgets()
{
- // We assume the first data type is the "primary" type
- switch (input_->data_type()) {
- // None of these inputs have applicable UI widgets
- case NodeParam::kNone:
- case NodeParam::kAny:
- case NodeParam::kTexture:
- case NodeParam::kMatrix:
- case NodeParam::kRational:
- case NodeParam::kSamples:
- case NodeParam::kDecimal:
- case NodeParam::kNumber:
- case NodeParam::kString:
- case NodeParam::kBuffer:
- case NodeParam::kVector:
- break;
- case NodeParam::kInt:
- {
- IntegerSlider* slider = new IntegerSlider();
- widgets_.append(slider);
- connect(slider, &IntegerSlider::ValueChanged, this, &NodeParamViewWidgetBridge::WidgetCallback);
- break;
- }
- case NodeParam::kFloat:
- {
- CreateSliders(1);
- break;
- }
- case NodeParam::kVec2:
- {
- CreateSliders(2);
- break;
- }
- case NodeParam::kVec3:
- {
- CreateSliders(3);
- break;
- }
- case NodeParam::kVec4:
- {
- CreateSliders(4);
- break;
- }
- case NodeParam::kCombo:
- {
- QComboBox* combobox = new QComboBox();
+ if (input_->IsArray()) {
- QStringList items = input_->get_combobox_strings();
- foreach (const QString& s, items) {
- combobox->addItem(s);
+ NodeParamViewArrayWidget* w = new NodeParamViewArrayWidget(static_cast(input_));
+ widgets_.append(w);
+
+ } else {
+
+ // We assume the first data type is the "primary" type
+ switch (input_->data_type()) {
+ // None of these inputs have applicable UI widgets
+ case NodeParam::kNone:
+ case NodeParam::kAny:
+ case NodeParam::kTexture:
+ case NodeParam::kMatrix:
+ case NodeParam::kRational:
+ case NodeParam::kSamples:
+ case NodeParam::kDecimal:
+ case NodeParam::kNumber:
+ case NodeParam::kString:
+ case NodeParam::kBuffer:
+ case NodeParam::kVector:
+ break;
+ case NodeParam::kInt:
+ {
+ IntegerSlider* slider = new IntegerSlider();
+ widgets_.append(slider);
+ connect(slider, &IntegerSlider::ValueChanged, this, &NodeParamViewWidgetBridge::WidgetCallback);
+ break;
+ }
+ case NodeParam::kFloat:
+ {
+ CreateSliders(1);
+ break;
+ }
+ case NodeParam::kVec2:
+ {
+ CreateSliders(2);
+ break;
+ }
+ case NodeParam::kVec3:
+ {
+ CreateSliders(3);
+ break;
+ }
+ case NodeParam::kVec4:
+ {
+ CreateSliders(4);
+ break;
+ }
+ case NodeParam::kCombo:
+ {
+ QComboBox* combobox = new QComboBox();
+
+ QStringList items = input_->get_combobox_strings();
+ foreach (const QString& s, items) {
+ combobox->addItem(s);
+ }
+
+ widgets_.append(combobox);
+ connect(combobox, static_cast(&QComboBox::currentIndexChanged), this, &NodeParamViewWidgetBridge::WidgetCallback);
+ break;
+ }
+ case NodeParam::kFile:
+ // FIXME: File selector
+ break;
+ case NodeParam::kColor:
+ {
+ // NOTE: Very convoluted way to get back to the project's color manager
+ ColorButton* color_button = new ColorButton(static_cast(input_->parentNode()->parent())->project()->color_manager());
+ widgets_.append(color_button);
+ connect(color_button, &ColorButton::ColorChanged, this, &NodeParamViewWidgetBridge::WidgetCallback);
+ break;
+ }
+ case NodeParam::kText:
+ {
+ QLineEdit* line_edit = new QLineEdit();
+ widgets_.append(line_edit);
+ connect(line_edit, &QLineEdit::textEdited, this, &NodeParamViewWidgetBridge::WidgetCallback);
+ break;
+ }
+ case NodeParam::kBoolean:
+ {
+ QCheckBox* check_box = new QCheckBox();
+ widgets_.append(check_box);
+ connect(check_box, &QCheckBox::clicked, this, &NodeParamViewWidgetBridge::WidgetCallback);
+ break;
+ }
+ case NodeParam::kFont:
+ {
+ QFontComboBox* font_combobox = new QFontComboBox();
+ widgets_.append(font_combobox);
+ break;
+ }
+ case NodeParam::kFootage:
+ {
+ FootageComboBox* footage_combobox = new FootageComboBox();
+ footage_combobox->SetRoot(static_cast(input_->parentNode()->parent())->project()->root());
+
+ connect(footage_combobox, &FootageComboBox::FootageChanged, this, &NodeParamViewWidgetBridge::WidgetCallback);
+
+ widgets_.append(footage_combobox);
+
+ break;
+ }
}
- widgets_.append(combobox);
- connect(combobox, static_cast(&QComboBox::currentIndexChanged), this, &NodeParamViewWidgetBridge::WidgetCallback);
- break;
- }
- case NodeParam::kFile:
- // FIXME: File selector
- break;
- case NodeParam::kColor:
- {
- // NOTE: Very convoluted way to get back to the project's color manager
- ColorButton* color_button = new ColorButton(static_cast(input_->parentNode()->parent())->project()->color_manager());
- widgets_.append(color_button);
- connect(color_button, &ColorButton::ColorChanged, this, &NodeParamViewWidgetBridge::WidgetCallback);
- break;
- }
- case NodeParam::kText:
- {
- QLineEdit* line_edit = new QLineEdit();
- widgets_.append(line_edit);
- connect(line_edit, &QLineEdit::textEdited, this, &NodeParamViewWidgetBridge::WidgetCallback);
- break;
- }
- case NodeParam::kBoolean:
- {
- QCheckBox* check_box = new QCheckBox();
- widgets_.append(check_box);
- connect(check_box, &QCheckBox::clicked, this, &NodeParamViewWidgetBridge::WidgetCallback);
- break;
- }
- case NodeParam::kFont:
- {
- QFontComboBox* font_combobox = new QFontComboBox();
- widgets_.append(font_combobox);
- break;
- }
- case NodeParam::kFootage:
- {
- FootageComboBox* footage_combobox = new FootageComboBox();
- footage_combobox->SetRoot(static_cast(input_->parentNode()->parent())->project()->root());
+ // Check all properties
+ QHash::const_iterator iterator;
- connect(footage_combobox, &FootageComboBox::FootageChanged, this, &NodeParamViewWidgetBridge::WidgetCallback);
+ for (iterator=input_->properties().begin();iterator!=input_->properties().end();iterator++) {
+ PropertyChanged(iterator.key(), iterator.value());
+ }
- widgets_.append(footage_combobox);
+ UpdateWidgetValues();
- break;
}
- }
-
- // Check all properties
- QHash::const_iterator iterator;
-
- for (iterator=input_->properties().begin();iterator!=input_->properties().end();iterator++) {
- PropertyChanged(iterator.key(), iterator.value());
- }
-
- UpdateWidgetValues();
}
void NodeParamViewWidgetBridge::SetInputValue(const QVariant &value, int track)