diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2016-07-12 01:01:38 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2016-07-12 01:07:44 +0300 |
commit | cfbd605567f48229a923df382baf6db98fbafc61 (patch) | |
tree | d4218c49672047d6c3b37517034660b3b5dcd966 /source/blender/editors/space_nla | |
parent | 71a57a37b2eebbed53b5335019287b4df9c30519 (diff) | |
parent | 7212ebd09f9720883581221be923ae5e97ff5d76 (diff) |
Merge branch 'master' into blender2.8
Conflicts:
intern/cycles/blender/addon/ui.py
source/blender/blenkernel/BKE_particle.h
source/blender/blenkernel/intern/dynamicpaint.c
source/blender/blenkernel/intern/library.c
source/blender/blenkernel/intern/object.c
source/blender/blenkernel/intern/particle.c
source/blender/blenkernel/intern/particle_distribute.c
source/blender/blenkernel/intern/texture.c
source/blender/editors/object/object_add.c
source/blender/editors/object/object_relations.c
source/blender/editors/physics/particle_edit.c
source/blender/editors/physics/particle_object.c
source/blender/editors/transform/transform_snap_object.c
Diffstat (limited to 'source/blender/editors/space_nla')
-rw-r--r-- | source/blender/editors/space_nla/nla_draw.c | 62 | ||||
-rw-r--r-- | source/blender/editors/space_nla/nla_edit.c | 6 |
2 files changed, 65 insertions, 3 deletions
diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c index b0adabe4d1d..5b3c062e16d 100644 --- a/source/blender/editors/space_nla/nla_draw.c +++ b/source/blender/editors/space_nla/nla_draw.c @@ -62,7 +62,7 @@ #include "UI_resources.h" #include "UI_view2d.h" - +#include "nla_private.h" #include "nla_intern.h" /* own include */ @@ -145,6 +145,62 @@ static void nla_action_draw_keyframes(AnimData *adt, bAction *act, View2D *v2d, BLI_dlrbTree_free(&keys); } +/* Strip Markers ------------------------ */ + +/* Markers inside an action strip */ +static void nla_actionclip_draw_markers(NlaStrip *strip, float yminc, float ymaxc) +{ + bAction *act = strip->act; + TimeMarker *marker; + + if (ELEM(NULL, strip->act, strip->act->markers.first)) + return; + + for (marker = act->markers.first; marker; marker = marker->next) { + if ((marker->frame > strip->actstart) && (marker->frame < strip->actend)) { + float frame = nlastrip_get_frame(strip, marker->frame, NLATIME_CONVERT_MAP); + + /* just a simple line for now */ + // XXX: draw a triangle instead... + fdrawline(frame, yminc + 1, frame, ymaxc - 1); + } + } +} + +/* Markers inside a NLA-Strip */ +static void nla_strip_draw_markers(NlaStrip *strip, float yminc, float ymaxc) +{ + glLineWidth(2.0); + + if (strip->type == NLASTRIP_TYPE_CLIP) { + /* try not to be too conspicuous, while being visible enough when transforming */ + if (strip->flag & NLASTRIP_FLAG_SELECT) + UI_ThemeColorShade(TH_STRIP_SELECT, -60); + else + UI_ThemeColorShade(TH_STRIP_SELECT, -40); + + setlinestyle(3); + + /* just draw the markers in this clip */ + nla_actionclip_draw_markers(strip, yminc, ymaxc); + + setlinestyle(0); + } + else if (strip->flag & NLASTRIP_FLAG_TEMP_META) { + /* just a solid color, so that it is very easy to spot */ + UI_ThemeColorShade(TH_STRIP_SELECT, 20); + + /* draw the markers in the first level of strips only (if they are actions) */ + for (NlaStrip *nls = strip->strips.first; nls; nls = nls->next) { + if (nls->type == NLASTRIP_TYPE_CLIP) { + nla_actionclip_draw_markers(nls, yminc, ymaxc); + } + } + } + + glLineWidth(1.0); +} + /* Strips (Proper) ---------------------- */ /* get colors for drawing NLA-Strips */ @@ -361,6 +417,10 @@ static void nla_draw_strip(SpaceNla *snla, AnimData *adt, NlaTrack *nlt, NlaStri nla_draw_strip_curves(strip, yminc, ymaxc); + /* draw markings indicating locations of local markers (useful for lining up different actions) */ + if ((snla->flag & SNLA_NOLOCALMARKERS) == 0) + nla_strip_draw_markers(strip, yminc, ymaxc); + /* draw strip outline * - color used here is to indicate active vs non-active */ diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c index a2159696394..3e7e8ccc3f4 100644 --- a/source/blender/editors/space_nla/nla_edit.c +++ b/source/blender/editors/space_nla/nla_edit.c @@ -1856,6 +1856,7 @@ void NLA_OT_action_sync_length(wmOperatorType *ot) static int nlaedit_make_single_user_exec(bContext *C, wmOperator *UNUSED(op)) { + Main *bmain = CTX_data_main(C); bAnimContext ac; ListBase anim_data = {NULL, NULL}; @@ -1887,7 +1888,7 @@ static int nlaedit_make_single_user_exec(bContext *C, wmOperator *UNUSED(op)) /* multi-user? */ if (ID_REAL_USERS(strip->act) > 1) { /* make a new copy of the action for us to use (it will have 1 user already) */ - bAction *new_action = BKE_action_copy(strip->act); + bAction *new_action = BKE_action_copy(bmain, strip->act); /* decrement user count of our existing action */ id_us_min(&strip->act->id); @@ -1945,6 +1946,7 @@ static short bezt_apply_nlamapping(KeyframeEditData *ked, BezTriple *bezt) static int nlaedit_apply_scale_exec(bContext *C, wmOperator *UNUSED(op)) { + Main *bmain = CTX_data_main(C); bAnimContext ac; ListBase anim_data = {NULL, NULL}; @@ -1974,7 +1976,7 @@ static int nlaedit_apply_scale_exec(bContext *C, wmOperator *UNUSED(op)) continue; if (strip->act->id.us > 1) { /* make a copy of the Action to work on */ - bAction *act = BKE_action_copy(strip->act); + bAction *act = BKE_action_copy(bmain, strip->act); /* set this as the new referenced action, decrementing the users of the old one */ id_us_min(&strip->act->id); |