diff options
author | Pablo Dobarro <pablodp606@gmail.com> | 2020-06-23 17:10:47 +0300 |
---|---|---|
committer | Pablo Dobarro <pablodp606@gmail.com> | 2020-06-30 18:43:37 +0300 |
commit | 438bd823714a24475962ab89ad38b0d7e36349fe (patch) | |
tree | c8abded5be18609bbad57f561efc01990dc35fdf /source/blender/blenloader/intern | |
parent | 6ac235a6f75b71ec3d37dabc2e86b032e07c868e (diff) |
Sculpt: Pose Brush option to affect loose parts
This option allows posing meshes with different disconnected elements
using the Pose Brush.
This is achieved by doing the following:
- Creating an ID per vertex that stores the connected component of that vertex.
- By using those IDs, one fake topology connection is created per vertex to the nearest vertex in a different ID. The maximum distance to create that connection is determined by the "Max Element Distance" property. These fake connectivity neighbors are used in the Sculpt API functions iterators, so all the algorithms of the Pose Brush can run without modifications as if everything was part of the same mesh.
In order to make this work, the "Connected only" property of the Pose Brush needs to be disabled. This will add an extra performance cost to the Pose Brush and its preview. To achieve optimal results, max element distance should be as low as possible.
Reviewed By: sergey, campbellbarton
Differential Revision: https://developer.blender.org/D7282
Diffstat (limited to 'source/blender/blenloader/intern')
-rw-r--r-- | source/blender/blenloader/intern/versioning_280.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index d5ca47d726c..111ac728cc3 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -1759,6 +1759,14 @@ void do_versions_after_linking_280(Main *bmain, ReportList *UNUSED(reports)) brush->tip_scale_x = 1.0f; } } + + /* Pose Brush with support for loose parts. */ + LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) { + if (brush->sculpt_tool == SCULPT_TOOL_POSE && brush->disconnected_distance_max == 0.0f) { + brush->flag2 |= BRUSH_USE_CONNECTED_ONLY; + brush->disconnected_distance_max = 0.1f; + } + } } } |