Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/sculpt_paint/paint_ops.c
| Show First 20 Lines • Show All 725 Lines • ▼ Show 20 Lines | static bool brush_generic_tool_set(bContext *C, | ||||
| if (brush) { | if (brush) { | ||||
| BKE_paint_brush_set(paint, brush); | BKE_paint_brush_set(paint, brush); | ||||
| BKE_paint_invalidate_overlay_all(); | BKE_paint_invalidate_overlay_all(); | ||||
| WM_main_add_notifier(NC_BRUSH | NA_EDITED, brush); | WM_main_add_notifier(NC_BRUSH | NA_EDITED, brush); | ||||
| /* Tool System | /* Tool System | ||||
| * This is needed for when there is a non-sculpt tool active (transform for e.g.) */ | * This is needed for when there is a non-sculpt tool active (transform for e.g.). | ||||
| * In case we are toogling (and the brush changed to the toggle_brush), we need to get the | |||||
| * tool_name again. */ | |||||
| int tool_result = brush_tool(brush, paint->runtime.tool_offset); | |||||
| ePaintMode paint_mode = BKE_paintmode_get_active_from_context(C); | |||||
| const EnumPropertyItem *items = BKE_paint_get_tool_enum_from_paintmode(paint_mode); | |||||
| RNA_enum_name_from_value(items, tool_result, &tool_name); | |||||
| char tool_id[MAX_NAME]; | char tool_id[MAX_NAME]; | ||||
| SNPRINTF(tool_id, "builtin_brush.%s", tool_name); | SNPRINTF(tool_id, "builtin_brush.%s", tool_name); | ||||
| WM_toolsystem_ref_set_by_id(C, tool_id); | WM_toolsystem_ref_set_by_id(C, tool_id); | ||||
| return true; | return true; | ||||
| } | } | ||||
| else { | else { | ||||
| return false; | return false; | ||||
| ▲ Show 20 Lines • Show All 640 Lines • Show Last 20 Lines | |||||