From fb7878a2c29338ee706b5add6a9a95b665616725 Mon Sep 17 00:00:00 2001 From: Martin Poirier Date: Wed, 27 Jan 2010 21:19:39 +0000 Subject: 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. --- source/blender/editors/armature/poselib.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'source/blender/editors/armature') 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; } -- cgit v1.2.3