[Bf-blender-cvs] [dfb541342bb] id_override_static: Some cleanup, fix auto-override handling in NULL pointer case.
Bastien Montagne
noreply at git.blender.org
Tue Nov 14 22:35:43 CET 2017
Commit: dfb541342bba5661893578d82ac3e217329142a5
Author: Bastien Montagne
Date: Mon Nov 13 18:05:48 2017 +0100
Branches: id_override_static
https://developer.blender.org/rBdfb541342bba5661893578d82ac3e217329142a5
Some cleanup, fix auto-override handling in NULL pointer case.
Also, attempt to enable animation override, not yet working though think
we need some re-design of how override is handled per-property type...
===================================================================
M release/datafiles/locale
M release/scripts/addons
M release/scripts/addons_contrib
M source/blender/blenkernel/intern/library_override.c
M source/blender/blenloader/intern/writefile.c
M source/blender/makesdna/DNA_ID.h
M source/blender/makesrna/intern/rna_access.c
M source/blender/makesrna/intern/rna_animation.c
M source/tools
===================================================================
diff --git a/release/datafiles/locale b/release/datafiles/locale
index c93ed11a47b..b3d9c97f487 160000
--- a/release/datafiles/locale
+++ b/release/datafiles/locale
@@ -1 +1 @@
-Subproject commit c93ed11a47b3016cf59711ec16de2e2e94c30e99
+Subproject commit b3d9c97f487bff8b2423c903c14204ba5ca21a83
diff --git a/release/scripts/addons b/release/scripts/addons
index 371960484a3..5b02e6e1acc 160000
--- a/release/scripts/addons
+++ b/release/scripts/addons
@@ -1 +1 @@
-Subproject commit 371960484a38fc64e0a2635170a41a0d8ab2f6bd
+Subproject commit 5b02e6e1acc4c3cf4822607ab33f48d7cffecbd3
diff --git a/release/scripts/addons_contrib b/release/scripts/addons_contrib
index a8515cfdfe9..c3991195ad6 160000
--- a/release/scripts/addons_contrib
+++ b/release/scripts/addons_contrib
@@ -1 +1 @@
-Subproject commit a8515cfdfe9a98127b592f36fcbe51b7e23b969a
+Subproject commit c3991195ad6eac741db27dc9e8905efb224f219d
diff --git a/source/blender/blenkernel/intern/library_override.c b/source/blender/blenkernel/intern/library_override.c
index 64ba06342cb..456cf2fd877 100644
--- a/source/blender/blenkernel/intern/library_override.c
+++ b/source/blender/blenkernel/intern/library_override.c
@@ -501,7 +501,7 @@ void BKE_override_update(Main *bmain, ID *local)
* also remain correct). */
ID *tmp_id;
- id_copy(bmain, local->override->reference, &tmp_id, false); /* XXX ...and worse of all, this won't work with scene! */
+ id_copy(bmain, local->override->reference, &tmp_id, false);
if (tmp_id == NULL) {
return;
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index f01f172e490..25482617979 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -3963,7 +3963,9 @@ static bool write_file_handle(
/* We should never attempt to write non-regular IDs (i.e. all kind of temp/runtime ones). */
BLI_assert((id->tag & (LIB_TAG_NO_MAIN | LIB_TAG_NO_USER_REFCOUNT | LIB_TAG_NOT_ALLOCATED)) == 0);
- if (!ELEM(override_storage, NULL, main) && id->override) {
+ const bool do_override = !ELEM(override_storage, NULL, main) && id->override;
+
+ if (do_override) {
BKE_override_operations_store_start(override_storage, id);
}
@@ -4083,7 +4085,7 @@ static bool write_file_handle(
break;
}
- if (!ELEM(override_storage, NULL, main) && id->override) {
+ if (do_override) {
BKE_override_operations_store_end(override_storage, id);
}
}
diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h
index 2ba460aede9..df9f1597af2 100644
--- a/source/blender/makesdna/DNA_ID.h
+++ b/source/blender/makesdna/DNA_ID.h
@@ -157,7 +157,6 @@ enum {
/* IDOverridePropertyOperation->flag. */
enum {
- /* Basic operations. */
IDOVERRIDE_FLAG_MANDATORY = 1 << 0, /* User cannot remove that override operation. */
IDOVERRIDE_FLAG_LOCKED = 1 << 1, /* User cannot change that override operation. */
};
@@ -172,7 +171,7 @@ typedef struct IDOverrideProperty {
ListBase operations; /* List of overriding operations (IDOverridePropertyOperation) applied to this property. */
} IDOverrideProperty;
-/* Main container for all overriding data info. */
+/* Main container for all overriding data info of a data-block. */
typedef struct IDOverride {
struct ID *reference; /* Reference linked ID which this one overrides. */
ListBase properties; /* List of IDOverrideProperty structs. */
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index f7a6e3cc04c..a79e6655317 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -7026,34 +7026,40 @@ static bool rna_property_override_equals_propptr(
}
if (is_id) {
- /* In case this is an ID, do not compare structs!
- * This is a quite safe path to infinite loop.
- * Instead, just compare ID pointers themselves (we assume sub-ID structs cannot loop). */
- const bool equals = (propptr_a->id.data == propptr_b->id.data);
+ BLI_assert(propptr_a->data == propptr_a->id.data && propptr_b->data == propptr_b->id.data);
+ }
- if (!equals && rna_path) {
- bool created = false;
- IDOverrideProperty *op = BKE_override_property_get(override, rna_path, &created);
+ if (override) {
+ if (rna_path) {
+ if (is_type_null || is_id) {
+ /* In case this is an ID (or one of the pointers is NULL), do not compare structs!
+ * This is a quite safe path to infinite loop.
+ * Instead, just compare pointers themselves (we assume sub-ID structs cannot loop). */
+ const bool equals = (propptr_a->data == propptr_b->data);
- if (op != NULL && created) { /* If not yet overridden... */
- BKE_override_property_operation_get(op, IDOVERRIDE_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
- if (r_override_changed) {
- *r_override_changed = created;
+ if (!equals && rna_path) {
+ bool created = false;
+ 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_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
+ if (r_override_changed) {
+ *r_override_changed = created;
+ }
+ }
}
- }
- }
- return equals;
- }
- else if (!is_type_null && override) { /* We cannot override struct if one is NULL pointer... */
- if (rna_path) {
- const bool changed = RNA_struct_auto_override(propptr_a, propptr_b, override, rna_path);
- if (r_override_changed) {
- *r_override_changed = *r_override_changed || changed;
+ return equals;
+ }
+ else {
+ const bool changed = RNA_struct_auto_override(propptr_a, propptr_b, override, rna_path);
+ if (r_override_changed) {
+ *r_override_changed = *r_override_changed || changed;
+ }
+ /* XXX Simplification here, if no override was added we assume they are equal,
+ * this may not be good behavior, time will say. */
+ return !changed;
}
- /* XXX Simplification here, if no override was added we assume they are equal,
- * this may not be good behavior, time will say. */
- return !changed;
}
else {
return RNA_struct_override_matches(
diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c
index e53533df782..47f2a3a582f 100644
--- a/source/blender/makesrna/intern/rna_animation.c
+++ b/source/blender/makesrna/intern/rna_animation.c
@@ -999,6 +999,7 @@ void rna_def_animdata_common(StructRNA *srna)
prop = RNA_def_property(srna, "animation_data", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "adt");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_flag(prop, PROP_OVERRIDABLE);
RNA_def_property_ui_text(prop, "Animation Data", "Animation data for this data-block");
}
@@ -1022,7 +1023,7 @@ static void rna_def_animdata(BlenderRNA *brna)
/* Active Action */
prop = RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE);
/* this flag as well as the dynamic test must be defined for this to be editable... */
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT | PROP_OVERRIDABLE);
RNA_def_property_pointer_funcs(prop, NULL, "rna_AnimData_action_set", NULL, "rna_Action_id_poll");
RNA_def_property_editable_func(prop, "rna_AnimData_action_editable");
RNA_def_property_ui_text(prop, "Action", "Active Action for this data-block");
diff --git a/source/tools b/source/tools
index b11375e8906..9ea62ef860c 160000
--- a/source/tools
+++ b/source/tools
@@ -1 +1 @@
-Subproject commit b11375e89061303401376f7aeae42ac2fd64692a
+Subproject commit 9ea62ef860cde8eb313b74cd1b23ca5a0734eefe
More information about the Bf-blender-cvs
mailing list