[Bf-blender-cvs] [7e0bf7a0f10] master: LibOverride: Fix getting proper RNA path and ID from embedded ones.
Bastien Montagne
noreply at git.blender.org
Thu Jul 16 11:04:09 CEST 2020
Commit: 7e0bf7a0f10bc86fa50ddc852a949890efc11fe2
Author: Bastien Montagne
Date: Thu Jul 16 11:03:11 2020 +0200
Branches: master
https://developer.blender.org/rB7e0bf7a0f10bc86fa50ddc852a949890efc11fe2
LibOverride: Fix getting proper RNA path and ID from embedded ones.
Master collections and root node trees should now be working as expected
in that regard.
===================================================================
M source/blender/editors/interface/interface.c
M source/blender/editors/interface/interface_context_menu.c
M source/blender/editors/interface/interface_handlers.c
M source/blender/editors/interface/interface_intern.h
M source/blender/editors/interface/interface_ops.c
M source/blender/makesrna/RNA_access.h
M source/blender/makesrna/intern/rna_access_compare_override.c
===================================================================
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index ca89c5f606f..28b86674fdd 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -1500,10 +1500,10 @@ static void ui_menu_block_set_keymaps(const bContext *C, uiBlock *block)
}
}
-void ui_but_override_flag(uiBut *but)
+void ui_but_override_flag(Main *bmain, uiBut *but)
{
const uint override_status = RNA_property_override_library_status(
- &but->rnapoin, but->rnaprop, but->rnaindex);
+ bmain, &but->rnapoin, but->rnaprop, but->rnaindex);
if (override_status & RNA_OVERRIDE_STATUS_OVERRIDDEN) {
but->flag |= UI_BUT_OVERRIDEN;
@@ -1762,7 +1762,7 @@ void UI_block_end_ex(const bContext *C, uiBlock *block, const int xy[2], int r_x
}
ui_but_anim_flag(but, (scene) ? scene->r.cfra : 0.0f);
- ui_but_override_flag(but);
+ ui_but_override_flag(CTX_data_main(C), but);
if (UI_but_is_decorator(but)) {
ui_but_anim_decorate_update_from_flag(but);
}
diff --git a/source/blender/editors/interface/interface_context_menu.c b/source/blender/editors/interface/interface_context_menu.c
index 565e9d6820b..a08c5c45b6f 100644
--- a/source/blender/editors/interface/interface_context_menu.c
+++ b/source/blender/editors/interface/interface_context_menu.c
@@ -560,7 +560,8 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but)
const bool is_array_component = (is_array && but->rnaindex != -1);
const bool is_whole_array = (is_array && but->rnaindex == -1);
- const uint override_status = RNA_property_override_library_status(ptr, prop, -1);
+ const uint override_status = RNA_property_override_library_status(
+ CTX_data_main(C), ptr, prop, -1);
const bool is_overridable = (override_status & RNA_OVERRIDE_STATUS_OVERRIDABLE) != 0;
/* Set the (button_pointer, button_prop)
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index bad833265d9..43c91f1d2eb 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -8418,7 +8418,7 @@ void UI_context_update_anim_flag(const bContext *C)
for (block = region->uiblocks.first; block; block = block->next) {
for (but = block->buttons.first; but; but = but->next) {
ui_but_anim_flag(but, (scene) ? scene->r.cfra : 0.0f);
- ui_but_override_flag(but);
+ ui_but_override_flag(CTX_data_main(C), but);
if (UI_but_is_decorator(but)) {
ui_but_anim_decorate_update_from_flag(but);
}
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h
index fac78808a9a..a7cbfc23399 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -548,7 +548,7 @@ extern bool ui_but_supports_cycling(const uiBut *but) ATTR_WARN_UNUSED_RESULT;
extern int ui_but_is_pushed_ex(uiBut *but, double *value) ATTR_WARN_UNUSED_RESULT;
extern int ui_but_is_pushed(uiBut *but) ATTR_WARN_UNUSED_RESULT;
-void ui_but_override_flag(uiBut *but);
+void ui_but_override_flag(struct Main *bmain, uiBut *but);
extern void ui_block_bounds_calc(uiBlock *block);
diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c
index 5237e2ea3f7..39c1b8bb909 100644
--- a/source/blender/editors/interface/interface_ops.c
+++ b/source/blender/editors/interface/interface_ops.c
@@ -510,7 +510,8 @@ static bool override_type_set_button_poll(bContext *C)
UI_context_active_but_prop_get(C, &ptr, &prop, &index);
- const uint override_status = RNA_property_override_library_status(&ptr, prop, index);
+ const uint override_status = RNA_property_override_library_status(
+ CTX_data_main(C), &ptr, prop, index);
return (ptr.data && prop && (override_status & RNA_OVERRIDE_STATUS_OVERRIDABLE));
}
@@ -556,7 +557,7 @@ static int override_type_set_button_exec(bContext *C, wmOperator *op)
}
IDOverrideLibraryPropertyOperation *opop = RNA_property_override_property_operation_get(
- &ptr, prop, operation, index, true, NULL, &created);
+ CTX_data_main(C), &ptr, prop, operation, index, true, NULL, &created);
if (!created) {
opop->operation = operation;
}
@@ -610,7 +611,8 @@ static bool override_remove_button_poll(bContext *C)
UI_context_active_but_prop_get(C, &ptr, &prop, &index);
- const uint override_status = RNA_property_override_library_status(&ptr, prop, index);
+ const uint override_status = RNA_property_override_library_status(
+ CTX_data_main(C), &ptr, prop, index);
return (ptr.data && ptr.owner_id && prop && (override_status & RNA_OVERRIDE_STATUS_OVERRIDDEN));
}
@@ -627,7 +629,7 @@ static int override_remove_button_exec(bContext *C, wmOperator *op)
UI_context_active_but_prop_get(C, &ptr, &prop, &index);
ID *id = ptr.owner_id;
- IDOverrideLibraryProperty *oprop = RNA_property_override_property_find(&ptr, prop, &id);
+ IDOverrideLibraryProperty *oprop = RNA_property_override_property_find(bmain, &ptr, prop, &id);
BLI_assert(oprop != NULL);
BLI_assert(id != NULL && id->override_library != NULL);
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h
index 53bb8899855..6acd9d16f80 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -1484,16 +1484,24 @@ void RNA_struct_override_apply(struct Main *bmain,
struct PointerRNA *ptr_storage,
struct IDOverrideLibrary *override);
-struct IDOverrideLibraryProperty *RNA_property_override_property_find(PointerRNA *ptr,
+struct IDOverrideLibraryProperty *RNA_property_override_property_find(struct Main *bmain,
+ PointerRNA *ptr,
PropertyRNA *prop,
struct ID **r_owner_id);
-struct IDOverrideLibraryProperty *RNA_property_override_property_get(PointerRNA *ptr,
+struct IDOverrideLibraryProperty *RNA_property_override_property_get(struct Main *bmain,
+ PointerRNA *ptr,
PropertyRNA *prop,
bool *r_created);
struct IDOverrideLibraryPropertyOperation *RNA_property_override_property_operation_find(
- PointerRNA *ptr, PropertyRNA *prop, const int index, const bool strict, bool *r_strict);
+ struct Main *bmain,
+ PointerRNA *ptr,
+ PropertyRNA *prop,
+ const int index,
+ const bool strict,
+ bool *r_strict);
struct IDOverrideLibraryPropertyOperation *RNA_property_override_property_operation_get(
+ struct Main *bmain,
PointerRNA *ptr,
PropertyRNA *prop,
const short operation,
@@ -1502,7 +1510,8 @@ struct IDOverrideLibraryPropertyOperation *RNA_property_override_property_operat
bool *r_strict,
bool *r_created);
-eRNAOverrideStatus RNA_property_override_library_status(PointerRNA *ptr,
+eRNAOverrideStatus RNA_property_override_library_status(struct Main *bmainm,
+ PointerRNA *ptr,
PropertyRNA *prop,
const int index);
diff --git a/source/blender/makesrna/intern/rna_access_compare_override.c b/source/blender/makesrna/intern/rna_access_compare_override.c
index 1b846fd898c..e4af02f70fe 100644
--- a/source/blender/makesrna/intern/rna_access_compare_override.c
+++ b/source/blender/makesrna/intern/rna_access_compare_override.c
@@ -1052,7 +1052,8 @@ void RNA_struct_override_apply(Main *bmain,
#endif
}
-static char *rna_property_override_property_real_id_owner(PointerRNA *ptr,
+static char *rna_property_override_property_real_id_owner(Main *bmain,
+ PointerRNA *ptr,
PropertyRNA *prop,
ID **r_id)
{
@@ -1079,10 +1080,9 @@ static char *rna_property_override_property_real_id_owner(PointerRNA *ptr,
rna_path_prefix = "shape_keys.";
break;
case ID_GR:
- /* Master collection, TODO. */
- break;
case ID_NT:
- /* Root node trees, TODO. */
+ /* Master collections, Root node trees. */
+ owner_id = RNA_find_real_ID_and_path(bmain, id, &rna_path_prefix);
break;
default:
BLI_assert(0);
@@ -1107,13 +1107,15 @@ static char *rna_property_override_property_real_id_owner(PointerRNA *ptr,
return NULL;
}
-IDOverrideLibraryProperty *RNA_property_override_property_find(PointerRNA *ptr,
+IDOverrideLibraryProperty *RNA_property_override_property_find(Main *bmain,
+ PointerRNA *ptr,
PropertyRNA *prop,
ID **r_owner_id)
{
char *rna_path;
- if ((rna_path = rna_property_override_property_real_id_owner(ptr, prop, r_owner_id)) != NULL) {
+ if ((rna_path = rna_property_override_property_real_id_owner(bmain, ptr, prop, r_owner_id)) !=
+ NULL) {
IDOverrideLibraryProperty *op = BKE_lib_override_library_property_find(
(*r_owner_id)->override_library, rna_path);
MEM_freeN(rna_path);
@@ -1122,14 +1124,15 @@ IDOverrideLibraryProperty *RNA_property_override_property_find(PointerRNA *ptr,
return NULL;
}
-IDOverrideLibraryProperty *RNA_property_override_property_get(PointerRNA *ptr,
+IDOverrideLibraryProperty *RNA_property_override_property_get(Main *bmain,
+ PointerRNA *ptr,
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list