diff --git a/app/decoder/decoder.h b/app/decoder/decoder.h index 6180f0539..045280694 100644 --- a/app/decoder/decoder.h +++ b/app/decoder/decoder.h @@ -84,8 +84,6 @@ public: */ virtual bool Probe(Footage* f) = 0; - - /** * @brief Open media/allocate memory * diff --git a/app/node/input/media/media.cpp b/app/node/input/media/media.cpp index bbd9a9f48..713a8318f 100644 --- a/app/node/input/media/media.cpp +++ b/app/node/input/media/media.cpp @@ -22,6 +22,8 @@ #include +#include "project/item/footage/footage.h" + MediaInput::MediaInput() : texture_(nullptr) { @@ -63,9 +65,23 @@ void MediaInput::Process(const rational &time) { // FIXME: Use OIIO and OCIO here - // FIXME: Test code - Q_UNUSED(time) + // Get currently selected Footage + Footage* footage = ValueToPtr(footage_input_->get_value(time)); + // If no footage is selected, return nothing + if (footage == nullptr) { + texture_output_->set_value(0); + + return; + } + + // Otherwise try to get frame of footage from decoder + + // Determine which decoder to use + + // Grab frame from decoder + + // FIXME: Test code if (texture_ == nullptr) { QImage img("/home/matt/Desktop/oof.png"); diff --git a/app/widget/nodeparamview/CMakeLists.txt b/app/widget/nodeparamview/CMakeLists.txt index fa8e4a357..a9ab4577b 100644 --- a/app/widget/nodeparamview/CMakeLists.txt +++ b/app/widget/nodeparamview/CMakeLists.txt @@ -20,5 +20,7 @@ set(OLIVE_SOURCES widget/nodeparamview/nodeparamview.cpp widget/nodeparamview/nodeparamviewitem.h widget/nodeparamview/nodeparamviewitem.cpp + widget/nodeparamview/nodeparamviewwidgetbridge.h + widget/nodeparamview/nodeparamviewwidgetbridge.cpp PARENT_SCOPE ) diff --git a/app/widget/nodeparamview/nodeparamviewitem.cpp b/app/widget/nodeparamview/nodeparamviewitem.cpp index b22929b8a..1f8ccee25 100644 --- a/app/widget/nodeparamview/nodeparamviewitem.cpp +++ b/app/widget/nodeparamview/nodeparamviewitem.cpp @@ -22,18 +22,12 @@ #include #include -#include -#include + #include +#include "nodeparamviewwidgetbridge.h" #include "project/item/sequence/sequence.h" #include "ui/icons/icons.h" -#include "widget/footagecombobox/footagecombobox.h" - -// FIXME: Test code only -#include "panel/panelmanager.h" -#include "panel/project/project.h" -// End test code NodeParamViewItem::NodeParamViewItem(QWidget *parent) : QWidget(parent) @@ -123,8 +117,11 @@ void NodeParamViewItem::SetupUI() content_layout_->addWidget(param_label, row_count, 0); - // Add widgets for this parameter - QList widgets_for_param = CreateWidget(static_cast(param)); + // Create a widget/input bridge for this input + NodeParamViewWidgetBridge* bridge = new NodeParamViewWidgetBridge(this, static_cast(param)); + + // Add widgets for this parameter ot the layout + const QList& widgets_for_param = bridge->widgets(); for (int i=0;iaddWidget(widgets_for_param.at(i), row_count, i + 1); } @@ -134,72 +131,6 @@ void NodeParamViewItem::SetupUI() } } -QList NodeParamViewItem::CreateWidget(NodeInput* input) -{ - QList widgets; - - if (input->inputs().isEmpty()) { - return widgets; - } - - switch (input->inputs().first()) { - case NodeParam::kNone: - case NodeParam::kAny: - case NodeParam::kBlock: - case NodeParam::kTexture: - case NodeParam::kMatrix: - break; - case NodeParam::kInt: - // FIXME: LabelSlider in INTEGER mode - break; - case NodeParam::kFloat: - // FIXME: LabelSlider in FLOAT mode - break; - case NodeParam::kFile: - // FIXME: File selector - break; - case NodeParam::kColor: - // FIXME: Color selector - break; - case NodeParam::kString: - { - QLineEdit* line_edit = new QLineEdit(); - widgets.append(line_edit); - } - break; - case NodeParam::kBoolean: - { - QCheckBox* check_box = new QCheckBox(); - widgets.append(check_box); - } - break; - case NodeParam::kFont: - { - QFontComboBox* font_combobox = new QFontComboBox(); - widgets.append(font_combobox); - } - break; - case NodeParam::kFootage: - { - FootageComboBox* footage_combobox = new FootageComboBox(); - - // FIXME: Test code - ProjectPanel* pp = olive::panel_focus_manager->MostRecentlyFocused(); - footage_combobox->SetRoot(pp->project()->root()); - // End test code - - // Pretty hacky way of getting the root folder for this node's sequence - //const Folder* root_folder = static_cast(static_cast(input->parent()->parent())->root()); - //footage_combobox->SetRoot(root_folder); - - widgets.append(footage_combobox); - } - break; - } - - return widgets; -} - void NodeParamViewItem::SetExpanded(bool e) { expanded_ = e; diff --git a/app/widget/nodeparamview/nodeparamviewitem.h b/app/widget/nodeparamview/nodeparamviewitem.h index e2cb3f5bb..dbddf7ddf 100644 --- a/app/widget/nodeparamview/nodeparamviewitem.h +++ b/app/widget/nodeparamview/nodeparamviewitem.h @@ -53,8 +53,6 @@ protected: private: void SetupUI(); - QList CreateWidget(NodeInput *input); - bool expanded_; NodeParamViewItemTitleBar* title_bar_; diff --git a/app/widget/nodeparamview/nodeparamviewwidgetbridge.cpp b/app/widget/nodeparamview/nodeparamviewwidgetbridge.cpp new file mode 100644 index 000000000..7e710ca5f --- /dev/null +++ b/app/widget/nodeparamview/nodeparamviewwidgetbridge.cpp @@ -0,0 +1,140 @@ +#include "nodeparamviewwidgetbridge.h" + +#include +#include +#include + +#include "widget/footagecombobox/footagecombobox.h" + +// FIXME: Test code only +#include "panel/panelmanager.h" +#include "panel/project/project.h" +// End test code + +NodeParamViewWidgetBridge::NodeParamViewWidgetBridge(QObject* parent, NodeInput* input) : + QObject(parent), + input_(input) +{ + Q_ASSERT(parent != nullptr && input_ != nullptr); + + CreateWidgets(); +} + +const QList &NodeParamViewWidgetBridge::widgets() +{ + return widgets_; +} + +void NodeParamViewWidgetBridge::CreateWidgets() +{ + // Return empty list if the NodeInput has no actual input data types + if (input_->inputs().isEmpty()) { + return; + } + + // We assume the first data type is the "primary" type + switch (input_->inputs().first()) { + // None of these inputs have applicable UI widgets + case NodeParam::kNone: + case NodeParam::kAny: + case NodeParam::kBlock: + case NodeParam::kTexture: + case NodeParam::kMatrix: + break; + case NodeParam::kInt: + // FIXME: LabelSlider in INTEGER mode + break; + case NodeParam::kFloat: + // FIXME: LabelSlider in FLOAT mode + break; + case NodeParam::kFile: + // FIXME: File selector + break; + case NodeParam::kColor: + // FIXME: Color selector + break; + case NodeParam::kString: + { + QLineEdit* line_edit = new QLineEdit(); + widgets_.append(line_edit); + break; + } + case NodeParam::kBoolean: + { + QCheckBox* check_box = new QCheckBox(); + widgets_.append(check_box); + break; + } + case NodeParam::kFont: + { + QFontComboBox* font_combobox = new QFontComboBox(); + widgets_.append(font_combobox); + break; + } + case NodeParam::kFootage: + { + FootageComboBox* footage_combobox = new FootageComboBox(); + + // FIXME: Test code + // Pretty hacky way of getting the root folder for this node's sequence + ProjectPanel* pp = olive::panel_focus_manager->MostRecentlyFocused(); + footage_combobox->SetRoot(pp->project()->root()); + + // End test code + + widgets_.append(footage_combobox); + + break; + } + } +} + +void NodeParamViewWidgetBridge::WidgetCallback() +{ + switch (input_->inputs().first()) { + // None of these inputs have applicable UI widgets + case NodeParam::kNone: + case NodeParam::kAny: + case NodeParam::kBlock: + case NodeParam::kTexture: + case NodeParam::kMatrix: + break; + case NodeParam::kInt: + // FIXME: LabelSlider in INTEGER mode + break; + case NodeParam::kFloat: + // FIXME: LabelSlider in FLOAT mode + break; + case NodeParam::kFile: + // FIXME: File selector + break; + case NodeParam::kColor: + // FIXME: Color selector + break; + case NodeParam::kString: + { + // Sender is a QLineEdit + //QLineEdit* line_edit = static_cast(sender()); + break; + } + case NodeParam::kBoolean: + { + // Widget is a QCheckBox + //QCheckBox* check_box = static_cast(sender()); + break; + } + case NodeParam::kFont: + { + // Widget is a QFontComboBox + //QFontComboBox* font_combobox = static_cast(sender()); + break; + } + case NodeParam::kFootage: + { + // Widget is a FootageComboBox + //FootageComboBox* footage_combobox = static_cast(sender()); + + break; + } + } +} diff --git a/app/widget/nodeparamview/nodeparamviewwidgetbridge.h b/app/widget/nodeparamview/nodeparamviewwidgetbridge.h new file mode 100644 index 000000000..3d6365c41 --- /dev/null +++ b/app/widget/nodeparamview/nodeparamviewwidgetbridge.h @@ -0,0 +1,27 @@ +#ifndef NODEPARAMVIEWWIDGETBRIDGE_H +#define NODEPARAMVIEWWIDGETBRIDGE_H + +#include + +#include "node/input.h" + +class NodeParamViewWidgetBridge : public QObject +{ + Q_OBJECT +public: + NodeParamViewWidgetBridge(QObject* parent, NodeInput* input); + + const QList& widgets(); + +private: + NodeInput* input_; + + QList widgets_; + + void CreateWidgets(); + +private slots: + void WidgetCallback(); +}; + +#endif // NODEPARAMVIEWWIDGETBRIDGE_H