Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-05-01 11:10:34 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-05-01 13:32:38 +0300
commit928becec60d16880838dd756cc8b6b5ee73f9b2d (patch)
treea54a8038c357c20d7b88a52d065b0f487480597d /source/blender/windowmanager/intern/wm_toolsystem.c
parent5fd69f6bd8c91b73135d22b3cad829b0892dabca (diff)
UV Sculpt: improve tool-system integration
In 2.7x UV sculpt was a kind of sub-mode (a toggle with it's own key-map & drawing code). Move this to an operator that uses the tool-system, this simplifies internal logic, especially brush selection which now matches sculpt and other paint modes. - Remove toggle used to enable uv sculpt. - Expose the brush, which was already used but there was no way to select different brushes. - Make UV sculpt use paint paint tool slots (using brushes how all other paint mode currently do). - Move UV Sculpt keymap to the tools keymap. - Remove Q to toggle UV sculpt mode, S/P/G keys to switch tools.
Diffstat (limited to 'source/blender/windowmanager/intern/wm_toolsystem.c')
-rw-r--r--source/blender/windowmanager/intern/wm_toolsystem.c60
1 files changed, 1 insertions, 59 deletions
diff --git a/source/blender/windowmanager/intern/wm_toolsystem.c b/source/blender/windowmanager/intern/wm_toolsystem.c
index 0abb5678800..dc0f02f22dd 100644
--- a/source/blender/windowmanager/intern/wm_toolsystem.c
+++ b/source/blender/windowmanager/intern/wm_toolsystem.c
@@ -169,14 +169,6 @@ void WM_toolsystem_unlink(bContext *C, WorkSpace *workspace, const bToolKey *tke
}
}
-static void toolsystem_ref_link__refresh_image_uv_sculpt(bContext *C, Scene *scene)
-{
- PointerRNA ptr;
- RNA_pointer_create(&scene->id, &RNA_ToolSettings, scene->toolsettings, &ptr);
- PropertyRNA *prop = RNA_struct_find_property(&ptr, "use_uv_sculpt");
- RNA_property_update(C, &ptr, prop);
-}
-
/**
* \see #toolsystem_ref_link
*/
@@ -244,29 +236,6 @@ static void toolsystem_ref_link(bContext *C, WorkSpace *workspace, bToolRef *tre
}
}
}
- else if ((tref->space_type == SPACE_IMAGE) && (tref->mode == SI_MODE_UV)) {
- /* Note that switching uv-sculpt boolean is a hack at the moment.
- * It would be best to make this either an operator or a higher level mode
- * (like mesh-object sculpt mode). */
- const EnumPropertyItem *items = rna_enum_uv_sculpt_tool_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->uv_sculpt_tool = value;
-
- if (ts->use_uv_sculpt == false) {
- ts->use_uv_sculpt = true;
- toolsystem_ref_link__refresh_image_uv_sculpt(C, scene);
- }
- }
- }
- }
- }
else {
const ePaintMode paint_mode = BKE_paintmode_get_from_tool(tref);
BLI_assert(paint_mode != PAINT_MODE_INVALID);
@@ -280,6 +249,7 @@ static void toolsystem_ref_link(bContext *C, WorkSpace *workspace, bToolRef *tre
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);
+ BKE_paint_ensure_from_paintmode(scene, paint_mode);
Paint *paint = BKE_paint_get_active_from_paintmode(scene, paint_mode);
struct Brush *brush = BKE_paint_toolslots_brush_get(paint, slot_index);
if (brush == NULL) {
@@ -300,23 +270,6 @@ static void toolsystem_ref_link(bContext *C, WorkSpace *workspace, bToolRef *tre
}
}
}
- else {
- /* XXX, this part is weak, disables uv_sculpt when non uv-tool set. */
- if ((tref->space_type == SPACE_IMAGE) && (tref->mode == SI_MODE_UV)) {
- Main *bmain = CTX_data_main(C);
- 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;
- if (ts->use_uv_sculpt == true) {
- ts->use_uv_sculpt = false;
- toolsystem_ref_link__refresh_image_uv_sculpt(C, scene);
- }
- }
- }
- }
- }
}
static void toolsystem_refresh_ref(bContext *C, WorkSpace *workspace, bToolRef *tref)
@@ -489,17 +442,6 @@ void WM_toolsystem_ref_sync_from_context(Main *bmain, WorkSpace *workspace, bToo
}
}
}
- else if ((tref->space_type == SPACE_IMAGE) && (tref->mode == SI_MODE_UV)) {
- if (ob->mode & OB_MODE_EDIT) {
- const EnumPropertyItem *items = rna_enum_uv_sculpt_tool_items;
- const int i = RNA_enum_from_value(items, ts->uv_sculpt_tool);
- 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 {
const ePaintMode paint_mode = BKE_paintmode_get_from_tool(tref);
Paint *paint = BKE_paint_get_active_from_paintmode(scene, paint_mode);