void AnimationPlayer::_animation_process(float p_delta) { if (playback.current.from) { end_notify = false; _animation_process2(p_delta); _animation_update_transforms(); if (end_notify) { if (queued.size()) { String old = playback.assigned; play(queued.front()->get()); String new_name = playback.assigned; queued.pop_front(); end_notify = false; emit_signal(SceneStringNames::get_singleton()->animation_changed, old, new_name); } else { //stop(); playing = false; _set_process(false); end_notify = false; emit_signal(SceneStringNames::get_singleton()->animation_finished, playback.assigned); } } } else { _set_process(false); } }
void Tween::set_tween_process_mode(TweenProcessMode p_mode) { if (tween_process_mode==p_mode) return; bool pr = processing; if (pr) _set_process(false); tween_process_mode=p_mode; if (pr) _set_process(true); }
void AnimationPlayer::set_animation_process_mode(AnimationProcessMode p_mode) { if (animation_process_mode == p_mode) return; bool pr = processing; if (pr) _set_process(false); animation_process_mode = p_mode; if (pr) _set_process(true); }
void AnimationPlayer::stop_all() { stop(); _set_process(false); // always process when starting an animation }
void Timer::start(float p_time) { if (p_time > 0) { set_wait_time(p_time); } time_left = wait_time; _set_process(true); }
void Timer::set_paused(bool p_paused) { if (paused == p_paused) return; paused = p_paused; _set_process(processing); }
void AnimationPlayer::set_active(bool p_active) { if (active == p_active) return; active = p_active; _set_process(processing, true); }
void Tween::set_active(bool p_active) { if (active==p_active) return; active=p_active; _set_process(processing,true); }
void Timer::set_active(bool p_active) { if (active == p_active) return; active = p_active; _set_process(processing); }
bool Tween::remove_all() { ERR_FAIL_COND_V(pending_update != 0, false); set_active(false); _set_process(false); interpolates.clear(); return true; }
void AnimationPlayer::stop() { Playback &c=playback; c.blend.clear(); c.current.from=NULL; _set_process(false); queued.clear(); playing = false; }
bool Tween::remove_all() { if(pending_update != 0) { call_deferred("remove_all"); return true; } set_active(false); _set_process(false); interpolates.clear(); return true; }
void AnimationPlayer::stop(bool p_reset) { Playback &c = playback; c.blend.clear(); if (p_reset) { c.current.from = NULL; } _set_process(false); queued.clear(); playing = false; }
bool Tween::resume_all() { set_active(true); _set_process(true); pending_update ++; for(List<InterpolateData>::Element *E=interpolates.front();E;E=E->next()) { InterpolateData& data = E->get(); data.active = true; } pending_update --; return true; }
bool Tween::resume(Object *p_object, String p_key) { set_active(true); _set_process(true); pending_update ++; for(List<InterpolateData>::Element *E=interpolates.front();E;E=E->next()) { InterpolateData& data = E->get(); Object *object = ObjectDB::get_instance(data.id); if(object == NULL) continue; if(object == p_object && data.key == p_key) data.active = true; } pending_update --; return true; }
bool Tween::start() { set_active(true); _set_process(true); return true; }
void AnimationPlayer::play(const StringName &p_name, float p_custom_blend, float p_custom_scale, bool p_from_end) { //printf("animation is %ls\n", String(p_name).c_str()); //ERR_FAIL_COND(!is_inside_scene()); StringName name = p_name; if (String(name) == "") name = playback.assigned; if (!animation_set.has(name)) { ERR_EXPLAIN("Animation not found: " + name); ERR_FAIL(); } Playback &c = playback; if (c.current.from) { float blend_time = 0; // find if it can blend BlendKey bk; bk.from = c.current.from->name; bk.to = name; if (p_custom_blend >= 0) { blend_time = p_custom_blend; } else if (blend_times.has(bk)) { blend_time = blend_times[bk]; } else { bk.from = "*"; if (blend_times.has(bk)) { blend_time = blend_times[bk]; } else { bk.from = c.current.from->name; bk.to = "*"; if (blend_times.has(bk)) { blend_time = blend_times[bk]; } } } if (p_custom_blend < 0 && blend_time == 0 && default_blend_time) blend_time = default_blend_time; if (blend_time > 0) { Blend b; b.data = c.current; b.blend_time = b.blend_left = blend_time; c.blend.push_back(b); } } c.current.from = &animation_set[name]; c.current.pos = p_from_end ? c.current.from->animation->get_length() : 0; c.current.speed_scale = p_custom_scale; c.assigned = p_name; if (!end_notify) queued.clear(); _set_process(true); // always process when starting an animation playing = true; emit_signal(SceneStringNames::get_singleton()->animation_started, c.assigned); if (is_inside_tree() && Engine::get_singleton()->is_editor_hint()) return; // no next in this case StringName next = animation_get_next(p_name); if (next != StringName() && animation_set.has(next)) { queue(next); } }
void Timer::start() { time_left=wait_time; _set_process(true); }
void Timer::stop() { time_left=-1; _set_process(false); autostart=false; }