simplex-solver 3.0.18__37-abi3-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pysimplex.pyd +0 -0
- simplex_solver-3.0.18.dist-info/METADATA +87 -0
- simplex_solver-3.0.18.dist-info/RECORD +81 -0
- simplex_solver-3.0.18.dist-info/WHEEL +5 -0
- simplex_solver-3.0.18.dist-info/licenses/LICENSE +165 -0
- simplexui/__init__.py +54 -0
- simplexui/channelBox.py +862 -0
- simplexui/comboCheckDialog.py +335 -0
- simplexui/commands/__init__.py +16 -0
- simplexui/commands/alembicCommon.py +1045 -0
- simplexui/commands/applyCorrectives.py +455 -0
- simplexui/commands/buildIceXML.py +443 -0
- simplexui/commands/correctiveInterface.py +271 -0
- simplexui/commands/expandedExport.py +435 -0
- simplexui/commands/hdf5Convert.py +62 -0
- simplexui/commands/mayaCorrectiveInterface.py +164 -0
- simplexui/commands/mesh.py +1086 -0
- simplexui/commands/reorderSimplexPoints.py +103 -0
- simplexui/commands/rigidAlign.py +103 -0
- simplexui/commands/setDelta.xsicompound +60 -0
- simplexui/commands/smpxBlend.py +634 -0
- simplexui/commands/unsubdivide.py +1232 -0
- simplexui/commands/uvTransfer.py +986 -0
- simplexui/commands/xsiCorrectiveInterface.py +136 -0
- simplexui/dragFilter.py +299 -0
- simplexui/falloffDialog.py +476 -0
- simplexui/img/ChefHead.png +0 -0
- simplexui/img/frozen.png +0 -0
- simplexui/interface/__init__.py +30 -0
- simplexui/interface/dummyInterface.py +1564 -0
- simplexui/interface/mayaInterface.py +3197 -0
- simplexui/interface/xsiInterface.py +2944 -0
- simplexui/interfaceModel.py +1040 -0
- simplexui/interfaceModelTrees.py +439 -0
- simplexui/interfaceModel_Test.py +259 -0
- simplexui/items/__init__.py +26 -0
- simplexui/items/accessor.py +217 -0
- simplexui/items/combo.py +855 -0
- simplexui/items/falloff.py +780 -0
- simplexui/items/group.py +295 -0
- simplexui/items/progression.py +745 -0
- simplexui/items/shape.py +444 -0
- simplexui/items/simplex.py +1747 -0
- simplexui/items/slider.py +741 -0
- simplexui/items/stack.py +156 -0
- simplexui/items/traversal.py +969 -0
- simplexui/main.pyw +22 -0
- simplexui/menu/__init__.py +73 -0
- simplexui/menu/dummyPlugins/__init__.py +16 -0
- simplexui/menu/genericPlugins/__init__.py +16 -0
- simplexui/menu/genericPlugins/_builtins.py +260 -0
- simplexui/menu/genericPlugins/checkPossibleCombos.py +47 -0
- simplexui/menu/genericPlugins/exportSplit.py +61 -0
- simplexui/menu/genericPlugins/showFalloffs.py +24 -0
- simplexui/menu/genericPlugins/showTraversals.py +24 -0
- simplexui/menu/genericPlugins/simplexUvTransfer.py +109 -0
- simplexui/menu/genericPlugins/unsubdivide.py +71 -0
- simplexui/menu/mayaPlugins/__init__.py +16 -0
- simplexui/menu/mayaPlugins/exportOther.py +45 -0
- simplexui/menu/mayaPlugins/extractProgressives.py +67 -0
- simplexui/menu/mayaPlugins/freezeCombo.py +251 -0
- simplexui/menu/mayaPlugins/generateShapeIncrementals.py +100 -0
- simplexui/menu/mayaPlugins/importObjs.py +196 -0
- simplexui/menu/mayaPlugins/linearizeTraversal.py +49 -0
- simplexui/menu/mayaPlugins/makeShelfBtn.py +69 -0
- simplexui/menu/mayaPlugins/relaxToSelection.py +77 -0
- simplexui/menu/mayaPlugins/reloadDefinition.py +34 -0
- simplexui/menu/mayaPlugins/snapToNeutral.py +74 -0
- simplexui/menu/mayaPlugins/softSelectToCluster.py +204 -0
- simplexui/menu/mayaPlugins/tweakMix.py +138 -0
- simplexui/menu/mayaPlugins/updateRestShape.py +107 -0
- simplexui/menu/xsiPlugins/__init__.py +16 -0
- simplexui/simplexDialog.py +1391 -0
- simplexui/travCheckDialog.py +393 -0
- simplexui/traversalDialog.py +277 -0
- simplexui/ui/comboCheckDialog.ui +475 -0
- simplexui/ui/falloffDialog.ui +243 -0
- simplexui/ui/simplexDialog.ui +1458 -0
- simplexui/ui/travCheckDialog.ui +488 -0
- simplexui/ui/traversalDialog.ui +532 -0
- simplexui/utils.py +320 -0
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
from __future__ import absolute_import
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
from functools import partial
|
|
5
|
+
|
|
6
|
+
import maya.cmds as cmds
|
|
7
|
+
import six
|
|
8
|
+
|
|
9
|
+
from ...items import Combo, Slider, Traversal
|
|
10
|
+
from Qt.QtWidgets import (
|
|
11
|
+
QAction,
|
|
12
|
+
QApplication,
|
|
13
|
+
QFileDialog,
|
|
14
|
+
QMessageBox,
|
|
15
|
+
QProgressDialog,
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
try:
|
|
19
|
+
import numpy as np
|
|
20
|
+
except ImportError:
|
|
21
|
+
np = None
|
|
22
|
+
|
|
23
|
+
try:
|
|
24
|
+
from MeshCrawler.commands import setAllVerts
|
|
25
|
+
from MeshCrawler.mesh import Mesh
|
|
26
|
+
from MeshCrawler.meshcrawlerGen import autoCrawlMeshes
|
|
27
|
+
except ImportError:
|
|
28
|
+
autoCrawlMeshes = None
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def buildMesh(simplex, mesh):
|
|
32
|
+
topo = simplex.DCC.getMeshTopology(mesh)
|
|
33
|
+
faceIdxs, counts = topo[1], topo[2]
|
|
34
|
+
faces = []
|
|
35
|
+
ptr = 0
|
|
36
|
+
for c in counts:
|
|
37
|
+
faces.append(tuple(faceIdxs[ptr : ptr + c]))
|
|
38
|
+
ptr += c
|
|
39
|
+
return Mesh(topo[0], tuple(faces))
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def importSimpleObjs(simplex, orders, pBar):
|
|
43
|
+
for shapeName, ctrl, shape, path in orders:
|
|
44
|
+
pBar.setValue(pBar.value() + 1)
|
|
45
|
+
pBar.setLabelText("Loading Obj :\n{0}".format(shapeName))
|
|
46
|
+
QApplication.processEvents()
|
|
47
|
+
if pBar.wasCanceled():
|
|
48
|
+
return
|
|
49
|
+
|
|
50
|
+
mesh = simplex.DCC.importObj(path)
|
|
51
|
+
|
|
52
|
+
if isinstance(ctrl, Slider):
|
|
53
|
+
simplex.DCC.connectShape(shape, mesh=mesh, live=False, delete=True)
|
|
54
|
+
elif isinstance(ctrl, Combo):
|
|
55
|
+
simplex.DCC.connectComboShape(
|
|
56
|
+
ctrl, shape, mesh=mesh, live=False, delete=True
|
|
57
|
+
)
|
|
58
|
+
elif isinstance(ctrl, Traversal):
|
|
59
|
+
simplex.DCC.connectTraversalShape(
|
|
60
|
+
ctrl, shape, mesh=mesh, live=False, delete=True
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def importReorderObjs(simplex, orders, pBar):
|
|
65
|
+
reoMesh = simplex.DCC.extractShape(simplex.restShape, live=False)
|
|
66
|
+
orderMesh = buildMesh(simplex, reoMesh)
|
|
67
|
+
|
|
68
|
+
memo = {}
|
|
69
|
+
|
|
70
|
+
for shapeName, ctrl, shape, path in orders:
|
|
71
|
+
pBar.setValue(pBar.value() + 1)
|
|
72
|
+
pBar.setLabelText("Loading Obj :\n{0}".format(shapeName))
|
|
73
|
+
QApplication.processEvents()
|
|
74
|
+
if pBar.wasCanceled():
|
|
75
|
+
return
|
|
76
|
+
|
|
77
|
+
impMesh = simplex.DCC.importObj(path)
|
|
78
|
+
objMesh = buildMesh(simplex, impMesh)
|
|
79
|
+
reo = memo.setdefault(
|
|
80
|
+
objMesh.faceVertArray, autoCrawlMeshes(orderMesh, objMesh)
|
|
81
|
+
)
|
|
82
|
+
verts = simplex.DCC.getNumpyShape(impMesh)
|
|
83
|
+
|
|
84
|
+
setAllVerts(reoMesh, verts[reo])
|
|
85
|
+
|
|
86
|
+
if isinstance(ctrl, Slider):
|
|
87
|
+
simplex.DCC.connectShape(shape, mesh=reoMesh, live=False, delete=False)
|
|
88
|
+
elif isinstance(ctrl, Combo):
|
|
89
|
+
simplex.DCC.connectComboShape(
|
|
90
|
+
ctrl, shape, mesh=reoMesh, live=False, delete=False
|
|
91
|
+
)
|
|
92
|
+
elif isinstance(ctrl, Traversal):
|
|
93
|
+
simplex.DCC.connectTraversalShape(
|
|
94
|
+
ctrl, shape, mesh=reoMesh, live=False, delete=False
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
cmds.delete(reoMesh)
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def importObjList(simplex, paths, pBar, reorder=True):
|
|
101
|
+
"""Import all given .obj files
|
|
102
|
+
|
|
103
|
+
Parameters
|
|
104
|
+
----------
|
|
105
|
+
paths : list
|
|
106
|
+
The list of .obj files to import
|
|
107
|
+
"""
|
|
108
|
+
shapeDict = {shape.name: shape for shape in simplex.shapes}
|
|
109
|
+
|
|
110
|
+
inPairs = {}
|
|
111
|
+
for path in paths:
|
|
112
|
+
shapeName = os.path.splitext(os.path.basename(path))[0]
|
|
113
|
+
shape = shapeDict.get(shapeName)
|
|
114
|
+
if shape is not None:
|
|
115
|
+
inPairs[shapeName] = path
|
|
116
|
+
else:
|
|
117
|
+
sfx = "_Extract"
|
|
118
|
+
if shapeName.endswith(sfx):
|
|
119
|
+
shapeName = shapeName[: -len(sfx)]
|
|
120
|
+
shape = shapeDict.get(shapeName)
|
|
121
|
+
if shape is not None:
|
|
122
|
+
inPairs[shapeName] = path
|
|
123
|
+
|
|
124
|
+
sliderMasters, comboMasters, travMasters = {}, {}, {}
|
|
125
|
+
for masters in [simplex.sliders, simplex.combos, simplex.traversals]:
|
|
126
|
+
for master in masters:
|
|
127
|
+
for pp in master.prog.pairs:
|
|
128
|
+
shape = shapeDict.get(pp.shape.name)
|
|
129
|
+
if shape is not None:
|
|
130
|
+
if shape.name in inPairs:
|
|
131
|
+
if isinstance(master, Slider):
|
|
132
|
+
sliderMasters[shape.name] = master
|
|
133
|
+
elif isinstance(master, Combo):
|
|
134
|
+
comboMasters[shape.name] = master
|
|
135
|
+
elif isinstance(master, Traversal):
|
|
136
|
+
travMasters[shape.name] = master
|
|
137
|
+
|
|
138
|
+
comboDepth = {}
|
|
139
|
+
for k, v in six.iteritems(comboMasters):
|
|
140
|
+
depth = len(v.pairs)
|
|
141
|
+
comboDepth.setdefault(depth, {})[k] = v
|
|
142
|
+
|
|
143
|
+
importOrder = []
|
|
144
|
+
for shapeName, slider in six.iteritems(sliderMasters):
|
|
145
|
+
importOrder.append(
|
|
146
|
+
(shapeName, slider, shapeDict[shapeName], inPairs[shapeName])
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
for depth in sorted(comboDepth.keys()):
|
|
150
|
+
for shapeName, combo in six.iteritems(comboDepth[depth]):
|
|
151
|
+
importOrder.append(
|
|
152
|
+
(shapeName, combo, shapeDict[shapeName], inPairs[shapeName])
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
for shapeName, trav in six.iteritems(travMasters):
|
|
156
|
+
importOrder.append((shapeName, trav, shapeDict[shapeName], inPairs[shapeName]))
|
|
157
|
+
|
|
158
|
+
if pBar is not None:
|
|
159
|
+
pBar.setMaximum(len(sliderMasters) + len(comboMasters) + len(travMasters))
|
|
160
|
+
|
|
161
|
+
if reorder:
|
|
162
|
+
importReorderObjs(simplex, importOrder, pBar)
|
|
163
|
+
else:
|
|
164
|
+
importSimpleObjs(simplex, importOrder, pBar)
|
|
165
|
+
|
|
166
|
+
pBar.close()
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
def registerTool(window, menu):
|
|
170
|
+
importObjsACT = QAction("Import Obj Folder", window)
|
|
171
|
+
menu.addAction(importObjsACT)
|
|
172
|
+
importObjsACT.triggered.connect(partial(importObjsInterface, window))
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
def importObjsInterface(window):
|
|
176
|
+
reorder = True
|
|
177
|
+
if np is None or autoCrawlMeshes is None:
|
|
178
|
+
reorder = False
|
|
179
|
+
|
|
180
|
+
folder = QFileDialog.getExistingDirectory(window, "Import Obj Folder", "")
|
|
181
|
+
|
|
182
|
+
if not os.path.isdir(folder):
|
|
183
|
+
QMessageBox.warning(window, "Warning", "Folder does not exist")
|
|
184
|
+
return
|
|
185
|
+
|
|
186
|
+
paths = os.listdir(folder)
|
|
187
|
+
paths = [i for i in paths if i.endswith((".obj", ".OBJ"))]
|
|
188
|
+
if not paths:
|
|
189
|
+
QMessageBox.warning(window, "Warning", "Folder does not contain any .obj files")
|
|
190
|
+
return
|
|
191
|
+
paths = [os.path.join(folder, p) for p in paths]
|
|
192
|
+
|
|
193
|
+
pBar = QProgressDialog("Loading from Mesh", "Cancel", 0, 100, window)
|
|
194
|
+
pBar.show()
|
|
195
|
+
|
|
196
|
+
importObjList(window.simplex, paths, pBar=pBar, reorder=reorder)
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Copyright 2016, Blur Studio
|
|
2
|
+
#
|
|
3
|
+
# This file is part of Simplex.
|
|
4
|
+
#
|
|
5
|
+
# Simplex is free software: you can redistribute it and/or modify
|
|
6
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
|
7
|
+
# the Free Software Foundation, either version 3 of the License, or
|
|
8
|
+
# (at your option) any later version.
|
|
9
|
+
#
|
|
10
|
+
# Simplex 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 Simplex. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
|
|
18
|
+
from __future__ import absolute_import
|
|
19
|
+
from functools import partial
|
|
20
|
+
import maya.cmds as cmds
|
|
21
|
+
from Qt.QtWidgets import QAction
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def registerTool(window, menu):
|
|
25
|
+
lineTravACT = QAction("Linearize Traversal", window)
|
|
26
|
+
menu.addAction(lineTravACT)
|
|
27
|
+
lineTravACT.triggered.connect(partial(lineTrav, window))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def lineTrav(window):
|
|
31
|
+
simplex = window.simplex
|
|
32
|
+
travDialog = window.travDialog
|
|
33
|
+
sel = travDialog.uiTraversalTREE.getSelectedIndexes()
|
|
34
|
+
travIdx = sel[0]
|
|
35
|
+
trav = travIdx.model().itemFromIndex(travIdx)
|
|
36
|
+
extracted = window.shapeIndexExtract([travIdx])
|
|
37
|
+
rest = simplex.DCC.extractTraversalShape(trav, simplex.restShape, live=False)
|
|
38
|
+
|
|
39
|
+
end = extracted[-1]
|
|
40
|
+
val = len(extracted)
|
|
41
|
+
for i, mesh in enumerate(extracted[:-1]):
|
|
42
|
+
startDup = cmds.duplicate(rest, name="startDup")[0]
|
|
43
|
+
absBlend = cmds.blendShape(end, startDup)
|
|
44
|
+
cmds.blendShape(absBlend, edit=True, weight=((0, (i + 1.0) / val)))
|
|
45
|
+
|
|
46
|
+
finBlend = cmds.blendShape(startDup, mesh)
|
|
47
|
+
cmds.blendShape(finBlend, edit=True, weight=((0, 1)))
|
|
48
|
+
cmds.delete(startDup)
|
|
49
|
+
cmds.delete(rest)
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Copyright 2016, Blur Studio
|
|
2
|
+
#
|
|
3
|
+
# This file is part of Simplex.
|
|
4
|
+
#
|
|
5
|
+
# Simplex is free software: you can redistribute it and/or modify
|
|
6
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
|
7
|
+
# the Free Software Foundation, either version 3 of the License, or
|
|
8
|
+
# (at your option) any later version.
|
|
9
|
+
#
|
|
10
|
+
# Simplex 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 Simplex. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
|
|
18
|
+
from __future__ import absolute_import
|
|
19
|
+
|
|
20
|
+
import os
|
|
21
|
+
|
|
22
|
+
from Qt.QtWidgets import QAction
|
|
23
|
+
|
|
24
|
+
dn = os.path.dirname
|
|
25
|
+
SHELF_DEV_BUTTON = """
|
|
26
|
+
import os, sys
|
|
27
|
+
|
|
28
|
+
path = r'{0}'
|
|
29
|
+
path = os.path.normcase(os.path.normpath(path))
|
|
30
|
+
if sys.path[0] != path:
|
|
31
|
+
sys.path.insert(0, path)
|
|
32
|
+
|
|
33
|
+
import simplexui
|
|
34
|
+
if simplexui.SIMPLEX_UI is not None:
|
|
35
|
+
try:
|
|
36
|
+
simplexui.SIMPLEX_UI.close()
|
|
37
|
+
except RuntimeError:
|
|
38
|
+
# In case I closed it myself
|
|
39
|
+
pass
|
|
40
|
+
del simplexui
|
|
41
|
+
|
|
42
|
+
for key, value in sys.modules.items():
|
|
43
|
+
try:
|
|
44
|
+
packPath = value.__file__
|
|
45
|
+
except AttributeError:
|
|
46
|
+
continue
|
|
47
|
+
|
|
48
|
+
packPath = os.path.normcase(os.path.normpath(packPath))
|
|
49
|
+
if packPath.startswith(path):
|
|
50
|
+
sys.modules.pop(key)
|
|
51
|
+
|
|
52
|
+
import simplexui
|
|
53
|
+
simplexui.runSimplexUI()
|
|
54
|
+
|
|
55
|
+
sys.path.pop(0)
|
|
56
|
+
""".format(
|
|
57
|
+
dn(dn(dn(dn(__file__))))
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def registerTool(window, menu):
|
|
62
|
+
makeShelfBtnACT = QAction("Make Shelf Button", window)
|
|
63
|
+
menu.addAction(makeShelfBtnACT)
|
|
64
|
+
makeShelfBtnACT.triggered.connect(makeShelfButton)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def makeShelfButton():
|
|
68
|
+
pass
|
|
69
|
+
# TODO: Actually, ya know, Add the button to the shelf
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Copyright 2016, Blur Studio
|
|
2
|
+
#
|
|
3
|
+
# This file is part of Simplex.
|
|
4
|
+
#
|
|
5
|
+
# Simplex is free software: you can redistribute it and/or modify
|
|
6
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
|
7
|
+
# the Free Software Foundation, either version 3 of the License, or
|
|
8
|
+
# (at your option) any later version.
|
|
9
|
+
#
|
|
10
|
+
# Simplex 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 Simplex. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
|
|
18
|
+
from __future__ import absolute_import
|
|
19
|
+
|
|
20
|
+
import maya.cmds as cmds
|
|
21
|
+
|
|
22
|
+
from Qt.QtWidgets import QAction
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def registerTool(window, menu):
|
|
26
|
+
relaxToSelectionACT = QAction("Relax To Selection", window)
|
|
27
|
+
menu.addAction(relaxToSelectionACT)
|
|
28
|
+
relaxToSelectionACT.triggered.connect(relaxToSelectionInterface)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def relaxToSelectionInterface():
|
|
32
|
+
sel = cmds.ls(sl=True)
|
|
33
|
+
if len(sel) >= 2:
|
|
34
|
+
relaxToSelection(sel[0], sel[1])
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def relaxToSelection(source, target):
|
|
38
|
+
"""
|
|
39
|
+
Transfer high-frequency sculpts (like wrinkles) from one shape to another
|
|
40
|
+
|
|
41
|
+
This sets up a delta mush on a detailed mesh (source) before blending to a
|
|
42
|
+
less detailed shape (target). Turning up the deltaMush re-applies the
|
|
43
|
+
high-resolution deltas to that less detailed shape so then blend it back
|
|
44
|
+
into the target
|
|
45
|
+
"""
|
|
46
|
+
sourceDup = cmds.duplicate(source, name="deltaMushMesh")[0]
|
|
47
|
+
targetDup = cmds.duplicate(target, name="targetDup")[0]
|
|
48
|
+
deltaMushRelax = cmds.group(sourceDup, name="deltaMushRelax")
|
|
49
|
+
cmds.hide([sourceDup, targetDup, deltaMushRelax])
|
|
50
|
+
|
|
51
|
+
cmds.addAttr(
|
|
52
|
+
deltaMushRelax,
|
|
53
|
+
longName="smooth_iter",
|
|
54
|
+
attributeType="long",
|
|
55
|
+
minValue=0,
|
|
56
|
+
maxValue=100,
|
|
57
|
+
defaultValue=10,
|
|
58
|
+
)
|
|
59
|
+
smoothIter = "{0}.smooth_iter".format(deltaMushRelax)
|
|
60
|
+
cmds.setAttr(smoothIter, edit=True, keyable=True)
|
|
61
|
+
|
|
62
|
+
blender = cmds.blendShape(targetDup, sourceDup)
|
|
63
|
+
deltaMush = cmds.deltaMush(
|
|
64
|
+
sourceDup,
|
|
65
|
+
smoothingIterations=10,
|
|
66
|
+
smoothingStep=0.5,
|
|
67
|
+
pinBorderVertices=1,
|
|
68
|
+
envelope=1,
|
|
69
|
+
)[0]
|
|
70
|
+
cmds.connectAttr(smoothIter, deltaMush + ".smoothingIterations", force=True)
|
|
71
|
+
|
|
72
|
+
cmds.delete(targetDup)
|
|
73
|
+
finalBlend = cmds.blendShape(sourceDup, target)
|
|
74
|
+
cmds.blendShape(finalBlend, edit=True, weight=((0, 1)))
|
|
75
|
+
cmds.blendShape(blender, edit=True, weight=((0, 1)))
|
|
76
|
+
|
|
77
|
+
cmds.select(deltaMushRelax)
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Copyright 2016, Blur Studio
|
|
2
|
+
#
|
|
3
|
+
# This file is part of Simplex.
|
|
4
|
+
#
|
|
5
|
+
# Simplex is free software: you can redistribute it and/or modify
|
|
6
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
|
7
|
+
# the Free Software Foundation, either version 3 of the License, or
|
|
8
|
+
# (at your option) any later version.
|
|
9
|
+
#
|
|
10
|
+
# Simplex 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 Simplex. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
|
|
18
|
+
from __future__ import absolute_import
|
|
19
|
+
from functools import partial
|
|
20
|
+
from Qt.QtWidgets import QAction
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def registerTool(window, menu):
|
|
24
|
+
reloadDefinitionACT = QAction("Reload Definition", window)
|
|
25
|
+
menu.addAction(reloadDefinitionACT)
|
|
26
|
+
reloadDefinitionACT.triggered.connect(partial(reloadDefinitionInterface, window))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def reloadDefinitionInterface(window):
|
|
30
|
+
reloadDefinition(window.simplex)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def reloadDefinition(simplex):
|
|
34
|
+
simplex.DCC.setSimplexString(simplex.DCC.op, simplex.dump())
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Copyright 2016, Blur Studio
|
|
2
|
+
#
|
|
3
|
+
# This file is part of Simplex.
|
|
4
|
+
#
|
|
5
|
+
# Simplex is free software: you can redistribute it and/or modify
|
|
6
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
|
7
|
+
# the Free Software Foundation, either version 3 of the License, or
|
|
8
|
+
# (at your option) any later version.
|
|
9
|
+
#
|
|
10
|
+
# Simplex 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 Simplex. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
|
|
18
|
+
from __future__ import absolute_import
|
|
19
|
+
|
|
20
|
+
from functools import partial
|
|
21
|
+
|
|
22
|
+
import maya.cmds as cmds
|
|
23
|
+
|
|
24
|
+
from Qt.QtWidgets import QAction
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def registerTool(window, menu):
|
|
28
|
+
snapShapeToNeutralACT = QAction("Snap Shape To Neutral", window)
|
|
29
|
+
menu.addAction(snapShapeToNeutralACT)
|
|
30
|
+
snapShapeToNeutralACT.triggered.connect(
|
|
31
|
+
partial(snapShapeToNeutralInterface, window)
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def snapShapeToNeutralInterface(window):
|
|
36
|
+
sel = cmds.ls(sl=True)
|
|
37
|
+
if len(sel) >= 2:
|
|
38
|
+
snapShapeToNeutral(sel[0], sel[1])
|
|
39
|
+
elif len(sel) == 1:
|
|
40
|
+
rest = window.simplex.extractRestShape()
|
|
41
|
+
snapShapeToNeutral(sel[0], rest)
|
|
42
|
+
cmds.delete(rest)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def snapShapeToNeutral(source, target):
|
|
46
|
+
"""
|
|
47
|
+
Take a mesh, and find the closest location on the target head, and snap to that
|
|
48
|
+
Then set up a blendShape so the artist can "paint" in the snapping behavior
|
|
49
|
+
"""
|
|
50
|
+
# Make a duplicate of the source and snap it to the target
|
|
51
|
+
snapShape = cmds.duplicate(source, name="snp")
|
|
52
|
+
cmds.transferAttributes(
|
|
53
|
+
target,
|
|
54
|
+
snapShape,
|
|
55
|
+
transferPositions=1,
|
|
56
|
+
sampleSpace=1, # 0=World, 1=Local, 3=UV
|
|
57
|
+
searchMethod=0, # 0=Along Normal, 1=Closest Location
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
# Then delete history
|
|
61
|
+
cmds.delete(snapShape, constructionHistory=True)
|
|
62
|
+
cmds.hide(snapShape)
|
|
63
|
+
|
|
64
|
+
# Blend the source to the snappedShape
|
|
65
|
+
bs = cmds.blendShape(snapShape, source)[0]
|
|
66
|
+
cmds.blendShape(bs, edit=True, weight=((0, 1)))
|
|
67
|
+
|
|
68
|
+
# But set the weights back to 0.0 for painting
|
|
69
|
+
numVerts = cmds.polyEvaluate(source, vertex=1)
|
|
70
|
+
setter = "{0}.inputTarget[0].inputTargetGroup[0].targetWeights[0:{1}]".format(
|
|
71
|
+
bs, numVerts - 1
|
|
72
|
+
)
|
|
73
|
+
weights = [0.0] * numVerts
|
|
74
|
+
cmds.setAttr(setter, *weights, size=numVerts)
|