diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml index 090ca5a0337..585b94a5223 100644 --- a/doc/classes/@GlobalScope.xml +++ b/doc/classes/@GlobalScope.xml @@ -1085,8 +1085,8 @@ The [TranslationServer] singleton. - - The [VisualScriptEditor] singleton. + + The [VisualScriptCustomNodes] singleton. The [XRServer] singleton. diff --git a/modules/visual_script/doc_classes/VisualScriptEditor.xml b/doc/classes/VisualScriptCustomNodes.xml similarity index 82% rename from modules/visual_script/doc_classes/VisualScriptEditor.xml rename to doc/classes/VisualScriptCustomNodes.xml index 9ea889c77b2..3ef8022f5e9 100644 --- a/modules/visual_script/doc_classes/VisualScriptEditor.xml +++ b/doc/classes/VisualScriptCustomNodes.xml @@ -1,8 +1,10 @@ - + + Manages custom nodes for the Visual Script editor. + This singleton can be used to manage (i.e., add or remove) custom nodes for the Visual Script editor. diff --git a/modules/visual_script/register_types.cpp b/modules/visual_script/register_types.cpp index fce98eb8a03..7fb9707fcee 100644 --- a/modules/visual_script/register_types.cpp +++ b/modules/visual_script/register_types.cpp @@ -43,7 +43,7 @@ VisualScriptLanguage *visual_script_language = nullptr; #ifdef TOOLS_ENABLED -static vs_bind::VisualScriptEditor *vs_editor_singleton = nullptr; +static VisualScriptCustomNodes *vs_custom_nodes_singleton = nullptr; #endif void register_visual_script_types() { @@ -114,10 +114,10 @@ void register_visual_script_types() { #ifdef TOOLS_ENABLED ClassDB::set_current_api(ClassDB::API_EDITOR); - GDREGISTER_CLASS(vs_bind::VisualScriptEditor); + GDREGISTER_CLASS(VisualScriptCustomNodes); ClassDB::set_current_api(ClassDB::API_CORE); - vs_editor_singleton = memnew(vs_bind::VisualScriptEditor); - Engine::get_singleton()->add_singleton(Engine::Singleton("VisualScriptEditor", vs_bind::VisualScriptEditor::get_singleton())); + vs_custom_nodes_singleton = memnew(VisualScriptCustomNodes); + Engine::get_singleton()->add_singleton(Engine::Singleton("VisualScriptEditor", VisualScriptCustomNodes::get_singleton())); VisualScriptEditor::register_editor(); #endif @@ -130,8 +130,8 @@ void unregister_visual_script_types() { #ifdef TOOLS_ENABLED VisualScriptEditor::free_clipboard(); - if (vs_editor_singleton) { - memdelete(vs_editor_singleton); + if (vs_custom_nodes_singleton) { + memdelete(vs_custom_nodes_singleton); } #endif if (visual_script_language) { diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp index ded716cf189..eee9e8f32b6 100644 --- a/modules/visual_script/visual_script_editor.cpp +++ b/modules/visual_script/visual_script_editor.cpp @@ -4522,46 +4522,44 @@ void VisualScriptEditor::register_editor() { void VisualScriptEditor::validate() { } -namespace vs_bind { +// VisualScriptCustomNodes -Ref VisualScriptEditor::create_node_custom(const String &p_name) { +Ref VisualScriptCustomNodes::create_node_custom(const String &p_name) { Ref node; node.instantiate(); node->set_script(singleton->custom_nodes[p_name]); return node; } -VisualScriptEditor *VisualScriptEditor::singleton = nullptr; -Map VisualScriptEditor::custom_nodes; +VisualScriptCustomNodes *VisualScriptCustomNodes::singleton = nullptr; +Map VisualScriptCustomNodes::custom_nodes; -VisualScriptEditor::VisualScriptEditor() { +VisualScriptCustomNodes::VisualScriptCustomNodes() { singleton = this; } -VisualScriptEditor::~VisualScriptEditor() { +VisualScriptCustomNodes::~VisualScriptCustomNodes() { custom_nodes.clear(); } -void VisualScriptEditor::add_custom_node(const String &p_name, const String &p_category, const Ref