[Bf-blender-cvs] [1b6beea2dfa] sculpt-dev: Sculpt: More brush channels stuff

Joseph Eagar noreply at git.blender.org
Sat Sep 25 06:05:06 CEST 2021


Commit: 1b6beea2dfaee42edacacf36e282a9c63355bbfd
Author: Joseph Eagar
Date:   Fri Sep 24 21:04:49 2021 -0700
Branches: sculpt-dev
https://developer.blender.org/rB1b6beea2dfaee42edacacf36e282a9c63355bbfd

Sculpt:  More brush channels stuff

===================================================================

M	source/blender/blenkernel/intern/brush_channel_define.h
M	source/blender/blenkernel/intern/brush_engine_presets.c
M	source/blender/editors/sculpt_paint/sculpt.c
M	source/blender/editors/sculpt_paint/sculpt_intern.h
M	source/blender/makesrna/intern/rna_access_compare_override.c
M	source/blender/makesrna/intern/rna_space.c

===================================================================

diff --git a/source/blender/blenkernel/intern/brush_channel_define.h b/source/blender/blenkernel/intern/brush_channel_define.h
index 748c33993fd..3f239487cd6 100644
--- a/source/blender/blenkernel/intern/brush_channel_define.h
+++ b/source/blender/blenkernel/intern/brush_channel_define.h
@@ -170,7 +170,6 @@ places in rna_engine_codebase are relevent:
      }))
 
 MAKE_FLOAT(normal_weight, "Normal Weight", "", 0.0f, 0.0f, 1.0f)
-MAKE_FLOAT(rake_factor, "Rake Factor",  "How much grab will follow cursor rotation", 0.0f, 0.0f, 10.0f)
 MAKE_FLOAT(weight, "Weight", "", 0.5f, 0.0f, 1.0f)
 MAKE_FLOAT(jitter, "Jitter",  "Jitter the position of the brush while painting", 0.0f, 0.0f, 1.0f)
 MAKE_INT(jitter_absolute, "Absolute Jitter", "", 0, 0.0f, 1000.0f)
@@ -343,6 +342,67 @@ MAKE_ENUM_EX(radius_unit,  "Radius Unit", "Measure brush size relative to the vi
 }), BRUSH_CHANNEL_SHOW_IN_WORKSPACE)
 MAKE_FLOAT(tilt_strength_factor, "Tilt Strength", "How much the tilt of the pen will affect the brush", 0.0f, 0.0f, 1.0f)
 
+MAKE_FLOAT_EX(rake_factor, "Rake", "How much grab will follow cursor rotation", 0.5f, 0.0f, 10.0f, 0.0f, 1.0f, false)
+MAKE_FLOAT(pose_offset, "Pose Origin Offset", "Offset of the pose origin in relation to the brush radius", 0.0f, 0.0f, 2.0f)
+MAKE_FLOAT(disconnected_distance_max, "Max Element Distance",
+                           "Maximum distance to search for disconnected loose parts in the mesh", 0.1f, 0.0f, 10.0f)
+MAKE_INT(pose_smooth_iterations,  "Smooth Iterations",
+      "Smooth iterations applied after calculating the pose factor of each vertex", 4.0f, 0.0f, 100.0f)
+MAKE_INT(pose_ik_segments, "Pose IK Segments",
+      "Number of segments of the inverse kinematics chain that will deform the mesh", 1, 1, 20)
+MAKE_FLOAT(surface_smooth_shape_preservation, "Shape Preservation", "How much of the original shape is preserved when smoothing", 0.5f, 0.0f, 1.0f)
+MAKE_FLOAT(surface_smooth_current_vertex, "Per Vertex Displacement",
+      "How much the position of each individual vertex influences the final result", 0.5f, 0.0f, 1.0f)
+MAKE_INT(surface_smooth_iterations, "Iterations", "Number of smoothing iterations per brush step", 4, 1, 10)
+MAKE_BOOL(use_connected_only,  "Connected Only", "Affect only topologically connected elements", true)
+MAKE_BOOL(use_pose_ik_anchored,  "Keep Anchor Point", "Keep the position of the last segment in the IK chain fixed", true)
+MAKE_BOOL(use_pose_lock_rotation,  "Lock Rotation When Scaling",
+                           "Do not rotate the segment when using the scale deform mode", false)
+MAKE_ENUM(pose_deform_type, "Deformation", "Deformation type that is used in the brush", 0, _({
+  {BRUSH_POSE_DEFORM_ROTATE_TWIST, "ROTATE_TWIST", "NONE", "Rotate/Twist", ""},
+  {BRUSH_POSE_DEFORM_SCALE_TRASLATE, "SCALE_TRANSLATE", "NONE", "Scale/Translate", ""},
+  {BRUSH_POSE_DEFORM_SQUASH_STRETCH, "SQUASH_STRETCH", "NONE", "Squash & Stretch", ""},
+  {BRUSH_POSE_DEFORM_BEND, "BEND", "NONE", "Bend", ""},
+  {-1}
+}))
+MAKE_ENUM(pose_origin_type, "Rotation Origins",
+                           "Method to set the rotation origins for the segments of the brush", 0, _({
+
+  {BRUSH_POSE_ORIGIN_TOPOLOGY,
+    "TOPOLOGY",
+    "NONE",
+    "Topology",
+    "Sets the rotation origin automatically using the topology and shape of the mesh as a "
+    "guide"},
+  {BRUSH_POSE_ORIGIN_FACE_SETS,
+    "FACE_SETS",
+    "NONE",
+    "Face Sets",
+    "Creates a pose segment per face sets, starting from the active face set"},
+  {BRUSH_POSE_ORIGIN_FACE_SETS_FK,
+    "FACE_SETS_FK",
+    "NONE",
+    "Face Sets FK",
+    "Simulates an FK deformation using the Face Set under the cursor as control"},
+  {-1}
+}))
+
+MAKE_FLOAT(crease_pinch_factor, "Crease Brush Pinch Factor", "How much the crease brush pinches", 0.0f, 0.0f, 1.0f)
+
+MAKE_ENUM(snake_hook_deform_type, "Deformation", "Deformation type that is used in the brush", BRUSH_SNAKE_HOOK_DEFORM_FALLOFF, _({
+  {BRUSH_SNAKE_HOOK_DEFORM_FALLOFF,
+    "FALLOFF",
+    "NONE",
+    "Radius Falloff",
+    "Applies the brush falloff in the tip of the brush"},
+  {BRUSH_SNAKE_HOOK_DEFORM_ELASTIC,
+    "ELASTIC",
+    "NONE",
+    "Elastic",
+    "Modifies the entire mesh using elastic deform"},
+  {-1}
+}))
+
 /* clang-format on */
 #if defined(BRUSH_CHANNEL_DEFINE_TYPES) || defined(BRUSH_CHANNEL_DEFINE_EXTERNAL)
 #  ifdef MAKE_FLOAT
