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 <montagne29@wanadoo.fr>2018-05-02 19:13:15 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2018-05-02 19:14:19 +0300
commit0fb5a39baf46440a1dfbef939bb46bbb2b610036 (patch)
treeafb465fa28e5aec22231835fd3670e5eef8ea69b /source/blender/makesrna/intern/rna_access.c
parent6a9e6b1448be0f77291fdb9372587ba88421bf3b (diff)
Static Override: add insertion for modifiers and one constraints, fix editing of inserted items in collections.
Now insertable collection items have a flag to say they are 'local' (and hence can be freely edited).
Diffstat (limited to 'source/blender/makesrna/intern/rna_access.c')
-rw-r--r--source/blender/makesrna/intern/rna_access.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index 39815dbc3d2..7bf00ef65f6 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -34,6 +34,8 @@
#include "DNA_ID.h"
#include "DNA_scene_types.h"
+#include "DNA_constraint_types.h"
+#include "DNA_modifier_types.h"
#include "DNA_windowmanager_types.h"
#include "BLI_blenlib.h"
@@ -1966,9 +1968,24 @@ bool RNA_property_animated(PointerRNA *ptr, PropertyRNA *prop)
/** \note Does not take into account editable status, this has to be checked separately
* (using RNA_property_edtiable_flag() usually). */
-bool RNA_property_overridable_get(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
+bool RNA_property_overridable_get(PointerRNA *ptr, PropertyRNA *prop)
{
if (prop->magic == RNA_MAGIC) {
+ /* Special handling for insertions of constraints or modifiers... */
+ /* TODO Note We may want to add a more generic system to RNA (like a special property in struct of items)
+ * if we get more overrideable collections, for now we can live with those special-cases handling I think. */
+ if (RNA_struct_is_a(ptr->type, &RNA_Constraint)) {
+ bConstraint *con = ptr->data;
+ if (con->flag & CONSTRAINT_STATICOVERRIDE_LOCAL) {
+ return true;
+ }
+ }
+ else if (RNA_struct_is_a(ptr->type, &RNA_Modifier)) {
+ ModifierData *mod = ptr->data;
+ if (mod->flag & eModifierFlag_StaticOverride_Local) {
+ return true;
+ }
+ }
/* If this is a RNA-defined property (real or 'virtual' IDProp), we want to use RNA prop flag. */
return !(prop->flag & PROP_NO_COMPARISON) && (prop->flag & PROP_OVERRIDABLE_STATIC);
}