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 First 20 Lines • Show All 8,103 Lines • ▼ Show 20 Lines | static void SCULPT_OT_loop_to_vertex_colors(wmOperatorType *ot) | ||||
| ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | ||||
| } | } | ||||
| static int sculpt_sample_color_invoke(bContext *C, | static int sculpt_sample_color_invoke(bContext *C, | ||||
| wmOperator *UNUSED(op), | wmOperator *UNUSED(op), | ||||
| const wmEvent *UNUSED(e)) | const wmEvent *UNUSED(e)) | ||||
| { | { | ||||
| Sculpt *sd = CTX_data_tool_settings(C)->sculpt; | Sculpt *sd = CTX_data_tool_settings(C)->sculpt; | ||||
| Scene *scene = CTX_data_scene(C); | |||||
| Object *ob = CTX_data_active_object(C); | Object *ob = CTX_data_active_object(C); | ||||
| Brush *brush = BKE_paint_brush(&sd->paint); | Brush *brush = BKE_paint_brush(&sd->paint); | ||||
| SculptSession *ss = ob->sculpt; | SculptSession *ss = ob->sculpt; | ||||
| int active_vertex = SCULPT_active_vertex_get(ss); | int active_vertex = SCULPT_active_vertex_get(ss); | ||||
| const float *active_vertex_color = SCULPT_vertex_color_get(ss, active_vertex); | const float *active_vertex_color = SCULPT_vertex_color_get(ss, active_vertex); | ||||
| if (!active_vertex_color) { | if (!active_vertex_color) { | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| brush->rgb[0] = active_vertex_color[0]; | |||||
| brush->rgb[1] = active_vertex_color[1]; | float color_srgb[4]; | ||||
| brush->rgb[2] = active_vertex_color[2]; | linearrgb_to_srgb_v3_v3(color_srgb, active_vertex_color); | ||||
| BKE_brush_color_set(scene, brush, color_srgb); | |||||
| brush->alpha = active_vertex_color[3]; | brush->alpha = active_vertex_color[3]; | ||||
sergey: The `color_srgb` should be `float[3]`. | |||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| static void SCULPT_OT_sample_color(wmOperatorType *ot) | static void SCULPT_OT_sample_color(wmOperatorType *ot) | ||||
| { | { | ||||
| /* identifiers */ | /* identifiers */ | ||||
| ot->name = "Sample color"; | ot->name = "Sample color"; | ||||
| ot->idname = "SCULPT_OT_sample_color"; | ot->idname = "SCULPT_OT_sample_color"; | ||||
| Show All 36 Lines | |||||
The color_srgb should be float[3].