[Bf-blender-cvs] [ef6045a4735] id_override_static: Add finer controll over 'strict' finding of override property operations.
Bastien Montagne
noreply at git.blender.org
Wed Apr 5 21:54:37 CEST 2017
Commit: ef6045a473526fde2c03e1097d64bee8d9136c70
Author: Bastien Montagne
Date: Wed Apr 5 18:12:18 2017 +0200
Branches: id_override_static
https://developer.blender.org/rBef6045a473526fde2c03e1097d64bee8d9136c70
Add finer controll over 'strict' finding of override property operations.
===================================================================
M source/blender/blenkernel/BKE_library_override.h
M source/blender/blenkernel/intern/library_override.c
M source/blender/editors/interface/interface_ops.c
M source/blender/makesrna/RNA_access.h
M source/blender/makesrna/intern/rna_access.c
===================================================================
diff --git a/source/blender/blenkernel/BKE_library_override.h b/source/blender/blenkernel/BKE_library_override.h
index cc29b0cea8f..b5e56145cbc 100644
--- a/source/blender/blenkernel/BKE_library_override.h
+++ b/source/blender/blenkernel/BKE_library_override.h
@@ -49,11 +49,12 @@ void BKE_override_property_delete(struct IDOverride *override, struct IDOverride
struct IDOverridePropertyOperation *BKE_override_property_operation_find(
struct IDOverrideProperty *override_property,
const char *subitem_refname, const char *subitem_locname,
- const int subitem_refindex, const int subitem_locindex);
+ const int subitem_refindex, const int subitem_locindex, const bool strict, bool *r_strict);
struct IDOverridePropertyOperation *BKE_override_property_operation_get(
struct IDOverrideProperty *override_property, const short operation,
const char *subitem_refname, const char *subitem_locname,
- const int subitem_refindex, const int subitem_locindex, bool *r_created);
+ const int subitem_refindex, const int subitem_locindex,
+ const bool strict, bool *r_strict, bool *r_created);
void BKE_override_property_operation_delete(
struct IDOverrideProperty *override_property, struct IDOverridePropertyOperation *override_property_operation);
diff --git a/source/blender/blenkernel/intern/library_override.c b/source/blender/blenkernel/intern/library_override.c
index 1fecb5908b2..1f43eee5c7f 100644
--- a/source/blender/blenkernel/intern/library_override.c
+++ b/source/blender/blenkernel/intern/library_override.c
@@ -149,11 +149,15 @@ void BKE_override_property_delete(IDOverride *override, IDOverrideProperty *over
IDOverridePropertyOperation *BKE_override_property_operation_find(
IDOverrideProperty *override_property,
const char *subitem_refname, const char *subitem_locname,
- const int subitem_refindex, const int subitem_locindex)
+ const int subitem_refindex, const int subitem_locindex, const bool strict, bool *r_strict)
{
IDOverridePropertyOperation *opop;
const int subitem_defindex = -1;
+ if (r_strict) {
+ *r_strict = true;
+ }
+
if (subitem_locname &&
(opop = BLI_findstring_ptr(&override_property->operations, subitem_locname,
offsetof(IDOverridePropertyOperation, subitem_local_name))))
@@ -181,10 +185,13 @@ IDOverridePropertyOperation *BKE_override_property_operation_find(
}
/* index == -1 means all indices, that is valid fallback in case we requested specific index. */
- if ((subitem_locindex != subitem_defindex) &&
+ if (!strict && (subitem_locindex != subitem_defindex) &&
(opop = BLI_listbase_bytes_find(&override_property->operations, &subitem_defindex, sizeof(subitem_defindex),
offsetof(IDOverridePropertyOperation, subitem_local_index))))
{
+ if (r_strict) {
+ *r_strict = false;
+ }
return opop;
}
@@ -197,11 +204,13 @@ IDOverridePropertyOperation *BKE_override_property_operation_find(
IDOverridePropertyOperation *BKE_override_property_operation_get(
IDOverrideProperty *override_property, const short operation,
const char *subitem_refname, const char *subitem_locname,
- const int subitem_refindex, const int subitem_locindex, bool *r_created)
+ const int subitem_refindex, const int subitem_locindex,
+ const bool strict, bool *r_strict, bool *r_created)
{
IDOverridePropertyOperation *opop = BKE_override_property_operation_find(override_property,
subitem_refname, subitem_locname,
- subitem_refindex, subitem_locindex);
+ subitem_refindex, subitem_locindex,
+ strict, r_strict);
if (opop == NULL) {
opop = MEM_callocN(sizeof(IDOverridePropertyOperation), __func__);
diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c
index cbb7d6d0e8f..be7de1fb1d7 100644
--- a/source/blender/editors/interface/interface_ops.c
+++ b/source/blender/editors/interface/interface_ops.c
@@ -441,16 +441,17 @@ static int override_remove_button_exec(bContext *C, wmOperator *op)
}
if (!all && index != -1) {
+ bool is_strict_find;
/* Remove override operation for given item, add singular operations for the other items as needed. */
- IDOverridePropertyOperation *opop = BKE_override_property_operation_find(oprop, NULL, NULL, index, index);
- if (opop == NULL) {
+ IDOverridePropertyOperation *opop = BKE_override_property_operation_find(
+ oprop, NULL, NULL, index, index, false, &is_strict_find);
+ BLI_assert(opop != NULL);
+ if (!is_strict_find) {
/* No specific override operation, we have to get generic one, and... */
- opop = BKE_override_property_operation_find(oprop, NULL, NULL, -1, -1);
- BLI_assert(opop != NULL);
/* ... create item-specific override operations for all but given index, before removing generic one. */
for (int idx = RNA_property_array_length(&ptr, prop); idx--; ) {
if (idx != index) {
- BKE_override_property_operation_get(oprop, opop->operation, NULL, NULL, idx, idx, NULL);
+ BKE_override_property_operation_get(oprop, opop->operation, NULL, NULL, idx, idx, true, NULL, NULL);
}
}
}
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h
index 70c3bcc985d..d0eec992134 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -1241,9 +1241,10 @@ struct IDOverrideProperty *RNA_property_override_property_find(PointerRNA *ptr,
struct IDOverrideProperty *RNA_property_override_property_get(PointerRNA *ptr, PropertyRNA *prop, bool *r_created);
struct IDOverridePropertyOperation *RNA_property_override_property_operation_find(
- PointerRNA *ptr, PropertyRNA *prop, const int index);
+ PointerRNA *ptr, PropertyRNA *prop, const int index, const bool strict, bool *r_strict);
struct IDOverridePropertyOperation *RNA_property_override_property_operation_get(
- PointerRNA *ptr, PropertyRNA *prop, const short operation, const int index, bool *r_created);
+ PointerRNA *ptr, PropertyRNA *prop, const short operation, const int index,
+ const bool strict, bool *r_strict, bool *r_created);
bool RNA_property_overridable(PointerRNA *ptr, PropertyRNA *prop);
bool RNA_property_overridden(PointerRNA *ptr, PropertyRNA *prop, const int index);
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index 81091914c88..751f5297a3a 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -6853,7 +6853,7 @@ static bool rna_property_override_equals_propptr(
IDOverrideProperty *op = BKE_override_property_get(override, rna_path, &created);
if (op != NULL && created) { /* If not yet overridden... */
- BKE_override_property_operation_get(op, IDOVERRIDE_REPLACE, NULL, NULL, -1, -1, NULL);
+ BKE_override_property_operation_get(op, IDOVERRIDE_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
if (r_override_changed) {
*r_override_changed = *r_override_changed || created;
}
@@ -6930,7 +6930,7 @@ static bool rna_property_override_equals(
IDOverrideProperty *op = BKE_override_property_get(override, rna_path, &created);
if (op != NULL && created) {
- BKE_override_property_operation_get(op, IDOVERRIDE_REPLACE, NULL, NULL, -1, -1, NULL);
+ BKE_override_property_operation_get(op, IDOVERRIDE_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
if (r_override_changed) {
*r_override_changed = created;
}
@@ -6954,7 +6954,7 @@ static bool rna_property_override_equals(
IDOverrideProperty *op = BKE_override_property_get(override, rna_path, &created);
if (op != NULL && created) { /* If not yet overridden... */
- BKE_override_property_operation_get(op, IDOVERRIDE_REPLACE, NULL, NULL, -1, -1, NULL);
+ BKE_override_property_operation_get(op, IDOVERRIDE_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
if (r_override_changed) {
*r_override_changed = created;
}
@@ -6985,7 +6985,7 @@ static bool rna_property_override_equals(
IDOverrideProperty *op = BKE_override_property_get(override, rna_path, &created);
if (op != NULL && created) {
- BKE_override_property_operation_get(op, IDOVERRIDE_REPLACE, NULL, NULL, -1, -1, NULL);
+ BKE_override_property_operation_get(op, IDOVERRIDE_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
if (r_override_changed) {
*r_override_changed = created;
}
@@ -7009,7 +7009,7 @@ static bool rna_property_override_equals(
IDOverrideProperty *op = BKE_override_property_get(override, rna_path, &created);
if (op != NULL && created) { /* If not yet overridden... */
- BKE_override_property_operation_get(op, IDOVERRIDE_REPLACE, NULL, NULL, -1, -1, NULL);
+ BKE_override_property_operation_get(op, IDOVERRIDE_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
if (r_override_changed) {
*r_override_changed = created;
}
@@ -7041,7 +7041,8 @@ static bool rna_property_override_equals(
IDOverrideProperty *op = BKE_override_property_get(override, rna_path, &created);
if (op != NULL && created) {
- BKE_override_property_operation_get(op, is_proportional ? IDOVERRIDE_MULTIPLY : IDOVERRIDE_REPLACE, NULL, NULL, -1, -1, NULL);
+ BKE_override_property_operation_get(op, is_proportional ? IDOVERRIDE_MULTIPLY : IDOVERRIDE_REPLACE,
+ NULL, NULL, -1, -1, true, NULL, NULL);
if (r_override_changed) {
*r_override_changed = created;
}
@@ -7065,7 +7066,8 @@ static bool rna_property_override_equals(
IDOverrideProperty *op = BKE_override_property_get(override, rna_path, &created);
if (op != NULL && created) { /* If not yet overr
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list