1 /** 2 Base class for a family of nodes with variable amount of input and output ports within the visual shader graph. 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.visualshadernodegroupbase; 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.classdb; 24 import godot.visualshadernode; 25 import godot.resource; 26 import godot.reference; 27 /** 28 Base class for a family of nodes with variable amount of input and output ports within the visual shader graph. 29 30 Currently, has no direct usage, use the derived classes instead. 31 */ 32 @GodotBaseClass struct VisualShaderNodeGroupBase 33 { 34 package(godot) enum string _GODOT_internal_name = "VisualShaderNodeGroupBase"; 35 public: 36 @nogc nothrow: 37 union { /** */ godot_object _godot_object; /** */ VisualShaderNode _GODOT_base; } 38 alias _GODOT_base this; 39 alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses); 40 package(godot) __gshared bool _classBindingInitialized = false; 41 package(godot) static struct GDNativeClassBinding 42 { 43 __gshared: 44 @GodotName("add_input_port") GodotMethod!(void, long, long, String) addInputPort; 45 @GodotName("add_output_port") GodotMethod!(void, long, long, String) addOutputPort; 46 @GodotName("clear_input_ports") GodotMethod!(void) clearInputPorts; 47 @GodotName("clear_output_ports") GodotMethod!(void) clearOutputPorts; 48 @GodotName("get_free_input_port_id") GodotMethod!(long) getFreeInputPortId; 49 @GodotName("get_free_output_port_id") GodotMethod!(long) getFreeOutputPortId; 50 @GodotName("get_input_port_count") GodotMethod!(long) getInputPortCount; 51 @GodotName("get_inputs") GodotMethod!(String) getInputs; 52 @GodotName("get_output_port_count") GodotMethod!(long) getOutputPortCount; 53 @GodotName("get_outputs") GodotMethod!(String) getOutputs; 54 @GodotName("get_size") GodotMethod!(Vector2) getSize; 55 @GodotName("has_input_port") GodotMethod!(bool, long) hasInputPort; 56 @GodotName("has_output_port") GodotMethod!(bool, long) hasOutputPort; 57 @GodotName("is_valid_port_name") GodotMethod!(bool, String) isValidPortName; 58 @GodotName("remove_input_port") GodotMethod!(void, long) removeInputPort; 59 @GodotName("remove_output_port") GodotMethod!(void, long) removeOutputPort; 60 @GodotName("set_input_port_name") GodotMethod!(void, long, String) setInputPortName; 61 @GodotName("set_input_port_type") GodotMethod!(void, long, long) setInputPortType; 62 @GodotName("set_inputs") GodotMethod!(void, String) setInputs; 63 @GodotName("set_output_port_name") GodotMethod!(void, long, String) setOutputPortName; 64 @GodotName("set_output_port_type") GodotMethod!(void, long, long) setOutputPortType; 65 @GodotName("set_outputs") GodotMethod!(void, String) setOutputs; 66 @GodotName("set_size") GodotMethod!(void, Vector2) setSize; 67 } 68 /// 69 pragma(inline, true) bool opEquals(in VisualShaderNodeGroupBase other) const 70 { return _godot_object.ptr is other._godot_object.ptr; } 71 /// 72 pragma(inline, true) typeof(null) opAssign(typeof(null) n) 73 { _godot_object.ptr = n; return null; } 74 /// 75 pragma(inline, true) bool opEquals(typeof(null) n) const 76 { return _godot_object.ptr is n; } 77 /// 78 size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; } 79 mixin baseCasts; 80 /// Construct a new instance of VisualShaderNodeGroupBase. 81 /// Note: use `memnew!VisualShaderNodeGroupBase` instead. 82 static VisualShaderNodeGroupBase _new() 83 { 84 static godot_class_constructor constructor; 85 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("VisualShaderNodeGroupBase"); 86 if(constructor is null) return typeof(this).init; 87 return cast(VisualShaderNodeGroupBase)(constructor()); 88 } 89 @disable new(size_t s); 90 /** 91 Adds an input port with the specified `type` (see $(D VisualShaderNode.porttype)) and `name`. 92 */ 93 void addInputPort(in long id, in long type, in String name) 94 { 95 checkClassBinding!(typeof(this))(); 96 ptrcall!(void)(GDNativeClassBinding.addInputPort, _godot_object, id, type, name); 97 } 98 /** 99 Adds an output port with the specified `type` (see $(D VisualShaderNode.porttype)) and `name`. 100 */ 101 void addOutputPort(in long id, in long type, in String name) 102 { 103 checkClassBinding!(typeof(this))(); 104 ptrcall!(void)(GDNativeClassBinding.addOutputPort, _godot_object, id, type, name); 105 } 106 /** 107 Removes all previously specified input ports. 108 */ 109 void clearInputPorts() 110 { 111 checkClassBinding!(typeof(this))(); 112 ptrcall!(void)(GDNativeClassBinding.clearInputPorts, _godot_object); 113 } 114 /** 115 Removes all previously specified output ports. 116 */ 117 void clearOutputPorts() 118 { 119 checkClassBinding!(typeof(this))(); 120 ptrcall!(void)(GDNativeClassBinding.clearOutputPorts, _godot_object); 121 } 122 /** 123 Returns a free input port ID which can be used in $(D addInputPort). 124 */ 125 long getFreeInputPortId() const 126 { 127 checkClassBinding!(typeof(this))(); 128 return ptrcall!(long)(GDNativeClassBinding.getFreeInputPortId, _godot_object); 129 } 130 /** 131 Returns a free output port ID which can be used in $(D addOutputPort). 132 */ 133 long getFreeOutputPortId() const 134 { 135 checkClassBinding!(typeof(this))(); 136 return ptrcall!(long)(GDNativeClassBinding.getFreeOutputPortId, _godot_object); 137 } 138 /** 139 Returns the number of input ports in use. Alternative for $(D getFreeInputPortId). 140 */ 141 long getInputPortCount() const 142 { 143 checkClassBinding!(typeof(this))(); 144 return ptrcall!(long)(GDNativeClassBinding.getInputPortCount, _godot_object); 145 } 146 /** 147 Returns a $(D String) description of the input ports as a colon-separated list using the format `id,type,name;` (see $(D addInputPort)). 148 */ 149 String getInputs() const 150 { 151 checkClassBinding!(typeof(this))(); 152 return ptrcall!(String)(GDNativeClassBinding.getInputs, _godot_object); 153 } 154 /** 155 Returns the number of output ports in use. Alternative for $(D getFreeOutputPortId). 156 */ 157 long getOutputPortCount() const 158 { 159 checkClassBinding!(typeof(this))(); 160 return ptrcall!(long)(GDNativeClassBinding.getOutputPortCount, _godot_object); 161 } 162 /** 163 Returns a $(D String) description of the output ports as a colon-separated list using the format `id,type,name;` (see $(D addOutputPort)). 164 */ 165 String getOutputs() const 166 { 167 checkClassBinding!(typeof(this))(); 168 return ptrcall!(String)(GDNativeClassBinding.getOutputs, _godot_object); 169 } 170 /** 171 172 */ 173 Vector2 getSize() const 174 { 175 checkClassBinding!(typeof(this))(); 176 return ptrcall!(Vector2)(GDNativeClassBinding.getSize, _godot_object); 177 } 178 /** 179 Returns `true` if the specified input port exists. 180 */ 181 bool hasInputPort(in long id) const 182 { 183 checkClassBinding!(typeof(this))(); 184 return ptrcall!(bool)(GDNativeClassBinding.hasInputPort, _godot_object, id); 185 } 186 /** 187 Returns `true` if the specified output port exists. 188 */ 189 bool hasOutputPort(in long id) const 190 { 191 checkClassBinding!(typeof(this))(); 192 return ptrcall!(bool)(GDNativeClassBinding.hasOutputPort, _godot_object, id); 193 } 194 /** 195 Returns `true` if the specified port name does not override an existed port name and is valid within the shader. 196 */ 197 bool isValidPortName(in String name) const 198 { 199 checkClassBinding!(typeof(this))(); 200 return ptrcall!(bool)(GDNativeClassBinding.isValidPortName, _godot_object, name); 201 } 202 /** 203 Removes the specified input port. 204 */ 205 void removeInputPort(in long id) 206 { 207 checkClassBinding!(typeof(this))(); 208 ptrcall!(void)(GDNativeClassBinding.removeInputPort, _godot_object, id); 209 } 210 /** 211 Removes the specified output port. 212 */ 213 void removeOutputPort(in long id) 214 { 215 checkClassBinding!(typeof(this))(); 216 ptrcall!(void)(GDNativeClassBinding.removeOutputPort, _godot_object, id); 217 } 218 /** 219 Renames the specified input port. 220 */ 221 void setInputPortName(in long id, in String name) 222 { 223 checkClassBinding!(typeof(this))(); 224 ptrcall!(void)(GDNativeClassBinding.setInputPortName, _godot_object, id, name); 225 } 226 /** 227 Sets the specified input port's type (see $(D VisualShaderNode.porttype)). 228 */ 229 void setInputPortType(in long id, in long type) 230 { 231 checkClassBinding!(typeof(this))(); 232 ptrcall!(void)(GDNativeClassBinding.setInputPortType, _godot_object, id, type); 233 } 234 /** 235 Defines all input ports using a $(D String) formatted as a colon-separated list: `id,type,name;` (see $(D addInputPort)). 236 */ 237 void setInputs(in String inputs) 238 { 239 checkClassBinding!(typeof(this))(); 240 ptrcall!(void)(GDNativeClassBinding.setInputs, _godot_object, inputs); 241 } 242 /** 243 Renames the specified output port. 244 */ 245 void setOutputPortName(in long id, in String name) 246 { 247 checkClassBinding!(typeof(this))(); 248 ptrcall!(void)(GDNativeClassBinding.setOutputPortName, _godot_object, id, name); 249 } 250 /** 251 Sets the specified output port's type (see $(D VisualShaderNode.porttype)). 252 */ 253 void setOutputPortType(in long id, in long type) 254 { 255 checkClassBinding!(typeof(this))(); 256 ptrcall!(void)(GDNativeClassBinding.setOutputPortType, _godot_object, id, type); 257 } 258 /** 259 Defines all output ports using a $(D String) formatted as a colon-separated list: `id,type,name;` (see $(D addOutputPort)). 260 */ 261 void setOutputs(in String outputs) 262 { 263 checkClassBinding!(typeof(this))(); 264 ptrcall!(void)(GDNativeClassBinding.setOutputs, _godot_object, outputs); 265 } 266 /** 267 268 */ 269 void setSize(in Vector2 size) 270 { 271 checkClassBinding!(typeof(this))(); 272 ptrcall!(void)(GDNativeClassBinding.setSize, _godot_object, size); 273 } 274 /** 275 The size of the node in the visual shader graph. 276 */ 277 @property Vector2 size() 278 { 279 return getSize(); 280 } 281 /// ditto 282 @property void size(Vector2 v) 283 { 284 setSize(v); 285 } 286 }