Commit: d5e5ce62afa1255fd4f411d848e94387695bd52f
Author: Bastien Montagne
Date: Tue Jan 3 21:01:05 2017 +0100
Branches: id_override_static
https://developer.blender.org/rBd5e5ce62afa1255fd4f411d848e94387695bd52f
Add basic code to prevent editing non-overridable properties.
===================================================================
M source/blender/makesrna/intern/rna_access.c
===================================================================
diff --git a/source/blender/makesrna/intern/rna_access.c
b/source/blender/makesrna/intern/rna_access.c
index b1684ef..29f0425 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -1634,7 +1634,8 @@ bool RNA_property_editable(PointerRNA *ptr, PropertyRNA
*prop)
return ((flag & PROP_EDITABLE) &&
(flag & PROP_REGISTER) == 0 &&
- (!id || !ID_IS_LINKED_DATABLOCK(id) || (prop->flag &
PROP_LIB_EXCEPTION)));
+ (!id || ((!ID_IS_LINKED_DATABLOCK(id) || (prop->flag &
PROP_LIB_EXCEPTION)) &&
+ (!id->override || (prop->flag & PROP_OVERRIDABLE)))));
}
/**
@@ -1660,11 +1661,19 @@ bool RNA_property_editable_info(PointerRNA *ptr,
PropertyRNA *prop, const char *
}
/* property from linked data-block */
- if (id && ID_IS_LINKED_DATABLOCK(id) && (prop->flag &
PROP_LIB_EXCEPTION) == 0) {
- if (!(*r_info)[0]) {
- *r_info = "Can't edit this property from a linked
data-block.";
+ if (id) {
+ if (ID_IS_LINKED_DATABLOCK(id) && (prop->flag &
PROP_LIB_EXCEPTION) == 0) {
+ if (!(*r_info)[0]) {
+ *r_info = "Can't edit this property from a
linked data-block.";
+ }
+ return false;
+ }
+ if (id->override != NULL && (prop->flag & PROP_OVERRIDABLE) ==
0) {
+ if (!(*r_info)[0]) {
+ *r_info = "Can't edit this property from an
override data-block.";
+ }
+ return false;
}
- return false;
}
return ((flag & PROP_EDITABLE) && (flag & PROP_REGISTER) == 0);
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs