diff options
Diffstat (limited to 'source/blender/editors/space_view3d/drawanimviz.c')
-rw-r--r-- | source/blender/editors/space_view3d/drawanimviz.c | 86 |
1 files changed, 43 insertions, 43 deletions
diff --git a/source/blender/editors/space_view3d/drawanimviz.c b/source/blender/editors/space_view3d/drawanimviz.c index 7d279b95e3b..ba75ae6f766 100644 --- a/source/blender/editors/space_view3d/drawanimviz.c +++ b/source/blender/editors/space_view3d/drawanimviz.c @@ -65,12 +65,12 @@ * - include support for editing the path verts */ /* Set up drawing environment for drawing motion paths */ -void draw_motion_paths_init(View3D *v3d, ARegion *ar) +void draw_motion_paths_init(View3D *v3d, ARegion *ar) { RegionView3D *rv3d = ar->regiondata; - + if (v3d->zbuf) glDisable(GL_DEPTH_TEST); - + glPushMatrix(); glLoadMatrixf(rv3d->viewmat); } @@ -97,7 +97,7 @@ static void set_motion_path_color(Scene *scene, bMotionPath *mpath, int i, short if (frame < CFRA) { if (mpath->flag & MOTIONPATH_FLAG_CUSTOM) { /* Custom color: previous frames color is darker than current frame */ - glColor3fv(prev_color); + glColor3fv(prev_color); } else { /* black - before cfra */ @@ -115,7 +115,7 @@ static void set_motion_path_color(Scene *scene, bMotionPath *mpath, int i, short else if (frame > CFRA) { if (mpath->flag & MOTIONPATH_FLAG_CUSTOM) { /* Custom color: next frames color is equal to user selected color */ - glColor3fv(next_color); + glColor3fv(next_color); } else { /* blue - after cfra */ @@ -133,7 +133,7 @@ static void set_motion_path_color(Scene *scene, bMotionPath *mpath, int i, short else { if (mpath->flag & MOTIONPATH_FLAG_CUSTOM) { /* Custom color: current frame color is slightly darker than user selected color */ - glColor3fv(frame_color); + glColor3fv(frame_color); } else { /* green - on cfra */ @@ -149,11 +149,11 @@ static void set_motion_path_color(Scene *scene, bMotionPath *mpath, int i, short #undef SET_INTENSITY } -/* Draw the given motion path for an Object or a Bone +/* Draw the given motion path for an Object or a Bone * - assumes that the viewport has already been initialized properly * i.e. draw_motion_paths_init() has been called */ -void draw_motion_path_instance(Scene *scene, +void draw_motion_path_instance(Scene *scene, Object *ob, bPoseChannel *pchan, bAnimVizSettings *avs, bMotionPath *mpath) { //RegionView3D *rv3d = ar->regiondata; @@ -182,10 +182,10 @@ void draw_motion_path_instance(Scene *scene, /* Save old line width */ GLfloat old_width; glGetFloatv(GL_LINE_WIDTH, &old_width); - + /* get frame ranges */ if (avs->path_type == MOTIONPATH_TYPE_ACFRA) { - /* With "Around Current", we only choose frames from around + /* With "Around Current", we only choose frames from around * the current frame to draw. */ sfra = CFRA - avs->path_bc; @@ -196,8 +196,8 @@ void draw_motion_path_instance(Scene *scene, sfra = avs->path_sf; efra = avs->path_ef; } - - /* no matter what, we can only show what is in the cache and no more + + /* no matter what, we can only show what is in the cache and no more * - abort if whole range is past ends of path * - otherwise clamp endpoints to extents of path */ @@ -209,22 +209,22 @@ void draw_motion_path_instance(Scene *scene, /* end clamp */ efra = mpath->end_frame; } - + if ((sfra > mpath->end_frame) || (efra < mpath->start_frame)) { /* whole path is out of bounds */ return; } - + len = efra - sfra; - + if ((len <= 0) || (mpath->points == NULL)) { return; } - + /* get pointers to parts of path */ sind = sfra - mpath->start_frame; mpv_start = (mpath->points + sind); - + /* draw curve-line of path */ /* Draw lines only if line drawing option is enabled */ if (mpath->flag & MOTIONPATH_FLAG_LINES) { @@ -247,7 +247,7 @@ void draw_motion_path_instance(Scene *scene, /* Point must be bigger than line thickness */ glPointSize(mpath->line_thickness + 1.0); - + /* draw little black point at each frame * NOTE: this is not really visible/noticeable */ @@ -255,7 +255,7 @@ void draw_motion_path_instance(Scene *scene, for (i = 0, mpv = mpv_start; i < len; i++, mpv++) glVertex3fv(mpv->co); glEnd(); - + /* Draw little white dots at each framestep value or replace with custom color */ if (mpath->flag & MOTIONPATH_FLAG_CUSTOM) { glColor4fv(mpath->color); @@ -267,39 +267,39 @@ void draw_motion_path_instance(Scene *scene, for (i = 0, mpv = mpv_start; i < len; i += stepsize, mpv += stepsize) glVertex3fv(mpv->co); glEnd(); - - /* Draw big green dot where the current frame is + + /* Draw big green dot where the current frame is * NOTE: this is only done when keyframes are shown, since this adds similar types of clutter */ if ((avs->path_viewflag & MOTIONPATH_VIEW_KFRAS) && - (sfra < CFRA) && (CFRA <= efra)) + (sfra < CFRA) && (CFRA <= efra)) { UI_ThemeColor(TH_CFRAME); - + glPointSize(mpath->line_thickness + 5.0); glBegin(GL_POINTS); mpv = mpv_start + (CFRA - sfra); glVertex3fv(mpv->co); glEnd(); - + UI_ThemeColor(TH_TEXT_HI); } - + /* XXX, this isn't up to date but probably should be kept so. */ invert_m4_m4(ob->imat, ob->obmat); - + /* Draw frame numbers at each framestep value */ if (avs->path_viewflag & MOTIONPATH_VIEW_FNUMS) { unsigned char col[4]; UI_GetThemeColor3ubv(TH_TEXT_HI, col); col[3] = 255; - + for (i = 0, mpv = mpv_start; i < len; i += stepsize, mpv += stepsize) { int frame = sfra + i; char numstr[32]; size_t numstr_len; float co[3]; - + /* only draw framenum if several consecutive highlighted points don't occur on same point */ if (i == 0) { numstr_len = sprintf(numstr, " %d", frame); @@ -310,7 +310,7 @@ void draw_motion_path_instance(Scene *scene, else if ((i >= stepsize) && (i < len - stepsize)) { bMotionPathVert *mpvP = (mpv - stepsize); bMotionPathVert *mpvN = (mpv + stepsize); - + if ((equals_v3v3(mpv->co, mpvP->co) == 0) || (equals_v3v3(mpv->co, mpvN->co) == 0)) { numstr_len = sprintf(numstr, " %d", frame); mul_v3_m4v3(co, ob->imat, mpv->co); @@ -320,24 +320,24 @@ void draw_motion_path_instance(Scene *scene, } } } - + /* Keyframes - dots and numbers */ if (avs->path_viewflag & MOTIONPATH_VIEW_KFRAS) { unsigned char col[4]; - + AnimData *adt = BKE_animdata_from_id(&ob->id); DLRBT_Tree keys; - + /* build list of all keyframes in active action for object or pchan */ BLI_dlrbTree_init(&keys); - + if (adt) { /* it is assumed that keyframes for bones are all grouped in a single group * unless an option is set to always use the whole action */ if ((pchan) && (avs->path_viewflag & MOTIONPATH_VIEW_KFACT) == 0) { bActionGroup *agrp = BKE_action_group_find_name(adt->action, pchan->name); - + if (agrp) { agroup_to_keylist(adt, agrp, &keys, NULL); BLI_dlrbTree_linkedlist_sync(&keys); @@ -348,11 +348,11 @@ void draw_motion_path_instance(Scene *scene, BLI_dlrbTree_linkedlist_sync(&keys); } } - + /* Draw slightly-larger yellow dots at each keyframe */ UI_GetThemeColor3ubv(TH_VERTEX_SELECT, col); col[3] = 255; - + /* if custom, point must be bigger than line */ if (mpath->flag & MOTIONPATH_FLAG_CUSTOM) { glPointSize(mpath->line_thickness + 3.0); @@ -361,27 +361,27 @@ void draw_motion_path_instance(Scene *scene, glPointSize(4.0f); } glColor3ubv(col); - + glBegin(GL_POINTS); for (i = 0, mpv = mpv_start; i < len; i++, mpv++) { - int frame = sfra + i; + int frame = sfra + i; float mframe = (float)(frame); - + if (BLI_dlrbTree_search_exact(&keys, compare_ak_cfraPtr, &mframe)) glVertex3fv(mpv->co); } glEnd(); - + /* Draw frame numbers of keyframes */ if (avs->path_viewflag & MOTIONPATH_VIEW_KFNOS) { float co[3]; for (i = 0, mpv = mpv_start; i < len; i++, mpv++) { float mframe = (float)(sfra + i); - + if (BLI_dlrbTree_search_exact(&keys, compare_ak_cfraPtr, &mframe)) { char numstr[32]; size_t numstr_len; - + numstr_len = sprintf(numstr, " %d", (sfra + i)); mul_v3_m4v3(co, ob->imat, mpv->co); view3d_cached_text_draw_add(co, numstr, numstr_len, @@ -389,7 +389,7 @@ void draw_motion_path_instance(Scene *scene, } } } - + BLI_dlrbTree_free(&keys); } } |