diff options
Diffstat (limited to 'scene/animation')
-rw-r--r-- | scene/animation/animation_cache.cpp | 6 | ||||
-rw-r--r-- | scene/animation/animation_cache.h | 2 | ||||
-rw-r--r-- | scene/animation/animation_player.cpp | 39 | ||||
-rw-r--r-- | scene/animation/animation_player.h | 2 | ||||
-rw-r--r-- | scene/animation/animation_tree_player.cpp | 32 | ||||
-rw-r--r-- | scene/animation/animation_tree_player.h | 2 | ||||
-rw-r--r-- | scene/animation/tween.cpp | 64 | ||||
-rw-r--r-- | scene/animation/tween.h | 2 | ||||
-rw-r--r-- | scene/animation/tween_interpolaters.cpp | 2 |
9 files changed, 66 insertions, 85 deletions
diff --git a/scene/animation/animation_cache.cpp b/scene/animation/animation_cache.cpp index 31fee0e347..b35b2568d1 100644 --- a/scene/animation/animation_cache.cpp +++ b/scene/animation/animation_cache.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ @@ -120,7 +120,7 @@ void AnimationCache::_update_cache() { StringName property = np.get_property(); String ps = property; - Spatial *sp = node->cast_to<Spatial>(); + Spatial *sp = Object::cast_to<Spatial>(node); if (!sp) { @@ -131,7 +131,7 @@ void AnimationCache::_update_cache() { if (ps != "") { - Skeleton *sk = node->cast_to<Skeleton>(); + Skeleton *sk = Object::cast_to<Skeleton>(node); if (!sk) { path_cache.push_back(Path()); diff --git a/scene/animation/animation_cache.h b/scene/animation/animation_cache.h index 6687098d00..e593668df6 100644 --- a/scene/animation/animation_cache.h +++ b/scene/animation/animation_cache.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp index e2a0636466..be0b652276 100644 --- a/scene/animation/animation_player.cpp +++ b/scene/animation/animation_player.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ @@ -29,6 +29,7 @@ /*************************************************************************/ #include "animation_player.h" +#include "engine.h" #include "message_queue.h" #include "scene/scene_string_names.h" @@ -199,7 +200,7 @@ void AnimationPlayer::_notification(int p_what) { } break; case NOTIFICATION_READY: { - if (!get_tree()->is_editor_hint() && animation_set.has(autoplay)) { + if (!Engine::get_singleton()->is_editor_hint() && animation_set.has(autoplay)) { play(autoplay); set_autoplay(""); //this line is the fix for autoplay issues with animatio _animation_process(0); @@ -250,9 +251,9 @@ void AnimationPlayer::_generate_node_caches(AnimationData *p_anim) { uint32_t id = resource.is_valid() ? resource->get_instance_id() : child->get_instance_id(); int bone_idx = -1; - if (a->track_get_path(i).get_property() && child->cast_to<Skeleton>()) { + if (a->track_get_path(i).get_property() && Object::cast_to<Skeleton>(child)) { - bone_idx = child->cast_to<Skeleton>()->find_bone(a->track_get_path(i).get_property()); + bone_idx = Object::cast_to<Skeleton>(child)->find_bone(a->track_get_path(i).get_property()); if (bone_idx == -1) { continue; @@ -279,14 +280,14 @@ void AnimationPlayer::_generate_node_caches(AnimationData *p_anim) { p_anim->node_cache[i]->path = a->track_get_path(i); p_anim->node_cache[i]->node = child; p_anim->node_cache[i]->resource = resource; - p_anim->node_cache[i]->node_2d = child->cast_to<Node2D>(); + p_anim->node_cache[i]->node_2d = Object::cast_to<Node2D>(child); if (a->track_get_type(i) == Animation::TYPE_TRANSFORM) { // special cases and caches for transform tracks // cache spatial - p_anim->node_cache[i]->spatial = child->cast_to<Spatial>(); + p_anim->node_cache[i]->spatial = Object::cast_to<Spatial>(child); // cache skeleton - p_anim->node_cache[i]->skeleton = child->cast_to<Skeleton>(); + p_anim->node_cache[i]->skeleton = Object::cast_to<Skeleton>(child); if (p_anim->node_cache[i]->skeleton) { StringName bone_name = a->track_get_path(i).get_property(); @@ -344,7 +345,7 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, float ERR_FAIL_COND(p_anim->node_cache.size() != p_anim->animation->get_track_count()); Animation *a = p_anim->animation.operator->(); - bool can_call = is_inside_tree() && !get_tree()->is_editor_hint(); + bool can_call = is_inside_tree() && !Engine::get_singleton()->is_editor_hint(); for (int i = 0; i < a->get_track_count(); i++) { @@ -607,16 +608,6 @@ void AnimationPlayer::_animation_update_transforms() { ERR_CONTINUE(pa->accum_pass != accum_pass); -#if 1 - /* switch(pa->special) { - - - case SP_NONE: pa->object->set(pa->prop,pa->value_accum); break; //you are not speshul - case SP_NODE2D_POS: static_cast<Node2D*>(pa->object)->set_position(pa->value_accum); break; - case SP_NODE2D_ROT: static_cast<Node2D*>(pa->object)->set_rot(Math::deg2rad(pa->value_accum)); break; - case SP_NODE2D_SCALE: static_cast<Node2D*>(pa->object)->set_scale(pa->value_accum); break; - }*/ - switch (pa->special) { case SP_NONE: { @@ -656,10 +647,6 @@ void AnimationPlayer::_animation_update_transforms() { static_cast<Node2D *>(pa->object)->set_scale(pa->value_accum); } break; } -#else - - pa->object->set(pa->prop, pa->value_accum); -#endif } cache_update_prop_size = 0; @@ -667,8 +654,6 @@ void AnimationPlayer::_animation_update_transforms() { void AnimationPlayer::_animation_process(float p_delta) { - //bool any_active=false; - if (playback.current.from) { end_notify = false; @@ -955,7 +940,7 @@ void AnimationPlayer::play(const StringName &p_name, float p_custom_blend, float emit_signal(SceneStringNames::get_singleton()->animation_started, c.assigned); - if (is_inside_tree() && get_tree()->is_editor_hint()) + if (is_inside_tree() && Engine::get_singleton()->is_editor_hint()) return; // no next in this case StringName next = animation_get_next(p_name); @@ -1277,8 +1262,8 @@ void AnimationPlayer::_bind_methods() { ADD_SIGNAL(MethodInfo("animation_changed", PropertyInfo(Variant::STRING, "old_name"), PropertyInfo(Variant::STRING, "new_name"))); ADD_SIGNAL(MethodInfo("animation_started", PropertyInfo(Variant::STRING, "name"))); - BIND_CONSTANT(ANIMATION_PROCESS_FIXED); - BIND_CONSTANT(ANIMATION_PROCESS_IDLE); + BIND_ENUM_CONSTANT(ANIMATION_PROCESS_FIXED); + BIND_ENUM_CONSTANT(ANIMATION_PROCESS_IDLE); } AnimationPlayer::AnimationPlayer() { diff --git a/scene/animation/animation_player.h b/scene/animation/animation_player.h index 01b709205a..c6e52145a8 100644 --- a/scene/animation/animation_player.h +++ b/scene/animation/animation_player.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/animation/animation_tree_player.cpp b/scene/animation/animation_tree_player.cpp index c12e97c4a5..e2330eb0d4 100644 --- a/scene/animation/animation_tree_player.cpp +++ b/scene/animation/animation_tree_player.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ @@ -1487,8 +1487,8 @@ AnimationTreePlayer::Track *AnimationTreePlayer::_find_track(const NodePath &p_p if (p_path.get_property()) { - if (child->cast_to<Skeleton>()) - bone_idx = child->cast_to<Skeleton>()->find_bone(p_path.get_property()); + if (Object::cast_to<Skeleton>(child)) + bone_idx = Object::cast_to<Skeleton>(child)->find_bone(p_path.get_property()); if (bone_idx == -1) property = p_path.get_property(); } @@ -1503,8 +1503,8 @@ AnimationTreePlayer::Track *AnimationTreePlayer::_find_track(const NodePath &p_p Track tr; tr.id = id; tr.object = resource.is_valid() ? (Object *)resource.ptr() : (Object *)child; - tr.skeleton = child->cast_to<Skeleton>(); - tr.spatial = child->cast_to<Spatial>(); + tr.skeleton = Object::cast_to<Skeleton>(child); + tr.spatial = Object::cast_to<Spatial>(child); tr.bone_idx = bone_idx; tr.property = property; @@ -1644,7 +1644,7 @@ void AnimationTreePlayer::_update_sources() { ERR_FAIL_COND(!m); } - AnimationPlayer *ap = m->cast_to<AnimationPlayer>(); + AnimationPlayer *ap = Object::cast_to<AnimationPlayer>(m); if (!ap) { @@ -1797,16 +1797,16 @@ void AnimationTreePlayer::_bind_methods() { ADD_GROUP("Playback", "playback_"); ADD_PROPERTY(PropertyInfo(Variant::INT, "playback_process_mode", PROPERTY_HINT_ENUM, "Fixed,Idle"), "set_animation_process_mode", "get_animation_process_mode"); - BIND_CONSTANT(NODE_OUTPUT); - BIND_CONSTANT(NODE_ANIMATION); - BIND_CONSTANT(NODE_ONESHOT); - BIND_CONSTANT(NODE_MIX); - BIND_CONSTANT(NODE_BLEND2); - BIND_CONSTANT(NODE_BLEND3); - BIND_CONSTANT(NODE_BLEND4); - BIND_CONSTANT(NODE_TIMESCALE); - BIND_CONSTANT(NODE_TIMESEEK); - BIND_CONSTANT(NODE_TRANSITION); + BIND_ENUM_CONSTANT(NODE_OUTPUT); + BIND_ENUM_CONSTANT(NODE_ANIMATION); + BIND_ENUM_CONSTANT(NODE_ONESHOT); + BIND_ENUM_CONSTANT(NODE_MIX); + BIND_ENUM_CONSTANT(NODE_BLEND2); + BIND_ENUM_CONSTANT(NODE_BLEND3); + BIND_ENUM_CONSTANT(NODE_BLEND4); + BIND_ENUM_CONSTANT(NODE_TIMESCALE); + BIND_ENUM_CONSTANT(NODE_TIMESEEK); + BIND_ENUM_CONSTANT(NODE_TRANSITION); } AnimationTreePlayer::AnimationTreePlayer() { diff --git a/scene/animation/animation_tree_player.h b/scene/animation/animation_tree_player.h index 47f18795bd..71d7277118 100644 --- a/scene/animation/animation_tree_player.h +++ b/scene/animation/animation_tree_player.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp index 78d3357bb4..fb61c43d5c 100644 --- a/scene/animation/tween.cpp +++ b/scene/animation/tween.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ @@ -224,25 +224,25 @@ void Tween::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "playback_process_mode", PROPERTY_HINT_ENUM, "Fixed,Idle"), "set_tween_process_mode", "get_tween_process_mode"); - BIND_CONSTANT(TWEEN_PROCESS_FIXED); - BIND_CONSTANT(TWEEN_PROCESS_IDLE); - - BIND_CONSTANT(TRANS_LINEAR); - BIND_CONSTANT(TRANS_SINE); - BIND_CONSTANT(TRANS_QUINT); - BIND_CONSTANT(TRANS_QUART); - BIND_CONSTANT(TRANS_QUAD); - BIND_CONSTANT(TRANS_EXPO); - BIND_CONSTANT(TRANS_ELASTIC); - BIND_CONSTANT(TRANS_CUBIC); - BIND_CONSTANT(TRANS_CIRC); - BIND_CONSTANT(TRANS_BOUNCE); - BIND_CONSTANT(TRANS_BACK); - - BIND_CONSTANT(EASE_IN); - BIND_CONSTANT(EASE_OUT); - BIND_CONSTANT(EASE_IN_OUT); - BIND_CONSTANT(EASE_OUT_IN); + BIND_ENUM_CONSTANT(TWEEN_PROCESS_FIXED); + BIND_ENUM_CONSTANT(TWEEN_PROCESS_IDLE); + + BIND_ENUM_CONSTANT(TRANS_LINEAR); + BIND_ENUM_CONSTANT(TRANS_SINE); + BIND_ENUM_CONSTANT(TRANS_QUINT); + BIND_ENUM_CONSTANT(TRANS_QUART); + BIND_ENUM_CONSTANT(TRANS_QUAD); + BIND_ENUM_CONSTANT(TRANS_EXPO); + BIND_ENUM_CONSTANT(TRANS_ELASTIC); + BIND_ENUM_CONSTANT(TRANS_CUBIC); + BIND_ENUM_CONSTANT(TRANS_CIRC); + BIND_ENUM_CONSTANT(TRANS_BOUNCE); + BIND_ENUM_CONSTANT(TRANS_BACK); + + BIND_ENUM_CONSTANT(EASE_IN); + BIND_ENUM_CONSTANT(EASE_OUT); + BIND_ENUM_CONSTANT(EASE_IN_OUT); + BIND_ENUM_CONSTANT(EASE_OUT_IN); } Variant &Tween::_get_initial_val(InterpolateData &p_data) { @@ -560,12 +560,16 @@ void Tween::_tween_process(float p_delta) { switch (data.type) { case INTER_PROPERTY: - case INTER_METHOD: - break; + case INTER_METHOD: { + Variant result = _run_equation(data); + emit_signal("tween_step", object, data.key, data.elapsed, result); + _apply_tween_value(data, result); + if (data.finish) + _apply_tween_value(data, data.final_val); + } break; + case INTER_CALLBACK: if (data.finish) { - - Variant::CallError error; if (data.call_deferred) { switch (data.args) { @@ -588,8 +592,8 @@ void Tween::_tween_process(float p_delta) { object->call_deferred(data.key, data.arg[0], data.arg[1], data.arg[2], data.arg[3], data.arg[4]); break; } - } else { + Variant::CallError error; Variant *arg[5] = { &data.arg[0], &data.arg[1], @@ -599,19 +603,11 @@ void Tween::_tween_process(float p_delta) { }; object->call(data.key, (const Variant **)arg, data.args, error); } - if (!repeat) - call_deferred("_remove", object, data.key, true); } - continue; + break; } - Variant result = _run_equation(data); - emit_signal("tween_step", object, data.key, data.elapsed, result); - - _apply_tween_value(data, result); - if (data.finish) { - _apply_tween_value(data, data.final_val); emit_signal("tween_completed", object, data.key); // not repeat mode, remove completed action if (!repeat) diff --git a/scene/animation/tween.h b/scene/animation/tween.h index 43234fab86..929d63a7fc 100644 --- a/scene/animation/tween.h +++ b/scene/animation/tween.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/scene/animation/tween_interpolaters.cpp b/scene/animation/tween_interpolaters.cpp index 434f4df3e1..8f543a575a 100644 --- a/scene/animation/tween_interpolaters.cpp +++ b/scene/animation/tween_interpolaters.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ |