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.animationnodestatemachinetransition; 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.resource; 25 /** 26 27 */ 28 @GodotBaseClass struct AnimationNodeStateMachineTransition 29 { 30 package(godot) enum string _GODOT_internal_name = "AnimationNodeStateMachineTransition"; 31 public: 32 @nogc nothrow: 33 union { /** */ godot_object _godot_object; /** */ Resource _GODOT_base; } 34 alias _GODOT_base this; 35 alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses); 36 package(godot) __gshared bool _classBindingInitialized = false; 37 package(godot) static struct GDNativeClassBinding 38 { 39 __gshared: 40 @GodotName("get_advance_condition") GodotMethod!(String) getAdvanceCondition; 41 @GodotName("get_priority") GodotMethod!(long) getPriority; 42 @GodotName("get_switch_mode") GodotMethod!(AnimationNodeStateMachineTransition.SwitchMode) getSwitchMode; 43 @GodotName("get_xfade_time") GodotMethod!(double) getXfadeTime; 44 @GodotName("has_auto_advance") GodotMethod!(bool) hasAutoAdvance; 45 @GodotName("is_disabled") GodotMethod!(bool) isDisabled; 46 @GodotName("set_advance_condition") GodotMethod!(void, String) setAdvanceCondition; 47 @GodotName("set_auto_advance") GodotMethod!(void, bool) setAutoAdvance; 48 @GodotName("set_disabled") GodotMethod!(void, bool) setDisabled; 49 @GodotName("set_priority") GodotMethod!(void, long) setPriority; 50 @GodotName("set_switch_mode") GodotMethod!(void, long) setSwitchMode; 51 @GodotName("set_xfade_time") GodotMethod!(void, double) setXfadeTime; 52 } 53 /// 54 pragma(inline, true) bool opEquals(in AnimationNodeStateMachineTransition other) const 55 { return _godot_object.ptr is other._godot_object.ptr; } 56 /// 57 pragma(inline, true) typeof(null) opAssign(typeof(null) n) 58 { _godot_object.ptr = n; return null; } 59 /// 60 pragma(inline, true) bool opEquals(typeof(null) n) const 61 { return _godot_object.ptr is n; } 62 /// 63 size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; } 64 mixin baseCasts; 65 /// Construct a new instance of AnimationNodeStateMachineTransition. 66 /// Note: use `memnew!AnimationNodeStateMachineTransition` instead. 67 static AnimationNodeStateMachineTransition _new() 68 { 69 static godot_class_constructor constructor; 70 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("AnimationNodeStateMachineTransition"); 71 if(constructor is null) return typeof(this).init; 72 return cast(AnimationNodeStateMachineTransition)(constructor()); 73 } 74 @disable new(size_t s); 75 /// 76 enum SwitchMode : int 77 { 78 /** 79 Switch to the next state immediately. The current state will end and blend into the beginning of the new one. 80 */ 81 switchModeImmediate = 0, 82 /** 83 Switch to the next state immediately, but will seek the new state to the playback position of the old state. 84 */ 85 switchModeSync = 1, 86 /** 87 Wait for the current state playback to end, then switch to the beginning of the next state animation. 88 */ 89 switchModeAtEnd = 2, 90 } 91 /// 92 enum Constants : int 93 { 94 switchModeImmediate = 0, 95 switchModeSync = 1, 96 switchModeAtEnd = 2, 97 } 98 /** 99 100 */ 101 String getAdvanceCondition() const 102 { 103 checkClassBinding!(typeof(this))(); 104 return ptrcall!(String)(GDNativeClassBinding.getAdvanceCondition, _godot_object); 105 } 106 /** 107 108 */ 109 long getPriority() const 110 { 111 checkClassBinding!(typeof(this))(); 112 return ptrcall!(long)(GDNativeClassBinding.getPriority, _godot_object); 113 } 114 /** 115 116 */ 117 AnimationNodeStateMachineTransition.SwitchMode getSwitchMode() const 118 { 119 checkClassBinding!(typeof(this))(); 120 return ptrcall!(AnimationNodeStateMachineTransition.SwitchMode)(GDNativeClassBinding.getSwitchMode, _godot_object); 121 } 122 /** 123 124 */ 125 double getXfadeTime() const 126 { 127 checkClassBinding!(typeof(this))(); 128 return ptrcall!(double)(GDNativeClassBinding.getXfadeTime, _godot_object); 129 } 130 /** 131 132 */ 133 bool hasAutoAdvance() const 134 { 135 checkClassBinding!(typeof(this))(); 136 return ptrcall!(bool)(GDNativeClassBinding.hasAutoAdvance, _godot_object); 137 } 138 /** 139 140 */ 141 bool isDisabled() const 142 { 143 checkClassBinding!(typeof(this))(); 144 return ptrcall!(bool)(GDNativeClassBinding.isDisabled, _godot_object); 145 } 146 /** 147 148 */ 149 void setAdvanceCondition(in String name) 150 { 151 checkClassBinding!(typeof(this))(); 152 ptrcall!(void)(GDNativeClassBinding.setAdvanceCondition, _godot_object, name); 153 } 154 /** 155 156 */ 157 void setAutoAdvance(in bool auto_advance) 158 { 159 checkClassBinding!(typeof(this))(); 160 ptrcall!(void)(GDNativeClassBinding.setAutoAdvance, _godot_object, auto_advance); 161 } 162 /** 163 164 */ 165 void setDisabled(in bool disabled) 166 { 167 checkClassBinding!(typeof(this))(); 168 ptrcall!(void)(GDNativeClassBinding.setDisabled, _godot_object, disabled); 169 } 170 /** 171 172 */ 173 void setPriority(in long priority) 174 { 175 checkClassBinding!(typeof(this))(); 176 ptrcall!(void)(GDNativeClassBinding.setPriority, _godot_object, priority); 177 } 178 /** 179 180 */ 181 void setSwitchMode(in long mode) 182 { 183 checkClassBinding!(typeof(this))(); 184 ptrcall!(void)(GDNativeClassBinding.setSwitchMode, _godot_object, mode); 185 } 186 /** 187 188 */ 189 void setXfadeTime(in double secs) 190 { 191 checkClassBinding!(typeof(this))(); 192 ptrcall!(void)(GDNativeClassBinding.setXfadeTime, _godot_object, secs); 193 } 194 /** 195 Turn on auto advance when this condition is set. The provided name will become a boolean parameter on the $(D AnimationTree) that can be controlled from code (see $(D url=https://docs.godotengine.org/en/3.3/tutorials/animation/animation_tree.html#controlling-from-code)$(D /url)). For example, if $(D AnimationTree.treeRoot) is an $(D AnimationNodeStateMachine) and $(D advanceCondition) is set to `"idle"`: 196 197 198 $animation_tree$(D "parameters/conditions/idle") = is_on_floor and (linear_velocity.x == 0) 199 200 201 */ 202 @property String advanceCondition() 203 { 204 return getAdvanceCondition(); 205 } 206 /// ditto 207 @property void advanceCondition(String v) 208 { 209 setAdvanceCondition(v); 210 } 211 /** 212 Turn on the transition automatically when this state is reached. This works best with $(D constant SWITCH_MODE_AT_END). 213 */ 214 @property bool autoAdvance() 215 { 216 return hasAutoAdvance(); 217 } 218 /// ditto 219 @property void autoAdvance(bool v) 220 { 221 setAutoAdvance(v); 222 } 223 /** 224 Don't use this transition during $(D AnimationNodeStateMachinePlayback.travel) or $(D autoAdvance). 225 */ 226 @property bool disabled() 227 { 228 return isDisabled(); 229 } 230 /// ditto 231 @property void disabled(bool v) 232 { 233 setDisabled(v); 234 } 235 /** 236 Lower priority transitions are preferred when travelling through the tree via $(D AnimationNodeStateMachinePlayback.travel) or $(D autoAdvance). 237 */ 238 @property long priority() 239 { 240 return getPriority(); 241 } 242 /// ditto 243 @property void priority(long v) 244 { 245 setPriority(v); 246 } 247 /** 248 The transition type. 249 */ 250 @property AnimationNodeStateMachineTransition.SwitchMode switchMode() 251 { 252 return getSwitchMode(); 253 } 254 /// ditto 255 @property void switchMode(long v) 256 { 257 setSwitchMode(v); 258 } 259 /** 260 The time to cross-fade between this state and the next. 261 */ 262 @property double xfadeTime() 263 { 264 return getXfadeTime(); 265 } 266 /// ditto 267 @property void xfadeTime(double v) 268 { 269 setXfadeTime(v); 270 } 271 }