diff options
| author | Rémi Verschelde <rverschelde@gmail.com> | 2020-05-14 16:41:43 +0200 |
|---|---|---|
| committer | Rémi Verschelde <rverschelde@gmail.com> | 2020-05-14 21:57:34 +0200 |
| commit | 0ee0fa42e6639b6fa474b7cf6afc6b1a78142185 (patch) | |
| tree | 198d4ff7665d89307f6ca2469fa38620a9eb1672 /scene/animation/animation_cache.cpp | |
| parent | 07bc4e2f96f8f47991339654ff4ab16acc19d44f (diff) | |
| download | redot-engine-0ee0fa42e6639b6fa474b7cf6afc6b1a78142185.tar.gz | |
Style: Enforce braces around if blocks and loops
Using clang-tidy's `readability-braces-around-statements`.
https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
Diffstat (limited to 'scene/animation/animation_cache.cpp')
| -rw-r--r-- | scene/animation/animation_cache.cpp | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/scene/animation/animation_cache.cpp b/scene/animation/animation_cache.cpp index 1eea73fab8..abb2cf1b65 100644 --- a/scene/animation/animation_cache.cpp +++ b/scene/animation/animation_cache.cpp @@ -38,8 +38,9 @@ void AnimationCache::_node_exit_tree(Node *p_node) { connected_nodes.erase(p_node); for (int i = 0; i < path_cache.size(); i++) { - if (path_cache[i].node != p_node) + if (path_cache[i].node != p_node) { continue; + } path_cache.write[i].valid = false; //invalidate path cache } @@ -167,14 +168,16 @@ void AnimationCache::_update_cache() { } void AnimationCache::set_track_transform(int p_idx, const Transform &p_transform) { - if (cache_dirty) + if (cache_dirty) { _update_cache(); + } ERR_FAIL_COND(!cache_valid); ERR_FAIL_INDEX(p_idx, path_cache.size()); Path &p = path_cache.write[p_idx]; - if (!p.valid) + if (!p.valid) { return; + } ERR_FAIL_COND(!p.node); ERR_FAIL_COND(!p.spatial); @@ -187,36 +190,41 @@ void AnimationCache::set_track_transform(int p_idx, const Transform &p_transform } void AnimationCache::set_track_value(int p_idx, const Variant &p_value) { - if (cache_dirty) + if (cache_dirty) { _update_cache(); + } ERR_FAIL_COND(!cache_valid); ERR_FAIL_INDEX(p_idx, path_cache.size()); Path &p = path_cache.write[p_idx]; - if (!p.valid) + if (!p.valid) { return; + } ERR_FAIL_COND(!p.object); p.object->set_indexed(p.subpath, p_value); } void AnimationCache::call_track(int p_idx, const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error) { - if (cache_dirty) + if (cache_dirty) { _update_cache(); + } ERR_FAIL_COND(!cache_valid); ERR_FAIL_INDEX(p_idx, path_cache.size()); Path &p = path_cache.write[p_idx]; - if (!p.valid) + if (!p.valid) { return; + } ERR_FAIL_COND(!p.object); p.object->call(p_method, p_args, p_argcount, r_error); } void AnimationCache::set_all(float p_time, float p_delta) { - if (cache_dirty) + if (cache_dirty) { _update_cache(); + } ERR_FAIL_COND(!cache_valid); @@ -280,13 +288,15 @@ void AnimationCache::set_all(float p_time, float p_delta) { void AnimationCache::set_animation(const Ref<Animation> &p_animation) { _clear_cache(); - if (animation.is_valid()) + if (animation.is_valid()) { animation->disconnect("changed", callable_mp(this, &AnimationCache::_animation_changed)); + } animation = p_animation; - if (animation.is_valid()) + if (animation.is_valid()) { animation->connect("changed", callable_mp(this, &AnimationCache::_animation_changed)); + } } void AnimationCache::_bind_methods() { |
