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:
authorMartin Poirier <theeth@yahoo.com>2010-01-28 00:19:39 +0300
committerMartin Poirier <theeth@yahoo.com>2010-01-28 00:19:39 +0300
commitfb7878a2c29338ee706b5add6a9a95b665616725 (patch)
tree6612060c1a0c88fb283cab4659755cd6f007afef /source/blender/editors
parent86a65890c469506717cef8e5fba48993d8e0379f (diff)
PROP_ENUM_NO_CONTEXT flag for rna properties, forcing enum item functions to be passed a null context (to return non-contextual items).
This is set on keymap item operator properties and macro definition operator properties to make them non-contextual (since the context at definition time is most likely not the same then at execution time, it's better to have all options visible). This removes some more errors in keymap export and import. This commit also sanitize some enum item function, making sure they can cope with null context and have usable defaults in that case.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/armature/poselib.c10
-rw-r--r--source/blender/editors/mesh/editmesh_mods.c4
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c4
-rw-r--r--source/blender/editors/object/object_group.c18
-rw-r--r--source/blender/editors/object/object_relations.c4
5 files changed, 26 insertions, 14 deletions
diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c
index bbd60af018b..240e7f72654 100644
--- a/source/blender/editors/armature/poselib.c
+++ b/source/blender/editors/armature/poselib.c
@@ -64,6 +64,7 @@
#include "RNA_access.h"
#include "RNA_define.h"
#include "RNA_types.h"
+#include "RNA_enum_types.h"
#include "WM_api.h"
#include "WM_types.h"
@@ -432,6 +433,10 @@ static EnumPropertyItem *poselib_stored_pose_itemf(bContext *C, PointerRNA *ptr,
int totitem= 0;
int i= 0;
+ if (C==NULL) {
+ return DummyRNA_DEFAULT_items;
+ }
+
memset(&item_tmp, 0, sizeof(item_tmp));
/* check that the action exists */
@@ -500,9 +505,6 @@ static int poselib_remove_exec (bContext *C, wmOperator *op)
void POSELIB_OT_pose_remove (wmOperatorType *ot)
{
PropertyRNA *prop;
- static EnumPropertyItem prop_poses_dummy_types[] = {
- {0, NULL, 0, NULL, NULL}
- };
/* identifiers */
ot->name= "PoseLib Remove Pose";
@@ -518,7 +520,7 @@ void POSELIB_OT_pose_remove (wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
- prop= RNA_def_enum(ot->srna, "pose", prop_poses_dummy_types, 0, "Pose", "The pose to remove");
+ prop= RNA_def_enum(ot->srna, "pose", DummyRNA_DEFAULT_items, 0, "Pose", "The pose to remove");
RNA_def_enum_funcs(prop, poselib_stored_pose_itemf);
ot->prop= prop;
}
diff --git a/source/blender/editors/mesh/editmesh_mods.c b/source/blender/editors/mesh/editmesh_mods.c
index fc1e677b174..717b725387a 100644
--- a/source/blender/editors/mesh/editmesh_mods.c
+++ b/source/blender/editors/mesh/editmesh_mods.c
@@ -1260,6 +1260,10 @@ static EnumPropertyItem *select_similar_type_itemf(bContext *C, PointerRNA *ptr,
Object *obedit= CTX_data_edit_object(C);
EnumPropertyItem *item= NULL;
int a, totitem= 0;
+
+ if (C == NULL) {
+ return prop_similar_types;
+ }
if(obedit && obedit->type == OB_MESH) {
EditMesh *em= BKE_mesh_get_editmesh(obedit->data);
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index 6d6d21ffce2..3539079591d 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -5835,6 +5835,10 @@ static EnumPropertyItem *merge_type_itemf(bContext *C, PointerRNA *ptr, int *fre
EnumPropertyItem *item= NULL;
int totitem= 0;
+ if (C==NULL) {
+ return merge_type_items;
+ }
+
if(obedit && obedit->type == OB_MESH) {
EditMesh *em= BKE_mesh_get_editmesh(obedit->data);
diff --git a/source/blender/editors/object/object_group.c b/source/blender/editors/object/object_group.c
index 50fc5f5d2fe..a12c6108ba9 100644
--- a/source/blender/editors/object/object_group.c
+++ b/source/blender/editors/object/object_group.c
@@ -266,14 +266,16 @@ static EnumPropertyItem *group_itemf(bContext *C, PointerRNA *ptr, int *free)
RNA_enum_items_add_value(&item, &totitem, group_items, -1);
- if(bmain->group.first)
- RNA_enum_item_add_separator(&item, &totitem);
-
- for(a=0, group=bmain->group.first; group; group=group->id.next, a++) {
- tmp.value= a;
- tmp.identifier= group->id.name+2;
- tmp.name= group->id.name+2;
- RNA_enum_item_add(&item, &totitem, &tmp);
+ if (bmain) {
+ if(bmain->group.first)
+ RNA_enum_item_add_separator(&item, &totitem);
+
+ for(a=0, group=bmain->group.first; group; group=group->id.next, a++) {
+ tmp.value= a;
+ tmp.identifier= group->id.name+2;
+ tmp.name= group->id.name+2;
+ RNA_enum_item_add(&item, &totitem, &tmp);
+ }
}
RNA_enum_item_end(&item, &totitem);
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index 56990e0d975..647a9586aff 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -357,7 +357,7 @@ static EnumPropertyItem *proxy_group_object_itemf(bContext *C, PointerRNA *ptr,
GroupObject *go;
if(!ob || !ob->dup_group)
- return DummyRNA_NULL_items;
+ return DummyRNA_DEFAULT_items;
memset(&item_tmp, 0, sizeof(item_tmp));
@@ -393,7 +393,7 @@ void OBJECT_OT_proxy_make (wmOperatorType *ot)
/* properties */
RNA_def_string(ot->srna, "object", "", 19, "Proxy Object", "Name of lib-linked/grouped object to make a proxy for.");
- prop= RNA_def_enum(ot->srna, "type", DummyRNA_NULL_items, 0, "Type", "Group object"); /* XXX, relies on hard coded ID at the moment */
+ prop= RNA_def_enum(ot->srna, "type", DummyRNA_DEFAULT_items, 0, "Type", "Group object"); /* XXX, relies on hard coded ID at the moment */
RNA_def_enum_funcs(prop, proxy_group_object_itemf);
ot->prop= prop;
}