1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-07 12:30:27 +00:00

Create API to add and remove VisualScript custom nodes

This makes a VisualScriptEditor singleton, which gives plugins the
ability to register their own custom nodes. Those will be available for
insertion in the Visual Script editor, under the "Custom Nodes"
category.
This commit is contained in:
George Marques
2017-11-15 13:57:24 -02:00
parent 9543801d51
commit 0284727e7b
7 changed files with 135 additions and 0 deletions

View File

@@ -278,6 +278,29 @@ public:
VisualScriptEditor();
~VisualScriptEditor();
};
// Singleton
class _VisualScriptEditor : public Object {
GDCLASS(_VisualScriptEditor, Object);
friend class VisualScriptLanguage;
protected:
static void _bind_methods();
static _VisualScriptEditor *singleton;
static Map<String, RefPtr> custom_nodes;
static Ref<VisualScriptNode> create_node_custom(const String &p_name);
public:
static _VisualScriptEditor *get_singleton() { return singleton; }
void add_custom_node(const String &p_name, const String &p_category, const Ref<Script> &p_script);
void remove_custom_node(const String &p_name, const String &p_category);
_VisualScriptEditor();
~_VisualScriptEditor();
};
#endif
#endif // VISUALSCRIPT_EDITOR_H