fix [#30937] Pose UI hack needed to be undone, alternate fix is needed.
authorCampbell Barton <ideasman42@gmail.com>
Mon, 23 Apr 2012 09:17:37 +0000 (09:17 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 23 Apr 2012 09:17:37 +0000 (09:17 +0000)
rather then assigning the enum, default to the active pose when the property isnt set.

release/scripts/startup/bl_ui/properties_data_armature.py
source/blender/editors/armature/poselib.c

index b94af13af7e2078ce4d66a8b5153fe8105b0ef0b..08529a0423d13ec46149fe635db53d36445b3128 100644 (file)
@@ -204,7 +204,7 @@ class DATA_PT_pose_library(ArmatureButtonsPanel, Panel):
             pose_marker_active = poselib.pose_markers.active
 
             if pose_marker_active is not None:
-                col.operator("poselib.pose_remove", icon='ZOOMOUT', text="").pose = pose_marker_active.name
+                col.operator("poselib.pose_remove", icon='ZOOMOUT', text="")
                 col.operator("poselib.apply_pose", icon='ZOOM_SELECTED', text="").pose_index = poselib.pose_markers.active_index
 
             col.operator("poselib.action_sanitise", icon='HELP', text="")  # XXX: put in menu?
index fbe05d7ef49c9eb8b6677707fda24e22d2ce4192..381423182f9bc8f0d8d284432a409e0f8485ad16 100644 (file)
@@ -516,7 +516,7 @@ static EnumPropertyItem *poselib_stored_pose_itemf(bContext *C, PointerRNA *UNUS
        int i= 0;
 
        if (C == NULL) {
-               return DummyRNA_DEFAULT_items;
+               return DummyRNA_NULL_items;
        }
        
        /* check that the action exists */
@@ -541,18 +541,28 @@ static int poselib_remove_exec (bContext *C, wmOperator *op)
        Object *ob= get_poselib_object(C);
        bAction *act= (ob) ? ob->poselib : NULL;
        TimeMarker *marker;
+       int marker_index;
        FCurve *fcu;
-       
+       PropertyRNA *prop;
+
        /* check if valid poselib */
        if (act == NULL) {
                BKE_report(op->reports, RPT_ERROR, "Object doesn't have PoseLib data");
                return OPERATOR_CANCELLED;
        }
-       
+
+       prop = RNA_struct_find_property(op->ptr, "pose");
+       if (RNA_property_is_set(op->ptr, prop)) {
+               marker_index = RNA_property_enum_get(op->ptr, prop);
+       }
+       else {
+               marker_index = act->active_marker - 1;
+       }
+
        /* get index (and pointer) of pose to remove */
-       marker= BLI_findlink(&act->markers, RNA_enum_get(op->ptr, "pose"));
+       marker = BLI_findlink(&act->markers, marker_index);
        if (marker == NULL) {
-               BKE_reportf(op->reports, RPT_ERROR, "Invalid Pose specified %d", RNA_int_get(op->ptr, "pose"));
+               BKE_reportf(op->reports, RPT_ERROR, "Invalid Pose specified %d", marker_index);
                return OPERATOR_CANCELLED;
        }
        
@@ -605,8 +615,8 @@ void POSELIB_OT_pose_remove (wmOperatorType *ot)
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
        
        /* properties */
-       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);
+       prop = RNA_def_enum(ot->srna, "pose", DummyRNA_NULL_items, 0, "Pose", "The pose to remove");
+       RNA_def_enum_funcs(prop, poselib_stored_pose_itemf);
        ot->prop = prop;
 }