From 438bd823714a24475962ab89ad38b0d7e36349fe Mon Sep 17 00:00:00 2001 From: Pablo Dobarro Date: Tue, 23 Jun 2020 16:10:47 +0200 Subject: 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 --- source/blender/editors/sculpt_paint/sculpt_intern.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'source/blender/editors/sculpt_paint/sculpt_intern.h') diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h index 6d1315db723..6ca13f5caf2 100644 --- a/source/blender/editors/sculpt_paint/sculpt_intern.h +++ b/source/blender/editors/sculpt_paint/sculpt_intern.h @@ -148,6 +148,15 @@ void SCULPT_active_vertex_normal_get(SculptSession *ss, float normal[3]); bool SCULPT_vertex_is_boundary(SculptSession *ss, const int index); +/* Fake Neighbors */ + +#define FAKE_NEIGHBOR_NONE -1 + +void SCULPT_fake_neighbors_ensure(struct Sculpt *sd, Object *ob, const float max_dist); +void SCULPT_fake_neighbors_enable(Object *ob); +void SCULPT_fake_neighbors_disable(Object *ob); +void SCULPT_fake_neighbors_free(struct Object *ob); + /* Sculpt Visibility API */ void SCULPT_vertex_visible_set(SculptSession *ss, int index, bool visible); -- cgit v1.2.3