diff --git a/source/blender/blenkernel/intern/brush_engine_presets.c b/source/blender/blenkernel/intern/brush_engine_presets.c
index 6e59537b003..0ec6b79b2f4 100644
--- a/source/blender/blenkernel/intern/brush_engine_presets.c
+++ b/source/blender/blenkernel/intern/brush_engine_presets.c
@@ -292,6 +292,18 @@ static BrushSettingsMap brush_settings_map[] = {
   DEF(boundary_falloff_type, boundary_falloff_type, INT, INT)
   DEF(deform_target, deform_target, INT, INT)
   DEF(tilt_strength_factor, tilt_strength_factor, FLOAT, FLOAT)
+  DEF(crease_pinch_factor, crease_pinch_factor, FLOAT, FLOAT)
+  DEF(pose_offset, pose_offset, FLOAT, FLOAT)
+  DEF(disconnected_distance_max, disconnected_distance_max, FLOAT, FLOAT)
+  DEF(surface_smooth_shape_preservation, surface_smooth_shape_preservation, FLOAT, FLOAT)
+  DEF(pose_smooth_iterations, pose_smooth_iterations, INT, INT)
+  DEF(pose_ik_segments, pose_ik_segments, INT, INT)
+  DEF(surface_smooth_shape_preservation, surface_smooth_shape_preservation, FLOAT, FLOAT)
+  DEF(surface_smooth_current_vertex, surface_smooth_current_vertex, FLOAT, FLOAT)
+  DEF(surface_smooth_iterations, surface_smooth_iterations, INT, INT)
+  DEF(pose_deform_type, pose_deform_type, INT, INT)
+  DEF(pose_origin_type, pose_origin_type, INT, INT)
+  DEF(snake_hook_deform_type, snake_hook_deform_type, INT, INT)
 };
 
 static const int brush_settings_map_len = ARRAY_SIZE(brush_settings_map);
@@ -352,6 +364,9 @@ BrushFlagMap brush_flags_map[] =  {
   DEF(flag2, cloth_use_collision, BRUSH_CLOTH_USE_COLLISION)
   DEF(flag2, cloth_pin_simulation_boundary, BRUSH_CLOTH_PIN_SIMULATION_BOUNDARY)
   DEF(flag,  radius_unit, BRUSH_LOCK_SIZE)
+  DEF(flag2, use_pose_ik_anchored, BRUSH_POSE_IK_ANCHORED)
+  DEF(flag2, use_connected_only, BRUSH_USE_CONNECTED_ONLY)
+  DEF(flag2, use_pose_lock_rotation, BRUSH_POSE_USE_LOCK_ROTATION)
 };
 
 int brush_flags_map_len = ARRAY_SIZE(brush_flags_map);
@@ -733,6 +748,10 @@ void BKE_brush_builtin_patch(Brush *brush, int tool)
   ADDCH(autosmooth_projection);
   ADDCH(autosmooth_falloff_curve);
 
+  ADDCH(surface_smooth_shape_preservation);
+  ADDCH(surface_smooth_current_vertex);
+  ADDCH(surface_smooth_iterations);
+
   ADDCH(vcol_boundary_exponent);
   ADDCH(vcol_boundary_factor);
   ADDCH(vcol_boundary_radius_scale);
