Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the possibility to create custom GLSL filters and use them as nodes. #1839

Open
wants to merge 102 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
b67a6b9
Added the possibility to create cutom GLSL filters and use as nodes.
AngeloFrancabandiera Jan 21, 2022
fc687d5
Merge branch 'olive-editor:master' into master
AngeloFrancabandiera Jan 23, 2022
d1276f6
Merge branch 'olive-editor:master' into master
AngeloFrancabandiera Jan 25, 2022
1947e4f
Work in Progress. The shader filter has been implemented as described in
AngeloFrancabandiera Jan 26, 2022
134af69
Merge branch 'olive-editor:master' into master
AngeloFrancabandiera Jan 27, 2022
269e70a
Merge branch 'master' of https://github.com/AngeloFrancabandiera/olive
AngeloFrancabandiera Jan 27, 2022
2e42c88
Work in progress. Parsing of shader node implemented.
AngeloFrancabandiera Jan 27, 2022
6050436
Work in progress: added synch for added/removed inputs with Node
AngeloFrancabandiera Jan 30, 2022
8a50b28
Merge branch 'olive-editor:master' into master
AngeloFrancabandiera Jan 30, 2022
5cc74f1
Merge branch 'master' of https://github.com/AngeloFrancabandiera/olive
AngeloFrancabandiera Jan 30, 2022
7d7f3cd
Work in progress. Keyframe support added for dynamically created inputs.
AngeloFrancabandiera Jan 31, 2022
f5fa5d1
Work in progress. Added a shader text editor.
AngeloFrancabandiera Feb 1, 2022
3ef77f0
Merge branch 'olive-editor:master' into master
AngeloFrancabandiera Feb 3, 2022
8df0e1b
Work inprogress. Fixed an issue with method 'InputValueChangedEvent'
AngeloFrancabandiera Feb 4, 2022
b6104ca
Merge branch 'olive-editor:master' into master
AngeloFrancabandiera Feb 4, 2022
fd7d22c
Merge branch 'master' of https://github.com/AngeloFrancabandiera/olive
AngeloFrancabandiera Feb 4, 2022
75827d8
Work in progress. Added option page for editors. Options for internal
AngeloFrancabandiera Feb 5, 2022
7449650
Work in progress. Added external editor support. (Only tested on Linux)
AngeloFrancabandiera Feb 5, 2022
66d615c
Work in progress. Improved internal editor and error reporting
AngeloFrancabandiera Feb 9, 2022
de6502e
Basic functionality discussed in PR 1839 complete, including external
AngeloFrancabandiera Feb 10, 2022
658e0fa
Added input selected with combo box
AngeloFrancabandiera Feb 14, 2022
b015f8a
Fixed an issue with search bar in code editor
AngeloFrancabandiera Feb 19, 2022
b0f729d
Merge branch 'olive-editor:master' into master
AngeloFrancabandiera Feb 19, 2022
ece71f1
Merge branch 'olive-editor:master' into master
AngeloFrancabandiera Mar 11, 2022
1b93615
minor feature added: matching brackets highlight and configurable window
AngeloFrancabandiera Mar 14, 2022
fd9f2be
Added input kind POINT, to define one or more points in the shader
AngeloFrancabandiera Mar 20, 2022
4fd74db
Merge branch 'olive-editor:master' into master
AngeloFrancabandiera Mar 20, 2022
88256fd
Merge branch 'olive-editor:master' into master
AngeloFrancabandiera Mar 21, 2022
c5b2d7a
changed syntax highlight for openGL 3.2
AngeloFrancabandiera Mar 23, 2022
adf1d8e
Merge branch 'master' into master
AngeloFrancabandiera Mar 28, 2022
29314fb
Merge branch 'olive-editor:master' into master
AngeloFrancabandiera Mar 30, 2022
79ba091
Merge branch 'olive-editor:master' into master
AngeloFrancabandiera Apr 1, 2022
8fd73a9
Aligned to OpenGL 3.2
AngeloFrancabandiera Apr 1, 2022
37a5b4e
Merge branch 'master' into master
AngeloFrancabandiera Apr 10, 2022
0bd150d
Merge branch 'olive-editor:master' into master
AngeloFrancabandiera Apr 12, 2022
8f87eaf
Merge branch 'olive-editor:master' into master
AngeloFrancabandiera Apr 14, 2022
db08e7f
Merge branch 'olive-editor:master' into master
AngeloFrancabandiera Apr 18, 2022
8ccba8a
Minor changes to GLSL syntax highlighter and default script template
AngeloFrancabandiera Apr 18, 2022
eabd369
Minor changes: "find whole word" works with underscore; a pair of GLS…
AngeloFrancabandiera Apr 23, 2022
bd1b1f7
Merge branch 'olive-editor:master' into master
AngeloFrancabandiera Apr 26, 2022
e525a9d
Merge branch 'olive-editor:master' into master
AngeloFrancabandiera Apr 28, 2022
5b49e43
Merge branch 'olive-editor:master' into master
AngeloFrancabandiera Apr 29, 2022
a1435b5
Added transaltion of 'super' node to translate 'enable' input
AngeloFrancabandiera May 3, 2022
82d23dc
Merge branch 'master' into master
AngeloFrancabandiera May 4, 2022
954b580
Fixed 'Type' of Push function to align to master repo.
AngeloFrancabandiera May 4, 2022
6c1a58e
Merge branch 'olive-editor:master' into master
AngeloFrancabandiera May 8, 2022
865ca9a
Merge branch 'master' into master
AngeloFrancabandiera May 9, 2022
f35a80b
Merge branch 'olive-editor:master' into master
AngeloFrancabandiera May 9, 2022
6d38470
Merge branch 'olive-editor:master' into master
AngeloFrancabandiera May 10, 2022
c3bc458
Aligned to Olive master
AngeloFrancabandiera May 10, 2022
9c96eba
Merge branch 'master' into master
AngeloFrancabandiera May 12, 2022
639feab
Merge branch 'olive-editor:master' into master
AngeloFrancabandiera May 13, 2022
dbf8d0a
Merge branch 'olive-editor:master' into master
AngeloFrancabandiera May 14, 2022
d4bb0b7
Merge branch 'master' into master
AngeloFrancabandiera May 15, 2022
b5621ef
Merge branch 'master' into master
AngeloFrancabandiera May 16, 2022
f708d49
Alignment to olive master
AngeloFrancabandiera May 17, 2022
9357fa1
Fixed an issue with keyframes for a newly created node input
AngeloFrancabandiera May 21, 2022
f0f81b9
Merge branch 'olive-editor:master' into master
AngeloFrancabandiera May 21, 2022
9c96e9a
Merge branch 'master' of https://github.com/AngeloFrancabandiera/olive
AngeloFrancabandiera May 21, 2022
6c8eb9c
Merge branch 'olive-editor:master' into master
AngeloFrancabandiera May 26, 2022
45f2074
In function ShowTextDialog, used 'setText' function instead of
AngeloFrancabandiera May 28, 2022
0cbb6cf
Merge branch 'olive-editor:master' into master
AngeloFrancabandiera Jun 1, 2022
ea7411d
Merge branch 'master' of https://github.com/AngeloFrancabandiera/olive
AngeloFrancabandiera Jun 1, 2022
f5f61aa
Error messages of shader compilation exported to GUI
AngeloFrancabandiera Jun 4, 2022
c86c8eb
Built-in "Enabled" input integrated with Shader node.
AngeloFrancabandiera Jun 7, 2022
8541a48
Merge branch 'olive-editor:master' into master
AngeloFrancabandiera Jun 10, 2022
4c2be2c
Merge branch 'master' of https://github.com/AngeloFrancabandiera/olive
AngeloFrancabandiera Jun 10, 2022
7becf36
Added EffectInput to add shader node from NodeParamView menu.
AngeloFrancabandiera Jun 18, 2022
4db4746
Merge branch 'olive-editor:master' into master
AngeloFrancabandiera Jun 19, 2022
d26cd92
Merge branch 'master' of https://github.com/AngeloFrancabandiera/olive
AngeloFrancabandiera Jun 19, 2022
ce58185
Merge branch 'olive-editor:master' into master
AngeloFrancabandiera Dec 8, 2022
b6bb7f6
Aligned to new codebase.
AngeloFrancabandiera Dec 11, 2022
fb9f79a
Added custom name for default texture
AngeloFrancabandiera Dec 14, 2022
3d267d9
Merge branch 'master' into master
AngeloFrancabandiera Mar 9, 2023
0d939a9
Merge branch 'olive-editor:master' into master
AngeloFrancabandiera Mar 28, 2023
e743d99
Aligned to new code base
AngeloFrancabandiera Mar 29, 2023
b51a76a
Fixed a bug with flags comparison
AngeloFrancabandiera Apr 5, 2023
1393697
Merge branch 'olive-editor:master' into master
AngeloFrancabandiera Apr 17, 2023
b55ffa0
When changing input list or properties, the node editor gets update
AngeloFrancabandiera Apr 17, 2023
da00bfb
Fixed behavior when input flag "not-keyframable" is changed.
AngeloFrancabandiera May 1, 2023
3edf22c
Merge branch 'olive-editor:master' into master
AngeloFrancabandiera May 1, 2023
a66dba8
Merge branch 'master' of https://github.com/AngeloFrancabandiera/olive
AngeloFrancabandiera May 1, 2023
e33f739
Update of node item view fixed when property "NOT_CONNECTABLE" changes.
AngeloFrancabandiera May 3, 2023
b19c55c
Node view item update fixed when input property NOT_CONNECTABLE changes.
AngeloFrancabandiera May 3, 2023
0405001
Merge branch 'master' of https://github.com/AngeloFrancabandiera/olive
AngeloFrancabandiera May 3, 2023
2b4a0d7
Merge branch 'olive-editor:master' into master
AngeloFrancabandiera May 3, 2023
01f9d27
Removed unused include file
AngeloFrancabandiera May 3, 2023
e832a63
Improved the external editor feature
AngeloFrancabandiera May 10, 2023
524e17d
Fixed an issue when switching from external to internal editor
AngeloFrancabandiera May 11, 2023
aad0983
Fixed default shader to have a minimal functionality
AngeloFrancabandiera May 15, 2023
196c977
Added unit tests for metadata parser. Fixed a bug on end-of-metadata …
AngeloFrancabandiera May 21, 2023
613767a
Merge branch 'master' of https://github.com/AngeloFrancabandiera/olive
AngeloFrancabandiera May 21, 2023
a850b6e
Merge branch 'olive-editor:master' into master
AngeloFrancabandiera Jun 5, 2023
0bc6fb8
Added shader transition node; Added button to select external editor
AngeloFrancabandiera Jun 6, 2023
1948eca
Minor change to default transition
AngeloFrancabandiera Jun 10, 2023
9b57368
Merge branch 'olive-editor:master' into master
AngeloFrancabandiera Oct 16, 2023
a5752f9
Added vertex shader and number of iterations in shadres. Cosmetic pol…
AngeloFrancabandiera Oct 20, 2023
dc6f2b6
Added default description for shaders.
AngeloFrancabandiera Oct 24, 2023
7f71bcc
Dedicated folder for olive scripts in temp folder
AngeloFrancabandiera Oct 28, 2023
014a4ff
Fixed a bug with vertex shader
AngeloFrancabandiera Nov 1, 2023
bbca74c
Fixed a bug where saving a shader in an external editor while 'issues…
AngeloFrancabandiera Nov 11, 2023
cce542a
Remove temporary files when application quits. Improved behavior when…
AngeloFrancabandiera Nov 27, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions app/config/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,18 @@ void Config::SetDefaults()
SetEntryInternal(QStringLiteral("OfflinePixelFormat"), NodeValue::kInt, PixelFormat::F16);

