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:
authorDan Eicher <dan@eu.phorio.us>2012-05-20 01:22:01 +0400
committerDan Eicher <dan@eu.phorio.us>2012-05-20 01:22:01 +0400
commitdd7229aee066b879e58fb2f83efaf4e6059cc06f (patch)
treec561fa25df337e58da364bf49da2e3c4a7ae4730 /source/blender/makesrna/intern/rna_rna.c
parent436b63eea5cf994a8aa934a41b34737e2b09ae03 (diff)
Added 'LIBRARY_EDITABLE' flag to bpy.props.*
Rationale: custom props on linked objects are editable through ops and the console but the UI code calls RNA_property_editable() which returns false if (id->lib && !(prop->flag & PROP_LIB_EXCEPTION)) Setting the 'LIBRARY_EDITABLE' flag allows UI templates to change these props (but the changes aren't saved!) for things like indices into CollectionProperties which live on the linked object
Diffstat (limited to 'source/blender/makesrna/intern/rna_rna.c')
-rw-r--r--source/blender/makesrna/intern/rna_rna.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c
index 38fbe708038..aab3483e29b 100644
--- a/source/blender/makesrna/intern/rna_rna.c
+++ b/source/blender/makesrna/intern/rna_rna.c
@@ -577,6 +577,12 @@ static int rna_Property_is_enum_flag_get(PointerRNA *ptr)
return prop->flag & PROP_ENUM_FLAG ? 1 : 0;
}
+static int rna_Property_is_library_editable_flag_get(PointerRNA *ptr)
+{
+ PropertyRNA *prop = (PropertyRNA *)ptr->data;
+ return prop->flag & PROP_LIB_EXCEPTION ? 1 : 0;
+}
+
static int rna_Property_array_length_get(PointerRNA *ptr)
{
PropertyRNA *prop = (PropertyRNA *)ptr->data;
@@ -1174,6 +1180,11 @@ static void rna_def_property(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_boolean_funcs(prop, "rna_Property_is_enum_flag_get", NULL);
RNA_def_property_ui_text(prop, "Enum Flag", "True when multiple enums ");
+
+ prop = RNA_def_property(srna, "is_library_editable", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_boolean_funcs(prop, "rna_Property_is_library_editable_flag_get", NULL);
+ RNA_def_property_ui_text(prop, "Library Editable", "Property is editable from linked instances (changes not saved)");
}
static void rna_def_function(BlenderRNA *brna)