Sculpt: Split original normal into original normal and plane
This allows to create different effects with some brushes that use the sculpt plane. Reviewed By: jbakker Differential Revision: https://developer.blender.org/D5818
This commit is contained in:
@@ -649,6 +649,7 @@ class VIEW3D_PT_tools_brush_options(Panel, View3DPaintPanel):
|
||||
if capabilities.has_sculpt_plane:
|
||||
col.prop(brush, "sculpt_plane")
|
||||
col.prop(brush, "use_original_normal")
|
||||
col.prop(brush, "use_original_plane")
|
||||
|
||||
col.prop(brush, "use_frontface", text="Front Faces Only")
|
||||
col.prop(brush, "use_projected")
|
||||
|
||||
@@ -1746,7 +1746,8 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "Brush", "float", "falloff_angle")) {
|
||||
for (Brush *br = bmain->brushes.first; br; br = br->id.next) {
|
||||
br->falloff_angle = DEG2RADF(80);
|
||||
br->flag &= ~(BRUSH_FLAG_UNUSED_1 | BRUSH_FLAG_UNUSED_6 | BRUSH_GRAB_ACTIVE_VERTEX |
|
||||
/* These flags are used for new feautres. They are not related to falloff_angle */
|
||||
br->flag &= ~(BRUSH_FLAG_UNUSED_1 | BRUSH_ORIGINAL_PLANE | BRUSH_GRAB_ACTIVE_VERTEX |
|
||||
BRUSH_SCENE_SPACING | BRUSH_FRONTFACE_FALLOFF);
|
||||
}
|
||||
|
||||
|
||||
@@ -4247,7 +4247,8 @@ static void calc_sculpt_plane(
|
||||
|
||||
if (ss->cache->mirror_symmetry_pass == 0 && ss->cache->radial_symmetry_pass == 0 &&
|
||||
ss->cache->tile_pass == 0 &&
|
||||
(ss->cache->first_time || !(brush->flag & BRUSH_ORIGINAL_NORMAL))) {
|
||||
(ss->cache->first_time || !(brush->flag & BRUSH_ORIGINAL_PLANE) ||
|
||||
!(brush->flag & BRUSH_ORIGINAL_NORMAL))) {
|
||||
switch (brush->sculpt_plane) {
|
||||
case SCULPT_DISP_DIR_VIEW:
|
||||
copy_v3_v3(r_area_no, ss->cache->true_view_normal);
|
||||
@@ -4284,10 +4285,20 @@ static void calc_sculpt_plane(
|
||||
}
|
||||
|
||||
/* for area normal */
|
||||
copy_v3_v3(ss->cache->sculpt_normal, r_area_no);
|
||||
if ((!ss->cache->first_time) && (brush->flag & BRUSH_ORIGINAL_NORMAL)) {
|
||||
copy_v3_v3(r_area_no, ss->cache->sculpt_normal);
|
||||
}
|
||||
else {
|
||||
copy_v3_v3(ss->cache->sculpt_normal, r_area_no);
|
||||
}
|
||||
|
||||
/* for flatten center */
|
||||
copy_v3_v3(ss->cache->last_center, r_area_co);
|
||||
if ((!ss->cache->first_time) && (brush->flag & BRUSH_ORIGINAL_PLANE)) {
|
||||
copy_v3_v3(r_area_co, ss->cache->last_center);
|
||||
}
|
||||
else {
|
||||
copy_v3_v3(ss->cache->last_center, r_area_co);
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* for area normal */
|
||||
|
||||
@@ -406,7 +406,7 @@ typedef enum eBrushFlags {
|
||||
BRUSH_SIZE_PRESSURE = (1 << 3),
|
||||
BRUSH_JITTER_PRESSURE = (1 << 4),
|
||||
BRUSH_SPACING_PRESSURE = (1 << 5),
|
||||
BRUSH_FLAG_UNUSED_6 = (1 << 6), /* cleared */
|
||||
BRUSH_ORIGINAL_PLANE = (1 << 6),
|
||||
BRUSH_GRAB_ACTIVE_VERTEX = (1 << 7),
|
||||
BRUSH_ANCHORED = (1 << 8),
|
||||
BRUSH_DIR_IN = (1 << 9),
|
||||
|
||||
@@ -1978,6 +1978,14 @@ static void rna_def_brush(BlenderRNA *brna)
|
||||
"When locked keep using normal of surface where stroke was initiated");
|
||||
RNA_def_property_update(prop, 0, "rna_Brush_update");
|
||||
|
||||
prop = RNA_def_property(srna, "use_original_plane", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_ORIGINAL_PLANE);
|
||||
RNA_def_property_ui_text(
|
||||
prop,
|
||||
"Original Plane",
|
||||
"When locked keep using the plane origin of surface where stroke was initiated");
|
||||
RNA_def_property_update(prop, 0, "rna_Brush_update");
|
||||
|
||||
prop = RNA_def_property(srna, "use_automasking_topology", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "automasking_flags", BRUSH_AUTOMASKING_TOPOLOGY);
|
||||
RNA_def_property_ui_text(prop,
|
||||
|
||||
Reference in New Issue
Block a user