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 <bastien@blender.org>2021-08-04 17:56:06 +0300
committerBastien Montagne <bastien@blender.org>2021-08-04 17:57:08 +0300
commit58ba75f9e3bfc4ff08dbd1f2ce269c65388dfcfd (patch)
tree9f814ffac35f261a248a0e402084d43e3ceec6c2 /source/blender/makesrna
parenta8185d2d74d42389d881890897958c1223eb5cf1 (diff)
LibOverride RNA API: add removal of properties and operations.
This should complete the basics of RNA API for library overrides. Ref. T86656.
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r--source/blender/makesrna/intern/rna_ID.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c
index e4c9b70a1ec..8f8ad077935 100644
--- a/source/blender/makesrna/intern/rna_ID.c
+++ b/source/blender/makesrna/intern/rna_ID.c
@@ -807,6 +807,18 @@ static IDOverrideLibraryProperty *rna_ID_override_library_properties_add(
return result;
}
+static void rna_ID_override_library_properties_remove(IDOverrideLibrary *override_library,
+ ReportList *reports,
+ IDOverrideLibraryProperty *override_property)
+{
+ if (BLI_findindex(&override_library->properties, override_property) == -1) {
+ BKE_report(reports, RPT_ERROR, "Override property cannot be removed");
+ return;
+ }
+
+ BKE_lib_override_library_property_delete(override_library, override_property);
+}
+
static IDOverrideLibraryPropertyOperation *rna_ID_override_library_property_operations_add(
IDOverrideLibraryProperty *override_property,
ReportList *reports,
@@ -834,6 +846,19 @@ static IDOverrideLibraryPropertyOperation *rna_ID_override_library_property_oper
return result;
}
+static void rna_ID_override_library_property_operations_remove(
+ IDOverrideLibraryProperty *override_property,
+ ReportList *reports,
+ IDOverrideLibraryPropertyOperation *override_operation)
+{
+ if (BLI_findindex(&override_property->operations, override_operation) == -1) {
+ BKE_report(reports, RPT_ERROR, "Override operation cannot be removed");
+ return;
+ }
+
+ BKE_lib_override_library_property_operation_delete(override_property, override_operation);
+}
+
static void rna_ID_update_tag(ID *id, Main *bmain, ReportList *reports, int flag)
{
/* XXX, new function for this! */
@@ -1685,6 +1710,16 @@ static void rna_def_ID_override_library_property_operations(BlenderRNA *brna, Pr
"New Operation",
"Created operation");
RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_ID_override_library_property_operations_remove");
+ RNA_def_function_ui_description(func, "Remove and delete an operation");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(func,
+ "operation",
+ "IDOverrideLibraryPropertyOperation",
+ "Operation",
+ "Override operation to be deleted");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
static void rna_def_ID_override_library_property(BlenderRNA *brna)
@@ -1741,6 +1776,16 @@ static void rna_def_ID_override_library_properties(BlenderRNA *brna, PropertyRNA
parm = RNA_def_string(
func, "rna_path", NULL, 256, "RNA Path", "RNA-Path of the property to add");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ func = RNA_def_function(srna, "remove", "rna_ID_override_library_properties_remove");
+ RNA_def_function_ui_description(func, "Remove and delete a property");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(func,
+ "property",
+ "IDOverrideLibraryProperty",
+ "Property",
+ "Override property to be deleted");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
static void rna_def_ID_override_library(BlenderRNA *brna)