Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/sculpt_paint/sculpt.c
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
| Show All 24 Lines | |||||
| #include "MEM_guardedalloc.h" | #include "MEM_guardedalloc.h" | ||||
| #include "BLI_blenlib.h" | #include "BLI_blenlib.h" | ||||
| #include "BLI_dial_2d.h" | #include "BLI_dial_2d.h" | ||||
| #include "BLI_ghash.h" | #include "BLI_ghash.h" | ||||
| #include "BLI_gsqueue.h" | #include "BLI_gsqueue.h" | ||||
| #include "BLI_hash.h" | #include "BLI_hash.h" | ||||
| #include "BLI_math.h" | #include "BLI_math.h" | ||||
| #include "BLI_math_color.h" | |||||
| #include "BLI_math_color_blend.h" | #include "BLI_math_color_blend.h" | ||||
| #include "BLI_task.h" | #include "BLI_task.h" | ||||
| #include "BLI_utildefines.h" | #include "BLI_utildefines.h" | ||||
| #include "BLT_translation.h" | #include "BLT_translation.h" | ||||
| #include "PIL_time.h" | #include "PIL_time.h" | ||||
| ▲ Show 20 Lines • Show All 8,638 Lines • ▼ Show 20 Lines | static int vertex_to_loop_colors_exec(bContext *C, wmOperator *UNUSED(op)) | ||||
| MLoop *loops = CustomData_get_layer(&mesh->ldata, CD_MLOOP); | MLoop *loops = CustomData_get_layer(&mesh->ldata, CD_MLOOP); | ||||
| MPoly *polys = CustomData_get_layer(&mesh->pdata, CD_MPOLY); | MPoly *polys = CustomData_get_layer(&mesh->pdata, CD_MPOLY); | ||||
| for (int i = 0; i < mesh->totpoly; i++) { | for (int i = 0; i < mesh->totpoly; i++) { | ||||
| MPoly *c_poly = &polys[i]; | MPoly *c_poly = &polys[i]; | ||||
| for (int j = 0; j < c_poly->totloop; j++) { | for (int j = 0; j < c_poly->totloop; j++) { | ||||
| int loop_index = c_poly->loopstart + j; | int loop_index = c_poly->loopstart + j; | ||||
| MLoop *c_loop = &loops[c_poly->loopstart + j]; | MLoop *c_loop = &loops[c_poly->loopstart + j]; | ||||
| loopcols[loop_index].r = (char)(vertcols[c_loop->v].color[0] * 255); | float srgb_color[4]; | ||||
| loopcols[loop_index].g = (char)(vertcols[c_loop->v].color[1] * 255); | linearrgb_to_srgb_v4(srgb_color, vertcols[c_loop->v].color); | ||||
| loopcols[loop_index].b = (char)(vertcols[c_loop->v].color[2] * 255); | loopcols[loop_index].r = (char)(srgb_color[0] * 255); | ||||
| loopcols[loop_index].a = (char)(vertcols[c_loop->v].color[3] * 255); | loopcols[loop_index].g = (char)(srgb_color[1] * 255); | ||||
| loopcols[loop_index].b = (char)(srgb_color[2] * 255); | |||||
| loopcols[loop_index].a = (char)(srgb_color[3] * 255); | |||||
| } | } | ||||
| } | } | ||||
| DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); | DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); | ||||
| WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data); | WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data); | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 47 Lines • ▼ Show 20 Lines | for (int i = 0; i < mesh->totpoly; i++) { | ||||
| MPoly *c_poly = &polys[i]; | MPoly *c_poly = &polys[i]; | ||||
| for (int j = 0; j < c_poly->totloop; j++) { | for (int j = 0; j < c_poly->totloop; j++) { | ||||
| int loop_index = c_poly->loopstart + j; | int loop_index = c_poly->loopstart + j; | ||||
| MLoop *c_loop = &loops[c_poly->loopstart + j]; | MLoop *c_loop = &loops[c_poly->loopstart + j]; | ||||
| vertcols[c_loop->v].color[0] = (loopcols[loop_index].r / 255.0f); | vertcols[c_loop->v].color[0] = (loopcols[loop_index].r / 255.0f); | ||||
| vertcols[c_loop->v].color[1] = (loopcols[loop_index].g / 255.0f); | vertcols[c_loop->v].color[1] = (loopcols[loop_index].g / 255.0f); | ||||
| vertcols[c_loop->v].color[2] = (loopcols[loop_index].b / 255.0f); | vertcols[c_loop->v].color[2] = (loopcols[loop_index].b / 255.0f); | ||||
| vertcols[c_loop->v].color[3] = (loopcols[loop_index].a / 255.0f); | vertcols[c_loop->v].color[3] = (loopcols[loop_index].a / 255.0f); | ||||
| srgb_to_linearrgb_v4(vertcols[c_loop->v].color, vertcols[c_loop->v].color); | |||||
| } | } | ||||
| } | } | ||||
| DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); | DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); | ||||
| WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data); | WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data); | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 674 Lines • Show Last 20 Lines | |||||