[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [34210] trunk/blender: Restoring " Pose Markers"

Joshua Leung aligorith at gmail.com
Mon Jan 10 00:16:05 CET 2011


Revision: 34210
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=34210
Author:   aligorith
Date:     2011-01-09 23:16:05 +0000 (Sun, 09 Jan 2011)
Log Message:
-----------
Restoring "Pose Markers"

These were markers which belonged to an action instead of the scene,
and are used by PoseLib to keep track of where poses are.

To restore this, I've made this only available in Action/Shapekey
Editor modes, and only when an action is being shown and the "Show
Pose Markers" option in the Markers menu has been enabled. Other than
that, all the standard marker operators apply now (instead of using a
separate set of special operators).

Modified Paths:
--------------
    trunk/blender/release/scripts/ui/space_dopesheet.py
    trunk/blender/source/blender/editors/animation/anim_markers.c
    trunk/blender/source/blender/editors/space_action/space_action.c
    trunk/blender/source/blender/makesdna/DNA_action_types.h
    trunk/blender/source/blender/makesrna/intern/rna_space.c

Modified: trunk/blender/release/scripts/ui/space_dopesheet.py
===================================================================
--- trunk/blender/release/scripts/ui/space_dopesheet.py	2011-01-09 22:37:29 UTC (rev 34209)
+++ trunk/blender/release/scripts/ui/space_dopesheet.py	2011-01-09 23:16:05 UTC (rev 34210)
@@ -185,6 +185,8 @@
     def draw(self, context):
         layout = self.layout
         
+        st = context.space_data
+        
         #layout.operator_context = 'EXEC_REGION_WIN'
         
         layout.column()
@@ -197,7 +199,9 @@
         layout.operator("marker.rename", text="Rename Marker")
         layout.operator("marker.move", text="Grab/Move Marker")
         
-        # TODO: pose markers for action edit mode only?
+        if st.mode in ('ACTION', 'SHAPEKEY') and st.action:
+            layout.separator()
+            layout.prop(st, "show_pose_markers")
 
 class DOPESHEET_MT_channel(bpy.types.Menu):
     bl_label = "Channel"

Modified: trunk/blender/source/blender/editors/animation/anim_markers.c
===================================================================
--- trunk/blender/source/blender/editors/animation/anim_markers.c	2011-01-09 22:37:29 UTC (rev 34209)
+++ trunk/blender/source/blender/editors/animation/anim_markers.c	2011-01-09 23:16:05 UTC (rev 34210)
@@ -68,18 +68,23 @@
 
 static ListBase *context_get_markers(const bContext *C)
 {
+	ScrArea *sa = CTX_wm_area(C);
 	
-#if 0
-	/* XXX get them from pose */
-	if ((slink->spacetype == SPACE_ACTION) && (saction->flag & SACTION_POSEMARKERS_MOVE)) {
-		if (saction->action)
-			markers= &saction->action->markers;
-		else
-			markers= NULL;
+	/* local marker sets... */
+	if (sa->spacetype == SPACE_ACTION) {
+		SpaceAction *saction = (SpaceAction *)sa->spacedata.first;
+		
+		/* local markers can only be shown when there's only a single active action to grab them from 
+		 * 	- flag only takes effect when there's an action, otherwise it can get too confusing?
+		 */
+		if (ELEM(saction->mode, SACTCONT_ACTION, SACTCONT_SHAPEKEY) && (saction->action)) 
+		{
+			if (saction->flag & SACTION_POSEMARKERS_SHOW)
+				return &saction->action->markers;
+		}
 	}
-	else
-#endif
 	
+	/* default to using the scene's markers */
 	return &CTX_data_scene(C)->markers;
 }
 
@@ -453,7 +458,7 @@
 	}
 	
 	/* deselect all */
-	for(marker= markers->first; marker; marker= marker->next)
+	for (marker= markers->first; marker; marker= marker->next)
 		marker->flag &= ~SELECT;
 	
 	marker = MEM_callocN(sizeof(TimeMarker), "TimeMarker");
@@ -643,7 +648,7 @@
 		case LEFTMOUSE:
 		case MIDDLEMOUSE:
 		case RIGHTMOUSE:
-			if(WM_modal_tweak_exit(evt, mm->event_type)) {
+			if (WM_modal_tweak_exit(evt, mm->event_type)) {
 				ed_marker_move_exit(C, op);
 				WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL);
 				WM_event_add_notifier(C, NC_ANIMATION|ND_MARKERS, NULL);
@@ -652,9 +657,9 @@
 			
 			break;
 		case MOUSEMOVE:
-			if(hasNumInput(&mm->num))
+			if (hasNumInput(&mm->num))
 				break;
-
+			
 			dx= v2d->mask.xmax-v2d->mask.xmin;
 			dx= (v2d->cur.xmax-v2d->cur.xmin)/dx;
 			
@@ -729,22 +734,22 @@
 			}
 	}
 
