Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_view3d/drawobject.c
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
| Show First 20 Lines • Show All 308 Lines • ▼ Show 20 Lines | static bool check_ob_drawface_dot(Scene *sce, View3D *vd, char dt) | ||||
| return true; | return true; | ||||
| } | } | ||||
| /* ************************ */ | /* ************************ */ | ||||
| /* check for glsl drawing */ | /* check for glsl drawing */ | ||||
| bool draw_glsl_material(Scene *scene, SceneLayer *sl, Object *ob, View3D *v3d, const char dt) | bool draw_glsl_material(Scene *scene, ViewLayer *sl, Object *ob, View3D *v3d, const char dt) | ||||
| { | { | ||||
| if (G.f & G_PICKSEL) | if (G.f & G_PICKSEL) | ||||
| return false; | return false; | ||||
| if (!check_object_draw_texture(scene, v3d, dt)) | if (!check_object_draw_texture(scene, v3d, dt)) | ||||
| return false; | return false; | ||||
| if (ob == OBACT(sl) && (ob && ob->mode & OB_MODE_WEIGHT_PAINT)) | if (ob == OBACT(sl) && (ob && ob->mode & OB_MODE_WEIGHT_PAINT)) | ||||
| return false; | return false; | ||||
| ▲ Show 20 Lines • Show All 3,563 Lines • ▼ Show 20 Lines | static DMDrawOption draw_em_fancy__setGLSLFaceOpts(void *userData, int index) | ||||
| if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) { | if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) { | ||||
| return DM_DRAW_OPTION_NORMAL; | return DM_DRAW_OPTION_NORMAL; | ||||
| } | } | ||||
| else { | else { | ||||
| return DM_DRAW_OPTION_SKIP; | return DM_DRAW_OPTION_SKIP; | ||||
| } | } | ||||
| } | } | ||||
| static void draw_em_fancy(Scene *scene, SceneLayer *sl, ARegion *ar, View3D *v3d, | static void draw_em_fancy(Scene *scene, ViewLayer *sl, ARegion *ar, View3D *v3d, | ||||
| Object *ob, BMEditMesh *em, DerivedMesh *cageDM, DerivedMesh *finalDM, const char dt) | Object *ob, BMEditMesh *em, DerivedMesh *cageDM, DerivedMesh *finalDM, const char dt) | ||||
| { | { | ||||
| RegionView3D *rv3d = ar->regiondata; | RegionView3D *rv3d = ar->regiondata; | ||||
| Mesh *me = ob->data; | Mesh *me = ob->data; | ||||
| const bool use_occlude_wire = (dt > OB_WIRE) && (v3d->flag2 & V3D_OCCLUDE_WIRE); | const bool use_occlude_wire = (dt > OB_WIRE) && (v3d->flag2 & V3D_OCCLUDE_WIRE); | ||||
| bool use_depth_offset = false; | bool use_depth_offset = false; | ||||
| ▲ Show 20 Lines • Show All 389 Lines • ▼ Show 20 Lines | |||||
| static bool object_is_halo(Scene *scene, Object *ob) | static bool object_is_halo(Scene *scene, Object *ob) | ||||
| { | { | ||||
| const Material *ma = give_current_material(ob, 1); | const Material *ma = give_current_material(ob, 1); | ||||
| return (ma && (ma->material_type == MA_TYPE_HALO) && !BKE_scene_use_new_shading_nodes(scene)); | return (ma && (ma->material_type == MA_TYPE_HALO) && !BKE_scene_use_new_shading_nodes(scene)); | ||||
| } | } | ||||
| static void draw_mesh_fancy( | static void draw_mesh_fancy( | ||||
| const EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, ARegion *ar, View3D *v3d, RegionView3D *rv3d, Base *base, | const EvaluationContext *eval_ctx, Scene *scene, ViewLayer *sl, ARegion *ar, View3D *v3d, RegionView3D *rv3d, Base *base, | ||||
| const char dt, const unsigned char ob_wire_col[4], const short dflag) | const char dt, const unsigned char ob_wire_col[4], const short dflag) | ||||
| { | { | ||||
| #ifdef WITH_GAMEENGINE | #ifdef WITH_GAMEENGINE | ||||
| Object *ob = (rv3d->rflag & RV3D_IS_GAME_ENGINE) ? BKE_object_lod_meshob_get(base->object, sl) : base->object; | Object *ob = (rv3d->rflag & RV3D_IS_GAME_ENGINE) ? BKE_object_lod_meshob_get(base->object, sl) : base->object; | ||||
| #else | #else | ||||
| Object *ob = base->object; | Object *ob = base->object; | ||||
| #endif | #endif | ||||
| Mesh *me = ob->data; | Mesh *me = ob->data; | ||||
| ▲ Show 20 Lines • Show All 248 Lines • ▼ Show 20 Lines | if (is_obact && BKE_paint_select_vert_test(ob)) { | ||||
| if (!use_depth) glEnable(GL_DEPTH_TEST); | if (!use_depth) glEnable(GL_DEPTH_TEST); | ||||
| else ED_view3d_polygon_offset(rv3d, 0.0); | else ED_view3d_polygon_offset(rv3d, 0.0); | ||||
| } | } | ||||
| dm->release(dm); | dm->release(dm); | ||||
| } | } | ||||
| /* returns true if nothing was drawn, for detecting to draw an object center */ | /* returns true if nothing was drawn, for detecting to draw an object center */ | ||||
| static bool draw_mesh_object( | static bool draw_mesh_object( | ||||
| const EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, ARegion *ar, View3D *v3d, RegionView3D *rv3d, Base *base, | const EvaluationContext *eval_ctx, Scene *scene, ViewLayer *sl, ARegion *ar, View3D *v3d, RegionView3D *rv3d, Base *base, | ||||
| const char dt, const unsigned char ob_wire_col[4], const short dflag) | const char dt, const unsigned char ob_wire_col[4], const short dflag) | ||||
| { | { | ||||
| Object *ob = base->object; | Object *ob = base->object; | ||||
| Object *obedit = scene->obedit; | Object *obedit = scene->obedit; | ||||
| Mesh *me = ob->data; | Mesh *me = ob->data; | ||||
| BMEditMesh *em = me->edit_btmesh; | BMEditMesh *em = me->edit_btmesh; | ||||
| bool do_alpha_after = false, drawlinked = false, retval = false; | bool do_alpha_after = false, drawlinked = false, retval = false; | ||||
| ▲ Show 20 Lines • Show All 127 Lines • ▼ Show 20 Lines | static void make_color_variations(const unsigned char base_ubyte[4], float low[4], float med[4], float high[4], const bool other_obedit) | ||||
| } | } | ||||
| /* use original alpha */ | /* use original alpha */ | ||||
| low[3] = base[3]; | low[3] = base[3]; | ||||
| med[3] = base[3]; | med[3] = base[3]; | ||||
| high[3] = base[3]; | high[3] = base[3]; | ||||
| } | } | ||||
| static void draw_mesh_fancy_new(EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, ARegion *ar, View3D *v3d, RegionView3D *rv3d, Base *base, | static void draw_mesh_fancy_new(EvaluationContext *eval_ctx, Scene *scene, ViewLayer *sl, ARegion *ar, View3D *v3d, RegionView3D *rv3d, Base *base, | ||||
| const char dt, const unsigned char ob_wire_col[4], const short dflag, const bool other_obedit) | const char dt, const unsigned char ob_wire_col[4], const short dflag, const bool other_obedit) | ||||
| { | { | ||||
| if (dflag & (DRAW_PICKING | DRAW_CONSTCOLOR)) { | if (dflag & (DRAW_PICKING | DRAW_CONSTCOLOR)) { | ||||
| /* too complicated! use existing methods */ | /* too complicated! use existing methods */ | ||||
| /* TODO: move this into a separate depth pre-pass */ | /* TODO: move this into a separate depth pre-pass */ | ||||
| draw_mesh_fancy(eval_ctx, scene, sl, ar, v3d, rv3d, base, dt, ob_wire_col, dflag); | draw_mesh_fancy(eval_ctx, scene, sl, ar, v3d, rv3d, base, dt, ob_wire_col, dflag); | ||||
| return; | return; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 301 Lines • ▼ Show 20 Lines | if (is_obact && BKE_paint_select_vert_test(ob)) { | ||||
| if (!use_depth) glEnable(GL_DEPTH_TEST); | if (!use_depth) glEnable(GL_DEPTH_TEST); | ||||
| else ED_view3d_polygon_offset(rv3d, 0.0); | else ED_view3d_polygon_offset(rv3d, 0.0); | ||||
| } | } | ||||
| #endif | #endif | ||||
| dm->release(dm); | dm->release(dm); | ||||
| } | } | ||||
| static bool UNUSED_FUNCTION(draw_mesh_object_new)(const bContext *C, Scene *scene, SceneLayer *sl, ARegion *ar, View3D *v3d, RegionView3D *rv3d, Base *base, | static bool UNUSED_FUNCTION(draw_mesh_object_new)(const bContext *C, Scene *scene, ViewLayer *sl, ARegion *ar, View3D *v3d, RegionView3D *rv3d, Base *base, | ||||
| const char dt, const unsigned char ob_wire_col[4], const short dflag) | const char dt, const unsigned char ob_wire_col[4], const short dflag) | ||||
| { | { | ||||
| EvaluationContext eval_ctx; | EvaluationContext eval_ctx; | ||||
| Object *ob = base->object; | Object *ob = base->object; | ||||
| Object *obedit = scene->obedit; | Object *obedit = scene->obedit; | ||||
| Mesh *me = ob->data; | Mesh *me = ob->data; | ||||
| BMEditMesh *em = me->edit_btmesh; | BMEditMesh *em = me->edit_btmesh; | ||||
| bool do_alpha_after = false, drawlinked = false, retval = false; | bool do_alpha_after = false, drawlinked = false, retval = false; | ||||
| ▲ Show 20 Lines • Show All 383 Lines • ▼ Show 20 Lines | |||||
| static void drawCurveDMWired(Object *ob) | static void drawCurveDMWired(Object *ob) | ||||
| { | { | ||||
| DerivedMesh *dm = ob->derivedFinal; | DerivedMesh *dm = ob->derivedFinal; | ||||
| dm->drawEdges(dm, 1, 0); | dm->drawEdges(dm, 1, 0); | ||||
| } | } | ||||
| /* return true when nothing was drawn */ | /* return true when nothing was drawn */ | ||||
| static bool drawCurveDerivedMesh(Scene *scene, SceneLayer *sl, View3D *v3d, RegionView3D *rv3d, Base *base, const char dt) | static bool drawCurveDerivedMesh(Scene *scene, ViewLayer *sl, View3D *v3d, RegionView3D *rv3d, Base *base, const char dt) | ||||
| { | { | ||||
| Object *ob = base->object; | Object *ob = base->object; | ||||
| DerivedMesh *dm = ob->derivedFinal; | DerivedMesh *dm = ob->derivedFinal; | ||||
| if (!dm) { | if (!dm) { | ||||
| return true; | return true; | ||||
| } | } | ||||
| Show All 19 Lines | static bool drawCurveDerivedMesh(Scene *scene, ViewLayer *sl, View3D *v3d, RegionView3D *rv3d, Base *base, const char dt) | ||||
| return false; | return false; | ||||
| } | } | ||||
| /** | /** | ||||
| * Only called by #drawDispList | * Only called by #drawDispList | ||||
| * \return true when nothing was drawn | * \return true when nothing was drawn | ||||
| */ | */ | ||||
| static bool drawDispList_nobackface(Scene *scene, SceneLayer *sl, View3D *v3d, RegionView3D *rv3d, Base *base, | static bool drawDispList_nobackface(Scene *scene, ViewLayer *sl, View3D *v3d, RegionView3D *rv3d, Base *base, | ||||
| const char dt, const short dflag, const unsigned char ob_wire_col[4]) | const char dt, const short dflag, const unsigned char ob_wire_col[4]) | ||||
| { | { | ||||
| Object *ob = base->object; | Object *ob = base->object; | ||||
| ListBase *lb = NULL; | ListBase *lb = NULL; | ||||
| DispList *dl; | DispList *dl; | ||||
| Curve *cu; | Curve *cu; | ||||
| const bool render_only = (v3d->flag2 & V3D_RENDER_OVERRIDE) != 0; | const bool render_only = (v3d->flag2 & V3D_RENDER_OVERRIDE) != 0; | ||||
| const bool solid = (dt > OB_WIRE); | const bool solid = (dt > OB_WIRE); | ||||
| ▲ Show 20 Lines • Show All 105 Lines • ▼ Show 20 Lines | case OB_MBALL: | ||||
| } | } | ||||
| } | } | ||||
| break; | break; | ||||
| } | } | ||||
| return false; | return false; | ||||
| } | } | ||||
| static bool drawDispList( | static bool drawDispList( | ||||
| const EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, View3D *v3d, RegionView3D *rv3d, Base *base, | const EvaluationContext *eval_ctx, Scene *scene, ViewLayer *sl, View3D *v3d, RegionView3D *rv3d, Base *base, | ||||
| const char dt, const short dflag, const unsigned char ob_wire_col[4]) | const char dt, const short dflag, const unsigned char ob_wire_col[4]) | ||||
| { | { | ||||
| bool retval; | bool retval; | ||||
| /* backface culling */ | /* backface culling */ | ||||
| if (v3d->flag2 & V3D_BACKFACE_CULLING) { | if (v3d->flag2 & V3D_BACKFACE_CULLING) { | ||||
| /* not all displists use same in/out normal direction convention */ | /* not all displists use same in/out normal direction convention */ | ||||
| glEnable(GL_CULL_FACE); | glEnable(GL_CULL_FACE); | ||||
| ▲ Show 20 Lines • Show All 339 Lines • ▼ Show 20 Lines | |||||
| /* 1. */ | /* 1. */ | ||||
| if (part == NULL || !psys_check_enabled(ob, psys, G.is_rendering)) | if (part == NULL || !psys_check_enabled(ob, psys, G.is_rendering)) | ||||
| return; | return; | ||||
| if (pars == NULL) return; | if (pars == NULL) return; | ||||
| /* don't draw normal paths in edit mode */ | /* don't draw normal paths in edit mode */ | ||||
| if (psys_in_edit_mode(eval_ctx->scene_layer, psys) && (pset->flag & PE_DRAW_PART) == 0) | if (psys_in_edit_mode(eval_ctx->view_layer, psys) && (pset->flag & PE_DRAW_PART) == 0) | ||||
| return; | return; | ||||
| if (part->draw_as == PART_DRAW_REND) | if (part->draw_as == PART_DRAW_REND) | ||||
| draw_as = part->ren_as; | draw_as = part->ren_as; | ||||
| else | else | ||||
| draw_as = part->draw_as; | draw_as = part->draw_as; | ||||
| if (draw_as == PART_DRAW_NOT) | if (draw_as == PART_DRAW_NOT) | ||||
| ▲ Show 20 Lines • Show All 637 Lines • ▼ Show 20 Lines | /* 7. */ | ||||
| } | } | ||||
| if ((ob->flag & OB_FROMGROUP) != 0) { | if ((ob->flag & OB_FROMGROUP) != 0) { | ||||
| gpuLoadMatrix(rv3d->viewmat); | gpuLoadMatrix(rv3d->viewmat); | ||||
| } | } | ||||
| } | } | ||||
| static void draw_update_ptcache_edit( | static void draw_update_ptcache_edit( | ||||
| const EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, Object *ob, PTCacheEdit *edit) | const EvaluationContext *eval_ctx, Scene *scene, ViewLayer *sl, Object *ob, PTCacheEdit *edit) | ||||
| { | { | ||||
| if (edit->psys && edit->psys->flag & PSYS_HAIR_UPDATED) | if (edit->psys && edit->psys->flag & PSYS_HAIR_UPDATED) | ||||
| PE_update_object(eval_ctx, scene, sl, ob, 0); | PE_update_object(eval_ctx, scene, sl, ob, 0); | ||||
| /* create path and child path cache if it doesn't exist already */ | /* create path and child path cache if it doesn't exist already */ | ||||
| if (edit->pathcache == NULL) { | if (edit->pathcache == NULL) { | ||||
| psys_cache_edit_paths(eval_ctx, scene, ob, edit, CFRA, G.is_rendering); | psys_cache_edit_paths(eval_ctx, scene, ob, edit, CFRA, G.is_rendering); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 725 Lines • ▼ Show 20 Lines | while (nu) { | ||||
| } | } | ||||
| index++; | index++; | ||||
| nu = nu->next; | nu = nu->next; | ||||
| } | } | ||||
| } | } | ||||
| static void draw_editnurb( | static void draw_editnurb( | ||||
| const EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, | const EvaluationContext *eval_ctx, Scene *scene, ViewLayer *sl, | ||||
| View3D *v3d, RegionView3D *rv3d, Base *base, Nurb *nurb, | View3D *v3d, RegionView3D *rv3d, Base *base, Nurb *nurb, | ||||
| const char dt, const short dflag, const unsigned char UNUSED(ob_wire_col[4])) | const char dt, const short dflag, const unsigned char UNUSED(ob_wire_col[4])) | ||||
| { | { | ||||
| ToolSettings *ts = scene->toolsettings; | ToolSettings *ts = scene->toolsettings; | ||||
| Object *ob = base->object; | Object *ob = base->object; | ||||
| Curve *cu = ob->data; | Curve *cu = ob->data; | ||||
| Nurb *nu; | Nurb *nu; | ||||
| const void *vert = BKE_curve_vert_active_get(cu); | const void *vert = BKE_curve_vert_active_get(cu); | ||||
| ▲ Show 20 Lines • Show All 124 Lines • ▼ Show 20 Lines | static void draw_editfont_textcurs(RegionView3D *rv3d, float textcurs[4][2]) | ||||
| immVertex2fv(pos, textcurs[3]); | immVertex2fv(pos, textcurs[3]); | ||||
| immEnd(); | immEnd(); | ||||
| set_inverted_drawing(0); | set_inverted_drawing(0); | ||||
| ED_view3d_polygon_offset(rv3d, 0.0); | ED_view3d_polygon_offset(rv3d, 0.0); | ||||
| immUnbindProgram(); | immUnbindProgram(); | ||||
| } | } | ||||
| static void draw_editfont( | static void draw_editfont( | ||||
| const EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, View3D *v3d, RegionView3D *rv3d, Base *base, | const EvaluationContext *eval_ctx, Scene *scene, ViewLayer *sl, View3D *v3d, RegionView3D *rv3d, Base *base, | ||||
| const char dt, const short dflag, const unsigned char ob_wire_col[4]) | const char dt, const short dflag, const unsigned char ob_wire_col[4]) | ||||
| { | { | ||||
| Object *ob = base->object; | Object *ob = base->object; | ||||
| Curve *cu = ob->data; | Curve *cu = ob->data; | ||||
| EditFont *ef = cu->editfont; | EditFont *ef = cu->editfont; | ||||
| float vec1[3], vec2[3]; | float vec1[3], vec2[3]; | ||||
| draw_editfont_textcurs(rv3d, ef->textcurs); | draw_editfont_textcurs(rv3d, ef->textcurs); | ||||
| ▲ Show 20 Lines • Show All 303 Lines • ▼ Show 20 Lines | static void imm_drawcone(const float vec[3], float radius, float height, float tmat[4][4], unsigned pos) | ||||
| immVertex3f(pos, cur[0], cur[1] + radius, cur[2]); | immVertex3f(pos, cur[0], cur[1] + radius, cur[2]); | ||||
| immVertex3f(pos, vec[0], vec[1], vec[2]); | immVertex3f(pos, vec[0], vec[1], vec[2]); | ||||
| immVertex3f(pos, cur[0], cur[1] - radius, cur[2]); | immVertex3f(pos, cur[0], cur[1] - radius, cur[2]); | ||||
| immEnd(); | immEnd(); | ||||
| } | } | ||||
| /* return true if nothing was drawn */ | /* return true if nothing was drawn */ | ||||
| static bool drawmball( | static bool drawmball( | ||||
| const EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, View3D *v3d, RegionView3D *rv3d, Base *base, | const EvaluationContext *eval_ctx, Scene *scene, ViewLayer *sl, View3D *v3d, RegionView3D *rv3d, Base *base, | ||||
| const char dt, const short dflag, const unsigned char ob_wire_col[4]) | const char dt, const short dflag, const unsigned char ob_wire_col[4]) | ||||
| { | { | ||||
| Object *ob = base->object; | Object *ob = base->object; | ||||
| MetaElem *ml; | MetaElem *ml; | ||||
| float imat[4][4]; | float imat[4][4]; | ||||
| int code = 1; | int code = 1; | ||||
| MetaBall *mb = ob->data; | MetaBall *mb = ob->data; | ||||
| ▲ Show 20 Lines • Show All 451 Lines • ▼ Show 20 Lines | static void drawtexspace(Object *ob, const unsigned char ob_wire_col[3]) | ||||
| immUnbindProgram(); | immUnbindProgram(); | ||||
| setlinestyle(0); | setlinestyle(0); | ||||
| } | } | ||||
| /* draws wire outline */ | /* draws wire outline */ | ||||
| static void draw_object_selected_outline( | static void draw_object_selected_outline( | ||||
| const EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, View3D *v3d, ARegion *ar, Base *base, | const EvaluationContext *eval_ctx, Scene *scene, ViewLayer *sl, View3D *v3d, ARegion *ar, Base *base, | ||||
| const unsigned char ob_wire_col[4]) | const unsigned char ob_wire_col[4]) | ||||
| { | { | ||||
| RegionView3D *rv3d = ar->regiondata; | RegionView3D *rv3d = ar->regiondata; | ||||
| Object *ob = base->object; | Object *ob = base->object; | ||||
| glDepthMask(GL_FALSE); | glDepthMask(GL_FALSE); | ||||
| if (ELEM(ob->type, OB_FONT, OB_CURVE, OB_SURF)) { | if (ELEM(ob->type, OB_FONT, OB_CURVE, OB_SURF)) { | ||||
| ▲ Show 20 Lines • Show All 140 Lines • ▼ Show 20 Lines | static void draw_rigid_body_pivot(bRigidBodyJointConstraint *data, | ||||
| immEnd(); | immEnd(); | ||||
| setlinestyle(0); | setlinestyle(0); | ||||
| glLineWidth(1.0f); | glLineWidth(1.0f); | ||||
| immUnbindProgram(); | immUnbindProgram(); | ||||
| } | } | ||||
| void draw_object_wire_color(Scene *scene, SceneLayer *sl, Base *base, unsigned char r_ob_wire_col[4]) | void draw_object_wire_color(Scene *scene, ViewLayer *sl, Base *base, unsigned char r_ob_wire_col[4]) | ||||
| { | { | ||||
| Object *ob = base->object; | Object *ob = base->object; | ||||
| int colindex = 0; | int colindex = 0; | ||||
| const bool is_edit = (ob->mode & OB_MODE_EDIT) != 0; | const bool is_edit = (ob->mode & OB_MODE_EDIT) != 0; | ||||
| /* confusing logic here, there are 2 methods of setting the color | /* confusing logic here, there are 2 methods of setting the color | ||||
| * 'colortab[colindex]' and 'theme_id', colindex overrides theme_id. | * 'colortab[colindex]' and 'theme_id', colindex overrides theme_id. | ||||
| * | * | ||||
| * note: no theme yet for 'colindex' */ | * note: no theme yet for 'colindex' */ | ||||
| ▲ Show 20 Lines • Show All 128 Lines • ▼ Show 20 Lines | void draw_rigidbody_shape(Object *ob, const unsigned char ob_wire_col[4]) | ||||
| } | } | ||||
| } | } | ||||
| /** | /** | ||||
| * main object drawing function, draws in selection | * main object drawing function, draws in selection | ||||
| * \param dflag (draw flag) can be DRAW_PICKING and/or DRAW_CONSTCOLOR, DRAW_SCENESET | * \param dflag (draw flag) can be DRAW_PICKING and/or DRAW_CONSTCOLOR, DRAW_SCENESET | ||||
| */ | */ | ||||
| void draw_object( | void draw_object( | ||||
| const EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, ARegion *ar, View3D *v3d, | const EvaluationContext *eval_ctx, Scene *scene, ViewLayer *sl, ARegion *ar, View3D *v3d, | ||||
| Base *base, const short dflag) | Base *base, const short dflag) | ||||
| { | { | ||||
| ModifierData *md = NULL; | ModifierData *md = NULL; | ||||
| Object *ob = base->object; | Object *ob = base->object; | ||||
| Curve *cu; | Curve *cu; | ||||
| RegionView3D *rv3d = ar->regiondata; | RegionView3D *rv3d = ar->regiondata; | ||||
| unsigned char _ob_wire_col[4]; /* dont initialize this */ | unsigned char _ob_wire_col[4]; /* dont initialize this */ | ||||
| const unsigned char *ob_wire_col = NULL; /* dont initialize this, use NULL crashes as a way to find invalid use */ | const unsigned char *ob_wire_col = NULL; /* dont initialize this, use NULL crashes as a way to find invalid use */ | ||||
| ▲ Show 20 Lines • Show All 746 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| /** | /** | ||||
| * Drawing for selection picking, | * Drawing for selection picking, | ||||
| * caller must have called 'GPU_select_load_id(base->selcode)' first. | * caller must have called 'GPU_select_load_id(base->selcode)' first. | ||||
| */ | */ | ||||
| void draw_object_select( | void draw_object_select( | ||||
| const EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, ARegion *ar, View3D *v3d, | const EvaluationContext *eval_ctx, Scene *scene, ViewLayer *sl, ARegion *ar, View3D *v3d, | ||||
| Base *base, const short dflag) | Base *base, const short dflag) | ||||
| { | { | ||||
| BLI_assert(dflag & DRAW_PICKING && dflag & DRAW_CONSTCOLOR); | BLI_assert(dflag & DRAW_PICKING && dflag & DRAW_CONSTCOLOR); | ||||
| draw_object(eval_ctx, scene, sl, ar, v3d, base, dflag); | draw_object(eval_ctx, scene, sl, ar, v3d, base, dflag); | ||||
| /* we draw duplicators for selection too */ | /* we draw duplicators for selection too */ | ||||
| if ((base->object->transflag & OB_DUPLI)) { | if ((base->object->transflag & OB_DUPLI)) { | ||||
| ListBase *lb; | ListBase *lb; | ||||
| ▲ Show 20 Lines • Show All 468 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| /* ************* draw object instances for bones, for example ****************** */ | /* ************* draw object instances for bones, for example ****************** */ | ||||
| /* assumes all matrices/etc set OK */ | /* assumes all matrices/etc set OK */ | ||||
| /* helper function for drawing object instances - meshes */ | /* helper function for drawing object instances - meshes */ | ||||
| static void draw_object_mesh_instance( | static void draw_object_mesh_instance( | ||||
| const EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, View3D *v3d, RegionView3D *rv3d, | const EvaluationContext *eval_ctx, Scene *scene, ViewLayer *sl, View3D *v3d, RegionView3D *rv3d, | ||||
| Object *ob, const short dt, int outline, const unsigned char ob_wire_col[4]) | Object *ob, const short dt, int outline, const unsigned char ob_wire_col[4]) | ||||
| { | { | ||||
| Mesh *me = ob->data; | Mesh *me = ob->data; | ||||
| DerivedMesh *dm = NULL, *edm = NULL; | DerivedMesh *dm = NULL, *edm = NULL; | ||||
| if (ob->mode & OB_MODE_EDIT) { | if (ob->mode & OB_MODE_EDIT) { | ||||
| edm = editbmesh_get_derived_base(ob, me->edit_btmesh, CD_MASK_BAREMESH); | edm = editbmesh_get_derived_base(ob, me->edit_btmesh, CD_MASK_BAREMESH); | ||||
| DM_update_materials(edm, ob); | DM_update_materials(edm, ob); | ||||
| Show All 30 Lines | else { | ||||
| GPU_object_material_unbind(); | GPU_object_material_unbind(); | ||||
| } | } | ||||
| if (edm) edm->release(edm); | if (edm) edm->release(edm); | ||||
| if (dm) dm->release(dm); | if (dm) dm->release(dm); | ||||
| } | } | ||||
| void draw_object_instance(const EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, View3D *v3d, RegionView3D *rv3d, Object *ob, const char dt, int outline, const float wire_col[4]) | void draw_object_instance(const EvaluationContext *eval_ctx, Scene *scene, ViewLayer *sl, View3D *v3d, RegionView3D *rv3d, Object *ob, const char dt, int outline, const float wire_col[4]) | ||||
| { | { | ||||
| if (ob == NULL) | if (ob == NULL) | ||||
| return; | return; | ||||
| unsigned char bcol[4]; | unsigned char bcol[4]; | ||||
| rgba_float_to_uchar(bcol, wire_col); | rgba_float_to_uchar(bcol, wire_col); | ||||
| switch (ob->type) { | switch (ob->type) { | ||||
| ▲ Show 20 Lines • Show All 141 Lines • Show Last 20 Lines | |||||