From 20b7a8da4cd593edc2844459232e7b01f04d244c Mon Sep 17 00:00:00 2001 From: Umang Kalra Date: Wed, 11 Aug 2021 00:44:19 +0530 Subject: [PATCH] Automatic arrangement of nodes in VisualScript/VisualShaders editors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR and commit adds the functionality to arrange nodes in VisualScript/VisualShader editor. The layout generated by this feature is compact, with minimum crossings between connections & uniform horizontal & vertical gaps between the nodes. This work has been sponsored by GSoC '21. Full list of additions/changes: • Added arrange_nodes() method in GraphEdit module. • This method computes new positions for all the selected nodes by forming blocks and compressing them. The nodes are moved to these new positions. • Adding this method to GraphEdit makes it available for use in VisualScript/VisualShaders editors and its other subclasses. • Button with an icon has been added to call arrange_nodes() in GraphEdit. • This button is inherited by VisualScript/VisualShaders editors to invoke the method. • Undo/redo is functional with this method. • By using signals in arrange_nodes(), position changes are registered in undo/redo stack of the subclass that is using the method. • Metadata of the method has been updated in ClassDB • Method description has been added to class reference of GraphEdit --- visual_script_editor.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/visual_script_editor.h b/visual_script_editor.h index 3b7ed3d..962ea38 100644 --- a/visual_script_editor.h +++ b/visual_script_editor.h @@ -60,7 +60,7 @@ class VisualScriptEditor : public ScriptEditorBase { EDIT_CUT_NODES, EDIT_PASTE_NODES, EDIT_CREATE_FUNCTION, - REFRESH_GRAPH + REFRESH_GRAPH, }; enum PortAction {