1 /**
2 Playback control for $(D AnimationNodeStateMachine).
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.animationnodestatemachineplayback;
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 Playback control for $(D AnimationNodeStateMachine).
27 
28 Allows control of $(D AnimationTree) state machines created with $(D AnimationNodeStateMachine). Retrieve with `$AnimationTree.get("parameters/playback")`.
29 $(B Example:)
30 
31 
32 var state_machine = $AnimationTree.get("parameters/playback")
33 state_machine.travel("some_state")
34 
35 
36 */
37 @GodotBaseClass struct AnimationNodeStateMachinePlayback
38 {
39 	package(godot) enum string _GODOT_internal_name = "AnimationNodeStateMachinePlayback";
40 public:
41 @nogc nothrow:
42 	union { /** */ godot_object _godot_object; /** */ Resource _GODOT_base; }
43 	alias _GODOT_base this;
44 	alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses);
45 	package(godot) __gshared bool _classBindingInitialized = false;
46 	package(godot) static struct GDNativeClassBinding
47 	{
48 		__gshared:
49 		@GodotName("get_current_length") GodotMethod!(double) getCurrentLength;
50 		@GodotName("get_current_node") GodotMethod!(String) getCurrentNode;
51 		@GodotName("get_current_play_position") GodotMethod!(double) getCurrentPlayPosition;
52 		@GodotName("get_travel_path") GodotMethod!(PoolStringArray) getTravelPath;
53 		@GodotName("is_playing") GodotMethod!(bool) isPlaying;
54 		@GodotName("start") GodotMethod!(void, String) start;
55 		@GodotName("stop") GodotMethod!(void) stop;
56 		@GodotName("travel") GodotMethod!(void, String) travel;
57 	}
58 	/// 
59 	pragma(inline, true) bool opEquals(in AnimationNodeStateMachinePlayback other) const
60 	{ return _godot_object.ptr is other._godot_object.ptr; }
61 	/// 
62 	pragma(inline, true) typeof(null) opAssign(typeof(null) n)
63 	{ _godot_object.ptr = n; return null; }
64 	/// 
65 	pragma(inline, true) bool opEquals(typeof(null) n) const
66 	{ return _godot_object.ptr is n; }
67 	/// 
68 	size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; }
69 	mixin baseCasts;
70 	/// Construct a new instance of AnimationNodeStateMachinePlayback.
71 	/// Note: use `memnew!AnimationNodeStateMachinePlayback` instead.
72 	static AnimationNodeStateMachinePlayback _new()
73 	{
74 		static godot_class_constructor constructor;
75 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("AnimationNodeStateMachinePlayback");
76 		if(constructor is null) return typeof(this).init;
77 		return cast(AnimationNodeStateMachinePlayback)(constructor());
78 	}
79 	@disable new(size_t s);
80 	/**
81 	
82 	*/
83 	double getCurrentLength() const
84 	{
85 		checkClassBinding!(typeof(this))();
86 		return ptrcall!(double)(GDNativeClassBinding.getCurrentLength, _godot_object);
87 	}
88 	/**
89 	Returns the currently playing animation state.
90 	*/
91 	String getCurrentNode() const
92 	{
93 		checkClassBinding!(typeof(this))();
94 		return ptrcall!(String)(GDNativeClassBinding.getCurrentNode, _godot_object);
95 	}
96 	/**
97 	Returns the playback position within the current animation state.
98 	*/
99 	double getCurrentPlayPosition() const
100 	{
101 		checkClassBinding!(typeof(this))();
102 		return ptrcall!(double)(GDNativeClassBinding.getCurrentPlayPosition, _godot_object);
103 	}
104 	/**
105 	Returns the current travel path as computed internally by the A* algorithm.
106 	*/
107 	PoolStringArray getTravelPath() const
108 	{
109 		checkClassBinding!(typeof(this))();
110 		return ptrcall!(PoolStringArray)(GDNativeClassBinding.getTravelPath, _godot_object);
111 	}
112 	/**
113 	Returns `true` if an animation is playing.
114 	*/
115 	bool isPlaying() const
116 	{
117 		checkClassBinding!(typeof(this))();
118 		return ptrcall!(bool)(GDNativeClassBinding.isPlaying, _godot_object);
119 	}
120 	/**
121 	Starts playing the given animation.
122 	*/
123 	void start(in String node)
124 	{
125 		checkClassBinding!(typeof(this))();
126 		ptrcall!(void)(GDNativeClassBinding.start, _godot_object, node);
127 	}
128 	/**
129 	Stops the currently playing animation.
130 	*/
131 	void stop()
132 	{
133 		checkClassBinding!(typeof(this))();
134 		ptrcall!(void)(GDNativeClassBinding.stop, _godot_object);
135 	}
136 	/**
137 	Transitions from the current state to another one, following the shortest path.
138 	*/
139 	void travel(in String to_node)
140 	{
141 		checkClassBinding!(typeof(this))();
142 		ptrcall!(void)(GDNativeClassBinding.travel, _godot_object, to_node);
143 	}
144 }