diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-03-25 05:12:44 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-03-25 05:12:44 +0300 |
commit | 0c03fa78c10f04283512f2a5a4557d86c72d6f29 (patch) | |
tree | 257e95d18d20a923c52f4aef811787e956b93703 /source/blender/makesrna/intern | |
parent | b5100196021d12129c0d7e80be7e202c319ea120 (diff) |
fix [#26601] Python error when use of autocomplete
Was a naming collision with 'keys' python method, reserve keys/items/values/get for python.
Updated animsys_update.py for shapekey data paths.
renamed:
Particle.hair --> hair_keys
Particle.keys --> particle_keys
Key.keys --> key_blocks
EnumProperty.items --> enum_items
KeyMap.items --> keymap_items
noted:
http://wiki.blender.org/index.php/Dev:2.5/Py/API/Updates#Since_2.56a
Diffstat (limited to 'source/blender/makesrna/intern')
-rw-r--r-- | source/blender/makesrna/intern/rna_define.c | 15 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_key.c | 12 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_particle.c | 4 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_rna.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_wm.c | 3 |
5 files changed, 26 insertions, 10 deletions
diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index 4a14b2286f9..12f15911bda 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -411,6 +411,21 @@ static int rna_validate_identifier(const char *identifier, char *error, int prop return 0; } } + + if(property) { + static const char *kwlist_prop[] = { + /* not keywords but reserved all the same because py uses */ + "keys", "values", "items", "get", + NULL + }; + + for(a=0; kwlist_prop[a]; a++) { + if (strcmp(identifier, kwlist_prop[a]) == 0) { + strcpy(error, "this keyword is reserved by python"); + return 0; + } + } + } return 1; } diff --git a/source/blender/makesrna/intern/rna_key.c b/source/blender/makesrna/intern/rna_key.c index 0edd46c089a..48cab3b13d1 100644 --- a/source/blender/makesrna/intern/rna_key.c +++ b/source/blender/makesrna/intern/rna_key.c @@ -85,7 +85,7 @@ void rna_ShapeKey_name_set(PointerRNA *ptr, const char *value) } /* fix all the animation data which may link to this */ - BKE_all_animdata_fix_paths_rename("keys", oldname, kb->name); + BKE_all_animdata_fix_paths_rename("key_blocks", oldname, kb->name); } static void rna_ShapeKey_value_set(PointerRNA *ptr, float value) @@ -350,7 +350,7 @@ static char *rna_ShapeKey_path(PointerRNA *ptr) if ((id) && (GS(id->name) != ID_KE)) return BLI_sprintfN("shape_keys.keys[\"%s\"]", kb->name); else - return BLI_sprintfN("keys[\"%s\"]", kb->name); + return BLI_sprintfN("key_blocks[\"%s\"]", kb->name); } static void rna_Key_update_data(Main *bmain, Scene *scene, PointerRNA *ptr) @@ -434,9 +434,9 @@ static char *rna_ShapeKeyPoint_path(PointerRNA *ptr) int index = rna_ShapeKeyPoint_get_index(key, kb, point); if (GS(id->name) == ID_KE) - return BLI_sprintfN("keys[\"%s\"].data[%d]", kb->name, index); + return BLI_sprintfN("key_blocks[\"%s\"].data[%d]", kb->name, index); else - return BLI_sprintfN("shape_keys.keys[\"%s\"].data[%d]", kb->name, index); + return BLI_sprintfN("shape_keys.key_blocks[\"%s\"].data[%d]", kb->name, index); } else return NULL; // XXX: there's really no way to resolve this... @@ -599,10 +599,10 @@ static void rna_def_key(BlenderRNA *brna) RNA_def_property_pointer_sdna(prop, NULL, "refkey"); RNA_def_property_ui_text(prop, "Reference Key", ""); - prop= RNA_def_property(srna, "keys", PROP_COLLECTION, PROP_NONE); + prop= RNA_def_property(srna, "key_blocks", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "block", NULL); RNA_def_property_struct_type(prop, "ShapeKey"); - RNA_def_property_ui_text(prop, "Keys", "Shape keys"); + RNA_def_property_ui_text(prop, "Key Blocks", "Shape keys"); rna_def_animdata_common(srna); diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index 55882f0acee..1531b6a9dc0 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -1045,12 +1045,12 @@ static void rna_def_particle(BlenderRNA *brna) /* Hair & Keyed Keys */ - prop= RNA_def_property(srna, "hair", PROP_COLLECTION, PROP_NONE); + prop= RNA_def_property(srna, "hair_keys", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "hair", "totkey"); RNA_def_property_struct_type(prop, "ParticleHairKey"); RNA_def_property_ui_text(prop, "Hair", ""); - prop= RNA_def_property(srna, "keys", PROP_COLLECTION, PROP_NONE); + prop= RNA_def_property(srna, "particle_keys", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "keys", "totkey"); RNA_def_property_struct_type(prop, "ParticleKey"); RNA_def_property_ui_text(prop, "Keyed States", ""); diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c index 203a399ea6c..ca3852c0fd0 100644 --- a/source/blender/makesrna/intern/rna_rna.c +++ b/source/blender/makesrna/intern/rna_rna.c @@ -1233,7 +1233,7 @@ static void rna_def_enum_property(BlenderRNA *brna, StructRNA *srna) RNA_def_property_enum_funcs(prop, "rna_EnumProperty_default_get", NULL, "rna_EnumProperty_default_itemf"); RNA_def_property_ui_text(prop, "Default", "Default value for this enum"); - prop= RNA_def_property(srna, "items", PROP_COLLECTION, PROP_NONE); + prop= RNA_def_property(srna, "enum_items", PROP_COLLECTION, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_struct_type(prop, "EnumPropertyItem"); RNA_def_property_collection_funcs(prop, "rna_EnumProperty_items_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", 0, 0, 0); diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index 2a51d8b682b..0d1463428bb 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -1664,7 +1664,8 @@ static void rna_def_keyconfig(BlenderRNA *brna) RNA_def_property_enum_items(prop, region_type_items); RNA_def_property_ui_text(prop, "Region Type", "Optional region type keymap is associated with"); - prop= RNA_def_property(srna, "items", PROP_COLLECTION, PROP_NONE); + prop= RNA_def_property(srna, "keymap_items", PROP_COLLECTION, PROP_NONE); + RNA_def_property_collection_sdna(prop, NULL, "items", NULL); RNA_def_property_struct_type(prop, "KeyMapItem"); RNA_def_property_ui_text(prop, "Items", "Items in the keymap, linking an operator to an input event"); rna_def_keymap_items(brna, prop); |