1 /** 2 $(D AnimationTree) node resource that contains many blend type nodes. 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.animationnodeblendtree; 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.animationrootnode; 25 import godot.animationnode; 26 /** 27 $(D AnimationTree) node resource that contains many blend type nodes. 28 29 This node may contain a sub-tree of any other blend type nodes, such as mix, blend2, blend3, one shot, etc. This is one of the most commonly used roots. 30 */ 31 @GodotBaseClass struct AnimationNodeBlendTree 32 { 33 package(godot) enum string _GODOT_internal_name = "AnimationNodeBlendTree"; 34 public: 35 @nogc nothrow: 36 union { /** */ godot_object _godot_object; /** */ AnimationRootNode _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("_node_changed") GodotMethod!(void, String) _nodeChanged; 44 @GodotName("_tree_changed") GodotMethod!(void) _treeChanged; 45 @GodotName("add_node") GodotMethod!(void, String, AnimationNode, Vector2) addNode; 46 @GodotName("connect_node") GodotMethod!(void, String, long, String) connectNode; 47 @GodotName("disconnect_node") GodotMethod!(void, String, long) disconnectNode; 48 @GodotName("get_graph_offset") GodotMethod!(Vector2) getGraphOffset; 49 @GodotName("get_node") GodotMethod!(AnimationNode, String) getNode; 50 @GodotName("get_node_position") GodotMethod!(Vector2, String) getNodePosition; 51 @GodotName("has_node") GodotMethod!(bool, String) hasNode; 52 @GodotName("remove_node") GodotMethod!(void, String) removeNode; 53 @GodotName("rename_node") GodotMethod!(void, String, String) renameNode; 54 @GodotName("set_graph_offset") GodotMethod!(void, Vector2) setGraphOffset; 55 @GodotName("set_node_position") GodotMethod!(void, String, Vector2) setNodePosition; 56 } 57 /// 58 pragma(inline, true) bool opEquals(in AnimationNodeBlendTree other) const 59 { return _godot_object.ptr is other._godot_object.ptr; } 60 /// 61 pragma(inline, true) typeof(null) opAssign(typeof(null) n) 62 { _godot_object.ptr = n; return null; } 63 /// 64 pragma(inline, true) bool opEquals(typeof(null) n) const 65 { return _godot_object.ptr is n; } 66 /// 67 size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; } 68 mixin baseCasts; 69 /// Construct a new instance of AnimationNodeBlendTree. 70 /// Note: use `memnew!AnimationNodeBlendTree` instead. 71 static AnimationNodeBlendTree _new() 72 { 73 static godot_class_constructor constructor; 74 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("AnimationNodeBlendTree"); 75 if(constructor is null) return typeof(this).init; 76 return cast(AnimationNodeBlendTree)(constructor()); 77 } 78 @disable new(size_t s); 79 /// 80 enum Constants : int 81 { 82 /** 83 The connection was successful. 84 */ 85 connectionOk = 0, 86 /** 87 The input node is `null`. 88 */ 89 connectionErrorNoInput = 1, 90 /** 91 The specified input port is out of range. 92 */ 93 connectionErrorNoInputIndex = 2, 94 /** 95 The output node is `null`. 96 */ 97 connectionErrorNoOutput = 3, 98 /** 99 Input and output nodes are the same. 100 */ 101 connectionErrorSameNode = 4, 102 /** 103 The specified connection already exists. 104 */ 105 connectionErrorConnectionExists = 5, 106 } 107 /** 108 109 */ 110 void _nodeChanged(in String node) 111 { 112 Array _GODOT_args = Array.make(); 113 _GODOT_args.append(node); 114 String _GODOT_method_name = String("_node_changed"); 115 this.callv(_GODOT_method_name, _GODOT_args); 116 } 117 /** 118 119 */ 120 void _treeChanged() 121 { 122 Array _GODOT_args = Array.make(); 123 String _GODOT_method_name = String("_tree_changed"); 124 this.callv(_GODOT_method_name, _GODOT_args); 125 } 126 /** 127 Adds an $(D AnimationNode) at the given `position`. The `name` is used to identify the created sub-node later. 128 */ 129 void addNode(in String name, AnimationNode node, in Vector2 position = Vector2(0, 0)) 130 { 131 checkClassBinding!(typeof(this))(); 132 ptrcall!(void)(GDNativeClassBinding.addNode, _godot_object, name, node, position); 133 } 134 /** 135 Connects the output of an $(D AnimationNode) as input for another $(D AnimationNode), at the input port specified by `input_index`. 136 */ 137 void connectNode(in String input_node, in long input_index, in String output_node) 138 { 139 checkClassBinding!(typeof(this))(); 140 ptrcall!(void)(GDNativeClassBinding.connectNode, _godot_object, input_node, input_index, output_node); 141 } 142 /** 143 Disconnects the node connected to the specified input. 144 */ 145 void disconnectNode(in String input_node, in long input_index) 146 { 147 checkClassBinding!(typeof(this))(); 148 ptrcall!(void)(GDNativeClassBinding.disconnectNode, _godot_object, input_node, input_index); 149 } 150 /** 151 152 */ 153 Vector2 getGraphOffset() const 154 { 155 checkClassBinding!(typeof(this))(); 156 return ptrcall!(Vector2)(GDNativeClassBinding.getGraphOffset, _godot_object); 157 } 158 /** 159 Returns the sub-node with the specified `name`. 160 */ 161 Ref!AnimationNode getNode(in String name) const 162 { 163 checkClassBinding!(typeof(this))(); 164 return ptrcall!(AnimationNode)(GDNativeClassBinding.getNode, _godot_object, name); 165 } 166 /** 167 Returns the position of the sub-node with the specified `name`. 168 */ 169 Vector2 getNodePosition(in String name) const 170 { 171 checkClassBinding!(typeof(this))(); 172 return ptrcall!(Vector2)(GDNativeClassBinding.getNodePosition, _godot_object, name); 173 } 174 /** 175 Returns `true` if a sub-node with specified `name` exists. 176 */ 177 bool hasNode(in String name) const 178 { 179 checkClassBinding!(typeof(this))(); 180 return ptrcall!(bool)(GDNativeClassBinding.hasNode, _godot_object, name); 181 } 182 /** 183 Removes a sub-node. 184 */ 185 void removeNode(in String name) 186 { 187 checkClassBinding!(typeof(this))(); 188 ptrcall!(void)(GDNativeClassBinding.removeNode, _godot_object, name); 189 } 190 /** 191 Changes the name of a sub-node. 192 */ 193 void renameNode(in String name, in String new_name) 194 { 195 checkClassBinding!(typeof(this))(); 196 ptrcall!(void)(GDNativeClassBinding.renameNode, _godot_object, name, new_name); 197 } 198 /** 199 200 */ 201 void setGraphOffset(in Vector2 offset) 202 { 203 checkClassBinding!(typeof(this))(); 204 ptrcall!(void)(GDNativeClassBinding.setGraphOffset, _godot_object, offset); 205 } 206 /** 207 Modifies the position of a sub-node. 208 */ 209 void setNodePosition(in String name, in Vector2 position) 210 { 211 checkClassBinding!(typeof(this))(); 212 ptrcall!(void)(GDNativeClassBinding.setNodePosition, _godot_object, name, position); 213 } 214 /** 215 The global offset of all sub-nodes. 216 */ 217 @property Vector2 graphOffset() 218 { 219 return getGraphOffset(); 220 } 221 /// ditto 222 @property void graphOffset(Vector2 v) 223 { 224 setGraphOffset(v); 225 } 226 }