Skip to content

Commit b4caddd

Browse files
Add 'Surface Cluster' tool.
This is based on my original "surfaceCluster.py" script from 2014, but re-written to be more modular and reusable and easier to understand. This new version has a lot of improvements, such as: - A tool to update the soft-selection weights for a surface cluster. - A UI enable/disable opening the paint-weights tool, after creation. - A tool to open the paint-weights tool for the selected surface cluster control node. - The ability to create multiple surface clusters from multiple selected mesh components. GitHub issue #111.
1 parent f5bb313 commit b4caddd

18 files changed

+1411
-22
lines changed

docs/source/mmSolver.tools.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ mmSolver.tools
6565
mmSolver.tools.solver
6666
mmSolver.tools.sortoutlinernodes
6767
mmSolver.tools.subdivideline
68+
mmSolver.tools.surfacecluster
6869
mmSolver.tools.sysinfowindow
6970
mmSolver.tools.togglebundlelock
7071
mmSolver.tools.togglecameradistort
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
=============================
2+
mmSolver.tools.surfacecluster
3+
=============================
4+
5+
.. automodule:: mmSolver.tools.surfacecluster
6+
:members:
7+
:undoc-members:
8+
9+
Tools
10+
+++++
11+
12+
.. automodule:: mmSolver.tools.surfacecluster.tool
13+
:members:
14+
:undoc-members:
15+
16+
Library
17+
+++++++
18+
19+
.. automodule:: mmSolver.tools.surfacecluster.lib
20+
:members:
21+
:undoc-members:
22+
23+
UI - Layout
24+
+++++++++++
25+
26+
.. automodule:: mmSolver.tools.surfacecluster.ui.surfacecluster_layout
27+
:members:
28+
:undoc-members:
29+
30+
UI - Window
31+
+++++++++++
32+
33+
.. automodule:: mmSolver.tools.surfacecluster.ui.surfacecluster_window
34+
:members:
35+
:undoc-members:
36+
37+
Constants
38+
+++++++++
39+
40+
.. automodule:: mmSolver.tools.surfacecluster.constant
41+
:members:
42+
:undoc-members:

docs/source/tools_generaltools.rst

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,124 @@ To run the tool, use this Python command:
276276
.. _rivet.mel:
277277
https://www.highend3d.com/maya/script/rivet-button-for-maya
278278

279+
.. _create-rivet-tool-ref:
280+
281+
Surface Cluster
282+
---------------
283+
284+
A Surface Cluster is a "cluster" deformer that will be riveted to the
285+
surface of a mesh object. All movement of the underlying surface is
286+
inherited by the Surface Cluster, so the cluster "sits on" the
287+
surface, even if the underlying surface is animated/deformed.
288+
289+
Surface Clusters can be very helpful for subtly adjusting the
290+
silhouette of an object, or adding a bulge, especially when the change
291+
needs to be animated.
292+
293+
.. note:: This old `Surface Cluster YouTube Video`_ shows the general
294+
usage of the tool, however the tool has been re-written and
295+
improved with features for editing the deforming weights.
296+
297+
.. _Surface Cluster YouTube Video:
298+
https://youtu.be/7SFP4TgVbEI
299+
300+
Create Single Surface Cluster
301+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
302+
303+
Create a Surface Cluster on the selected Mesh component.
304+
305+
Usage:
306+
307+
1) Select 1 or more components (vertices, edges, faces, etc).
308+
309+
2) Run this tool.
310+
311+
- create a single surface cluster at the average position of all selected
312+
components.
313+
314+
- (Optionally) Use current Soft Selection as default weighting - the
315+
same as the "update_weights_with_soft_selection" tool.
316+
317+
To run the tool, use this Python command:
318+
319+
.. code:: python
320+
321+
import mmSolver.tools.surfacecluster.tool as tool
322+
tool.create_single_surface_cluster()
323+
324+
# Open the UI window change settings before creation.
325+
tool.open_window()
326+
327+
Create Multiple Surface Cluster
328+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
329+
330+
Create multiple surface clusters, one for each component selected.
331+
332+
Usage:
333+
334+
1) Select 1 or more components (vertices, edges, faces, etc).
335+
336+
2) Run this tool.
337+
338+
- For each component, create a surface cluster is created.
339+
340+
To run the tool, use this Python command:
341+
342+
.. code:: python
343+
344+
import mmSolver.tools.surfacecluster.tool as tool
345+
tool.create_multiple_surface_clusters()
346+
347+
# Open the UI window change settings before creation.
348+
tool.open_window()
349+
350+
Update Weights With Soft-Selection
351+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
352+
353+
Update the cluster deformer weights using the current component
354+
soft-selection.
355+
356+
357+
Usage:
358+
1) Enable Soft Selection ('b' hotkey)
359+
360+
2) Select 1 or more components (vertices, edges, faces, etc).
361+
362+
3) Select surface cluster control.
363+
364+
4) Run this tool.
365+
366+
- The weights of the surface cluster are updated with the soft
367+
selection.
368+
369+
To run the tool, use this Python command:
370+
371+
.. code:: python
372+
373+
import mmSolver.tools.surfacecluster.tool as tool
374+
tool.update_weights_with_soft_selection()
375+
376+
Open Surface Cluster Paint Weights
377+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
378+
379+
Open the paint weights tool for the selected surface cluster Control.
380+
381+
Usage:
382+
1) Select a surface cluster control.
383+
384+
2) Run tool.
385+
386+
- The paint weights tool is opened.
387+
388+
3) User paints weights.
389+
390+
To run the tool, use this Python command:
391+
392+
.. code:: python
393+
394+
import mmSolver.tools.surfacecluster.tool as tool
395+
tool.open_paint_weights_tool()
396+
279397
.. _marker-bundle-rename-tool-ref:
280398

