diff options
author | Joshua Leung <aligorith@gmail.com> | 2011-01-10 02:16:05 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2011-01-10 02:16:05 +0300 |
commit | 56db5f10aab70fe9f99c830efbafd77b5f8b6c49 (patch) | |
tree | 98988cf3dacd332bb998d526ac1473dde573f776 /source/blender | |
parent | 3fba5cfe7ae1b3e626a88b63ed2295e1a6ce13b0 (diff) |
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).
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/animation/anim_markers.c | 39 | ||||
-rw-r--r-- | source/blender/editors/space_action/space_action.c | 4 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_action_types.h | 4 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_space.c | 5 |
4 files changed, 32 insertions, 20 deletions
diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c index 85138bb9f06..0a2df6afdcb 100644 --- a/source/blender/editors/animation/anim_markers.c +++ b/source/blender/editors/animation/anim_markers.c @@ -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); } diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c index 031743953ec..faeb7a68968 100644 --- a/source/blender/editors/space_action/space_action.c +++ b/source/blender/editors/space_action/space_action.c @@ -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); diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h index 592e443baf7..cf1c379cbb6 100644 --- a/source/blender/makesdna/DNA_action_types.h +++ b/source/blender/makesdna/DNA_action_types.h @@ -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 */ diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 4a98d71a76a..54b34c6ba45 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -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); |