@@ -813,6 +832,11 @@ void BKE_brush_builtin_patch(Brush *brush, int tool)
       ADDCH(cloth_use_collision);
       ADDCH(cloth_pin_simulation_boundary);
 
+      break;
+    case SCULPT_TOOL_SNAKE_HOOK:
+      ADDCH(crease_pinch_factor);
+      ADDCH(rake_factor);
+      ADDCH(snake_hook_deform_type);
       break;
     case SCULPT_TOOL_BOUNDARY:
       ADDCH(boundary_offset);
@@ -820,8 +844,21 @@ void BKE_brush_builtin_patch(Brush *brush, int tool)
       ADDCH(boundary_falloff_type);
       ADDCH(deform_target);
       break;
+    case SCULPT_TOOL_CREASE:
+      ADDCH(crease_pinch_factor);
+      break;
     case SCULPT_TOOL_POSE:
       ADDCH(deform_target);
+      ADDCH(disconnected_distance_max);
+      ADDCH(surface_smooth_shape_preservation);
+      ADDCH(pose_smooth_iterations);
+      ADDCH(pose_ik_segments);
+      ADDCH(use_pose_ik_anchored);
+      ADDCH(use_connected_only);
+      ADDCH(use_pose_lock_rotation);
+      ADDCH(pose_deform_type);
+      ADDCH(pose_origin_type);
+
       break;
   }
 
@@ -866,7 +903,25 @@ void BKE_brush_channelset_ui_init(Brush *brush, int tool)
   SHOWALL(strength);
   SHOWALL(color);
   SHOWALL(secondary_color);
-  SHOWALL(accumulate);
+
+  if (!ELEM(tool,
+            SCULPT_TOOL_SNAKE_HOOK,
+            SCULPT_TOOL_ARRAY,
+            SCULPT_TOOL_BOUNDARY,
+            SCULPT_TOOL_POSE,
+            SCULPT_TOOL_ROTATE,
+            SCULPT_TOOL_SCENE_PROJECT,
+            SCULPT_TOOL_SLIDE_RELAX,
+            SCULPT_TOOL_CLOTH,
+            SCULPT_TOOL_ELASTIC_DEFORM,
+            SCULPT_TOOL_FAIRING,
+            SCULPT_TOOL_DRAW_FACE_SETS,
+            SCULPT_TOOL_SMOOTH,
+            SCULPT_TOOL_SIMPLIFY)) {
+
+    SHOWALL(accumulate);
+  }
+  SHOWWRK(direction);
 
   SHOWWRK(radius_unit);
   SHOWWRK(use_frontface);
@@ -877,6 +932,11 @@ void BKE_brush_channelset_ui_init(Brush *brush, int tool)
   SHOWWRK(hardness);
 
   switch (tool) {
+    case SCULPT_TOOL_SMOOTH:
+      SHOWWRK(surface_smooth_shape_preservation);
+      SHOWWRK(surface_smooth_current_vertex);
+      SHOWWRK(surface_smooth_iterations);
+      break;
     case SCULPT_TOOL_SCRAPE:
     case SCULPT_TOOL_FILL:
       SHOWWRK(plane_offset);
@@ -917,6 +977,26 @@ void BKE_brush_channelset_ui_init(Brush *brush, int tool)
       SHOWWRK(boundary_deform_type);
       SHOWWRK(boundary_falloff_type);
 
+      break;
+    case SCULPT_TOOL_CREASE:
+      SHOWWRK(crease_pinch_factor);
+      break;
+    case SCULPT_TOOL_SNAKE_HOOK:
+      SHOWWRK(crease_pinch_factor);
+      SHOWWRK(rake_factor);
+      SHOWWRK(snake_hook_deform_type);
+      break;
+    case SCULPT_TOOL_POSE:
+      SHOWWRK(pose_ik_segments);
+      SHOWWRK(pose_smooth_iterations);
+      SHOWWRK(disconnected_distance_max);
+      SHOWWRK(pose_offset);
+      SHOWWRK(use_connected_only);
+      SHOWWRK(use_pose_ik_anchored);
+      SHOWWRK(use_pose_lock_rotation);
+      SHOWWRK(pose_deform_type);
+      SHOWWRK(pose_origin_type);
+
       break;
   }
 
@@ -963,9 +1043,12 @@ void BKE_brush_builtin_create(Brush *brush, int tool)
       break;
     }
     case SCULPT_TOOL_DRAW_SHARP:
-      GETCH(spacing)->ivalue = 5;
-      GETCH(radius)->mappings[BRUSH_MAPPING_PRESSURE].flag |= BRUSH_MAPPING_ENABLED;
-      GETCH(strength)->mappings[BRUSH_MAPPING_PRESSURE].flag &= ~BRUSH_MAPPING_ENABLED;
+      BRUSHSET_LOOKUP(chset, spacing)->ivalue = 5;
+      BRUSHSET_SET_INT(chset, direction, 1);
+      BRUSHSET_LOOKUP(chset, radius)->mappings[BRUSH_MAPPING_PRESSURE].flag |=
+          BRUSH_MAPPING_ENABLED;
+      BRUSHSET_LOOKUP(chset, strength)->m

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list