Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2018-06-29 13:46:54 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2018-06-29 13:48:12 +0300
commit2223d63c58c9a2125fb4a2e6ee1c780c781a95bb (patch)
tree42b820b7ffd2ebe4f71a51d6e05b73c1cc13fdd7 /source/blender
parent3733be8731df978ec50cd283ff24b813bdd89df1 (diff)
Refactor static override code to pass Main around.
Access to main database is actually rarely needed, but some custom 'apply' functions do need it (like Collections' overriding of objects or children collections).
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/BKE_library_override.h9
-rw-r--r--source/blender/blenkernel/intern/library_override.c23
-rw-r--r--source/blender/blenloader/intern/writefile.c2
-rw-r--r--source/blender/editors/interface/interface_ops.c8
-rw-r--r--source/blender/editors/object/object_relations.c2
-rw-r--r--source/blender/makesrna/RNA_access.h13
-rw-r--r--source/blender/makesrna/intern/rna_access.c40
-rw-r--r--source/blender/makesrna/intern/rna_animation.c1
-rw-r--r--source/blender/makesrna/intern/rna_group.c6
-rw-r--r--source/blender/makesrna/intern/rna_internal.h4
-rw-r--r--source/blender/makesrna/intern/rna_internal_types.h3
-rw-r--r--source/blender/makesrna/intern/rna_object.c2
-rw-r--r--source/blender/makesrna/intern/rna_pose.c1
-rw-r--r--source/blender/makesrna/intern/rna_rna.c18
-rw-r--r--source/blender/windowmanager/intern/wm_keymap.c3
15 files changed, 97 insertions, 38 deletions
diff --git a/source/blender/blenkernel/BKE_library_override.h b/source/blender/blenkernel/BKE_library_override.h
index 6f32d565562..4792d203d23 100644
--- a/source/blender/blenkernel/BKE_library_override.h
+++ b/source/blender/blenkernel/BKE_library_override.h
@@ -62,10 +62,10 @@ struct IDOverrideStaticPropertyOperation *BKE_override_static_property_operation
void BKE_override_static_property_operation_delete(
struct IDOverrideStaticProperty *override_property, struct IDOverrideStaticPropertyOperation *override_property_operation);
-bool BKE_override_static_status_check_local(struct ID *local);
-bool BKE_override_static_status_check_reference(struct ID *local);
+bool BKE_override_static_status_check_local(struct Main *bmain, struct ID *local);
+bool BKE_override_static_status_check_reference(struct Main *bmain, struct ID *local);
-bool BKE_override_static_operations_create(struct ID *local, const bool force_auto);
+bool BKE_override_static_operations_create(struct Main *bmain, struct ID *local, const bool force_auto);
void BKE_main_override_static_operations_create(struct Main *bmain, const bool force_auto);
void BKE_override_static_update(struct Main *bmain, struct ID *local);
@@ -78,7 +78,8 @@ void BKE_main_override_static_update(struct Main *bmain);
typedef struct Main OverrideStaticStorage;
OverrideStaticStorage *BKE_override_static_operations_store_initialize(void);
-struct ID *BKE_override_static_operations_store_start(OverrideStaticStorage *override_storage, struct ID *local);
+struct ID *BKE_override_static_operations_store_start(
+ struct Main *bmain, OverrideStaticStorage *override_storage, struct ID *local);
void BKE_override_static_operations_store_end(OverrideStaticStorage *override_storage, struct ID *local);
void BKE_override_static_operations_store_finalize(OverrideStaticStorage *override_storage);
diff --git a/source/blender/blenkernel/intern/library_override.c b/source/blender/blenkernel/intern/library_override.c
index 31e621b236f..150092392b4 100644
--- a/source/blender/blenkernel/intern/library_override.c
+++ b/source/blender/blenkernel/intern/library_override.c
@@ -439,7 +439,7 @@ void BKE_override_static_property_operation_delete(
* (of IDOverridePropertyOperation) has to be added.
*
* \return true if status is OK, false otherwise. */
-bool BKE_override_static_status_check_local(ID *local)
+bool BKE_override_static_status_check_local(Main *bmain, ID *local)
{
BLI_assert(local->override_static != NULL);
@@ -459,6 +459,7 @@ bool BKE_override_static_status_check_local(ID *local)
RNA_id_pointer_create(reference, &rnaptr_reference);
if (!RNA_struct_override_matches(
+ bmain,
&rnaptr_local, &rnaptr_reference, NULL, local->override_static,
RNA_OVERRIDE_COMPARE_IGNORE_NON_OVERRIDABLE | RNA_OVERRIDE_COMPARE_IGNORE_OVERRIDDEN, NULL))
{
@@ -478,7 +479,7 @@ bool BKE_override_static_status_check_local(ID *local)
* This is typically used to detect whether some reference has changed and local needs to be updated against it.
*
* \return true if status is OK, false otherwise. */
-bool BKE_override_static_status_check_reference(ID *local)
+bool BKE_override_static_status_check_reference(Main *bmain, ID *local)
{
BLI_assert(local->override_static != NULL);
@@ -492,7 +493,7 @@ bool BKE_override_static_status_check_reference(ID *local)
BLI_assert(GS(local->name) == GS(reference->name));
if (reference->override_static && (reference->tag & LIB_TAG_OVERRIDESTATIC_REFOK) == 0) {
- if (!BKE_override_static_status_check_reference(reference)) {
+ if (!BKE_override_static_status_check_reference(bmain, reference)) {
/* If reference is also override of another data-block, and its status is not OK,
* then this override is not OK either.
* Note that this should only happen when reloading libraries... */
@@ -506,6 +507,7 @@ bool BKE_override_static_status_check_reference(ID *local)
RNA_id_pointer_create(reference, &rnaptr_reference);
if (!RNA_struct_override_matches(
+ bmain,
&rnaptr_local, &rnaptr_reference, NULL, local->override_static,
RNA_OVERRIDE_COMPARE_IGNORE_OVERRIDDEN, NULL))
{
@@ -528,7 +530,7 @@ bool BKE_override_static_status_check_reference(ID *local)
* are much cheaper.
*
* \return true if new overriding op was created, or some local data was reset. */
-bool BKE_override_static_operations_create(ID *local, const bool force_auto)
+bool BKE_override_static_operations_create(Main *bmain, ID *local, const bool force_auto)
{
BLI_assert(local->override_static != NULL);
const bool is_template = (local->override_static->reference == NULL);
@@ -541,6 +543,7 @@ bool BKE_override_static_operations_create(ID *local, const bool force_auto)
eRNAOverrideMatchResult report_flags = 0;
RNA_struct_override_matches(
+ bmain,
&rnaptr_local, &rnaptr_reference, NULL, local->override_static,
RNA_OVERRIDE_COMPARE_CREATE | RNA_OVERRIDE_COMPARE_RESTORE, &report_flags);
if (report_flags & RNA_OVERRIDE_MATCH_RESULT_CREATED) {
@@ -577,7 +580,7 @@ void BKE_main_override_static_operations_create(Main *bmain, const bool force_au
if (force_auto ||
(ID_IS_STATIC_OVERRIDE_AUTO(id) && (id->tag & LIB_TAG_OVERRIDESTATIC_AUTOREFRESH)))
{
- BKE_override_static_operations_create(id, force_auto);
+ BKE_override_static_operations_create(bmain, id, force_auto);
id->tag &= ~LIB_TAG_OVERRIDESTATIC_AUTOREFRESH;
}
}
@@ -625,7 +628,7 @@ void BKE_override_static_update(Main *bmain, ID *local)
RNA_id_pointer_create(local->override_static->storage, rnaptr_storage);
}
- RNA_struct_override_apply(&rnaptr_dst, &rnaptr_src, rnaptr_storage, local->override_static);
+ RNA_struct_override_apply(bmain, &rnaptr_dst, &rnaptr_src, rnaptr_storage, local->override_static);
/* This also transfers all pointers (memory) owned by local to tmp_id, and vice-versa. So when we'll free tmp_id,
* we'll actually free old, outdated data from local. */
@@ -693,7 +696,7 @@ OverrideStaticStorage *BKE_override_static_operations_store_initialize(void)
* Generate suitable 'write' data (this only affects differential override operations).
*
* Note that \a local ID is no more modified by this call, all extra data are stored in its temp \a storage_id copy. */
-ID *BKE_override_static_operations_store_start(OverrideStaticStorage *override_storage, ID *local)
+ID *BKE_override_static_operations_store_start(Main *bmain, OverrideStaticStorage *override_storage, ID *local)
{
BLI_assert(local->override_static != NULL);
BLI_assert(override_storage != NULL);
@@ -705,7 +708,7 @@ ID *BKE_override_static_operations_store_start(OverrideStaticStorage *override_s
}
/* Forcefully ensure we know about all needed override operations. */
- BKE_override_static_operations_create(local, false);
+ BKE_override_static_operations_create(bmain, local, false);
ID *storage_id;
#ifdef DEBUG_OVERRIDE_TIMEIT
@@ -725,7 +728,9 @@ ID *BKE_override_static_operations_store_start(OverrideStaticStorage *override_s
RNA_id_pointer_create(local, &rnaptr_final);
RNA_id_pointer_create(storage_id, &rnaptr_storage);
- if (!RNA_struct_override_store(&rnaptr_final, &rnaptr_reference, &rnaptr_storage, local->override_static)) {
+ if (!RNA_struct_override_store(
+ bmain, &rnaptr_final, &rnaptr_reference, &rnaptr_storage, local->override_static))
+ {
BKE_libblock_free_ex(override_storage, storage_id, true, false);
storage_id = NULL;
}
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 5402114c8f8..61762b5d7ed 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -3840,7 +3840,7 @@ static bool write_file_handle(
const bool do_override = !ELEM(override_storage, NULL, bmain) && id->override_static;
if (do_override) {
- BKE_override_static_operations_store_start(override_storage, id);
+ BKE_override_static_operations_store_start(bmain, override_storage, id);
}
switch ((ID_Type)GS(id->name)) {
diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c
index aad48d13277..571c1327f78 100644
--- a/source/blender/editors/interface/interface_ops.c
+++ b/source/blender/editors/interface/interface_ops.c
@@ -464,6 +464,7 @@ static int override_remove_button_poll(bContext *C)
static int override_remove_button_exec(bContext *C, wmOperator *op)
{
+ Main *bmain = CTX_data_main(C);
PointerRNA ptr, id_refptr, src;
PropertyRNA *prop;
int index;
@@ -505,7 +506,7 @@ static int override_remove_button_exec(bContext *C, wmOperator *op)
}
BKE_override_static_property_operation_delete(oprop, opop);
if (!is_template) {
- RNA_property_copy(&ptr, &src, prop, index);
+ RNA_property_copy(bmain, &ptr, &src, prop, index);
}
if (BLI_listbase_is_empty(&oprop->operations)) {
BKE_override_static_property_delete(id->override_static, oprop);
@@ -515,7 +516,7 @@ static int override_remove_button_exec(bContext *C, wmOperator *op)
/* Just remove whole generic override operation of this property. */
BKE_override_static_property_delete(id->override_static, oprop);
if (!is_template) {
- RNA_property_copy(&ptr, &src, prop, -1);
+ RNA_property_copy(bmain, &ptr, &src, prop, -1);
}
}
@@ -699,6 +700,7 @@ bool UI_context_copy_to_selected_list(
*/
static bool copy_to_selected_button(bContext *C, bool all, bool poll)
{
+ Main *bmain = CTX_data_main(C);
PointerRNA ptr, lptr, idptr;
PropertyRNA *prop, *lprop;
bool success = false;
@@ -747,7 +749,7 @@ static bool copy_to_selected_button(bContext *C, bool all, bool poll)
break;
}
else {
- if (RNA_property_copy(&lptr, &ptr, prop, (all) ? -1 : index)) {
+ if (RNA_property_copy(bmain, &lptr, &ptr, prop, (all) ? -1 : index)) {
RNA_property_update(C, &lptr, prop);
success = true;
}
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index f2e996237cf..8db58b17520 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -2343,7 +2343,7 @@ static int make_override_static_exec(bContext *C, wmOperator *op)
new_ob->id.override_static->flag &= ~STATICOVERRIDE_AUTO;
}
/* We still want to store all objects' current override status (i.e. change of parent). */
- BKE_override_static_operations_create(&new_ob->id, true);
+ BKE_override_static_operations_create(bmain, &new_ob->id, true);
}
}
FOREACH_COLLECTION_OBJECT_RECURSIVE_END;
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h
index 4ec6107d676..a135e716770 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -977,7 +977,7 @@ void RNA_property_collection_clear(PointerRNA *ptr, PropertyRNA *prop);
bool RNA_property_collection_move(PointerRNA *ptr, PropertyRNA *prop, int key, int pos);
/* copy/reset */
-bool RNA_property_copy(PointerRNA *ptr, PointerRNA *fromptr, PropertyRNA *prop, int index);
+bool RNA_property_copy(struct Main *bmain, PointerRNA *ptr, PointerRNA *fromptr, PropertyRNA *prop, int index);
bool RNA_property_reset(PointerRNA *ptr, PropertyRNA *prop, int index);
/* Path
@@ -1251,8 +1251,12 @@ typedef enum eRNACompareMode {
RNA_EQ_COMPARE,
} eRNACompareMode;
-bool RNA_property_equals(struct PointerRNA *ptr_a, struct PointerRNA *ptr_b, struct PropertyRNA *prop, eRNACompareMode mode);
-bool RNA_struct_equals(struct PointerRNA *ptr_a, struct PointerRNA *ptr_b, eRNACompareMode mode);
+bool RNA_property_equals(
+ struct Main *bmain,
+ struct PointerRNA *ptr_a, struct PointerRNA *ptr_b, struct PropertyRNA *prop, eRNACompareMode mode);
+bool RNA_struct_equals(
+ struct Main *bmain,
+ struct PointerRNA *ptr_a, struct PointerRNA *ptr_b, eRNACompareMode mode);
/* Override. */
@@ -1284,15 +1288,18 @@ typedef enum eRNAOverrideStatus {
} eRNAOverrideStatus;
bool RNA_struct_override_matches(
+ struct Main *bmain,
struct PointerRNA *ptr_local, struct PointerRNA *ptr_reference, const char *root_path,
struct IDOverrideStatic *override, const eRNAOverrideMatch flags,
eRNAOverrideMatchResult *r_report_flags);
bool RNA_struct_override_store(
+ struct Main *bmain,
struct PointerRNA *ptr_local, struct PointerRNA *ptr_reference, PointerRNA *ptr_storage,
struct IDOverrideStatic *override);
void RNA_struct_override_apply(
+ struct Main *bmain,
struct PointerRNA *ptr_local, struct PointerRNA *ptr_override, struct PointerRNA *ptr_storage,
struct IDOverrideStatic *override);
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index 3cae03d466c..9b231f4aa5e 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -7198,12 +7198,13 @@ bool RNA_property_reset(PointerRNA *ptr, PropertyRNA *prop, int index)
}
static bool rna_property_override_operation_apply(
+ Main *bmain,
PointerRNA *ptr_local, PointerRNA *ptr_override, PointerRNA *ptr_storage,
PropertyRNA *prop_local, PropertyRNA *prop_override, PropertyRNA *prop_storage,
PointerRNA *ptr_item_local, PointerRNA *ptr_item_override, PointerRNA *ptr_item_storage,
IDOverrideStaticPropertyOperation *opop);
-bool RNA_property_copy(PointerRNA *ptr, PointerRNA *fromptr, PropertyRNA *prop, int index)
+bool RNA_property_copy(Main *bmain, PointerRNA *ptr, PointerRNA *fromptr, PropertyRNA *prop, int index)
{
if (!RNA_property_editable(ptr, prop)) {
return false;
@@ -7239,6 +7240,7 @@ bool RNA_property_copy(PointerRNA *ptr, PointerRNA *fromptr, PropertyRNA *prop,
.subitem_local_index = index
};
return rna_property_override_operation_apply(
+ bmain,
ptr, fromptr, NULL,
prop_dst, prop_src, NULL,
NULL, NULL, NULL,
@@ -7268,17 +7270,18 @@ void _RNA_warning(const char *format, ...)
}
static int rna_property_override_diff(
+ Main *bmain,
PointerRNA *ptr_a, PointerRNA *ptr_b, PropertyRNA *prop, PropertyRNA *prop_a, PropertyRNA *prop_b, const char *rna_path,
eRNACompareMode mode, IDOverrideStatic *override, const int flags, eRNAOverrideMatchResult *r_report_flags);
-bool RNA_property_equals(PointerRNA *ptr_a, PointerRNA *ptr_b, PropertyRNA *prop, eRNACompareMode mode)
+bool RNA_property_equals(Main *bmain, PointerRNA *ptr_a, PointerRNA *ptr_b, PropertyRNA *prop, eRNACompareMode mode)
{
BLI_assert(ELEM(mode, RNA_EQ_STRICT, RNA_EQ_UNSET_MATCH_ANY, RNA_EQ_UNSET_MATCH_NONE));
- return (rna_property_override_diff(ptr_a, ptr_b, prop, NULL, NULL, NULL, mode, NULL, 0, NULL) == 0);
+ return (rna_property_override_diff(bmain, ptr_a, ptr_b, prop, NULL, NULL, NULL, mode, NULL, 0, NULL) == 0);
}
-bool RNA_struct_equals(PointerRNA *ptr_a, PointerRNA *ptr_b, eRNACompareMode mode)
+bool RNA_struct_equals(Main *bmain, PointerRNA *ptr_a, PointerRNA *ptr_b, eRNACompareMode mode)
{
CollectionPropertyIterator iter;
PropertyRNA *iterprop;
@@ -7297,7 +7300,7 @@ bool RNA_struct_equals(PointerRNA *ptr_a, PointerRNA *ptr_b, eRNACompareMode mod
for (; iter.valid; RNA_property_collection_next(&iter)) {
PropertyRNA *prop = iter.ptr.data;
- if (!RNA_property_equals(ptr_a, ptr_b, prop, mode)) {
+ if (!RNA_property_equals(bmain, ptr_a, ptr_b, prop, mode)) {
equals = false;
break;
}
@@ -7320,6 +7323,7 @@ bool RNA_struct_equals(PointerRNA *ptr_a, PointerRNA *ptr_b, eRNACompareMode mod
* \note When there is no equality, but we cannot determine an order (greater than/lesser than), we return 1.
*/
static int rna_property_override_diff(
+ Main *bmain,
PointerRNA *ptr_a, PointerRNA *ptr_b, PropertyRNA *prop, PropertyRNA *prop_a, PropertyRNA *prop_b,
const char *rna_path, eRNACompareMode mode,
IDOverrideStatic *override, const int flags, eRNAOverrideMatchResult *r_report_flags)
@@ -7419,6 +7423,7 @@ static int rna_property_override_diff(
diff_flags &= ~RNA_OVERRIDE_COMPARE_CREATE;
}
const int diff = override_diff(
+ bmain,
ptr_a, ptr_b, prop_a, prop_b, len_a, len_b,
mode, override, rna_path, diff_flags, &override_changed);
if (override_changed && r_report_flags) {
@@ -7431,6 +7436,7 @@ static int rna_property_override_diff(
/* Modify local data-block to make it ready for override application (only needed for diff operations, where we use
* the local data-block's data as second operand). */
static bool rna_property_override_operation_store(
+ Main *bmain,
PointerRNA *ptr_local, PointerRNA *ptr_reference, PointerRNA *ptr_storage,
PropertyRNA *prop_local, PropertyRNA *prop_reference, PropertyRNA *prop_storage,
IDOverrideStaticProperty *op)
@@ -7465,8 +7471,11 @@ static bool rna_property_override_operation_store(
}
if (prop_local->override_store(
- ptr_local, ptr_reference, ptr_storage, prop_local, prop_reference, prop_storage,
- len_local, len_reference, len_storage, opop))
+ bmain,
+ ptr_local, ptr_reference, ptr_storage,
+ prop_local, prop_reference, prop_storage,
+ len_local, len_reference, len_storage,
+ opop))
{
changed = true;
}
@@ -7476,6 +7485,7 @@ static bool rna_property_override_operation_store(
}
static bool rna_property_override_operation_apply(
+ Main *bmain,
PointerRNA *ptr_local, PointerRNA *ptr_override, PointerRNA *ptr_storage,
PropertyRNA *prop_local, PropertyRNA *prop_override, PropertyRNA *prop_storage,
PointerRNA *ptr_item_local, PointerRNA *ptr_item_override, PointerRNA *ptr_item_storage,
@@ -7547,6 +7557,7 @@ static bool rna_property_override_operation_apply(
/* get and set the default values as appropriate for the various types */
return override_apply(
+ bmain,
ptr_local, ptr_override, ptr_storage,
prop_local, prop_override, prop_storage,
len_local, len_reference, len_storage,
@@ -7564,6 +7575,7 @@ static bool rna_property_override_operation_apply(
* \return True if _resulting_ \a ptr_local does match \a ptr_reference.
*/
bool RNA_struct_override_matches(
+ Main *bmain,
PointerRNA *ptr_local, PointerRNA *ptr_reference, const char *root_path,
IDOverrideStatic *override, const eRNAOverrideMatch flags,
eRNAOverrideMatchResult *r_report_flags)
@@ -7668,6 +7680,7 @@ bool RNA_struct_override_matches(
eRNAOverrideMatchResult report_flags = 0;
const int diff = rna_property_override_diff(
+ bmain,
ptr_local, ptr_reference, NULL, prop_local, prop_reference, rna_path,
RNA_EQ_STRICT, override, flags, &report_flags);
@@ -7700,6 +7713,7 @@ bool RNA_struct_override_matches(
.subitem_local_index = -1
};
rna_property_override_operation_apply(
+ bmain,
ptr_local, ptr_reference, NULL,
prop_local, prop_reference, NULL,
NULL, NULL, NULL,
@@ -7757,6 +7771,7 @@ bool RNA_struct_override_matches(
/** Store needed second operands into \a storage data-block for differential override operations. */
bool RNA_struct_override_store(
+ Main *bmain,
PointerRNA *ptr_local, PointerRNA *ptr_reference, PointerRNA *ptr_storage, IDOverrideStatic *override)
{
bool changed = false;
@@ -7780,8 +7795,11 @@ bool RNA_struct_override_store(
RNA_path_resolve_property(ptr_storage, op->rna_path, &data_storage, &prop_storage);
}
- if (rna_property_override_operation_store(&data_local, &data_reference, &data_storage,
- prop_reference, prop_local, prop_storage, op))
+ if (rna_property_override_operation_store(
+ bmain,
+ &data_local, &data_reference, &data_storage,
+ prop_reference, prop_local, prop_storage,
+ op))
{
changed = true;
}
@@ -7795,6 +7813,7 @@ bool RNA_struct_override_store(
}
static void rna_property_override_apply_ex(
+ Main *bmain,
PointerRNA *ptr_local, PointerRNA *ptr_override, PointerRNA *ptr_storage,
PropertyRNA *prop_local, PropertyRNA *prop_override, PropertyRNA *prop_storage,
PointerRNA *ptr_item_local, PointerRNA *ptr_item_override, PointerRNA *ptr_item_storage,
@@ -7808,6 +7827,7 @@ static void rna_property_override_apply_ex(
continue;
}
if (!rna_property_override_operation_apply(
+ bmain,
ptr_local, ptr_override, ptr_storage,
prop_local, prop_override, prop_storage,
ptr_item_local, ptr_item_override, ptr_item_storage,
@@ -7823,6 +7843,7 @@ static void rna_property_override_apply_ex(
/** Apply given \a override operations on \a ptr_local, using \a ptr_override
* (and \a ptr_storage form differential ops) as source. */
void RNA_struct_override_apply(
+ Main *bmain,
PointerRNA *ptr_local, PointerRNA *ptr_override, PointerRNA *ptr_storage, IDOverrideStatic *override)
{
#ifdef DEBUG_OVERRIDE_TIMEIT
@@ -7854,6 +7875,7 @@ void RNA_struct_override_apply(
}
rna_property_override_apply_ex(
+ bmain,
&data_local, &data_override, prop_storage ? &data_storage : NULL,
prop_local, prop_override, prop_storage,
&data_item_local, &data_item_override, prop_storage ? &data_item_storage : NULL,
diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c
index 1aee30cd94b..7b14c6960b5 100644
--- a/source/blender/makesrna/intern/rna_animation.c
+++ b/source/blender/makesrna/intern/rna_animation.c
@@ -586,6 +586,7 @@ static FCurve *rna_Driver_find(AnimData *adt, ReportList *reports, const char *d
}
bool rna_AnimaData_override_apply(
+ Main *UNUSED(bmain),
PointerRNA *ptr_dst, PointerRNA *ptr_src, PointerRNA *ptr_storage,
PropertyRNA *prop_dst, PropertyRNA *prop_src, PropertyRNA *UNUSED(prop_storage),
const int len_dst, const int len_src, const int len_storage,
diff --git a/source/blender/makesrna/intern/rna_group.c b/source/blender/makesrna/intern/rna_group.c
index ff3900705e4..b3afba36a9f 100644
--- a/source/blender/makesrna/intern/rna_group.c
+++ b/source/blender/makesrna/intern/rna_group.c
@@ -109,6 +109,7 @@ static void rna_Collection_objects_unlink(Collection *collection, Main *bmain, R
}
static bool rna_Collection_objects_override_apply(
+ Main *bmain,
PointerRNA *ptr_dst, PointerRNA *UNUSED(ptr_src), PointerRNA *UNUSED(ptr_storage),
PropertyRNA *UNUSED(prop_dst), PropertyRNA *UNUSED(prop_src), PropertyRNA *UNUSED(prop_storage),
const int UNUSED(len_dst), const int UNUSED(len_src), const int UNUSED(len_storage),
@@ -142,7 +143,7 @@ static bool rna_Collection_objects_override_apply(
id_us_plus(&cob_dst->ob->id);
if (BKE_collection_is_in_scene(coll_dst)) {
- BKE_main_collection_sync(G.main); /* YUCK!!!!!!!!!!!!! */
+ BKE_main_collection_sync(bmain);
}
return true;
@@ -191,6 +192,7 @@ static void rna_Collection_children_unlink(Collection *collection, Main *bmain,
}
static bool rna_Collection_children_override_apply(
+ Main *bmain,
PointerRNA *ptr_dst, PointerRNA *UNUSED(ptr_src), PointerRNA *UNUSED(ptr_storage),
PropertyRNA *UNUSED(prop_dst), PropertyRNA *UNUSED(prop_src), PropertyRNA *UNUSED(prop_storage),
const int UNUSED(len_dst), const int UNUSED(len_src), const int UNUSED(len_storage),
@@ -224,7 +226,7 @@ static bool rna_Collection_children_override_apply(
id_us_plus(&collchild_dst->collection->id);
BKE_collection_object_cache_free(coll_dst);
- BKE_main_collection_sync(G.main); /* YUCK!!!!!!!!!!!!! */
+ BKE_main_collection_sync(bmain);
return true;
}
diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h
index 012a24cb572..5ab1297f43c 100644
--- a/source/blender/makesrna/intern/rna_internal.h
+++ b/source/blender/makesrna/intern/rna_internal.h
@@ -205,6 +205,7 @@ void RNA_def_mask(struct BlenderRNA *brna);
void rna_def_animdata_common(struct StructRNA *srna);
bool rna_AnimaData_override_apply(
+ struct Main *bmain,
struct PointerRNA *ptr_local, struct PointerRNA *ptr_reference, struct PointerRNA *ptr_storage,
struct PropertyRNA *prop_local, struct PropertyRNA *prop_reference, struct PropertyRNA *prop_storage,
const int len_local, const int len_reference, const int len_storage,
@@ -411,6 +412,7 @@ struct PropertyRNA *rna_ensure_property_realdata(struct PropertyRNA **prop, stru
* Not obvious though, those are fairly more complicated than basic SDNA access.
*/
int rna_property_override_diff_default(
+ struct Main *bmain,
struct PointerRNA *ptr_a, struct PointerRNA *ptr_b,
struct PropertyRNA *prop_a, struct PropertyRNA *prop_b,
const int len_a, const int len_b,
@@ -419,12 +421,14 @@ int rna_property_override_diff_default(
const int flags, bool *r_override_changed);
bool rna_property_override_store_default(
+ struct Main *bmain,
struct PointerRNA *ptr_local, struct PointerRNA *ptr_reference, struct PointerRNA *ptr_storage,
struct PropertyRNA *prop_local, struct PropertyRNA *prop_reference, struct PropertyRNA *prop_storage,
const int len_local, const int len_reference, const int len_storage,
struct IDOverrideStaticPropertyOperation *opop);
bool rna_property_override_apply_default(
+ struct Main *bmain,
struct PointerRNA *ptr_dst, struct PointerRNA *ptr_src, struct PointerRNA *ptr_storage,
struct PropertyRNA *prop_dst, struct PropertyRNA *prop_src, struct PropertyRNA *prop_storage,
const int len_dst, const int len_src, const int len_storage,
diff --git a/source/blender/makesrna/intern/rna_internal_types.h b/source/blender/makesrna/intern/rna_internal_types.h
index 83d83826341..fcca0c0a3ab 100644
--- a/source/blender/makesrna/intern/rna_internal_types.h
+++ b/source/blender/makesrna/intern/rna_internal_types.h
@@ -133,6 +133,7 @@ typedef void (*PropEnumSetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *pr
* \note \a override, \a rna_path and \a r_override_changed may be NULL pointers.
*/
typedef int (*RNAPropOverrideDiff)(
+ struct Main *bmain,
struct PointerRNA *ptr_a, struct PointerRNA *ptr_b,
struct PropertyRNA *prop_a, struct PropertyRNA *prop_b,
const int len_a, const int len_b,
@@ -150,6 +151,7 @@ typedef int (*RNAPropOverrideDiff)(
* is out of range (or even change it to basic 'set' operation if nothing else works).
*/
typedef bool (*RNAPropOverrideStore)(
+ struct Main *bmain,
struct PointerRNA *ptr_local, struct PointerRNA *ptr_reference, struct PointerRNA *ptr_storage,
struct PropertyRNA *prop_local, struct PropertyRNA *prop_reference, struct PropertyRNA *prop_storage,
const int len_local, const int len_reference, const int len_storage,
@@ -163,6 +165,7 @@ typedef bool (*RNAPropOverrideStore)(
* \note In non-array cases, \a len values are 0.
*/
typedef bool (*RNAPropOverrideApply)(
+ struct Main *bmain,
struct PointerRNA *ptr_dst, struct PointerRNA *ptr_src, struct PointerRNA *ptr_storage,
struct PropertyRNA *prop_dst, struct PropertyRNA *prop_src, struct PropertyRNA *prop_storage,
const int len_dst, const int len_src, const int len_storage,
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index 204a2c28746..e75a03edac1 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -1147,6 +1147,7 @@ static void rna_Object_constraints_clear(Object *object, Main *bmain)
}
bool rna_Object_constraints_override_apply(
+ Main *UNUSED(bmain),
PointerRNA *ptr_dst, PointerRNA *ptr_src, PointerRNA *UNUSED(ptr_storage),
PropertyRNA *UNUSED(prop_dst), PropertyRNA *UNUSED(prop_src), PropertyRNA *UNUSED(prop_storage),
const int UNUSED(len_dst), const int UNUSED(len_src), const int UNUSED(len_storage),
@@ -1222,6 +1223,7 @@ static void rna_Object_modifier_clear(Object *object, bContext *C)
}
bool rna_Object_modifiers_override_apply(
+ Main *UNUSED(bmain),
PointerRNA *ptr_dst, PointerRNA *ptr_src, PointerRNA *UNUSED(ptr_storage),
PropertyRNA *UNUSED(prop_dst), PropertyRNA *UNUSED(prop_src), PropertyRNA *UNUSED(prop_storage),
const int UNUSED(len_dst), const int UNUSED(len_src), const int UNUSED(len_storage),
diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c
index 5152480255a..05eb2117990 100644
--- a/source/blender/makesrna/intern/rna_pose.c
+++ b/source/blender/makesrna/intern/rna_pose.c
@@ -570,6 +570,7 @@ static void rna_PoseChannel_constraints_remove(
}
bool rna_PoseChannel_constraints_override_apply(
+ Main *UNUSED(bmain),
PointerRNA *ptr_dst, PointerRNA *ptr_src, PointerRNA *UNUSED(ptr_storage),
PropertyRNA *UNUSED(prop_dst), PropertyRNA *UNUSED(prop_src), PropertyRNA *UNUSED(prop_storage),
const int UNUSED(len_dst), const int UNUSED(len_src), const int UNUSED(len_storage),
diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c
index 2777f87d0d2..0d3fe1bac33 100644
--- a/source/blender/makesrna/intern/rna_rna.c
+++ b/source/blender/makesrna/intern/rna_rna.c
@@ -1222,6 +1222,7 @@ static bool rna_property_override_diff_propptr_validate_diffing(
/* Used for both Pointer and Collection properties. */
static int rna_property_override_diff_propptr(
+ Main *bmain,
PointerRNA *propptr_a, PointerRNA *propptr_b,
eRNACompareMode mode, const bool no_ownership, const bool no_prop_name,
IDOverrideStatic *override, const char *rna_path, const int flags, bool *r_override_changed)
@@ -1264,7 +1265,8 @@ static int rna_property_override_diff_propptr(
}
else {
eRNAOverrideMatchResult report_flags = 0;
- const bool match = RNA_struct_override_matches(propptr_a, propptr_b, rna_path, override, flags, &report_flags);
+ const bool match = RNA_struct_override_matches(
+ bmain, propptr_a, propptr_b, rna_path, override, flags, &report_flags);
if (r_override_changed && (report_flags & RNA_OVERRIDE_MATCH_RESULT_CREATED) != 0) {
*r_override_changed = true;
}
@@ -1274,7 +1276,7 @@ static int rna_property_override_diff_propptr(
else {
/* We could also use is_diff_pointer, but then we potentially lose the gt/lt info -
* and don't think performances are critical here for now anyway... */
- return !RNA_struct_equals(propptr_a, propptr_b, mode);
+ return !RNA_struct_equals(bmain, propptr_a, propptr_b, mode);
}
}
@@ -1287,7 +1289,9 @@ static int rna_property_override_diff_propptr(
(is_array ? RNA_property_##_typename##_set_index((_ptr), (_prop), (_index), (_value)) : \
RNA_property_##_typename##_set((_ptr), (_prop), (_value)))
-int rna_property_override_diff_default(PointerRNA *ptr_a, PointerRNA *ptr_b,
+int rna_property_override_diff_default(
+ Main *bmain,
+ PointerRNA *ptr_a, PointerRNA *ptr_b,
PropertyRNA *prop_a, PropertyRNA *prop_b,
const int len_a, const int len_b,
const int mode,
@@ -1541,6 +1545,7 @@ int rna_property_override_diff_default(PointerRNA *ptr_a, PointerRNA *ptr_b,
const bool no_ownership = (RNA_property_flag(prop_a) & PROP_PTR_NO_OWNERSHIP) != 0;
const bool no_prop_name = (RNA_property_override_flag(prop_a) & PROPOVERRIDE_NO_PROP_NAME) != 0;
return rna_property_override_diff_propptr(
+ bmain,
&propptr_a, &propptr_b, mode, no_ownership, no_prop_name,
override, rna_path, flags, r_override_changed);
}
@@ -1691,8 +1696,9 @@ int rna_property_override_diff_default(PointerRNA *ptr_a, PointerRNA *ptr_b,
if (equals || do_create) {
const bool no_ownership = (RNA_property_flag(prop_a) & PROP_PTR_NO_OWNERSHIP) != 0;
const int eq = rna_property_override_diff_propptr(
- &iter_a.ptr, &iter_b.ptr, mode, no_ownership, no_prop_name,
- override, extended_rna_path, flags, r_override_changed);
+ bmain,
+ &iter_a.ptr, &iter_b.ptr, mode, no_ownership, no_prop_name,
+ override, extended_rna_path, flags, r_override_changed);
equals = equals && eq;
}
}
@@ -1763,6 +1769,7 @@ int rna_property_override_diff_default(PointerRNA *ptr_a, PointerRNA *ptr_b,
}
bool rna_property_override_store_default(
+ Main *UNUSED(bmain),
PointerRNA *ptr_local, PointerRNA *ptr_reference, PointerRNA *ptr_storage,
PropertyRNA *prop_local, PropertyRNA *prop_reference, PropertyRNA *prop_storage,
const int len_local, const int len_reference, const int len_storage,
@@ -2006,6 +2013,7 @@ bool rna_property_override_store_default(
}
bool rna_property_override_apply_default(
+ Main *UNUSED(bmain),
PointerRNA *ptr_dst, PointerRNA *ptr_src, PointerRNA *ptr_storage,
PropertyRNA *prop_dst, PropertyRNA *prop_src, PropertyRNA *prop_storage,
const int len_dst, const int len_src, const int len_storage,
diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c
index bcb4fffea87..2b0c550280d 100644
--- a/source/blender/windowmanager/intern/wm_keymap.c
+++ b/source/blender/windowmanager/intern/wm_keymap.c
@@ -166,7 +166,8 @@ static void wm_keyconfig_properties_update_ot(ListBase *km_lb)
static bool wm_keymap_item_equals_result(wmKeyMapItem *a, wmKeyMapItem *b)
{
return (STREQ(a->idname, b->idname) &&
- RNA_struct_equals(a->ptr, b->ptr, RNA_EQ_UNSET_MATCH_NONE) &&
+ /* We do not really care about which Main we pass here, tbh. */
+ RNA_struct_equals(G_MAIN, a->ptr, b->ptr, RNA_EQ_UNSET_MATCH_NONE) &&
(a->flag & KMI_INACTIVE) == (b->flag & KMI_INACTIVE) &&
a->propvalue == b->propvalue);
}