Skip to content

Commit

Permalink
Merge pull request #84 from zbanks/glsl-editor
Browse files Browse the repository at this point in the history
Glsl editor
  • Loading branch information
ervanalb authored Oct 28, 2018
2 parents e226614 + fe64034 commit 2b947cf
Show file tree
Hide file tree
Showing 12 changed files with 781 additions and 12 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ endif()
add_library(libradiance ${libradiance_SOURCES})

add_executable(radiance WIN32 src/main.cpp
src/GlslDocument.cpp
src/GlslHighlighter.cpp
src/QQuickVideoNodePreview.cpp
src/QQuickPreviewAdapter.cpp)

Expand Down
46 changes: 36 additions & 10 deletions resources/qml/ConsoleWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,21 @@ Item {
popOut();
}

Connections {
target: graph.model
onGraphChanged: {
for (var i=0; i<listModel.count; i++) {
for (var j=0; j<verticesRemoved.length; j++) {
if (verticesRemoved[j] == listModel.get(i).videoNode) {
listModel.remove(i);
i--;
break;
}
}
}
}
}

ListView {
id: listView
clip: true
Expand All @@ -42,28 +57,41 @@ Item {
height: t.height + 8
width: parent.width - 15
anchors.margins: 5

function removeMe() {
listModel.remove(index);
}

Rectangle {
anchors.fill: parent
anchors.margins: 2
opacity: 0.1
color: type == "warning" ? "gold" : type == "error" ? "red" : "green"
radius: 3
}
MouseArea {
anchors.fill: parent
onClicked: {
graph.view.tileForVideoNode(videoNode).forceActiveFocus();
}
}
Connections {
target: videoNode ? graph.view.tileForVideoNode(videoNode) : null;
onReloaded: removeMe()
}
ColumnLayout {
anchors.fill: parent
anchors.leftMargin: 10
anchors.rightMargin: 10
Text {
textFormat: Text.RichText
color: RadianceStyle.mainTextColor
id: t
text: str
text: "<style>a {color: " + RadianceStyle.mainTextHighlightColor + ";}</style>" + str
Layout.maximumWidth: parent.width - 20
}
}
MouseArea {
anchors.fill: parent
onClicked: {
graph.view.tileForVideoNode(videoNode).forceActiveFocus();
onLinkActivated: {
graph.view.tileForVideoNode(videoNode).consoleLinkClicked(link);
}
}
}
Rectangle {
Expand All @@ -84,9 +112,7 @@ Item {
}
MouseArea {
anchors.fill: parent
onClicked: {
listModel.remove(index)
}
onClicked: removeMe()
}
}
}
Expand Down
50 changes: 49 additions & 1 deletion resources/qml/EffectNodeTile.qml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,42 @@ VideoNodeTile {
*/
}

Loader {
id: editorLoader
property int line;
property int col;

function makeVisible() {
// Use show instead incase it isn't loaded yet
item.line = line;
item.col = col;
item.open(videoNode.file);
}

Connections {
target: editorLoader.item
onSaved: {
if (editorLoader.item.file == videoNode.file) {
videoNode.reload();
reloaded();
}
}
}

function show(line, col) {
editorLoader.line = line ? line : 0;
editorLoader.col = col ? col : 0;
if (status == Loader.Ready) {
makeVisible();
} else if (source == "") {
editorLoader.source = "GlslEditor.qml"
}
}
onLoaded: {
makeVisible();
}
}

Keys.onPressed: {
if (event.modifiers == Qt.NoModifier) {
if (event.key == Qt.Key_J)
Expand Down Expand Up @@ -143,8 +179,11 @@ VideoNodeTile {
slider.value = 0.9;
else if (event.key == Qt.Key_0)
slider.value = 1.0;
else if (event.key == Qt.Key_R)
else if (event.key == Qt.Key_R) {
videoNode.reload();
reloaded();
} else if (event.key == Qt.Key_E)
editorLoader.show();
} else if (event.modifiers == Qt.ControlModifier) {
if (event.key == Qt.Key_QuoteLeft)
attachedParameter = -1;
Expand Down Expand Up @@ -199,4 +238,13 @@ VideoNodeTile {
intensity = i;
}
}

function consoleLinkClicked(link) {
link = link.split(",");
if (link[0] == "editline") {
var line = link[1];
var col = link[2];
editorLoader.show(line, col);
}
}
}
Loading

0 comments on commit 2b947cf

Please sign in to comment.