281399
Marker Bundle Rename

python/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,11 @@ if (MMSOLVER_BUILD_QT_UI)
189189
${CMAKE_CURRENT_BINARY_DIR}/mmSolver/tools/screenspacerigbake/ui/ui_screenspacerigbake_layout.py
190190
)
191191

192+
compile_qt_ui_to_python_file("surfacecluster"
193+
${CMAKE_CURRENT_SOURCE_DIR}/mmSolver/tools/surfacecluster/ui/surfacecluster_layout.ui
194+
${CMAKE_CURRENT_BINARY_DIR}/mmSolver/tools/surfacecluster/ui/ui_surfacecluster_layout.py
195+
)
196+
192197
# Install generated Python UI files
193198
install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/"
194199
DESTINATION "${MODULE_FULL_NAME}/python"
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Copyright (C) 2023 David Cattermole.
2+
#
3+
# This file is part of mmSolver.
4+
#
5+
# mmSolver is free software: you can redistribute it and/or modify it
6+
# under the terms of the GNU Lesser General Public License as
7+
# published by the Free Software Foundation, either version 3 of the
8+
# License, or (at your option) any later version.
9+
#
10+
# mmSolver is distributed in the hope that it will be useful,
11+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
# GNU Lesser General Public License for more details.
14+
#
15+
# You should have received a copy of the GNU Lesser General Public License
16+
# along with mmSolver. If not, see <https://www.gnu.org/licenses/>.
17+
#
18+
"""
19+
Surface Cluster constants.
20+
"""
21+
22+
WINDOW_TITLE = 'Create Surface Cluster'
23+
24+
CONFIG_CREATE_MODE_KEY = 'mmSolver_surfacecluster_createMode'
25+
CONFIG_OPEN_PAINT_WEIGHTS_KEY = 'mmSolver_surfacecluster_openPaintWeights'
26+
27+
CREATE_MODE_SINGLE_VALUE = 'single_surface_cluster'
28+
CREATE_MODE_MULTIPLE_VALUE = 'multiple_surface_cluster'
29+
CREATE_MODE_VALUES = [
30+
CREATE_MODE_SINGLE_VALUE,
31+
CREATE_MODE_MULTIPLE_VALUE,
32+
]
33+
34+
CREATE_MODE_SINGLE_LABEL = 'Create Single Cluster On Components'
35+
CREATE_MODE_MULTIPLE_LABEL = 'Create Multiple Clusters On Each Component'
36+
CREATE_MODE_LABELS = [
37+
CREATE_MODE_SINGLE_LABEL,
38+
CREATE_MODE_MULTIPLE_LABEL,
39+
]
40+
41+
DEFAULT_CREATE_MODE = CREATE_MODE_SINGLE_VALUE
42+
DEFAULT_OPEN_PAINT_WEIGHTS = True

0 commit comments

Comments
 (0)