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).
This commit is contained in:
Joshua Leung 2011-01-09 23:16:05 +00:00
parent 3fba5cfe7a
commit 56db5f10aa
5 changed files with 37 additions and 21 deletions

@ -185,6 +185,8 @@ class DOPESHEET_MT_marker(bpy.types.Menu):
def draw(self, context):
layout = self.layout
st = context.space_data
#layout.operator_context = 'EXEC_REGION_WIN'
layout.column()
@ -197,7 +199,9 @@ class DOPESHEET_MT_marker(bpy.types.Menu):
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"

@ -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 @@ static int ed_marker_add(bContext *C, wmOperator *UNUSED(op))
}
/* 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 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt)
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 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt)
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 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt)
}
}
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);
}

@ -191,7 +191,9 @@ static void action_main_area_draw(const bContext *C, ARegion *ar)
/* 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);

@ -593,8 +593,8 @@ typedef enum eSAction_Flag {
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 */

@ -1731,6 +1731,11 @@ static void rna_def_space_dopesheet(BlenderRNA *brna)
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);