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 68 Lines • ▼ Show 20 Lines | |||||
| #include "BKE_report.h" | #include "BKE_report.h" | ||||
| #include "BKE_scene.h" | #include "BKE_scene.h" | ||||
| #include "BKE_screen.h" | #include "BKE_screen.h" | ||||
| #include "BKE_subdiv_ccg.h" | #include "BKE_subdiv_ccg.h" | ||||
| #include "BKE_subsurf.h" | #include "BKE_subsurf.h" | ||||
| #include "DEG_depsgraph.h" | #include "DEG_depsgraph.h" | ||||
| #include "IMB_colormanagement.h" | |||||
| #include "WM_api.h" | #include "WM_api.h" | ||||
| #include "WM_message.h" | #include "WM_message.h" | ||||
| #include "WM_toolsystem.h" | #include "WM_toolsystem.h" | ||||
| #include "WM_types.h" | #include "WM_types.h" | ||||
| #include "ED_object.h" | #include "ED_object.h" | ||||
| #include "ED_screen.h" | #include "ED_screen.h" | ||||
| #include "ED_sculpt.h" | #include "ED_sculpt.h" | ||||
| ▲ Show 20 Lines • Show All 8,026 Lines • ▼ Show 20 Lines | static int sculpt_sample_color_invoke(bContext *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; | ||||
| } | } | ||||
| BKE_brush_color_set(scene, brush, active_vertex_color); | float color_srgb[3]; | ||||
| copy_v3_v3(color_srgb, active_vertex_color); | |||||
| IMB_colormanagement_scene_linear_to_srgb_v3(color_srgb); | |||||
sergey: The `color_srgb` should be `float[3]`. | |||||
| BKE_brush_color_set(scene, brush, color_srgb); | |||||
| BKE_brush_alpha_set(scene, brush, active_vertex_color[3]); | BKE_brush_alpha_set(scene, brush, 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 40 Lines | |||||
The color_srgb should be float[3].