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
path: root/source
diff options
context:
space:
mode:
authorJeroen Bakker <jeroen@blender.org>2021-08-04 10:18:21 +0300
committerJeroen Bakker <jeroen@blender.org>2021-08-04 10:28:18 +0300
commit3b0fab6dfaa00a6fd476d28c160fcd9219f9a973 (patch)
tree81026d0881c4ef9f438c83f1e9ae89a5497a4784 /source
parenteffc0487106bc74590acf35a61541597b1149daa (diff)
Override: API update_operations.
The update_operations function will update the override structure of the local object. When working with overrides the override structure is only updated when the work-file is stored. When using scripts you might want to enforce the update of override properties and operations. This function removes a hack on the test cases. Reviewed By: mont29 Maniphest Tasks: T86656 Differential Revision: https://developer.blender.org/D10848
Diffstat (limited to 'source')
-rw-r--r--source/blender/makesrna/intern/rna_ID.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c
index 6df03d19538..e177f211c7f 100644
--- a/source/blender/makesrna/intern/rna_ID.c
+++ b/source/blender/makesrna/intern/rna_ID.c
@@ -741,6 +741,19 @@ static void rna_ID_override_template_create(ID *id, ReportList *reports)
BKE_lib_override_library_template_create(id);
}
+static void rna_ID_override_library_update_operations(ID *id,
+ IDOverrideLibrary *UNUSED(override_library),
+ Main *bmain,
+ ReportList *reports)
+{
+ if (!ID_IS_OVERRIDE_LIBRARY_REAL(id)) {
+ BKE_report(reports, RPT_ERROR, "ID isn't an override");
+ return;
+ }
+
+ BKE_lib_override_library_operations_create(bmain, id);
+}
+
static IDOverrideLibraryProperty *rna_ID_override_library_properties_add(
IDOverrideLibrary *override_library, ReportList *reports, const char rna_path[])
{
@@ -1695,6 +1708,7 @@ static void rna_def_ID_override_library(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
+ FunctionRNA *func;
srna = RNA_def_struct(brna, "IDOverrideLibrary", NULL);
RNA_def_struct_ui_text(
@@ -1710,6 +1724,13 @@ static void rna_def_ID_override_library(BlenderRNA *brna)
"List of overridden properties");
rna_def_ID_override_library_properties(brna, prop);
+ /* Update function. */
+ func = RNA_def_function(srna, "update_operations", "rna_ID_override_library_update_operations");
+ RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_SELF_ID | FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func,
+ "Update the library override operations based on the "
+ "differences between this override ID and its reference");
+
rna_def_ID_override_library_property(brna);
}