diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2020-03-09 18:27:24 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2020-03-09 18:27:24 +0300 |
commit | 29f3af95272590d26f610ae828b2eeee89c82a00 (patch) | |
tree | a696a58a2561c48f7ec6166e369e22081e0a64d8 /source/blender/windowmanager/intern/wm_toolsystem.c | |
parent | dcb93126876879d969a30a7865700abd072066f8 (diff) |
GPencil: Refactor of Draw Engine, Vertex Paint and all internal functions
This commit is a full refactor of the grease pencil modules including Draw Engine, Modifiers, VFX, depsgraph update, improvements in operators and conversion of Sculpt and Weight paint tools to real brushes.
Also, a huge code cleanup has been done at all levels.
Thanks to @fclem for his work and yo @pepeland and @mendio for the testing and help in the development.
Differential Revision: https://developer.blender.org/D6293
Diffstat (limited to 'source/blender/windowmanager/intern/wm_toolsystem.c')
-rw-r--r-- | source/blender/windowmanager/intern/wm_toolsystem.c | 58 |
1 files changed, 4 insertions, 54 deletions
diff --git a/source/blender/windowmanager/intern/wm_toolsystem.c b/source/blender/windowmanager/intern/wm_toolsystem.c index e335800636c..e721fd21b88 100644 --- a/source/blender/windowmanager/intern/wm_toolsystem.c +++ b/source/blender/windowmanager/intern/wm_toolsystem.c @@ -172,37 +172,7 @@ static void toolsystem_ref_link(bContext *C, WorkSpace *workspace, bToolRef *tre if (tref_rt->data_block[0]) { Main *bmain = CTX_data_main(C); - if ((tref->space_type == SPACE_VIEW3D) && (tref->mode == CTX_MODE_SCULPT_GPENCIL)) { - 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)) { + if ((tref->space_type == SPACE_VIEW3D) && (tref->mode == CTX_MODE_PARTICLE)) { const EnumPropertyItem *items = rna_enum_particle_edit_hair_brush_items; const int i = RNA_enum_from_identifier(items, tref_rt->data_block); if (i != -1) { @@ -414,29 +384,7 @@ void WM_toolsystem_ref_sync_from_context(Main *bmain, WorkSpace *workspace, bToo if (ob == NULL) { /* pass */ } - else if ((tref->space_type == SPACE_VIEW3D) && (tref->mode == CTX_MODE_SCULPT_GPENCIL)) { - 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 ((tref->space_type == SPACE_VIEW3D) && (tref->mode == CTX_MODE_PARTICLE)) { if (ob->mode & OB_MODE_PARTICLE_EDIT) { const EnumPropertyItem *items = rna_enum_particle_edit_hair_brush_items; const int i = RNA_enum_from_value(items, ts->particle.brushtype); @@ -735,6 +683,8 @@ static const char *toolsystem_default_tool(const bToolKey *tkey) return "builtin_brush.Push"; case CTX_MODE_WEIGHT_GPENCIL: return "builtin_brush.Weight"; + case CTX_MODE_VERTEX_GPENCIL: + return "builtin_brush.Draw"; /* end temporary hack. */ case CTX_MODE_PARTICLE: |