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>2022-02-22 19:20:18 +0300
committerBastien Montagne <bastien@blender.org>2022-03-29 18:58:40 +0300
commit5adcf6c85e4c28fcfda0048a9ec7cceae105046d (patch)
treeebc6b23cb3ede2cd3581371aaf6fae3f057eb511 /source/blender/makesrna/intern/rna_access.c
parent101308403833aedbfef1d105424867a8f787d7b6 (diff)
LibOverride: Add initial System Override flag.
This merely adds the flag, exposes it in RMA, and uses it in some of the most common 'is editable' checks (RNA, `BASE_EDITABLE` macro...). Next step: do_version and defining systemoverrides at creation. Ref: {T95707}.
Diffstat (limited to 'source/blender/makesrna/intern/rna_access.c')
-rw-r--r--source/blender/makesrna/intern/rna_access.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index 67fa29adb47..5690d864a75 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -32,8 +32,10 @@
#include "BKE_collection.h"
#include "BKE_context.h"
#include "BKE_fcurve.h"
+#include "BKE_global.h"
#include "BKE_idprop.h"
#include "BKE_idtype.h"
+#include "BKE_lib_override.h"
#include "BKE_main.h"
#include "BKE_node.h"
#include "BKE_report.h"
@@ -1930,17 +1932,29 @@ static bool rna_property_editable_do(PointerRNA *ptr,
/* Handle linked or liboverride ID cases. */
const bool is_linked_prop_exception = (prop->flag & PROP_LIB_EXCEPTION) != 0;
- if (ID_IS_LINKED(id) && !is_linked_prop_exception) {
+ if (ID_IS_LINKED(id)) {
+ if (is_linked_prop_exception) {
+ return true;
+ }
if (r_info != NULL && (*r_info)[0] == '\0') {
*r_info = N_("Can't edit this property from a linked data-block");
}
return false;
}
- if (ID_IS_OVERRIDE_LIBRARY(id) && !RNA_property_overridable_get(ptr, prop_orig)) {
- if (r_info != NULL && (*r_info)[0] == '\0') {
- *r_info = N_("Can't edit this property from an override data-block");
+ if (ID_IS_OVERRIDE_LIBRARY(id)) {
+ const bool is_liboverride_system = BKE_lib_override_library_is_system_defined(G_MAIN, id);
+ if (!RNA_property_overridable_get(ptr, prop_orig)) {
+ if (r_info != NULL && (*r_info)[0] == '\0') {
+ *r_info = N_("Can't edit this property from an override data-block");
+ }
+ return false;
+ }
+ if (is_liboverride_system && !is_linked_prop_exception) {
+ if (r_info != NULL && (*r_info)[0] == '\0') {
+ *r_info = N_("Can't edit this property from a system override data-block");
+ }
+ return false;
}
- return false;
}
/* At this point, property is owned by a local ID and therefore fully editable. */