diff options
author | Martin Poirier <theeth@yahoo.com> | 2010-01-28 00:19:39 +0300 |
---|---|---|
committer | Martin Poirier <theeth@yahoo.com> | 2010-01-28 00:19:39 +0300 |
commit | fb7878a2c29338ee706b5add6a9a95b665616725 (patch) | |
tree | 6612060c1a0c88fb283cab4659755cd6f007afef /source/blender/editors/armature | |
parent | 86a65890c469506717cef8e5fba48993d8e0379f (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/armature')
-rw-r--r-- | source/blender/editors/armature/poselib.c | 10 |
1 files changed, 6 insertions, 4 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; } |