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/makesrna
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/makesrna')
-rw-r--r--source/blender/makesrna/RNA_enum_types.h1
-rw-r--r--source/blender/makesrna/intern/rna_brush.c16
-rw-r--r--source/blender/makesrna/intern/rna_scene.c26
-rw-r--r--source/blender/makesrna/intern/rna_sculpt_paint.c6
4 files changed, 23 insertions, 26 deletions
diff --git a/source/blender/makesrna/RNA_enum_types.h b/source/blender/makesrna/RNA_enum_types.h
index 56791542fbd..119186ff748 100644
--- a/source/blender/makesrna/RNA_enum_types.h
+++ b/source/blender/makesrna/RNA_enum_types.h
@@ -114,6 +114,7 @@ extern const EnumPropertyItem rna_enum_operator_return_items[];
extern const EnumPropertyItem rna_enum_operator_property_tags[];
extern const EnumPropertyItem rna_enum_brush_sculpt_tool_items[];
+extern const EnumPropertyItem rna_enum_brush_uv_sculpt_tool_items[];
extern const EnumPropertyItem rna_enum_brush_vertex_tool_items[];
extern const EnumPropertyItem rna_enum_brush_weight_tool_items[];
extern const EnumPropertyItem rna_enum_brush_gpencil_types_items[];
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c
index d5c9dfb8d02..40c3a75df85 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -94,6 +94,13 @@ const EnumPropertyItem rna_enum_brush_sculpt_tool_items[] = {
{0, NULL, 0, NULL, NULL},
};
+const EnumPropertyItem rna_enum_brush_uv_sculpt_tool_items[] = {
+ {UV_SCULPT_TOOL_GRAB, "GRAB", 0, "Grab", "Grab UVs"},
+ {UV_SCULPT_TOOL_RELAX, "RELAX", 0, "Relax", "Relax UVs"},
+ {UV_SCULPT_TOOL_PINCH, "PINCH", 0, "Pinch", "Pinch UVs"},
+ {0, NULL, 0, NULL, NULL},
+};
+
const EnumPropertyItem rna_enum_brush_vertex_tool_items[] = {
{VPAINT_TOOL_DRAW, "DRAW", ICON_BRUSH_MIX, "Draw", ""},
{VPAINT_TOOL_BLUR, "BLUR", ICON_BRUSH_BLUR, "Blur", ""},
@@ -1575,6 +1582,11 @@ static void rna_def_brush(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Sculpt Tool", "");
RNA_def_property_update(prop, 0, "rna_Brush_update_and_reset_icon");
+ prop = RNA_def_property(srna, "uv_sculpt_tool", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, rna_enum_brush_uv_sculpt_tool_items);
+ RNA_def_property_ui_text(prop, "Sculpt Tool", "");
+ RNA_def_property_update(prop, 0, "rna_Brush_update_and_reset_icon");
+
prop = RNA_def_property(srna, "vertex_tool", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "vertexpaint_tool");
RNA_def_property_enum_items(prop, rna_enum_brush_vertex_tool_items);
@@ -2105,6 +2117,10 @@ static void rna_def_brush(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "ob_mode", OB_MODE_SCULPT);
RNA_def_property_ui_text(prop, "Use Sculpt", "Use this brush in sculpt mode");
+ prop = RNA_def_property(srna, "use_paint_uv_sculpt", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "ob_mode", OB_MODE_EDIT);
+ RNA_def_property_ui_text(prop, "Use UV Sculpt", "Use this brush in UV sculpt mode");
+
prop = RNA_def_property(srna, "use_paint_vertex", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "ob_mode", OB_MODE_VERTEX_PAINT);
RNA_def_property_ui_text(prop, "Use Vertex", "Use this brush in vertex paint mode");
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index fb820f93c1d..6f6699fa81b 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -106,13 +106,6 @@ static const EnumPropertyItem uv_sculpt_relaxation_items[] = {
};
#endif
-const EnumPropertyItem rna_enum_uv_sculpt_tool_items[] = {
- {UV_SCULPT_TOOL_PINCH, "PINCH", 0, "Pinch", "Pinch UVs"},
- {UV_SCULPT_TOOL_RELAX, "RELAX", 0, "Relax", "Relax UVs"},
- {UV_SCULPT_TOOL_GRAB, "GRAB", 0, "Grab", "Grab UVs"},
- {0, NULL, 0, NULL, NULL},
-};
-
const EnumPropertyItem rna_enum_snap_target_items[] = {
{SCE_SNAP_TARGET_CLOSEST, "CLOSEST", 0, "Closest", "Snap closest point onto target"},
{SCE_SNAP_TARGET_CENTER, "CENTER", 0, "Center", "Snap transformation center onto target"},
@@ -708,13 +701,6 @@ static void rna_GPencilInterpolateSettings_type_set(PointerRNA *ptr, int value)
}
}
-static void rna_SpaceImageEditor_uv_sculpt_update(Main *bmain,
- Scene *scene,
- PointerRNA *UNUSED(ptr))
-{
- ED_space_image_uv_sculpt_update(bmain, bmain->wm.first, scene);
-}
-
/* Read-only Iterator of all the scene objects. */
static void rna_Scene_objects_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
@@ -2751,13 +2737,6 @@ static void rna_def_tool_settings(BlenderRNA *brna)
RNA_def_property_pointer_sdna(prop, NULL, "particle");
RNA_def_property_ui_text(prop, "Particle Edit", "");
- prop = RNA_def_property(srna, "use_uv_sculpt", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "use_uv_sculpt", 1);
- RNA_def_property_ui_text(prop, "UV Sculpt", "Enable brush for UV sculpting");
- RNA_def_property_ui_icon(prop, ICON_TPAINT_HLT, 0);
- RNA_def_property_update(
- prop, NC_SPACE | ND_SPACE_IMAGE, "rna_SpaceImageEditor_uv_sculpt_update");
-
prop = RNA_def_property(srna, "uv_sculpt_lock_borders", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "uv_sculpt_settings", UV_SCULPT_LOCK_BORDERS);
RNA_def_property_ui_text(prop, "Lock Borders", "Disable editing of boundary edges");
@@ -2766,11 +2745,6 @@ static void rna_def_tool_settings(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "uv_sculpt_settings", UV_SCULPT_ALL_ISLANDS);
RNA_def_property_ui_text(prop, "Sculpt All Islands", "Brush operates on all islands");
- prop = RNA_def_property(srna, "uv_sculpt_tool", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "uv_sculpt_tool");
- RNA_def_property_enum_items(prop, rna_enum_uv_sculpt_tool_items);
- RNA_def_property_ui_text(prop, "UV Sculpt Tools", "Select Tools for the UV sculpt brushes");
-
prop = RNA_def_property(srna, "uv_relax_method", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "uv_relax_method");
RNA_def_property_enum_items(prop, uv_sculpt_relaxation_items);
diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c
index be76a8136c0..2791c49b3d9 100644
--- a/source/blender/makesrna/intern/rna_sculpt_paint.c
+++ b/source/blender/makesrna/intern/rna_sculpt_paint.c
@@ -365,6 +365,12 @@ static bool rna_Brush_mode_with_tool_poll(PointerRNA *ptr, PointerRNA value)
}
mode = OB_MODE_SCULPT;
}
+ else if (paint_contains_brush_slot(&ts->uvsculpt->paint, tslot, &slot_index)) {
+ if (slot_index != brush->uv_sculpt_tool) {
+ return false;
+ }
+ mode = OB_MODE_EDIT;
+ }
else if (paint_contains_brush_slot(&ts->vpaint->paint, tslot, &slot_index)) {
if (slot_index != brush->vertexpaint_tool) {
return false;