diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2019-11-26 19:59:27 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2019-11-26 19:59:27 +0300 |
commit | bf9c2e6fde34c0cb9029e33025627c743fca50b6 (patch) | |
tree | 409e1b4a0cba0f74e903254589325734e940ac11 /source/blender/blenkernel/intern/object.c | |
parent | b21648ab3656986bae1df5897ff16f9d187c9039 (diff) |
Anim: added BKE_object_moves_in_time(object) function
This function exposes the already-existing static `object_moves_in_time()`
function, and optionally recursively checks the parent object for
animatedness as well.
I also added checking `AnimData::overrides` to
`BKE_animdata_id_is_animated()`. This ensures that, apart from the optional
recursion to the parent object, the function has the same functionality.
Diffstat (limited to 'source/blender/blenkernel/intern/object.c')
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 6837336b8b8..08890965ece 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -3763,26 +3763,26 @@ int BKE_object_is_modified(Scene *scene, Object *ob) * speed. In combination with checks of modifier stack and real life usage * percentage of false-positives shouldn't be that height. */ -static bool object_moves_in_time(Object *object) +bool BKE_object_moves_in_time(const Object *object, bool recurse_parent) { - AnimData *adt = object->adt; - if (adt != NULL) { - /* If object has any sort of animation data assume it is moving. */ - if (adt->action != NULL || !BLI_listbase_is_empty(&adt->nla_tracks) || - !BLI_listbase_is_empty(&adt->drivers) || !BLI_listbase_is_empty(&adt->overrides)) { - return true; - } + /* If object has any sort of animation data assume it is moving. */ + if (BKE_animdata_id_is_animated(&object->id)) { + return true; } if (!BLI_listbase_is_empty(&object->constraints)) { return true; } - if (object->parent != NULL) { - /* TODO(sergey): Do recursive check here? */ - return true; + if (recurse_parent && object->parent != NULL) { + return BKE_object_moves_in_time(object->parent, true); } return false; } +static bool object_moves_in_time(const Object *object) +{ + return BKE_object_moves_in_time(object, true); +} + static bool object_deforms_in_time(Object *object) { if (BKE_key_from_object(object) != NULL) { |