Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_view3d/drawobject.c
| Show First 20 Lines • Show All 146 Lines • ▼ Show 20 Lines | |||||
| typedef struct drawDMEdgesSelInterp_userData { | typedef struct drawDMEdgesSelInterp_userData { | ||||
| BMesh *bm; | BMesh *bm; | ||||
| unsigned char *baseCol, *selCol; | unsigned char *baseCol, *selCol; | ||||
| unsigned char *lastCol; | unsigned char *lastCol; | ||||
| } drawDMEdgesSelInterp_userData; | } drawDMEdgesSelInterp_userData; | ||||
| typedef struct drawDMFacesSel_userData { | typedef struct drawDMFacesSel_userData { | ||||
campbellbarton: result of `DM_get_weight_user()` can go here too. | |||||
| #ifdef WITH_FREESTYLE | #ifdef WITH_FREESTYLE | ||||
| unsigned char *cols[4]; | unsigned char *cols[4]; | ||||
| #else | #else | ||||
| unsigned char *cols[3]; | unsigned char *cols[3]; | ||||
| #endif | #endif | ||||
| DerivedMesh *dm; | DerivedMesh *dm; | ||||
| BMesh *bm; | BMesh *bm; | ||||
| ▲ Show 20 Lines • Show All 2,247 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| static void draw_dm_edges_sel_interp(BMEditMesh *em, DerivedMesh *dm, unsigned char *baseCol, unsigned char *selCol) | static void draw_dm_edges_sel_interp(BMEditMesh *em, DerivedMesh *dm, unsigned char *baseCol, unsigned char *selCol) | ||||
| { | { | ||||
| drawDMEdgesSelInterp_userData data; | drawDMEdgesSelInterp_userData data; | ||||
| data.bm = em->bm; | data.bm = em->bm; | ||||
| data.baseCol = baseCol; | data.baseCol = baseCol; | ||||
| data.selCol = selCol; | data.selCol = selCol; | ||||
| data.lastCol = NULL; | data.lastCol = NULL; | ||||
Not Done Inline ActionsThe mesh either has deform weights or not. This check should be moved into draw_dm_edges_sel_interp or even earlier. campbellbarton: The mesh either has deform weights or not. This check should be moved into… | |||||
| dm->drawMappedEdgesInterp(dm, draw_dm_edges_sel_interp__setDrawOptions, draw_dm_edges_sel_interp__setDrawInterpOptions, &data); | dm->drawMappedEdgesInterp(dm, draw_dm_edges_sel_interp__setDrawOptions, draw_dm_edges_sel_interp__setDrawInterpOptions, &data); | ||||
| } | } | ||||
| /* Draw only seam edges */ | /* Draw only seam edges */ | ||||
| static DMDrawOption draw_dm_edges_seams__setDrawOptions(void *userData, int index) | static DMDrawOption draw_dm_edges_seams__setDrawOptions(void *userData, int index) | ||||
| { | { | ||||
| BMEdge *eed = BM_edge_at_index(userData, index); | BMEdge *eed = BM_edge_at_index(userData, index); | ||||
| Show All 9 Lines | static void draw_dm_edges_seams(BMEditMesh *em, DerivedMesh *dm) | ||||
| dm->drawMappedEdges(dm, draw_dm_edges_seams__setDrawOptions, em->bm); | dm->drawMappedEdges(dm, draw_dm_edges_seams__setDrawOptions, em->bm); | ||||
| } | } | ||||
| /* Draw only sharp edges */ | /* Draw only sharp edges */ | ||||
| static DMDrawOption draw_dm_edges_sharp__setDrawOptions(void *userData, int index) | static DMDrawOption draw_dm_edges_sharp__setDrawOptions(void *userData, int index) | ||||
| { | { | ||||
| BMEdge *eed = BM_edge_at_index(userData, index); | BMEdge *eed = BM_edge_at_index(userData, index); | ||||
| if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN) && !BM_elem_flag_test(eed, BM_ELEM_SMOOTH)) | if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN) && !BM_elem_flag_test(eed, BM_ELEM_SMOOTH)) | ||||
Not Done Inline ActionsThis is incorrect, It should interpolate between the 2 colors if its not 0.0 or 1.0. As selection does. You should be able to check this is working with subsurf+cage. campbellbarton: This is incorrect, It should interpolate between the 2 colors if its not 0.0 or 1.0. As… | |||||
| 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_dm_edges_sharp(BMEditMesh *em, DerivedMesh *dm) | static void draw_dm_edges_sharp(BMEditMesh *em, DerivedMesh *dm) | ||||
| { | { | ||||
| dm->drawMappedEdges(dm, draw_dm_edges_sharp__setDrawOptions, em->bm); | dm->drawMappedEdges(dm, draw_dm_edges_sharp__setDrawOptions, em->bm); | ||||
| ▲ Show 20 Lines • Show All 374 Lines • ▼ Show 20 Lines | else { | ||||
| selCol[3] = 255; | selCol[3] = 255; | ||||
| if (!sel_only) wireCol[3] = 255; | if (!sel_only) wireCol[3] = 255; | ||||
| } | } | ||||
| if (ts->selectmode == SCE_SELECT_FACE) { | if (ts->selectmode == SCE_SELECT_FACE) { | ||||
| draw_dm_edges_sel(em, cageDM, wireCol, selCol, actCol, eed_act); | draw_dm_edges_sel(em, cageDM, wireCol, selCol, actCol, eed_act); | ||||
| } | } | ||||
| else if ((me->drawflag & ME_DRAWEDGES) || (ts->selectmode & SCE_SELECT_EDGE)) { | else if ((me->drawflag & ME_DRAWEDGES) || (ts->selectmode & SCE_SELECT_EDGE)) { | ||||
| if (cageDM->drawMappedEdgesInterp && (ts->selectmode & SCE_SELECT_VERTEX)) { | if (cageDM->drawMappedEdgesInterp && | ||||
| ((ts->selectmode & SCE_SELECT_VERTEX) || (me->drawflag & ME_DRAWEIGHT))) | |||||
| { | |||||
| glShadeModel(GL_SMOOTH); | glShadeModel(GL_SMOOTH); | ||||
| draw_dm_edges_sel_interp(em, cageDM, wireCol, selCol); | draw_dm_edges_sel_interp(em, cageDM, wireCol, selCol); | ||||
| glShadeModel(GL_FLAT); | glShadeModel(GL_FLAT); | ||||
| } | } | ||||
| else { | else { | ||||
| draw_dm_edges_sel(em, cageDM, wireCol, selCol, actCol, eed_act); | draw_dm_edges_sel(em, cageDM, wireCol, selCol, actCol, eed_act); | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 5,226 Lines • Show Last 20 Lines | |||||
result of DM_get_weight_user() can go here too.