Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/uvedit/uvedit_draw.c
| Show First 20 Lines • Show All 511 Lines • ▼ Show 20 Lines | static void draw_uvs_other_mesh(Object *ob, const Image *curimage, const bool new_shading_nodes, | ||||
| if (new_shading_nodes) { | if (new_shading_nodes) { | ||||
| draw_uvs_other_mesh_new_shading(ob, curimage, other_uv_filter, pos); | draw_uvs_other_mesh_new_shading(ob, curimage, other_uv_filter, pos); | ||||
| } | } | ||||
| else { | else { | ||||
| draw_uvs_other_mesh_texface(ob, curimage, other_uv_filter, pos); | draw_uvs_other_mesh_texface(ob, curimage, other_uv_filter, pos); | ||||
| } | } | ||||
| } | } | ||||
| static void draw_uvs_other(SceneLayer *sl, Object *obedit, const Image *curimage, const bool new_shading_nodes, | static void draw_uvs_other(ViewLayer *sl, Object *obedit, const Image *curimage, const bool new_shading_nodes, | ||||
| const int other_uv_filter) | const int other_uv_filter) | ||||
| { | { | ||||
| unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); | unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | ||||
| immUniformThemeColor(TH_UV_OTHERS); | immUniformThemeColor(TH_UV_OTHERS); | ||||
| for (Base *base = sl->object_bases.first; base; base = base->next) { | for (Base *base = sl->object_bases.first; base; base = base->next) { | ||||
| if (((base->flag & BASE_SELECTED) != 0) && | if (((base->flag & BASE_SELECTED) != 0) && | ||||
| ((base->flag & BASE_VISIBLED) != 0)) | ((base->flag & BASE_VISIBLED) != 0)) | ||||
| { | { | ||||
| Object *ob = base->object; | Object *ob = base->object; | ||||
| if ((ob->type == OB_MESH) && (ob != obedit) && ((Mesh *)ob->data)->mloopuv) { | if ((ob->type == OB_MESH) && (ob != obedit) && ((Mesh *)ob->data)->mloopuv) { | ||||
| draw_uvs_other_mesh(ob, curimage, new_shading_nodes, other_uv_filter, pos); | draw_uvs_other_mesh(ob, curimage, new_shading_nodes, other_uv_filter, pos); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| immUnbindProgram(); | immUnbindProgram(); | ||||
| } | } | ||||
| static void draw_uvs_texpaint(SpaceImage *sima, Scene *scene, SceneLayer *sl, Object *ob) | static void draw_uvs_texpaint(SpaceImage *sima, Scene *scene, ViewLayer *sl, Object *ob) | ||||
| { | { | ||||
| const bool new_shading_nodes = BKE_scene_use_new_shading_nodes(scene); | const bool new_shading_nodes = BKE_scene_use_new_shading_nodes(scene); | ||||
| Image *curimage = ED_space_image(sima); | Image *curimage = ED_space_image(sima); | ||||
| Mesh *me = ob->data; | Mesh *me = ob->data; | ||||
| Material *ma; | Material *ma; | ||||
| if (sima->flag & SI_DRAW_OTHER) { | if (sima->flag & SI_DRAW_OTHER) { | ||||
| draw_uvs_other(sl, ob, curimage, new_shading_nodes, sima->other_uv_filter); | draw_uvs_other(sl, ob, curimage, new_shading_nodes, sima->other_uv_filter); | ||||
| ▲ Show 20 Lines • Show All 48 Lines • ▼ Show 20 Lines | for (j = 0; j < 3; j++) { | ||||
| immVertex2fv(pos, luv->uv); | immVertex2fv(pos, luv->uv); | ||||
| } | } | ||||
| i++; | i++; | ||||
| } while (i != em->tottri && (f == em->looptris[i][0]->f)); | } while (i != em->tottri && (f == em->looptris[i][0]->f)); | ||||
| *r_loop_index = i - 1; | *r_loop_index = i - 1; | ||||
| } | } | ||||
| /* draws uv's in the image space */ | /* draws uv's in the image space */ | ||||
| static void draw_uvs(SpaceImage *sima, Scene *scene, SceneLayer *sl, Object *obedit, Depsgraph *depsgraph) | static void draw_uvs(SpaceImage *sima, Scene *scene, ViewLayer *sl, Object *obedit, Depsgraph *depsgraph) | ||||
| { | { | ||||
| const bool new_shading_nodes = BKE_scene_use_new_shading_nodes(scene); | const bool new_shading_nodes = BKE_scene_use_new_shading_nodes(scene); | ||||
| ToolSettings *ts; | ToolSettings *ts; | ||||
| Mesh *me = obedit->data; | Mesh *me = obedit->data; | ||||
| BMEditMesh *em = me->edit_btmesh; | BMEditMesh *em = me->edit_btmesh; | ||||
| BMesh *bm = em->bm; | BMesh *bm = em->bm; | ||||
| BMFace *efa, *efa_act; | BMFace *efa, *efa_act; | ||||
| BMLoop *l; | BMLoop *l; | ||||
| ▲ Show 20 Lines • Show All 424 Lines • ▼ Show 20 Lines | if ((sima->mode == SI_MODE_PAINT) && obedit && obedit->type == OB_MESH) { | ||||
| struct BMEditMesh *em = BKE_editmesh_from_object(obedit); | struct BMEditMesh *em = BKE_editmesh_from_object(obedit); | ||||
| *show_shadow = EDBM_uv_check(em); | *show_shadow = EDBM_uv_check(em); | ||||
| } | } | ||||
| *show_texpaint = (ob && ob->type == OB_MESH && ob->mode == OB_MODE_TEXTURE_PAINT); | *show_texpaint = (ob && ob->type == OB_MESH && ob->mode == OB_MODE_TEXTURE_PAINT); | ||||
| } | } | ||||
| void ED_uvedit_draw_main(SpaceImage *sima, ARegion *ar, Scene *scene, SceneLayer *sl, Object *obedit, Object *obact, Depsgraph *depsgraph) | void ED_uvedit_draw_main(SpaceImage *sima, ARegion *ar, Scene *scene, ViewLayer *sl, Object *obedit, Object *obact, Depsgraph *depsgraph) | ||||
| { | { | ||||
| ToolSettings *toolsettings = scene->toolsettings; | ToolSettings *toolsettings = scene->toolsettings; | ||||
| bool show_uvedit, show_uvshadow, show_texpaint_uvshadow; | bool show_uvedit, show_uvshadow, show_texpaint_uvshadow; | ||||
| show_uvedit = ED_space_image_show_uvedit(sima, obedit); | show_uvedit = ED_space_image_show_uvedit(sima, obedit); | ||||
| draw_uv_shadows_get(sima, obact, obedit, &show_uvshadow, &show_texpaint_uvshadow); | draw_uv_shadows_get(sima, obact, obedit, &show_uvshadow, &show_texpaint_uvshadow); | ||||
| if (show_uvedit || show_uvshadow || show_texpaint_uvshadow) { | if (show_uvedit || show_uvshadow || show_texpaint_uvshadow) { | ||||
| Show All 12 Lines | |||||