diff options
author | Bastien Montagne <bastien@blender.org> | 2020-12-08 11:40:42 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2020-12-08 11:40:42 +0300 |
commit | 682ccd770c629402b771491d45a0523f75750f30 (patch) | |
tree | fb37b6966691426464e7dd01f1e5b2372895974b /source/blender/blenkernel/intern | |
parent | 5f1a155a5ef39a4db144b38a607c19b763f965a3 (diff) |
LibOverride: Refactor collection items 'local' helper functions.
It's easier to read and less 'weird' to check that an item is non-local
in a liboverride data-block, than the other way around. Thanks to
@sybren for noticing it.
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/constraint.c | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/gpencil_modifier.c | 12 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/modifier.c | 6 |
3 files changed, 12 insertions, 12 deletions
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index 982e91dd1e0..d9135572159 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -5963,10 +5963,10 @@ static bConstraint *constraint_find_original_for_update(bConstraintOb *cob, bCon * * \note This check is only valid for a liboverride data-block, it always return \a true otherwise. */ -bool BKE_constraint_is_local_in_liboverride(const Object *ob, const bConstraint *con) +bool BKE_constraint_is_nonlocal_in_liboverride(const Object *ob, const bConstraint *con) { - return (!ID_IS_OVERRIDE_LIBRARY(ob) || - (con != NULL && (con->flag & CONSTRAINT_OVERRIDE_LIBRARY_LOCAL) != 0)); + return (ID_IS_OVERRIDE_LIBRARY(ob) && + (con == NULL || (con->flag & CONSTRAINT_OVERRIDE_LIBRARY_LOCAL) == 0)); } /* -------- Constraints and Proxies ------- */ diff --git a/source/blender/blenkernel/intern/gpencil_modifier.c b/source/blender/blenkernel/intern/gpencil_modifier.c index 7425a1a5f7a..ac81e4a5470 100644 --- a/source/blender/blenkernel/intern/gpencil_modifier.c +++ b/source/blender/blenkernel/intern/gpencil_modifier.c @@ -531,16 +531,16 @@ void BKE_gpencil_modifier_set_error(GpencilModifierData *md, const char *_format } /** - * Check whether given modifier is local when the object is a library override. + * Check whether given modifier is not local (i.e. from linked data) when the object is a library + * override. * * \param gmd May be NULL, in which case we consider it as a non-local modifier case. - * - * \note This check is only valid for a liboverride data-block, it always return \a true otherwise. */ -bool BKE_gpencil_modifier_is_local_in_liboverride(const Object *ob, const GpencilModifierData *gmd) +bool BKE_gpencil_modifier_is_nonlocal_in_liboverride(const Object *ob, + const GpencilModifierData *gmd) { - return (!ID_IS_OVERRIDE_LIBRARY(ob) || - (gmd != NULL && (gmd->flag & eGpencilModifierFlag_OverrideLibrary_Local) != 0)); + return (ID_IS_OVERRIDE_LIBRARY(ob) && + (gmd == NULL || (gmd->flag & eGpencilModifierFlag_OverrideLibrary_Local) == 0)); } /** diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index 7865d44c446..405de3bdca1 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -581,10 +581,10 @@ bool BKE_modifier_is_enabled(const struct Scene *scene, ModifierData *md, int re * * \note This check is only valid for a liboverride data-block, it always return \a true otherwise. */ -bool BKE_modifier_is_local_in_liboverride(const Object *ob, const ModifierData *md) +bool BKE_modifier_is_nonlocal_in_liboverride(const Object *ob, const ModifierData *md) { - return (!ID_IS_OVERRIDE_LIBRARY(ob) || - (md != NULL && (md->flag & eModifierFlag_OverrideLibrary_Local) != 0)); + return (ID_IS_OVERRIDE_LIBRARY(ob) && + (md == NULL || (md->flag & eModifierFlag_OverrideLibrary_Local) == 0)); } CDMaskLink *BKE_modifier_calc_data_masks(struct Scene *scene, |