1 /** 2 A node which is part of a $(D VisualScript). 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.visualscriptnode; 14 import std.meta : AliasSeq, staticIndexOf; 15 import std.traits : Unqual; 16 import godot.d.meta; 17 import godot.core; 18 import godot.c; 19 import godot.d.bind; 20 import godot.d.reference; 21 import godot.object; 22 import godot.resource; 23 import godot.visualscript; 24 import godot.reference; 25 /** 26 A node which is part of a $(D VisualScript). 27 28 Not to be confused with $(D Node), which is a part of a $(D SceneTree). 29 */ 30 @GodotBaseClass struct VisualScriptNode 31 { 32 enum string _GODOT_internal_name = "VisualScriptNode"; 33 public: 34 @nogc nothrow: 35 union { godot_object _godot_object; Resource _GODOT_base; } 36 alias _GODOT_base this; 37 alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses); 38 package(godot) __gshared bool _classBindingInitialized = false; 39 package(godot) static struct _classBinding 40 { 41 __gshared: 42 @GodotName("get_visual_script") GodotMethod!(VisualScript) getVisualScript; 43 @GodotName("set_default_input_value") GodotMethod!(void, long, Variant) setDefaultInputValue; 44 @GodotName("get_default_input_value") GodotMethod!(Variant, long) getDefaultInputValue; 45 @GodotName("ports_changed_notify") GodotMethod!(void) portsChangedNotify; 46 @GodotName("_set_default_input_values") GodotMethod!(void, Array) _setDefaultInputValues; 47 @GodotName("_get_default_input_values") GodotMethod!(Array) _getDefaultInputValues; 48 } 49 bool opEquals(in VisualScriptNode other) const { return _godot_object.ptr is other._godot_object.ptr; } 50 VisualScriptNode opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; } 51 bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; } 52 mixin baseCasts; 53 static VisualScriptNode _new() 54 { 55 static godot_class_constructor constructor; 56 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("VisualScriptNode"); 57 if(constructor is null) return typeof(this).init; 58 return cast(VisualScriptNode)(constructor()); 59 } 60 @disable new(size_t s); 61 /** 62 Returns the $(D VisualScript) instance the node is bound to. 63 */ 64 Ref!VisualScript getVisualScript() const 65 { 66 checkClassBinding!(typeof(this))(); 67 return ptrcall!(VisualScript)(_classBinding.getVisualScript, _godot_object); 68 } 69 /** 70 Change the default value of a given port. 71 */ 72 void setDefaultInputValue(VariantArg1)(in long port_idx, in VariantArg1 value) 73 { 74 checkClassBinding!(typeof(this))(); 75 ptrcall!(void)(_classBinding.setDefaultInputValue, _godot_object, port_idx, value); 76 } 77 /** 78 Returns the default value of a given port. The default value is used when nothing is connected to the port. 79 */ 80 Variant getDefaultInputValue(in long port_idx) const 81 { 82 checkClassBinding!(typeof(this))(); 83 return ptrcall!(Variant)(_classBinding.getDefaultInputValue, _godot_object, port_idx); 84 } 85 /** 86 Notify that the node's ports have changed. Usually used in conjunction with $(D VisualScriptCustomNode) . 87 */ 88 void portsChangedNotify() 89 { 90 checkClassBinding!(typeof(this))(); 91 ptrcall!(void)(_classBinding.portsChangedNotify, _godot_object); 92 } 93 /** 94 95 */ 96 void _setDefaultInputValues(in Array values) 97 { 98 Array _GODOT_args = Array.empty_array; 99 _GODOT_args.append(values); 100 String _GODOT_method_name = String("_set_default_input_values"); 101 this.callv(_GODOT_method_name, _GODOT_args); 102 } 103 /** 104 105 */ 106 Array _getDefaultInputValues() const 107 { 108 Array _GODOT_args = Array.empty_array; 109 String _GODOT_method_name = String("_get_default_input_values"); 110 return this.callv(_GODOT_method_name, _GODOT_args).as!(RefOrT!Array); 111 } 112 /** 113 114 */ 115 @property Array _defaultInputValues() 116 { 117 return _getDefaultInputValues(); 118 } 119 /// ditto 120 @property void _defaultInputValues(Array v) 121 { 122 _setDefaultInputValues(v); 123 } 124 }