[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [45876] trunk/blender: fix [#30937] Pose UI hack needed to be undone, alternate fix is needed.

Campbell Barton ideasman42 at gmail.com
Mon Apr 23 11:17:37 CEST 2012


Revision: 45876
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=45876
Author:   campbellbarton
Date:     2012-04-23 09:17:37 +0000 (Mon, 23 Apr 2012)
Log Message:
-----------
fix [#30937] Pose UI hack needed to be undone, alternate fix is needed.

rather then assigning the enum, default to the active pose when the property isnt set.

Modified Paths:
--------------
    trunk/blender/release/scripts/startup/bl_ui/properties_data_armature.py
    trunk/blender/source/blender/editors/armature/poselib.c

Modified: trunk/blender/release/scripts/startup/bl_ui/properties_data_armature.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/properties_data_armature.py	2012-04-23 09:01:27 UTC (rev 45875)
+++ trunk/blender/release/scripts/startup/bl_ui/properties_data_armature.py	2012-04-23 09:17:37 UTC (rev 45876)
@@ -204,7 +204,7 @@
             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?

Modified: trunk/blender/source/blender/editors/armature/poselib.c
===================================================================
--- trunk/blender/source/blender/editors/armature/poselib.c	2012-04-23 09:01:27 UTC (rev 45875)
+++ trunk/blender/source/blender/editors/armature/poselib.c	2012-04-23 09:17:37 UTC (rev 45876)
@@ -516,7 +516,7 @@
 	int i= 0;
 
 	if (C == NULL) {
-		return DummyRNA_DEFAULT_items;
+		return DummyRNA_NULL_items;
 	}
 	
 	/* check that the action exists */
@@ -541,18 +541,28 @@
 	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 @@
 	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;
 }
 




More information about the Bf-blender-cvs mailing list