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]; | BKE_brush_color_set(scene, brush, active_vertex_color); | ||||
| brush->rgb[2] = active_vertex_color[2]; | BKE_brush_alpha_set(scene, brush, active_vertex_color[3]); | ||||
| brush->alpha = active_vertex_color[3]; | |||||
| WM_event_add_notifier(C, NC_BRUSH | NA_EDITED, brush); | WM_event_add_notifier(C, NC_BRUSH | NA_EDITED, brush); | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| static void SCULPT_OT_sample_color(wmOperatorType *ot) | static void SCULPT_OT_sample_color(wmOperatorType *ot) | ||||
| { | { | ||||
| Show All 39 Lines | |||||