diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2019-06-15 00:16:04 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2019-06-15 00:21:12 +0300 |
commit | 23254ce4ee6b21b202549b421cf1d98f6a03b33d (patch) | |
tree | 77ebd72c7f1cd2776e058f04b5e6e49f14a327ec /source/blender/makesrna/intern/rna_access.c | |
parent | f64070185808f153d141b26e63942424a1b258b1 (diff) |
Cleanup: Rename: Static Override -> Library Override.
Better to make internal code naming match official/UI naming to some
extent, this will reduce confusion in the future.
This is 'breaking' scripts and files that would use that feature, but
since it is not yet officially supported nor exposed in 2.80, as far
as that release is concerned, it is effectively
a 'no functional changes' commit.
Diffstat (limited to 'source/blender/makesrna/intern/rna_access.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_access.c | 142 |
1 files changed, 71 insertions, 71 deletions
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index a9ba1730216..4a8e80d17bb 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -2053,7 +2053,7 @@ bool RNA_property_editable(PointerRNA *ptr, PropertyRNA *prop) return ((flag & PROP_EDITABLE) && (flag & PROP_REGISTER) == 0 && (!id || ((!ID_IS_LINKED(id) || (prop->flag & PROP_LIB_EXCEPTION)) && - (!id->override_static || RNA_property_overridable_get(ptr, prop))))); + (!id->override_library || RNA_property_overridable_get(ptr, prop))))); } /** @@ -2087,7 +2087,7 @@ bool RNA_property_editable_info(PointerRNA *ptr, PropertyRNA *prop, const char * } return false; } - if (id->override_static != NULL && !RNA_property_overridable_get(ptr, prop)) { + if (id->override_library != NULL && !RNA_property_overridable_get(ptr, prop)) { if (!(*r_info)[0]) { *r_info = N_("Can't edit this property from an override data-block"); } @@ -2184,39 +2184,39 @@ bool RNA_property_overridable_get(PointerRNA *ptr, PropertyRNA *prop) * for now we can live with those special-cases handling I think. */ if (RNA_struct_is_a(ptr->type, &RNA_Constraint)) { bConstraint *con = ptr->data; - if (con->flag & CONSTRAINT_STATICOVERRIDE_LOCAL) { + if (con->flag & CONSTRAINT_OVERRIDE_LIBRARY_LOCAL) { return true; } } else if (RNA_struct_is_a(ptr->type, &RNA_Modifier)) { ModifierData *mod = ptr->data; - if (mod->flag & eModifierFlag_StaticOverride_Local) { + if (mod->flag & eModifierFlag_OverrideLibrary_Local) { return true; } } /* If this is a RNA-defined property (real or 'virtual' IDProp), * we want to use RNA prop flag. */ return !(prop->flag_override & PROPOVERRIDE_NO_COMPARISON) && - (prop->flag_override & PROPOVERRIDE_OVERRIDABLE_STATIC); + (prop->flag_override & PROPOVERRIDE_OVERRIDABLE_LIBRARY); } else { /* If this is a real 'pure' IDProp (aka custom property), we want to use the IDProp flag. */ return !(prop->flag_override & PROPOVERRIDE_NO_COMPARISON) && - (((IDProperty *)prop)->flag & IDP_FLAG_OVERRIDABLE_STATIC); + (((IDProperty *)prop)->flag & IDP_FLAG_OVERRIDABLE_LIBRARY); } } /* Should only be used for custom properties */ -bool RNA_property_overridable_static_set(PointerRNA *UNUSED(ptr), - PropertyRNA *prop, - const bool is_overridable) +bool RNA_property_overridable_library_set(PointerRNA *UNUSED(ptr), + PropertyRNA *prop, + const bool is_overridable) { /* Only works for pure custom properties IDProps. */ if (prop->magic != RNA_MAGIC) { IDProperty *idprop = (IDProperty *)prop; - idprop->flag = is_overridable ? (idprop->flag | IDP_FLAG_OVERRIDABLE_STATIC) : - (idprop->flag & ~IDP_FLAG_OVERRIDABLE_STATIC); + idprop->flag = is_overridable ? (idprop->flag | IDP_FLAG_OVERRIDABLE_LIBRARY) : + (idprop->flag & ~IDP_FLAG_OVERRIDABLE_LIBRARY); return true; } @@ -2228,11 +2228,11 @@ bool RNA_property_overridden(PointerRNA *ptr, PropertyRNA *prop) char *rna_path = RNA_path_from_ID_to_property(ptr, prop); ID *id = ptr->id.data; - if (rna_path == NULL || id == NULL || id->override_static == NULL) { + if (rna_path == NULL || id == NULL || id->override_library == NULL) { return false; } - return (BKE_override_static_property_find(id->override_static, rna_path) != NULL); + return (BKE_override_library_property_find(id->override_library, rna_path) != NULL); } bool RNA_property_comparable(PointerRNA *UNUSED(ptr), PropertyRNA *prop) @@ -8026,7 +8026,7 @@ static bool rna_property_override_operation_apply(Main *bmain, PointerRNA *ptr_item_local, PointerRNA *ptr_item_override, PointerRNA *ptr_item_storage, - IDOverrideStaticPropertyOperation *opop); + IDOverrideLibraryPropertyOperation *opop); bool RNA_property_copy( Main *bmain, PointerRNA *ptr, PointerRNA *fromptr, PropertyRNA *prop, int index) @@ -8060,8 +8060,8 @@ bool RNA_property_copy( return false; } - IDOverrideStaticPropertyOperation opop = { - .operation = IDOVERRIDESTATIC_OP_REPLACE, + IDOverrideLibraryPropertyOperation opop = { + .operation = IDOVERRIDE_LIBRARY_OP_REPLACE, .subitem_reference_index = index, .subitem_local_index = index, }; @@ -8099,7 +8099,7 @@ static int rna_property_override_diff(Main *bmain, PropertyRNA *prop_b, const char *rna_path, eRNACompareMode mode, - IDOverrideStatic *override, + IDOverrideLibrary *override, const int flags, eRNAOverrideMatchResult *r_report_flags); @@ -8167,7 +8167,7 @@ static int rna_property_override_diff(Main *bmain, PropertyRNA *prop_b, const char *rna_path, eRNACompareMode mode, - IDOverrideStatic *override, + IDOverrideLibrary *override, const int flags, eRNAOverrideMatchResult *r_report_flags) { @@ -8299,7 +8299,7 @@ static bool rna_property_override_operation_store(Main *bmain, PropertyRNA *prop_local, PropertyRNA *prop_reference, PropertyRNA *prop_storage, - IDOverrideStaticProperty *op) + IDOverrideLibraryProperty *op) { int len_local, len_reference, len_storage = 0; bool changed = false; @@ -8325,12 +8325,12 @@ static bool rna_property_override_operation_store(Main *bmain, (!ptr_storage || prop_local->override_store == prop_storage->override_store) && prop_local->override_store != NULL); - for (IDOverrideStaticPropertyOperation *opop = op->operations.first; opop; opop = opop->next) { + for (IDOverrideLibraryPropertyOperation *opop = op->operations.first; opop; opop = opop->next) { /* Only needed for diff operations. */ if (!ELEM(opop->operation, - IDOVERRIDESTATIC_OP_ADD, - IDOVERRIDESTATIC_OP_SUBTRACT, - IDOVERRIDESTATIC_OP_MULTIPLY)) { + IDOVERRIDE_LIBRARY_OP_ADD, + IDOVERRIDE_LIBRARY_OP_SUBTRACT, + IDOVERRIDE_LIBRARY_OP_MULTIPLY)) { continue; } @@ -8362,20 +8362,20 @@ static bool rna_property_override_operation_apply(Main *bmain, PointerRNA *ptr_item_local, PointerRNA *ptr_item_override, PointerRNA *ptr_item_storage, - IDOverrideStaticPropertyOperation *opop) + IDOverrideLibraryPropertyOperation *opop) { int len_local, len_reference, len_storage = 0; const short override_op = opop->operation; - if (override_op == IDOVERRIDESTATIC_OP_NOOP) { + if (override_op == IDOVERRIDE_LIBRARY_OP_NOOP) { return true; } if (ELEM(override_op, - IDOVERRIDESTATIC_OP_ADD, - IDOVERRIDESTATIC_OP_SUBTRACT, - IDOVERRIDESTATIC_OP_MULTIPLY) && + IDOVERRIDE_LIBRARY_OP_ADD, + IDOVERRIDE_LIBRARY_OP_SUBTRACT, + IDOVERRIDE_LIBRARY_OP_MULTIPLY) && !ptr_storage) { /* We cannot apply 'diff' override operations without some reference storage. * This should typically only happen at read time of .blend file... */ @@ -8383,9 +8383,9 @@ static bool rna_property_override_operation_apply(Main *bmain, } if (ELEM(override_op, - IDOVERRIDESTATIC_OP_ADD, - IDOVERRIDESTATIC_OP_SUBTRACT, - IDOVERRIDESTATIC_OP_MULTIPLY) && + IDOVERRIDE_LIBRARY_OP_ADD, + IDOVERRIDE_LIBRARY_OP_SUBTRACT, + IDOVERRIDE_LIBRARY_OP_MULTIPLY) && !prop_storage) { /* We cannot apply 'diff' override operations without some reference storage. * This should typically only happen at read time of .blend file... */ @@ -8471,7 +8471,7 @@ bool RNA_struct_override_matches(Main *bmain, PointerRNA *ptr_local, PointerRNA *ptr_reference, const char *root_path, - IDOverrideStatic *override, + IDOverrideLibrary *override, const eRNAOverrideMatch flags, eRNAOverrideMatchResult *r_report_flags) { @@ -8566,7 +8566,7 @@ bool RNA_struct_override_matches(Main *bmain, // printf("Override Checking %s\n", rna_path); - if (ignore_overridden && BKE_override_static_property_find(override, rna_path) != NULL) { + if (ignore_overridden && BKE_override_library_property_find(override, rna_path) != NULL) { RNA_PATH_FREE; continue; } @@ -8605,16 +8605,16 @@ bool RNA_struct_override_matches(Main *bmain, if (diff != 0) { /* XXX TODO: refine this for per-item overriding of arrays... */ - IDOverrideStaticProperty *op = BKE_override_static_property_find(override, rna_path); - IDOverrideStaticPropertyOperation *opop = op ? op->operations.first : NULL; + IDOverrideLibraryProperty *op = BKE_override_library_property_find(override, rna_path); + IDOverrideLibraryPropertyOperation *opop = op ? op->operations.first : NULL; if (do_restore && (report_flags & RNA_OVERRIDE_MATCH_RESULT_CREATED) == 0) { /* We are allowed to restore to reference's values. */ - if (ELEM(NULL, op, opop) || opop->operation == IDOVERRIDESTATIC_OP_NOOP) { + if (ELEM(NULL, op, opop) || opop->operation == IDOVERRIDE_LIBRARY_OP_NOOP) { /* We should restore that property to its reference value */ if (RNA_property_editable(ptr_local, prop_local)) { - IDOverrideStaticPropertyOperation opop_tmp = { - .operation = IDOVERRIDESTATIC_OP_REPLACE, + IDOverrideLibraryPropertyOperation opop_tmp = { + .operation = IDOVERRIDE_LIBRARY_OP_REPLACE, .subitem_reference_index = -1, .subitem_local_index = -1, }; @@ -8697,14 +8697,14 @@ bool RNA_struct_override_store(Main *bmain, PointerRNA *ptr_local, PointerRNA *ptr_reference, PointerRNA *ptr_storage, - IDOverrideStatic *override) + IDOverrideLibrary *override) { bool changed = false; #ifdef DEBUG_OVERRIDE_TIMEIT TIMEIT_START_AVERAGED(RNA_struct_override_store); #endif - for (IDOverrideStaticProperty *op = override->properties.first; op; op = op->next) { + for (IDOverrideLibraryProperty *op = override->properties.first; op; op = op->next) { /* Simplified for now! */ PointerRNA data_reference, data_local; PropertyRNA *prop_reference, *prop_local; @@ -8749,13 +8749,13 @@ static void rna_property_override_apply_ex(Main *bmain, PointerRNA *ptr_item_local, PointerRNA *ptr_item_override, PointerRNA *ptr_item_storage, - IDOverrideStaticProperty *op, + IDOverrideLibraryProperty *op, const bool do_insert) { - for (IDOverrideStaticPropertyOperation *opop = op->operations.first; opop; opop = opop->next) { + for (IDOverrideLibraryPropertyOperation *opop = op->operations.first; opop; opop = opop->next) { if (!do_insert != !ELEM(opop->operation, - IDOVERRIDESTATIC_OP_INSERT_AFTER, - IDOVERRIDESTATIC_OP_INSERT_BEFORE)) { + IDOVERRIDE_LIBRARY_OP_INSERT_AFTER, + IDOVERRIDE_LIBRARY_OP_INSERT_BEFORE)) { if (!do_insert) { printf("Skipping insert override operations in first pass (%s)!\n", op->rna_path); } @@ -8785,7 +8785,7 @@ void RNA_struct_override_apply(Main *bmain, PointerRNA *ptr_local, PointerRNA *ptr_override, PointerRNA *ptr_storage, - IDOverrideStatic *override) + IDOverrideLibrary *override) { #ifdef DEBUG_OVERRIDE_TIMEIT TIMEIT_START_AVERAGED(RNA_struct_override_apply); @@ -8796,7 +8796,7 @@ void RNA_struct_override_apply(Main *bmain, */ bool do_insert = false; for (int i = 0; i < 2; i++, do_insert = true) { - for (IDOverrideStaticProperty *op = override->properties.first; op; op = op->next) { + for (IDOverrideLibraryProperty *op = override->properties.first; op; op = op->next) { /* Simplified for now! */ PointerRNA data_override, data_local; PointerRNA data_item_override, data_item_local; @@ -8832,7 +8832,7 @@ void RNA_struct_override_apply(Main *bmain, #ifndef NDEBUG else { printf( - "Failed to apply static override operation to '%s.%s' " + "Failed to apply library override operation to '%s.%s' " "(could not resolve some properties, local: %d, override: %d)\n", ((ID *)ptr_override->id.data)->name, op->rna_path, @@ -8847,58 +8847,58 @@ void RNA_struct_override_apply(Main *bmain, #endif } -IDOverrideStaticProperty *RNA_property_override_property_find(PointerRNA *ptr, PropertyRNA *prop) +IDOverrideLibraryProperty *RNA_property_override_property_find(PointerRNA *ptr, PropertyRNA *prop) { ID *id = ptr->id.data; - if (!id || !id->override_static) { + if (!id || !id->override_library) { return NULL; } char *rna_path = RNA_path_from_ID_to_property(ptr, prop); if (rna_path) { - IDOverrideStaticProperty *op = BKE_override_static_property_find(id->override_static, - rna_path); + IDOverrideLibraryProperty *op = BKE_override_library_property_find(id->override_library, + rna_path); MEM_freeN(rna_path); return op; } return NULL; } -IDOverrideStaticProperty *RNA_property_override_property_get(PointerRNA *ptr, - PropertyRNA *prop, - bool *r_created) +IDOverrideLibraryProperty *RNA_property_override_property_get(PointerRNA *ptr, + PropertyRNA *prop, + bool *r_created) { ID *id = ptr->id.data; - if (!id || !id->override_static) { + if (!id || !id->override_library) { return NULL; } char *rna_path = RNA_path_from_ID_to_property(ptr, prop); if (rna_path) { - IDOverrideStaticProperty *op = BKE_override_static_property_get( - id->override_static, rna_path, r_created); + IDOverrideLibraryProperty *op = BKE_override_library_property_get( + id->override_library, rna_path, r_created); MEM_freeN(rna_path); return op; } return NULL; } -IDOverrideStaticPropertyOperation *RNA_property_override_property_operation_find( +IDOverrideLibraryPropertyOperation *RNA_property_override_property_operation_find( PointerRNA *ptr, PropertyRNA *prop, const int index, const bool strict, bool *r_strict) { - IDOverrideStaticProperty *op = RNA_property_override_property_find(ptr, prop); + IDOverrideLibraryProperty *op = RNA_property_override_property_find(ptr, prop); if (!op) { return NULL; } - return BKE_override_static_property_operation_find( + return BKE_override_library_property_operation_find( op, NULL, NULL, index, index, strict, r_strict); } -IDOverrideStaticPropertyOperation *RNA_property_override_property_operation_get( +IDOverrideLibraryPropertyOperation *RNA_property_override_property_operation_get( PointerRNA *ptr, PropertyRNA *prop, const short operation, @@ -8907,27 +8907,27 @@ IDOverrideStaticPropertyOperation *RNA_property_override_property_operation_get( bool *r_strict, bool *r_created) { - IDOverrideStaticProperty *op = RNA_property_override_property_get(ptr, prop, NULL); + IDOverrideLibraryProperty *op = RNA_property_override_property_get(ptr, prop, NULL); if (!op) { return NULL; } - return BKE_override_static_property_operation_get( + return BKE_override_library_property_operation_get( op, operation, NULL, NULL, index, index, strict, r_strict, r_created); } -eRNAOverrideStatus RNA_property_static_override_status(PointerRNA *ptr, - PropertyRNA *prop, - const int index) +eRNAOverrideStatus RNA_property_override_library_status(PointerRNA *ptr, + PropertyRNA *prop, + const int index) { int override_status = 0; - if (!BKE_override_static_is_enabled()) { + if (!BKE_override_library_is_enabled()) { return override_status; } - if (!ptr || !prop || !ptr->id.data || !((ID *)ptr->id.data)->override_static) { + if (!ptr || !prop || !ptr->id.data || !((ID *)ptr->id.data)->override_library) { return override_status; } @@ -8935,14 +8935,14 @@ eRNAOverrideStatus RNA_property_static_override_status(PointerRNA *ptr, override_status |= RNA_OVERRIDE_STATUS_OVERRIDABLE; } - IDOverrideStaticPropertyOperation *opop = RNA_property_override_property_operation_find( + IDOverrideLibraryPropertyOperation *opop = RNA_property_override_property_operation_find( ptr, prop, index, false, NULL); if (opop != NULL) { override_status |= RNA_OVERRIDE_STATUS_OVERRIDDEN; - if (opop->flag & IDOVERRIDESTATIC_FLAG_MANDATORY) { + if (opop->flag & IDOVERRIDE_LIBRARY_FLAG_MANDATORY) { override_status |= RNA_OVERRIDE_STATUS_MANDATORY; } - if (opop->flag & IDOVERRIDESTATIC_FLAG_LOCKED) { + if (opop->flag & IDOVERRIDE_LIBRARY_FLAG_LOCKED) { override_status |= RNA_OVERRIDE_STATUS_LOCKED; } } |