1 /** 2 3 4 Copyright: 5 Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. 6 Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) 7 Copyright (c) 2017-2018 Godot-D contributors 8 9 License: $(LINK2 https://opensource.org/licenses/MIT, MIT License) 10 11 12 */ 13 module godot.visualscripteditor; 14 import std.meta : AliasSeq, staticIndexOf; 15 import std.traits : Unqual; 16 import godot.d.traits; 17 import godot.core; 18 import godot.c; 19 import godot.d.bind; 20 import godot.d.reference; 21 import godot.globalenums; 22 import godot.object; 23 import godot.script; 24 /** 25 26 */ 27 @GodotBaseClass struct VisualScriptEditorSingleton 28 { 29 package(godot) enum string _GODOT_internal_name = "_VisualScriptEditor"; 30 public: 31 @nogc nothrow: 32 union { /** */ godot_object _godot_object; /** */ GodotObject _GODOT_base; } 33 alias _GODOT_base this; 34 alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses); 35 package(godot) __gshared bool _classBindingInitialized = false; 36 package(godot) static struct GDNativeClassBinding 37 { 38 __gshared: 39 godot_object _singleton; 40 immutable char* _singletonName = "VisualScriptEditor"; 41 @GodotName("add_custom_node") GodotMethod!(void, String, String, Script) addCustomNode; 42 @GodotName("remove_custom_node") GodotMethod!(void, String, String) removeCustomNode; 43 } 44 /// 45 pragma(inline, true) bool opEquals(in VisualScriptEditorSingleton other) const 46 { return _godot_object.ptr is other._godot_object.ptr; } 47 /// 48 pragma(inline, true) typeof(null) opAssign(typeof(null) n) 49 { _godot_object.ptr = n; return null; } 50 /// 51 pragma(inline, true) bool opEquals(typeof(null) n) const 52 { return _godot_object.ptr is n; } 53 /// 54 size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; } 55 mixin baseCasts; 56 /// Construct a new instance of VisualScriptEditorSingleton. 57 /// Note: use `memnew!VisualScriptEditorSingleton` instead. 58 static VisualScriptEditorSingleton _new() 59 { 60 static godot_class_constructor constructor; 61 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("_VisualScriptEditor"); 62 if(constructor is null) return typeof(this).init; 63 return cast(VisualScriptEditorSingleton)(constructor()); 64 } 65 @disable new(size_t s); 66 /** 67 Add a custom Visual Script node to the editor. It'll be placed under "Custom Nodes" with the `category` as the parameter. 68 */ 69 void addCustomNode(in String name, in String category, Script script) 70 { 71 checkClassBinding!(typeof(this))(); 72 ptrcall!(void)(GDNativeClassBinding.addCustomNode, _godot_object, name, category, script); 73 } 74 /** 75 Remove a custom Visual Script node from the editor. Custom nodes already placed on scripts won't be removed. 76 */ 77 void removeCustomNode(in String name, in String category) 78 { 79 checkClassBinding!(typeof(this))(); 80 ptrcall!(void)(GDNativeClassBinding.removeCustomNode, _godot_object, name, category); 81 } 82 } 83 /// Returns: the VisualScriptEditorSingleton 84 @property @nogc nothrow pragma(inline, true) 85 VisualScriptEditorSingleton VisualScriptEditor() 86 { 87 checkClassBinding!VisualScriptEditorSingleton(); 88 return VisualScriptEditorSingleton(VisualScriptEditorSingleton.GDNativeClassBinding._singleton); 89 }