SetEntryInternal(QStringLiteral("MarkerColor"), NodeValue::kInt, ColorCoding::kLime);

// Code editor
SetEntryInternal(QStringLiteral("EditorUseInternal"), NodeValue::kBoolean, true);

SetEntryInternal(QStringLiteral("EditorExternalCommand"), NodeValue::kText, QString());
SetEntryInternal(QStringLiteral("EditorExternalParams"), NodeValue::kText, QString());
SetEntryInternal(QStringLiteral("EditorExternalTempFolder"), NodeValue::kText,
QStandardPaths::standardLocations( QStandardPaths::TempLocation).at(0));
SetEntryInternal(QStringLiteral("EditorInternalFontSize"), NodeValue::kInt, 14);
SetEntryInternal(QStringLiteral("EditorInternalIndentSize"), NodeValue::kInt, 3);
SetEntryInternal(QStringLiteral("EditorInternalWindowWidth"), NodeValue::kInt, 800);
SetEntryInternal(QStringLiteral("EditorInternalWindowHeight"), NodeValue::kInt, 600);
}

void Config::Load()
Expand Down
1 change: 1 addition & 0 deletions app/dialog/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
add_subdirectory(about)
add_subdirectory(actionsearch)
add_subdirectory(autorecovery)
add_subdirectory(codeeditor)
add_subdirectory(color)
add_subdirectory(configbase)
add_subdirectory(diskcache)
Expand Down
32 changes: 32 additions & 0 deletions app/dialog/codeeditor/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Olive - Non-Linear Video Editor
# Copyright (C) 2021 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}
dialog/codeeditor/editor.h
dialog/codeeditor/editor.cpp
dialog/codeeditor/glslhighlighter.h
dialog/codeeditor/glslhighlighter.cpp
dialog/codeeditor/codeeditordialog.h
dialog/codeeditor/codeeditordialog.cpp
dialog/codeeditor/externaleditorproxy.h
dialog/codeeditor/externaleditorproxy.cpp
dialog/codeeditor/searchtextbar.h
dialog/codeeditor/searchtextbar.cpp
dialog/codeeditor/messagehighlighter.h
dialog/codeeditor/messagehighlighter.cpp
PARENT_SCOPE
)
162 changes: 162 additions & 0 deletions app/dialog/codeeditor/codeeditordialog.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
#include "codeeditordialog.h"
#include "searchtextbar.h"

