Changeset View
Changeset View
Standalone View
Standalone View
source/blender/windowmanager/intern/wm_toolsystem.c
| Show First 20 Lines • Show All 166 Lines • ▼ Show 20 Lines | if (tref_rt->gizmo_group[0]) { | ||||
| else { | else { | ||||
| CLOG_WARN(WM_LOG_TOOLS, "'%s' widget not found", idname); | CLOG_WARN(WM_LOG_TOOLS, "'%s' widget not found", idname); | ||||
| } | } | ||||
| } | } | ||||
| if (tref_rt->data_block[0]) { | if (tref_rt->data_block[0]) { | ||||
| Main *bmain = CTX_data_main(C); | Main *bmain = CTX_data_main(C); | ||||
| if ((tref->space_type == SPACE_VIEW3D) && (tref->mode == CTX_MODE_SCULPT_GPENCIL)) { | if ((tref->space_type == SPACE_VIEW3D) && (tref->mode == CTX_MODE_PARTICLE)) { | ||||
| const EnumPropertyItem *items = rna_enum_gpencil_sculpt_brush_items; | |||||
| const int i = RNA_enum_from_identifier(items, tref_rt->data_block); | |||||
| if (i != -1) { | |||||
| const int value = items[i].value; | |||||
| wmWindowManager *wm = bmain->wm.first; | |||||
| for (wmWindow *win = wm->windows.first; win; win = win->next) { | |||||
| if (workspace == WM_window_get_active_workspace(win)) { | |||||
| Scene *scene = WM_window_get_active_scene(win); | |||||
| ToolSettings *ts = scene->toolsettings; | |||||
| ts->gp_sculpt.brushtype = value; | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| else if ((tref->space_type == SPACE_VIEW3D) && (tref->mode == CTX_MODE_WEIGHT_GPENCIL)) { | |||||
| const EnumPropertyItem *items = rna_enum_gpencil_weight_brush_items; | |||||
| const int i = RNA_enum_from_identifier(items, tref_rt->data_block); | |||||
| if (i != -1) { | |||||
| const int value = items[i].value; | |||||
| wmWindowManager *wm = bmain->wm.first; | |||||
| for (wmWindow *win = wm->windows.first; win; win = win->next) { | |||||
| if (workspace == WM_window_get_active_workspace(win)) { | |||||
| Scene *scene = WM_window_get_active_scene(win); | |||||
| ToolSettings *ts = scene->toolsettings; | |||||
| ts->gp_sculpt.weighttype = value; | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| else if ((tref->space_type == SPACE_VIEW3D) && (tref->mode == CTX_MODE_PARTICLE)) { | |||||
| const EnumPropertyItem *items = rna_enum_particle_edit_hair_brush_items; | const EnumPropertyItem *items = rna_enum_particle_edit_hair_brush_items; | ||||
| const int i = RNA_enum_from_identifier(items, tref_rt->data_block); | const int i = RNA_enum_from_identifier(items, tref_rt->data_block); | ||||
| if (i != -1) { | if (i != -1) { | ||||
| const int value = items[i].value; | const int value = items[i].value; | ||||
| wmWindowManager *wm = bmain->wm.first; | wmWindowManager *wm = bmain->wm.first; | ||||
| for (wmWindow *win = wm->windows.first; win; win = win->next) { | for (wmWindow *win = wm->windows.first; win; win = win->next) { | ||||
| if (workspace == WM_window_get_active_workspace(win)) { | if (workspace == WM_window_get_active_workspace(win)) { | ||||
| Scene *scene = WM_window_get_active_scene(win); | Scene *scene = WM_window_get_active_scene(win); | ||||
| ▲ Show 20 Lines • Show All 186 Lines • ▼ Show 20 Lines | for (wmWindow *win = wm->windows.first; win; win = win->next) { | ||||
| Scene *scene = WM_window_get_active_scene(win); | Scene *scene = WM_window_get_active_scene(win); | ||||
| ToolSettings *ts = scene->toolsettings; | ToolSettings *ts = scene->toolsettings; | ||||
| const ViewLayer *view_layer = WM_window_get_active_view_layer(win); | const ViewLayer *view_layer = WM_window_get_active_view_layer(win); | ||||
| const Object *ob = OBACT(view_layer); | const Object *ob = OBACT(view_layer); | ||||
| if (ob == NULL) { | if (ob == NULL) { | ||||
| /* pass */ | /* pass */ | ||||
| } | } | ||||
| else if ((tref->space_type == SPACE_VIEW3D) && (tref->mode == CTX_MODE_SCULPT_GPENCIL)) { | if ((tref->space_type == SPACE_VIEW3D) && (tref->mode == CTX_MODE_PARTICLE)) { | ||||
| if (ob->mode & OB_MODE_SCULPT_GPENCIL) { | |||||
| const EnumPropertyItem *items = rna_enum_gpencil_sculpt_brush_items; | |||||
| const int i = RNA_enum_from_value(items, ts->gp_sculpt.brushtype); | |||||
| const EnumPropertyItem *item = &items[i]; | |||||
| if (!STREQ(tref_rt->data_block, item->identifier)) { | |||||
| STRNCPY(tref_rt->data_block, item->identifier); | |||||
| SNPRINTF(tref->idname, "builtin_brush.%s", item->name); | |||||
| } | |||||
| } | |||||
| } | |||||
| else if ((tref->space_type == SPACE_VIEW3D) && (tref->mode == CTX_MODE_WEIGHT_GPENCIL)) { | |||||
| if (ob->mode & OB_MODE_WEIGHT_GPENCIL) { | |||||
| const EnumPropertyItem *items = rna_enum_gpencil_weight_brush_items; | |||||
| const int i = RNA_enum_from_value(items, ts->gp_sculpt.weighttype); | |||||
| const EnumPropertyItem *item = &items[i]; | |||||
| if (!STREQ(tref_rt->data_block, item->identifier)) { | |||||
| STRNCPY(tref_rt->data_block, item->identifier); | |||||
| SNPRINTF(tref->idname, "builtin_brush.%s", item->name); | |||||
| } | |||||
| } | |||||
| } | |||||
| else if ((tref->space_type == SPACE_VIEW3D) && (tref->mode == CTX_MODE_PARTICLE)) { | |||||
| if (ob->mode & OB_MODE_PARTICLE_EDIT) { | if (ob->mode & OB_MODE_PARTICLE_EDIT) { | ||||
| const EnumPropertyItem *items = rna_enum_particle_edit_hair_brush_items; | const EnumPropertyItem *items = rna_enum_particle_edit_hair_brush_items; | ||||
| const int i = RNA_enum_from_value(items, ts->particle.brushtype); | const int i = RNA_enum_from_value(items, ts->particle.brushtype); | ||||
| const EnumPropertyItem *item = &items[i]; | const EnumPropertyItem *item = &items[i]; | ||||
| if (!STREQ(tref_rt->data_block, item->identifier)) { | if (!STREQ(tref_rt->data_block, item->identifier)) { | ||||
| STRNCPY(tref_rt->data_block, item->identifier); | STRNCPY(tref_rt->data_block, item->identifier); | ||||
| SNPRINTF(tref->idname, "builtin_brush.%s", item->name); | SNPRINTF(tref->idname, "builtin_brush.%s", item->name); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 282 Lines • ▼ Show 20 Lines | case SPACE_VIEW3D: | ||||
| case CTX_MODE_PAINT_WEIGHT: | case CTX_MODE_PAINT_WEIGHT: | ||||
| case CTX_MODE_PAINT_TEXTURE: | case CTX_MODE_PAINT_TEXTURE: | ||||
| case CTX_MODE_PAINT_GPENCIL: | case CTX_MODE_PAINT_GPENCIL: | ||||
| return "builtin_brush.Draw"; | return "builtin_brush.Draw"; | ||||
| case CTX_MODE_SCULPT_GPENCIL: | case CTX_MODE_SCULPT_GPENCIL: | ||||
| return "builtin_brush.Push"; | return "builtin_brush.Push"; | ||||
| case CTX_MODE_WEIGHT_GPENCIL: | case CTX_MODE_WEIGHT_GPENCIL: | ||||
| return "builtin_brush.Weight"; | return "builtin_brush.Weight"; | ||||
| case CTX_MODE_VERTEX_GPENCIL: | |||||
| return "builtin_brush.Draw"; | |||||
| /* end temporary hack. */ | /* end temporary hack. */ | ||||
| case CTX_MODE_PARTICLE: | case CTX_MODE_PARTICLE: | ||||
| return "builtin_brush.Comb"; | return "builtin_brush.Comb"; | ||||
| case CTX_MODE_EDIT_TEXT: | case CTX_MODE_EDIT_TEXT: | ||||
| return "builtin.cursor"; | return "builtin.cursor"; | ||||
| } | } | ||||
| break; | break; | ||||
| ▲ Show 20 Lines • Show All 204 Lines • Show Last 20 Lines | |||||