diff options
Diffstat (limited to 'source/blender/editors/space_view3d/drawarmature.c')
-rw-r--r-- | source/blender/editors/space_view3d/drawarmature.c | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c index b4e968226f4..6f395e2c761 100644 --- a/source/blender/editors/space_view3d/drawarmature.c +++ b/source/blender/editors/space_view3d/drawarmature.c @@ -1610,8 +1610,10 @@ static void draw_bone(const short dt, int armflag, int boneflag, short constflag } } -static void draw_custom_bone(const bContext *C, Scene *scene, SceneLayer *sl, View3D *v3d, RegionView3D *rv3d, Object *ob, - const short dt, int armflag, int boneflag, unsigned int id, float length) +static void draw_custom_bone( + const struct EvaluationContext *eval_ctx, + Scene *scene, SceneLayer *sl, View3D *v3d, RegionView3D *rv3d, Object *ob, + const short dt, int armflag, int boneflag, unsigned int id, float length) { if (ob == NULL) return; @@ -1626,7 +1628,7 @@ static void draw_custom_bone(const bContext *C, Scene *scene, SceneLayer *sl, Vi GPU_select_load_id((GLuint) id | BONESEL_BONE); } - draw_object_instance(C, scene, sl, v3d, rv3d, ob, dt, armflag & ARM_POSEMODE, fcolor); + draw_object_instance(eval_ctx, scene, sl, v3d, rv3d, ob, dt, armflag & ARM_POSEMODE, fcolor); } @@ -1930,9 +1932,10 @@ static void bone_matrix_translate_y(float mat[4][4], float y) } /* assumes object is Armature with pose */ -static void draw_pose_bones(const bContext *C, Scene *scene, SceneLayer *sl, View3D *v3d, ARegion *ar, Base *base, - const short dt, const unsigned char ob_wire_col[4], - const bool do_const_color, const bool is_outline) +static void draw_pose_bones( + const struct EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, View3D *v3d, ARegion *ar, Base *base, + const short dt, const unsigned char ob_wire_col[4], + const bool do_const_color, const bool is_outline) { RegionView3D *rv3d = ar->regiondata; Object *ob = base->object; @@ -2057,7 +2060,7 @@ static void draw_pose_bones(const bContext *C, Scene *scene, SceneLayer *sl, Vie glDisable(GL_CULL_FACE); } - draw_custom_bone(C, scene, sl, v3d, rv3d, pchan->custom, + draw_custom_bone(eval_ctx, scene, sl, v3d, rv3d, pchan->custom, OB_SOLID, arm->flag, flag, index, PCHAN_CUSTOM_DRAW_SIZE(pchan)); } } @@ -2153,7 +2156,7 @@ static void draw_pose_bones(const bContext *C, Scene *scene, SceneLayer *sl, Vie if (bone == arm->act_bone) flag |= BONE_DRAW_ACTIVE; - draw_custom_bone(C, scene, sl, v3d, rv3d, pchan->custom, + draw_custom_bone(eval_ctx, scene, sl, v3d, rv3d, pchan->custom, OB_WIRE, arm->flag, flag, index, PCHAN_CUSTOM_DRAW_SIZE(pchan)); gpuPopMatrix(); @@ -2659,9 +2662,9 @@ static void ghost_poses_tag_unselected(Object *ob, short unset) /* draw ghosts that occur within a frame range * note: object should be in posemode */ -static void draw_ghost_poses_range(const bContext *C, Scene *scene, SceneLayer *sl, View3D *v3d, ARegion *ar, Base *base) +static void draw_ghost_poses_range( + const EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, View3D *v3d, ARegion *ar, Base *base) { - EvaluationContext eval_ctx; Object *ob = base->object; AnimData *adt = BKE_animdata_from_id(&ob->id); bArmature *arm = ob->data; @@ -2669,8 +2672,6 @@ static void draw_ghost_poses_range(const bContext *C, Scene *scene, SceneLayer * float start, end, stepsize, range, colfac; int cfrao, flago; unsigned char col[4]; - - CTX_data_eval_ctx(C, &eval_ctx); start = (float)arm->ghostsf; end = (float)arm->ghostef; @@ -2706,8 +2707,8 @@ static void draw_ghost_poses_range(const bContext *C, Scene *scene, SceneLayer * UI_GetThemeColorShadeAlpha4ubv(TH_WIRE, 0, -128 - (int)(120.0f * sqrtf(colfac)), col); BKE_animsys_evaluate_animdata(scene, &ob->id, adt, (float)CFRA, ADT_RECALC_ALL); - BKE_pose_where_is(&eval_ctx, scene, ob); - draw_pose_bones(C, scene, sl, v3d, ar, base, OB_WIRE, col, true, false); + BKE_pose_where_is(eval_ctx, scene, ob); + draw_pose_bones(eval_ctx, scene, sl, v3d, ar, base, OB_WIRE, col, true, false); } glDisable(GL_BLEND); if (v3d->zbuf) glEnable(GL_DEPTH_TEST); @@ -2729,9 +2730,10 @@ static void draw_ghost_poses_range(const bContext *C, Scene *scene, SceneLayer * /* draw ghosts on keyframes in action within range * - object should be in posemode */ -static void draw_ghost_poses_keys(const bContext *C, Scene *scene, SceneLayer *sl, View3D *v3d, ARegion *ar, BaseLegacy *base) +static void draw_ghost_poses_keys( + const struct EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, + View3D *v3d, ARegion *ar, BaseLegacy *base) { - EvaluationContext eval_ctx; Object *ob = base->object; AnimData *adt = BKE_animdata_from_id(&ob->id); bAction *act = (adt) ? adt->action : NULL; @@ -2742,8 +2744,6 @@ static void draw_ghost_poses_keys(const bContext *C, Scene *scene, SceneLayer *s float start, end, range, colfac, i; int cfrao, flago; unsigned char col[4]; - - CTX_data_eval_ctx(C, &eval_ctx); start = (float)arm->ghostsf; end = (float)arm->ghostef; @@ -2790,8 +2790,8 @@ static void draw_ghost_poses_keys(const bContext *C, Scene *scene, SceneLayer *s CFRA = (int)ak->cfra; BKE_animsys_evaluate_animdata(scene, &ob->id, adt, (float)CFRA, ADT_RECALC_ALL); - BKE_pose_where_is(&eval_ctx, scene, ob); - draw_pose_bones(C, scene, sl, v3d, ar, base, OB_WIRE, col, true, false); + BKE_pose_where_is(eval_ctx, scene, ob); + draw_pose_bones(eval_ctx, scene, sl, v3d, ar, base, OB_WIRE, col, true, false); } glDisable(GL_BLEND); if (v3d->zbuf) glEnable(GL_DEPTH_TEST); @@ -2814,9 +2814,10 @@ static void draw_ghost_poses_keys(const bContext *C, Scene *scene, SceneLayer *s /* draw ghosts around current frame * - object is supposed to be armature in posemode */ -static void draw_ghost_poses(const bContext *C, Scene *scene, SceneLayer *sl, View3D *v3d, ARegion *ar, Base *base) +static void draw_ghost_poses( + const struct EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, + View3D *v3d, ARegion *ar, Base *base) { - EvaluationContext eval_ctx; Object *ob = base->object; AnimData *adt = BKE_animdata_from_id(&ob->id); bArmature *arm = ob->data; @@ -2825,8 +2826,6 @@ static void draw_ghost_poses(const bContext *C, Scene *scene, SceneLayer *sl, Vi int cfrao, flago; unsigned char col[4]; - CTX_data_eval_ctx(C, &eval_ctx); - /* pre conditions, get an action with sufficient frames */ if (ELEM(NULL, adt, adt->action)) return; @@ -2871,8 +2870,8 @@ static void draw_ghost_poses(const bContext *C, Scene *scene, SceneLayer *sl, Vi if (CFRA != cfrao) { BKE_animsys_evaluate_animdata(scene, &ob->id, adt, (float)CFRA, ADT_RECALC_ALL); - BKE_pose_where_is(&eval_ctx, scene, ob); - draw_pose_bones(C, scene, sl, v3d, ar, base, OB_WIRE, col, true, false); + BKE_pose_where_is(eval_ctx, scene, ob); + draw_pose_bones(eval_ctx, scene, sl, v3d, ar, base, OB_WIRE, col, true, false); } } @@ -2886,8 +2885,8 @@ static void draw_ghost_poses(const bContext *C, Scene *scene, SceneLayer *sl, Vi if (CFRA != cfrao) { BKE_animsys_evaluate_animdata(scene, &ob->id, adt, (float)CFRA, ADT_RECALC_ALL); - BKE_pose_where_is(&eval_ctx, scene, ob); - draw_pose_bones(C, scene, sl, v3d, ar, base, OB_WIRE, col, true, false); + BKE_pose_where_is(eval_ctx, scene, ob); + draw_pose_bones(eval_ctx, scene, sl, v3d, ar, base, OB_WIRE, col, true, false); } } } @@ -2912,9 +2911,10 @@ static void draw_ghost_poses(const bContext *C, Scene *scene, SceneLayer *sl, Vi /* called from drawobject.c, return true if nothing was drawn * (ob_wire_col == NULL) when drawing ghost */ -bool draw_armature(const bContext *C, Scene *scene, SceneLayer *sl, View3D *v3d, ARegion *ar, Base *base, - const short dt, const short dflag, const unsigned char ob_wire_col[4], - const bool is_outline) +bool draw_armature( + const EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, View3D *v3d, ARegion *ar, Base *base, + const short dt, const short dflag, const unsigned char ob_wire_col[4], + const bool is_outline) { Object *ob = base->object; bArmature *arm = ob->data; @@ -2972,14 +2972,14 @@ bool draw_armature(const bContext *C, Scene *scene, SceneLayer *sl, View3D *v3d, } else if (ob->mode & OB_MODE_POSE) { if (arm->ghosttype == ARM_GHOST_RANGE) { - draw_ghost_poses_range(C, scene, sl, v3d, ar, base); + draw_ghost_poses_range(eval_ctx, scene, sl, v3d, ar, base); } else if (arm->ghosttype == ARM_GHOST_KEYS) { - draw_ghost_poses_keys(C, scene, sl, v3d, ar, base); + draw_ghost_poses_keys(eval_ctx, scene, sl, v3d, ar, base); } else if (arm->ghosttype == ARM_GHOST_CUR) { if (arm->ghostep) - draw_ghost_poses(C, scene, sl, v3d, ar, base); + draw_ghost_poses(eval_ctx, scene, sl, v3d, ar, base); } if ((dflag & DRAW_SCENESET) == 0) { if (ob == OBACT_NEW(sl)) @@ -2992,7 +2992,7 @@ bool draw_armature(const bContext *C, Scene *scene, SceneLayer *sl, View3D *v3d, } } } - draw_pose_bones(C, scene, sl, v3d, ar, base, dt, ob_wire_col, (dflag & DRAW_CONSTCOLOR), is_outline); + draw_pose_bones(eval_ctx, scene, sl, v3d, ar, base, dt, ob_wire_col, (dflag & DRAW_CONSTCOLOR), is_outline); arm->flag &= ~ARM_POSEMODE; } else { |