-	if(evt->val==KM_PRESS) {
+	if (evt->val==KM_PRESS) {
 		float vec[3];
 		char str_tx[256];
-
+		
 		if (handleNumInput(&mm->num, evt))
 		{
 			applyNumInput(&mm->num, vec);
 			outputNumInput(&mm->num, str_tx);
-
+			
 			RNA_int_set(op->ptr, "frames", vec[0]);
 			ed_marker_move_apply(op);
 			// ed_marker_header_update(C, op, str, (int)vec[0]);
 			// strcat(str, str_tx);
 			sprintf(str, "Marker offset %s", str_tx);
 			ED_area_headerprint(CTX_wm_area(C), str);
-
+			
 			WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL);
 			WM_event_add_notifier(C, NC_ANIMATION|ND_MARKERS, NULL);
 		}

Modified: trunk/blender/source/blender/editors/space_action/space_action.c
===================================================================
--- trunk/blender/source/blender/editors/space_action/space_action.c	2011-01-09 22:37:29 UTC (rev 34209)
+++ trunk/blender/source/blender/editors/space_action/space_action.c	2011-01-09 23:16:05 UTC (rev 34210)
@@ -191,8 +191,10 @@
 	
 	/* markers */
 	UI_view2d_view_orthoSpecial(ar, v2d, 1);
-	draw_markers_time(C, 0);
 	
+	flag = (saction->flag & SACTION_POSEMARKERS_SHOW)? DRAW_MARKERS_LOCAL : 0;
+	draw_markers_time(C, flag);
+	
 	/* preview range */
 	UI_view2d_view_ortho(v2d);
 	ANIM_draw_previewrange(C, v2d);

Modified: trunk/blender/source/blender/makesdna/DNA_action_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_action_types.h	2011-01-09 22:37:29 UTC (rev 34209)
+++ trunk/blender/source/blender/makesdna/DNA_action_types.h	2011-01-09 23:16:05 UTC (rev 34210)
@@ -593,8 +593,8 @@
 	SACTION_NOTRANSKEYCULL = (1<<4),
 		/* don't include keyframes that are out of view */
 	//SACTION_HORIZOPTIMISEON = (1<<5), // XXX depreceated... old irrelevant trick
-		/* hack for moving pose-markers (temp flag)  */
-	SACTION_POSEMARKERS_MOVE = (1<<6),
+		/* show pose-markers (local to action) in Action Editor mode  */
+	SACTION_POSEMARKERS_SHOW = (1<<6),
 		/* don't draw action channels using group colors (where applicable) */
 	SACTION_NODRAWGCOLORS = (1<<7), // XXX depreceated... irrelevant for current groups implementation
 		/* don't draw current frame number beside frame indicator */

Modified: trunk/blender/source/blender/makesrna/intern/rna_space.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_space.c	2011-01-09 22:37:29 UTC (rev 34209)
+++ trunk/blender/source/blender/makesrna/intern/rna_space.c	2011-01-09 23:16:05 UTC (rev 34210)
@@ -1731,6 +1731,11 @@
 	RNA_def_property_ui_text(prop, "Show Sliders", "Show sliders beside F-Curve channels");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_DOPESHEET, NULL);
 	
+	prop= RNA_def_property(srna, "show_pose_markers", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flag", SACTION_POSEMARKERS_SHOW);
+	RNA_def_property_ui_text(prop, "Show Pose Markers", "Show markers belonging to the active action instead of Scene markers (Action and Shape Key Editors only)");
+	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_DOPESHEET, NULL);
+	
 	/* editing */
 	prop= RNA_def_property(srna, "use_auto_merge_keyframes", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SACTION_NOTRANSKEYCULL);




More information about the Bf-blender-cvs mailing list