From 3d7bea5c518414b6bdd37c336f0d856ebae15388 Mon Sep 17 00:00:00 2001 From: RobTheFiveNine <49003204+RobTheFiveNine@users.noreply.github.com> Date: Thu, 1 Oct 2020 18:00:58 +0100 Subject: [PATCH] Add ability to automatically sort node types / categories in the context menu --- src/litegraph.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/litegraph.js b/src/litegraph.js index d6415e81f..d909e7241 100755 --- a/src/litegraph.js +++ b/src/litegraph.js @@ -96,6 +96,7 @@ Globals: {}, //used to store vars between graphs searchbox_extras: {}, //used to add extra features to the search box + auto_sort_node_types: false, // If set to true, will automatically sort node types / categories in the context menus /** * Register a node class so it can be listed when the user wants to create a new one @@ -416,7 +417,7 @@ } } - return r; + return this.auto_sort_node_types ? r.sort() : r; }, /** @@ -440,7 +441,7 @@ for (var i in categories) { result.push(i); } - return result; + return this.auto_sort_node_types ? result.sort() : result; }, //debug purposes: reloads all the js scripts that matches a wildcard