29 #ifndef ANIMATION_TREE_PLAYER_H 30 #define ANIMATION_TREE_PLAYER_H 33 #include "scene/resources/animation.h" 34 #include "scene/3d/spatial.h" 35 #include "scene/3d/skeleton.h" 36 #include "scene/main/misc.h" 37 #include "animation_player.h" 43 OBJ_CATEGORY(
"Animation Nodes");
46 enum AnimationProcessMode {
47 ANIMATION_PROCESS_FIXED,
48 ANIMATION_PROCESS_IDLE,
87 inline bool operator<(
const TrackKey& p_right)
const {
90 if (bone_idx==p_right.bone_idx) {
91 return property<p_right.property;
93 return bone_idx<p_right.bone_idx;
136 NodeBase() { cycletest =
false; };
137 virtual ~NodeBase() { cycletest=
false; }
140 struct NodeOut :
public NodeBase {
142 NodeOut() { type=NODE_OUTPUT; inputs.resize(1); }
145 struct AnimationNode :
public NodeBase {
156 uint64_t last_version;
163 AnimationNode() { type=NODE_ANIMATION; next=NULL; last_version=0; skip=
false; }
167 struct OneShotNode :
public NodeBase {
175 float autorestart_delay;
176 float autorestart_random_delay;
182 float autorestart_remaining;
186 OneShotNode() { type=NODE_ONESHOT; fade_in=0; fade_out=0; inputs.resize(2); autorestart=
false; autorestart_delay=1; autorestart_remaining=0; mix=
false; active=
false; start=
false;}
189 struct MixNode :
public NodeBase {
192 MixNode() { type=NODE_MIX; inputs.resize(2); }
195 struct Blend2Node :
public NodeBase {
199 Blend2Node() { type=NODE_BLEND2; value=0; inputs.resize(2); }
202 struct Blend3Node :
public NodeBase {
205 Blend3Node() { type=NODE_BLEND3; value=0; inputs.resize(3); }
208 struct Blend4Node :
public NodeBase {
211 Blend4Node() { type=NODE_BLEND4; inputs.resize(4); }
214 struct TimeScaleNode :
public NodeBase {
217 TimeScaleNode() { type=NODE_TIMESCALE; scale=1; inputs.resize(1); }
220 struct TimeSeekNode :
public NodeBase {
224 TimeSeekNode() { type=NODE_TIMESEEK; inputs.resize(1); seek_pos=-1; }
227 struct TransitionNode :
public NodeBase {
248 TransitionNode() { type=NODE_TRANSITION; xfade=0; inputs.resize(1); input_data.resize(1); current=0; prev=-1; prev_time=0; prev_xfading=0; switched=
false; }
252 void _update_sources();
261 ConnectError last_error;
262 AnimationNode *active_list;
263 AnimationProcessMode animation_process_mode;
270 float _process_node(
const StringName& p_node,AnimationNode **r_prev_anim,
float p_weight,
float p_step,
bool switched,
bool p_seek=
false,
const HashMap<NodePath,bool> *p_filter=NULL,
float p_reverse_weight=0);
271 void _process_animation(
float p_delta);
274 ConnectError _cycle_test(
const StringName &p_at_node);
276 Track* _find_track(
const NodePath& p_path);
277 void _recompute_caches();
278 void _recompute_caches(
const StringName& p_node);
289 void _notification(
int p_what);
291 static void _bind_methods();
297 void add_node(NodeType p_type,
const StringName& p_node);
298 bool node_exists(
const StringName& p_name)
const;
301 int node_get_input_count(
const StringName& p_node)
const;
307 void animation_node_set_master_animation(
const StringName& p_node,
const String& p_master_animation);
312 void oneshot_node_set_fadein_time(
const StringName& p_node,
float p_time);
313 void oneshot_node_set_fadeout_time(
const StringName& p_node,
float p_time);
315 float oneshot_node_get_fadein_time(
const StringName& p_node)
const;
316 float oneshot_node_get_fadeout_time(
const StringName& p_node)
const;
318 void oneshot_node_set_autorestart(
const StringName& p_node,
bool p_active);
319 void oneshot_node_set_autorestart_delay(
const StringName& p_node,
float p_time);
320 void oneshot_node_set_autorestart_random_delay(
const StringName& p_node,
float p_time);
322 bool oneshot_node_has_autorestart(
const StringName& p_node)
const;
323 float oneshot_node_get_autorestart_delay(
const StringName& p_node)
const;
324 float oneshot_node_get_autorestart_random_delay(
const StringName& p_node)
const;
326 void oneshot_node_set_mix_mode(
const StringName& p_node,
bool p_enabled);
327 bool oneshot_node_get_mix_mode(
const StringName& p_node)
const;
329 void oneshot_node_start(
const StringName& p_node);
330 void oneshot_node_stop(
const StringName& p_node);
331 bool oneshot_node_is_active(
const StringName& p_node)
const;
333 void oneshot_node_set_filter_path(
const StringName& p_node,
const NodePath& p_filter,
bool p_enable);
335 bool oneshot_node_is_path_filtered(
const StringName& p_node,
const NodePath& p_path)
const;
340 void mix_node_set_amount(
const StringName& p_node,
float p_amount);
341 float mix_node_get_amount(
const StringName& p_node)
const;
343 void blend2_node_set_amount(
const StringName& p_node,
float p_amount);
344 float blend2_node_get_amount(
const StringName& p_node)
const;
345 void blend2_node_set_filter_path(
const StringName& p_node,
const NodePath& p_filter,
bool p_enable);
347 bool blend2_node_is_path_filtered(
const StringName& p_node,
const NodePath& p_path)
const;
349 void blend3_node_set_amount(
const StringName& p_node,
float p_amount);
350 float blend3_node_get_amount(
const StringName& p_node)
const;
352 void blend4_node_set_amount(
const StringName& p_node,
const Point2& p_amount);
357 void timescale_node_set_scale(
const StringName& p_node,
float p_scale);
358 float timescale_node_get_scale(
const StringName& p_node)
const;
360 void timeseek_node_seek(
const StringName& p_node,
float p_pos);
364 void transition_node_set_input_count(
const StringName& p_node,
int p_inputs);
365 int transition_node_get_input_count(
const StringName& p_node)
const;
366 void transition_node_delete_input(
const StringName& p_node,
int p_input);
368 void transition_node_set_input_auto_advance(
const StringName& p_node,
int p_input,
bool p_auto_advance);
369 bool transition_node_has_input_auto_advance(
const StringName& p_node,
int p_input)
const;
371 void transition_node_set_xfade_time(
const StringName& p_node,
float p_time);
372 float transition_node_get_xfade_time(
const StringName& p_node)
const;
374 void transition_node_set_current(
const StringName& p_node,
int p_current);
375 int transition_node_get_current(
const StringName& p_node)
const;
383 NodeType node_get_type(
const StringName& p_node)
const;
389 bool is_connected(
const StringName& p_src_node,
const StringName& p_dst_node,
int p_input)
const;
390 void disconnect(
const StringName& p_src_node,
int p_input);
392 void set_base_path(
const NodePath& p_path);
395 void set_master_player(
const NodePath& p_path);
409 void set_active(
bool p_active);
410 bool is_active()
const;
414 void recompute_caches();
416 ConnectError get_last_error()
const;
418 void set_animation_process_mode(AnimationProcessMode p_mode);
419 AnimationProcessMode get_animation_process_mode()
const;
421 void _set_process(
bool p_process,
bool p_force =
false);
423 void advance(
float p_time);
430 VARIANT_ENUM_CAST( AnimationTreePlayer::NodeType );
431 VARIANT_ENUM_CAST( AnimationTreePlayer::AnimationProcessMode );
433 #endif // ANIMATION_TREE_PLAYER_H
Definition: animation_tree_player.h:150
Definition: string_db.h:48
Definition: animation_tree_player.h:398
Definition: skeleton.h:38
Definition: animation_tree_player.h:40