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