developed beginnings of media node
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
add_subdirectory(block)
|
||||
add_subdirectory(generator)
|
||||
add_subdirectory(input)
|
||||
add_subdirectory(output)
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
#add_subdirectory(image)
|
||||
|
||||
set(OLIVE_SOURCES
|
||||
${OLIVE_SOURCES}
|
||||
node/block/block.h
|
||||
node/block/block.cpp
|
||||
PARENT_SCOPE
|
||||
)
|
||||
@@ -0,0 +1,11 @@
|
||||
#include "block.h"
|
||||
|
||||
Block::Block()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QString Block::Category()
|
||||
{
|
||||
return tr("Block");
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
#ifndef BLOCK_H
|
||||
#define BLOCK_H
|
||||
|
||||
#include "node/node.h"
|
||||
|
||||
class Block : public Node
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Block();
|
||||
|
||||
virtual QString Category() override;
|
||||
|
||||
public slots:
|
||||
// virtual void Process(const rational &time) override;
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif // BLOCK_H
|
||||
@@ -14,7 +14,7 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
add_subdirectory(image)
|
||||
add_subdirectory(media)
|
||||
|
||||
set(OLIVE_SOURCES
|
||||
${OLIVE_SOURCES}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
set(OLIVE_SOURCES
|
||||
${OLIVE_SOURCES}
|
||||
node/input/image/image.h
|
||||
node/input/image/image.cpp
|
||||
node/input/media/media.h
|
||||
node/input/media/media.cpp
|
||||
PARENT_SCOPE
|
||||
)
|
||||
@@ -1,39 +1,43 @@
|
||||
#include "image.h"
|
||||
#include "media.h"
|
||||
|
||||
ImageInput::ImageInput() :
|
||||
MediaInput::MediaInput() :
|
||||
texture_(nullptr)
|
||||
{
|
||||
footage_input_ = new NodeInput();
|
||||
footage_input_->add_data_input(NodeInput::kFootage);
|
||||
AddParameter(footage_input_);
|
||||
|
||||
texture_output_ = new NodeOutput();
|
||||
texture_output_->set_data_type(NodeOutput::kTexture);
|
||||
AddParameter(texture_output_);
|
||||
}
|
||||
|
||||
QString ImageInput::Name()
|
||||
QString MediaInput::Name()
|
||||
{
|
||||
return tr("Image");
|
||||
return tr("Media");
|
||||
}
|
||||
|
||||
QString ImageInput::id()
|
||||
QString MediaInput::id()
|
||||
{
|
||||
return "org.olivevideoeditor.Olive.imageinput";
|
||||
return "org.olivevideoeditor.Olive.mediainput";
|
||||
}
|
||||
|
||||
QString ImageInput::Category()
|
||||
QString MediaInput::Category()
|
||||
{
|
||||
return tr("Input");
|
||||
}
|
||||
|
||||
QString ImageInput::Description()
|
||||
QString MediaInput::Description()
|
||||
{
|
||||
return tr("Import an image file.");
|
||||
return tr("Import a footage stream.");
|
||||
}
|
||||
|
||||
NodeOutput *ImageInput::texture_output()
|
||||
NodeOutput *MediaInput::texture_output()
|
||||
{
|
||||
return texture_output_;
|
||||
}
|
||||
|
||||
void ImageInput::Process(const rational &time)
|
||||
void MediaInput::Process(const rational &time)
|
||||
{
|
||||
// FIXME: Use OIIO and OCIO here
|
||||
|
||||
@@ -11,11 +11,11 @@
|
||||
* FIXME: This will likely be replaced by the Media node as the Media node will be set up to pull from various decoders
|
||||
* from the beginning.
|
||||
*/
|
||||
class ImageInput : public Node
|
||||
class MediaInput : public Node
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ImageInput();
|
||||
MediaInput();
|
||||
|
||||
virtual QString Name() override;
|
||||
virtual QString id() override;
|
||||
@@ -28,6 +28,8 @@ public slots:
|
||||
virtual void Process(const rational &time) override;
|
||||
|
||||
private:
|
||||
NodeInput* footage_input_;
|
||||
|
||||
NodeOutput* texture_output_;
|
||||
|
||||
QOpenGLTexture* texture_;
|
||||
@@ -183,6 +183,7 @@ QString NodeParam::GetDefaultDataTypeName(const DataType& type)
|
||||
case kTexture: return tr("Texture");
|
||||
case kMatrix: return tr("Matrix");
|
||||
case kBlock: return tr("Block");
|
||||
case kFootage: return tr("Footage");
|
||||
case kAny: return tr("Any");
|
||||
}
|
||||
|
||||
|
||||
@@ -65,6 +65,7 @@ public:
|
||||
kTexture,
|
||||
kMatrix,
|
||||
kBlock,
|
||||
kFootage,
|
||||
kAny
|
||||
};
|
||||
|
||||
|
||||
@@ -60,12 +60,12 @@ void Item::remove_child(Item *c)
|
||||
c->parent_ = nullptr;
|
||||
}
|
||||
|
||||
int Item::child_count()
|
||||
int Item::child_count() const
|
||||
{
|
||||
return children_.size();
|
||||
}
|
||||
|
||||
Item *Item::child(int i)
|
||||
Item *Item::child(int i) const
|
||||
{
|
||||
return children_.at(i).get();
|
||||
}
|
||||
@@ -116,6 +116,17 @@ Item *Item::parent() const
|
||||
return parent_;
|
||||
}
|
||||
|
||||
const Item *Item::root() const
|
||||
{
|
||||
const Item* item = this;
|
||||
|
||||
while (item->parent() != nullptr) {
|
||||
item = item->parent();
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
bool Item::CanHaveChildren() const
|
||||
{
|
||||
return false;
|
||||
|
||||
@@ -79,8 +79,8 @@ public:
|
||||
|
||||
void add_child(ItemPtr c);
|
||||
void remove_child(Item* c);
|
||||
int child_count();
|
||||
Item* child(int i);
|
||||
int child_count() const;
|
||||
Item* child(int i) const;
|
||||
|
||||
ItemPtr shared_ptr_from_raw(Item* item);
|
||||
|
||||
@@ -94,6 +94,7 @@ public:
|
||||
void set_icon(const QIcon& icon);
|
||||
|
||||
Item *parent() const;
|
||||
const Item* root() const;
|
||||
|
||||
virtual bool CanHaveChildren() const;
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ a {
|
||||
}
|
||||
|
||||
/* All of these widgets' backgrounds are dark */
|
||||
QTreeView, QListView, QLineEdit, QMenu, QProgressBar, QPushButton::checked, NodeView {
|
||||
QTreeView, QListView, QLineEdit, QMenu, QProgressBar, QPushButton::checked, NodeView, QComboBox {
|
||||
/* Dark */
|
||||
background: #191919;
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ a {
|
||||
}
|
||||
|
||||
/* All of these widgets' backgrounds are dark */
|
||||
QTreeView, QListView, QLineEdit, QMenu, QProgressBar, QPushButton::checked, NodeView {
|
||||
QTreeView, QListView, QLineEdit, QMenu, QProgressBar, QPushButton::checked, NodeView, QCheckBox {
|
||||
/* Dark */
|
||||
background: #ffffff;
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
add_subdirectory(flowlayout)
|
||||
add_subdirectory(footagecombobox)
|
||||
add_subdirectory(menu)
|
||||
add_subdirectory(nodeview)
|
||||
add_subdirectory(nodeparamview)
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
set(OLIVE_SOURCES
|
||||
${OLIVE_SOURCES}
|
||||
widget/footagecombobox/footagecombobox.h
|
||||
widget/footagecombobox/footagecombobox.cpp
|
||||
PARENT_SCOPE
|
||||
)
|
||||
@@ -0,0 +1,59 @@
|
||||
#include "footagecombobox.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QMenu>
|
||||
|
||||
FootageComboBox::FootageComboBox(QWidget *parent) :
|
||||
QComboBox(parent),
|
||||
root_(nullptr)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void FootageComboBox::showPopup()
|
||||
{
|
||||
if (root_ == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
QMenu menu;
|
||||
|
||||
menu.setMinimumWidth(width());
|
||||
|
||||
TraverseFolder(root_, &menu);
|
||||
|
||||
QAction* selected = menu.exec(parentWidget()->mapToGlobal(pos()));
|
||||
|
||||
if (selected != nullptr) {
|
||||
clear();
|
||||
|
||||
addItem(selected->text());
|
||||
|
||||
emit FootageChanged(reinterpret_cast<Footage*>(selected->data().value<quintptr>()));
|
||||
}
|
||||
}
|
||||
|
||||
void FootageComboBox::SetRoot(const Folder *p)
|
||||
{
|
||||
root_ = p;
|
||||
|
||||
clear();
|
||||
}
|
||||
|
||||
void FootageComboBox::TraverseFolder(const Folder *f, QMenu *m)
|
||||
{
|
||||
for (int i=0;i<f->child_count();i++) {
|
||||
Item* child = f->child(i);
|
||||
|
||||
if (child->type() == Item::kFolder) {
|
||||
|
||||
TraverseFolder(static_cast<Folder*>(child), m->addMenu(child->name()));
|
||||
|
||||
} else if (child->type() == Item::kFootage) {
|
||||
|
||||
QAction* footage_action = m->addAction(child->name());
|
||||
footage_action->setData(reinterpret_cast<quintptr>(child));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
#ifndef FOOTAGECOMBOBOX_H
|
||||
#define FOOTAGECOMBOBOX_H
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QMenu>
|
||||
|
||||
#include "project/item/footage/footage.h"
|
||||
#include "project/project.h"
|
||||
|
||||
class FootageComboBox : public QComboBox
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
FootageComboBox(QWidget* parent = nullptr);
|
||||
|
||||
virtual void showPopup() override;
|
||||
|
||||
void SetRoot(const Folder *p);
|
||||
|
||||
signals:
|
||||
void FootageChanged(Footage* f);
|
||||
|
||||
private:
|
||||
void TraverseFolder(const Folder *f, QMenu* m);
|
||||
|
||||
const Folder* root_;
|
||||
};
|
||||
|
||||
#endif // FOOTAGECOMBOBOX_H
|
||||
@@ -20,10 +20,20 @@
|
||||
|
||||
#include "nodeparamviewitem.h"
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QDebug>
|
||||
#include <QFontComboBox>
|
||||
#include <QLineEdit>
|
||||
#include <QPainter>
|
||||
|
||||
#include "project/item/sequence/sequence.h"
|
||||
#include "ui/icons/icons.h"
|
||||
#include "widget/footagecombobox/footagecombobox.h"
|
||||
|
||||
// FIXME: Test code only
|
||||
#include "panel/panelfocusmanager.h"
|
||||
#include "panel/project/project.h"
|
||||
// End test code
|
||||
|
||||
NodeParamViewItem::NodeParamViewItem(QWidget *parent) :
|
||||
QWidget(parent)
|
||||
@@ -107,15 +117,90 @@ void NodeParamViewItem::SetupUI()
|
||||
|
||||
// This widget only needs to show input parameters
|
||||
if (param->type() == NodeParam::kInput) {
|
||||
|
||||
// Add descriptor label
|
||||
QLabel* param_label = new QLabel(tr("%1:").arg(param->name()));
|
||||
|
||||
content_layout_->addWidget(param_label, row_count, 0);
|
||||
|
||||
// Add widgets for this parameter
|
||||
QList<QWidget*> widgets_for_param = CreateWidget(static_cast<NodeInput*>(param));
|
||||
for (int i=0;i<widgets_for_param.size();i++) {
|
||||
content_layout_->addWidget(widgets_for_param.at(i), row_count, i + 1);
|
||||
}
|
||||
|
||||
row_count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QList<QWidget*> NodeParamViewItem::CreateWidget(NodeInput* input)
|
||||
{
|
||||
QList<QWidget*> 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<ProjectPanel>();
|
||||
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<const Folder*>(static_cast<Sequence*>(input->parent()->parent())->root());
|
||||
//footage_combobox->SetRoot(root_folder);
|
||||
|
||||
widgets.append(footage_combobox);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return widgets;
|
||||
}
|
||||
|
||||
void NodeParamViewItem::SetExpanded(bool e)
|
||||
{
|
||||
expanded_ = e;
|
||||
|
||||
@@ -53,6 +53,8 @@ protected:
|
||||
private:
|
||||
void SetupUI();
|
||||
|
||||
QList<QWidget*> CreateWidget(NodeInput *input);
|
||||
|
||||
bool expanded_;
|
||||
|
||||
NodeParamViewItemTitleBar* title_bar_;
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#include "mainmenu.h"
|
||||
|
||||
// FIXME: Test code
|
||||
#include "node/input/image/image.h"
|
||||
#include "node/input/media/media.h"
|
||||
#include "node/output/viewer/viewer.h"
|
||||
#include "node/generator/solid/solid.h"
|
||||
// End test code
|
||||
@@ -96,7 +96,7 @@ void olive::MainWindow::ProjectOpen(Project* p)
|
||||
SolidGenerator* sg = new SolidGenerator();
|
||||
NodeInput::ConnectEdge(sg->texture_output(), vo->texture_input());
|
||||
graph->AddNode(sg);
|
||||
ImageInput* ii = new ImageInput();
|
||||
MediaInput* ii = new MediaInput();
|
||||
graph->AddNode(ii);
|
||||
node_panel->SetGraph(graph);
|
||||
// End test code
|
||||
|
||||
Reference in New Issue
Block a user