#include <QBoxLayout>
#include <QDialogButtonBox>
#include <QMenuBar>
#include <QClipboard>
#include <QGuiApplication>
#include <QTextDocumentFragment>


namespace olive {

CodeEditorDialog::CodeEditorDialog(const QString &start, QWidget* parent) :
QDialog(parent)
{
QVBoxLayout* layout = new QVBoxLayout(this);

// Create text edit widget
text_edit_ = new CodeEditor( this);
text_edit_->document()->setPlainText(start);
text_edit_->gotoLineNumber(1);
layout->addWidget(text_edit_);

// Create buttons
QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
layout->addWidget(buttons);
connect(buttons, &QDialogButtonBox::accepted, this, &CodeEditorDialog::accept);
connect(buttons, &QDialogButtonBox::rejected, this, &CodeEditorDialog::reject);

// this does not work on all platforms
setWindowFlag( Qt::WindowMaximizeButtonHint, true);

QMenuBar * menu_bar = new QMenuBar( text_edit_);
QMenu * edit_menu = new QMenu(tr("Edit"), text_edit_);
QMenu * edit_addSnippet_menu = new QMenu(tr("add input"), text_edit_);

edit_menu->addMenu( edit_addSnippet_menu);
menu_bar->addMenu( edit_menu);

QAction * add_texture_input = edit_addSnippet_menu->addAction(tr("texture"));
QAction * add_color_input = edit_addSnippet_menu->addAction(tr("color"));
QAction * add_float_input = edit_addSnippet_menu->addAction(tr("float"));
QAction * add_int_input = edit_addSnippet_menu->addAction(tr("integer"));
QAction * add_boolean_input = edit_addSnippet_menu->addAction(tr("boolean"));
QAction * add_selection_input = edit_addSnippet_menu->addAction(tr("selection"));
QAction * add_point_input = edit_addSnippet_menu->addAction(tr("point"));

connect( add_texture_input, &QAction::triggered, this, &CodeEditorDialog::OnActionAddInputTexture);
connect( add_color_input, &QAction::triggered, this, &CodeEditorDialog::OnActionAddInputColor);
connect( add_float_input, &QAction::triggered, this, &CodeEditorDialog::OnActionAddInputFloat);
connect( add_int_input, &QAction::triggered, this, &CodeEditorDialog::OnActionAddInputInt);
connect( add_boolean_input, &QAction::triggered, this, &CodeEditorDialog::OnActionAddInputBoolean);
connect( add_selection_input, &QAction::triggered, this, &CodeEditorDialog::OnActionAddInputSelection);
connect( add_point_input, &QAction::triggered, this, &CodeEditorDialog::OnActionAddInputPoint);

search_bar_ = new SearchTextBar( this);
search_bar_->hide();
layout->addWidget( search_bar_);

QAction * show_find_dialog = edit_menu->addAction(tr("find/replace"));
show_find_dialog->setShortcut( QKeySequence(Qt::CTRL | Qt::Key_F));

connect( show_find_dialog, &QAction::triggered, this, &CodeEditorDialog::OnFindRequest);

connect( search_bar_, &SearchTextBar::searchTextForward, text_edit_, &CodeEditor::onSearchForwardRequest);
connect( search_bar_, &SearchTextBar::searchTextBackward, text_edit_, &CodeEditor::onSearchBackwardRequest);
connect( search_bar_, &SearchTextBar::replaceText, text_edit_, &CodeEditor::onReplaceTextRequest);

connect( text_edit_, &CodeEditor::textNotFound, search_bar_, &SearchTextBar::onTextNotFound);

layout->setMenuBar( menu_bar);
}

void CodeEditorDialog::OnActionAddInputTexture()
{
text_edit_->insertPlainText(
"//OVE name: my input\n"
"//OVE type: TEXTURE\n"
"//OVE flag: NOT_KEYFRAMABLE\n"
"//OVE description: \n"
"uniform sampler2D my_input;\n");
}

void CodeEditorDialog::OnActionAddInputColor()
{
text_edit_->insertPlainText(
"//OVE name: my color\n"
"//OVE type: COLOR\n"
"//OVE default: RGBA(0.5, 0.5, 1, 1)\n"
"//OVE description: \n"
"uniform vec4 my_color;\n");
}

void CodeEditorDialog::OnActionAddInputFloat()
{
text_edit_->insertPlainText(
"//OVE name: my float\n"
"//OVE type: FLOAT\n"
"//OVE flag: NOT_CONNECTABLE\n"
"//OVE min: 0.0\n"
"//OVE max: 3.0\n"
"//OVE default: 1.0\n"
"//OVE description: \n"
"uniform float my_float;\n");
}

void CodeEditorDialog::OnActionAddInputInt()
{
text_edit_->insertPlainText(
"//OVE name: my int\n"
"//OVE type: INTEGER\n"
"//OVE flag: NOT_CONNECTABLE\n"
"//OVE min: -10\n"
"//OVE max: 10\n"
"//OVE default: 0\n"
"//OVE description:\n"
"uniform int my_int;\n");
}

void CodeEditorDialog::OnActionAddInputBoolean()
{
text_edit_->insertPlainText(
"//OVE name: my boolean\n"
"//OVE type: BOOLEAN\n"
"//OVE flag: NOT_CONNECTABLE, NOT_KEYFRAMABLE\n"
"//OVE default: false\n"
"//OVE description: \n"
"uniform bool my_bool;\n");
}

void CodeEditorDialog::OnActionAddInputSelection()
{
text_edit_->insertPlainText(
"//OVE name: my selection\n"
"//OVE type: SELECTION\n"
"//OVE values: \"FIRST CHOICE\", \"SECOND CHOICE\"\n"
"//OVE default: 0\n"
"//OVE description: \n"
"uniform int my_selection;\n");
}

void CodeEditorDialog::OnActionAddInputPoint()
{
text_edit_->insertPlainText(
"//OVE name: my point\n"
"//OVE type: POINT\n"
"//OVE shape: SQUARE\n"
"//OVE default: (0.4, 0.2)\n"
"//OVE description: \n"
"uniform vec2 my_point;\n");
}

void CodeEditorDialog::OnFindRequest()
{
QString text_to_find = text_edit_->textCursor().selection().toPlainText();
search_bar_->showBar( text_to_find);
}


} // namespace olive

60 changes: 60 additions & 0 deletions app/dialog/codeeditor/codeeditordialog.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/***

Olive - Non-Linear Video Editor
Copyright (C) 2021 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/>.

***/
#ifndef CODEEDITORDIALOG_H
#define CODEEDITORDIALOG_H

#include <QDialog>
#include "dialog/codeeditor/editor.h"

namespace olive {

class SearchTextBar;


/// @brief Wrapper QDialog window for the code editor
class CodeEditorDialog : public QDialog
{
Q_OBJECT
public:
CodeEditorDialog(const QString &start, QWidget* parent = nullptr);

QString text() const
{
return text_edit_->toPlainText();
}

private:
CodeEditor* text_edit_;
SearchTextBar * search_bar_;

private slots:
void OnActionAddInputTexture();
void OnActionAddInputColor();
void OnActionAddInputFloat();
void OnActionAddInputInt();
void OnActionAddInputBoolean();
void OnActionAddInputSelection();
void OnActionAddInputPoint();
void OnFindRequest();
};

} // namespace olive

#endif // CODEEDITORDIALOG_H