[Bf-blender-cvs] [e973c94036e] sculpt-dev: Sculpt Expand: Add Expand to the keymap by default
Pablo Dobarro
noreply at git.blender.org
Wed Feb 3 01:26:42 CET 2021
Commit: e973c94036e1a9e69f3b46c9c8d45d9915bac005
Author: Pablo Dobarro
Date: Wed Feb 3 01:12:11 2021 +0100
Branches: sculpt-dev
https://developer.blender.org/rBe973c94036e1a9e69f3b46c9c8d45d9915bac005
Sculpt Expand: Add Expand to the keymap by default
===================================================================
M release/scripts/presets/keyconfig/keymap_data/blender_default.py
M source/blender/editors/sculpt_paint/sculpt_expand.c
M source/blender/editors/sculpt_paint/sculpt_intern.h
===================================================================
diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index 3590deb8188..d39740fd816 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -4477,8 +4477,9 @@ def km_sculpt(params):
{"properties": [("mode", 'HIDE_ACTIVE')]}),
("sculpt.face_set_change_visibility", {"type": 'H', "value": 'PRESS', "alt": True},
{"properties": [("mode", 'SHOW_ALL')]}),
- ("sculpt.mask_expand", {"type": 'W', "value": 'PRESS', "shift": True},
- {"properties": [("use_normals", False), ("keep_previous_mask", False), ("invert", False), ("smooth_iterations", 0), ("create_face_set", True)]}),
+
+ ## ("sculpt.mask_expand", {"type": 'W', "value": 'PRESS', "shift": True},
+ ## {"properties": [("use_normals", False), ("keep_previous_mask", False), ("invert", False), ("smooth_iterations", 0), ("create_face_set", True)]}),
("sculpt.face_set_edit", {"type": 'W', "value": 'PRESS', "ctrl": True},
{"properties": [("mode", 'GROW')]}),
("sculpt.face_set_edit", {"type": 'W', "value": 'PRESS', "ctrl": True, "alt": True},
@@ -4499,10 +4500,16 @@ def km_sculpt(params):
("paint.mask_lasso_gesture", {"type": 'LEFTMOUSE', "value": 'PRESS', "shift": True, "ctrl": True}, None),
("wm.context_toggle", {"type": 'M', "value": 'PRESS', "ctrl": True},
{"properties": [("data_path", 'scene.tool_settings.sculpt.show_mask')]}),
- ("sculpt.mask_expand", {"type": 'A', "value": 'PRESS', "shift": True},
- {"properties": [("use_normals", False), ("keep_previous_mask", False), ("invert", True), ("smooth_iterations", 2), ("create_face_set", False)]}),
- ("sculpt.mask_expand", {"type": 'A', "value": 'PRESS', "shift": True, 'alt': True},
- {"properties": [("use_normals", True), ("keep_previous_mask", True), ("invert", False), ("smooth_iterations", 0), ("create_face_set", False)]}),
+ ## ("sculpt.mask_expand", {"type": 'A', "value": 'PRESS', "shift": True},
+ ## {"properties": [("use_normals", False), ("keep_previous_mask", False), ("invert", True), ("smooth_iterations", 2), ("create_face_set", False)]}),
+ ##("sculpt.mask_expand", {"type": 'A', "value": 'PRESS', "shift": True, 'alt': True},
+ ## {"properties": [("use_normals", True), ("keep_previous_mask", True), ("invert", False), ("smooth_iterations", 0), ("create_face_set", False)]}),
+ ("sculpt.expand", {"type": 'A', "value": 'PRESS', "shift": True},
+ {"properties": [("target", "MASK"), ("falloff_type", "GEODESIC"), ("invert", True)]}),
+ ("sculpt.expand", {"type": 'W', "value": 'PRESS', "shift": True},
+ {"properties": [("target", "FACE_SETS"), ("falloff_type", "GEODESIC"), ("invert", False), ("use_modify_active", False)]}),
+ ("sculpt.expand", {"type": 'W', "value": 'PRESS', "shift": True, "alt": True},
+ {"properties": [("target", "FACE_SETS"), ("falloff_type", "BOUNDARY_FACE_SET"),("invert", False), ("use_modify_active", True)]}),
# Dynamic topology
("sculpt.dynamic_topology_toggle", {"type": 'D', "value": 'PRESS', "ctrl": True}, None),
("sculpt.dyntopo_detail_size_edit", {"type": 'D', "value": 'PRESS', "shift": True}, None),
diff --git a/source/blender/editors/sculpt_paint/sculpt_expand.c b/source/blender/editors/sculpt_paint/sculpt_expand.c
index 461dacecb6e..2efc8944dff 100644
--- a/source/blender/editors/sculpt_paint/sculpt_expand.c
+++ b/source/blender/editors/sculpt_paint/sculpt_expand.c
@@ -85,7 +85,7 @@ enum {
SCULPT_EXPAND_MODAL_RECURSION_STEP_GEODESIC,
SCULPT_EXPAND_MODAL_RECURSION_STEP_TOPOLOGY,
SCULPT_EXPAND_MODAL_MOVE_TOGGLE,
- SCULPT_EXPAND_MODAL_FALLOFF_GEODESICS,
+ SCULPT_EXPAND_MODAL_FALLOFF_GEODESIC,
SCULPT_EXPAND_MODAL_FALLOFF_TOPOLOGY,
SCULPT_EXPAND_MODAL_FALLOFF_TOPOLOGY_DIAGONALS,
SCULPT_EXPAND_MODAL_FALLOFF_SPHERICAL,
@@ -96,7 +96,7 @@ enum {
};
static EnumPropertyItem prop_sculpt_expand_falloff_type_items[] = {
- {SCULPT_EXPAND_FALLOFF_GEODESICS, "GEODESICS", 0, "Surface", ""},
+ {SCULPT_EXPAND_FALLOFF_GEODESIC, "GEODESIC", 0, "Geodesic", ""},
{SCULPT_EXPAND_FALLOFF_TOPOLOGY, "TOPOLOGY", 0, "Topology", ""},
{SCULPT_EXPAND_FALLOFF_TOPOLOGY_DIAGONALS, "TOPOLOGY_DIAGONALS", 0, "Topology Diagonals", ""},
{SCULPT_EXPAND_FALLOFF_NORMALS, "NORMALS", 0, "Normals", ""},
@@ -610,8 +610,9 @@ static void sculpt_expand_topology_from_state_boundary(Object *ob,
ExpandFloodFillData fdata;
fdata.dists = dists;
SCULPT_floodfill_execute(ss, &flood, mask_expand_topology_floodfill_cb, &fdata);
- expand_cache->falloff_factor = dists;
SCULPT_floodfill_free(&flood);
+
+ expand_cache->falloff_factor = dists;
}
static void sculpt_expand_initialize_from_face_set_boundary(Object *ob,
@@ -633,11 +634,13 @@ static void sculpt_expand_initialize_from_face_set_boundary(Object *ob,
BLI_BITMAP_ENABLE(enabled_vertices, i);
}
+ sculpt_expand_geodesics_from_state_boundary(ob, expand_cache, enabled_vertices);
+
MEM_freeN(enabled_vertices);
if (internal_falloff) {
for (int i = 0; i < totvert; i++) {
- if (!SCULPT_vertex_has_face_set(ss, i, active_face_set)) {
+ if (!(SCULPT_vertex_has_face_set(ss, i, active_face_set) && SCULPT_vertex_has_unique_face_set(ss, i))) {
continue;
}
expand_cache->falloff_factor[i] *= -1.0f;
@@ -712,7 +715,7 @@ static void sculpt_expand_falloff_factors_from_vertex_and_symm_create(
MEM_SAFE_FREE(expand_cache->falloff_factor);
switch (falloff_type) {
- case SCULPT_EXPAND_FALLOFF_GEODESICS:
+ case SCULPT_EXPAND_FALLOFF_GEODESIC:
expand_cache->falloff_factor = sculpt_expand_geodesic_falloff_create(sd, ob, vertex);
break;
case SCULPT_EXPAND_FALLOFF_TOPOLOGY:
@@ -1336,13 +1339,13 @@ static int sculpt_expand_modal(bContext *C, wmOperator *op, const wmEvent *event
sculpt_expand_finish(C);
return OPERATOR_FINISHED;
}
- case SCULPT_EXPAND_MODAL_FALLOFF_GEODESICS: {
+ case SCULPT_EXPAND_MODAL_FALLOFF_GEODESIC: {
sculpt_expand_falloff_factors_from_vertex_and_symm_create(
expand_cache,
sd,
ob,
expand_cache->initial_active_vertex,
- SCULPT_EXPAND_FALLOFF_GEODESICS);
+ SCULPT_EXPAND_FALLOFF_GEODESIC);
break;
}
case SCULPT_EXPAND_MODAL_FALLOFF_TOPOLOGY: {
@@ -1550,7 +1553,7 @@ static int sculpt_expand_invoke(bContext *C, wmOperator *op, const wmEvent *even
}
/* Initialize the factors. */
- eSculptExpandFalloffType falloff_type = SCULPT_EXPAND_FALLOFF_GEODESICS;
+ eSculptExpandFalloffType falloff_type = RNA_enum_get(op->ptr, "falloff_type");
if (SCULPT_vertex_is_boundary(ss, ss->expand_cache->initial_active_vertex)) {
falloff_type = SCULPT_EXPAND_FALLOFF_BOUNDARY_TOPOLOGY;
}
@@ -1584,7 +1587,7 @@ void sculpt_expand_modal_keymap(wmKeyConfig *keyconf)
"Topology recursion Step",
""},
{SCULPT_EXPAND_MODAL_MOVE_TOGGLE, "MOVE_TOGGLE", 0, "Move the origin of the expand", ""},
- {SCULPT_EXPAND_MODAL_FALLOFF_GEODESICS,
+ {SCULPT_EXPAND_MODAL_FALLOFF_GEODESIC,
"FALLOFF_GEODESICS",
0,
"Geodesic Falloff",
@@ -1657,13 +1660,20 @@ void SCULPT_OT_expand(wmOperatorType *ot)
"Data Target",
"Data that is going to be modified in the expand operation");
+ RNA_def_enum(ot->srna,
+ "falloff_type",
+ prop_sculpt_expand_falloff_type_items,
+ SCULPT_EXPAND_FALLOFF_GEODESIC,
+ "Fallof Type",
+ "Initial falloff of the expand operation");
+
ot->prop = RNA_def_boolean(
ot->srna, "invert", false, "Invert", "Invert the expand active elements");
ot->prop = RNA_def_boolean(ot->srna,
"use_mask_preserve",
false,
- "Preserve Previous Mask",
- "Preserve the previous mask");
+ "Preserve Previous",
+ "Preserve the previous state of the target data");
ot->prop = RNA_def_boolean(
ot->srna, "use_falloff_gradient", false, "Falloff Gradient", "Expand Using a Falloff");
diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h
index 32a4e7b1773..ade5ccb3907 100644
--- a/source/blender/editors/sculpt_paint/sculpt_intern.h
+++ b/source/blender/editors/sculpt_paint/sculpt_intern.h
@@ -1152,7 +1152,7 @@ typedef struct SculptGradientContext {
} SculptGradientContext;
typedef enum eSculptExpandFalloffType {
- SCULPT_EXPAND_FALLOFF_GEODESICS,
+ SCULPT_EXPAND_FALLOFF_GEODESIC,
SCULPT_EXPAND_FALLOFF_TOPOLOGY,
SCULPT_EXPAND_FALLOFF_TOPOLOGY_DIAGONALS,
SCULPT_EXPAND_FALLOFF_NORMALS,
More information about the Bf-blender-cvs
mailing list