simplex-solver 3.1.0__39-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.
Files changed (79) hide show
  1. simplex_solver-3.1.0.dist-info/METADATA +90 -0
  2. simplex_solver-3.1.0.dist-info/RECORD +79 -0
  3. simplex_solver-3.1.0.dist-info/WHEEL +5 -0
  4. simplexui/__init__.py +53 -0
  5. simplexui/_version.py +1 -0
  6. simplexui/channelBox.py +858 -0
  7. simplexui/comboCheckDialog.py +343 -0
  8. simplexui/commands/__init__.py +16 -0
  9. simplexui/commands/alembicCommon.py +991 -0
  10. simplexui/commands/applyCorrectives.py +451 -0
  11. simplexui/commands/correctiveInterface.py +261 -0
  12. simplexui/commands/expandedExport.py +436 -0
  13. simplexui/commands/hdf5Convert.py +60 -0
  14. simplexui/commands/mayaCorrectiveInterface.py +161 -0
  15. simplexui/commands/mayatonumpy.py +375 -0
  16. simplexui/commands/mesh.py +1081 -0
  17. simplexui/commands/numpytoimath.py +319 -0
  18. simplexui/commands/poseblendlib.py +166 -0
  19. simplexui/commands/reorderSimplexPoints.py +102 -0
  20. simplexui/commands/rigidAlign.py +99 -0
  21. simplexui/commands/smpxBlend.py +629 -0
  22. simplexui/commands/unsubdivide.py +1227 -0
  23. simplexui/commands/uvTransfer.py +977 -0
  24. simplexui/dragFilter.py +299 -0
  25. simplexui/falloffDialog.py +471 -0
  26. simplexui/img/ChefHead.png +0 -0
  27. simplexui/img/frozen.png +0 -0
  28. simplexui/interface/__init__.py +28 -0
  29. simplexui/interface/dummyInterface.py +1585 -0
  30. simplexui/interface/mayaInterface.py +3271 -0
  31. simplexui/interfaceModel.py +1053 -0
  32. simplexui/interfaceModelTrees.py +441 -0
  33. simplexui/items/__init__.py +42 -0
  34. simplexui/items/accessor.py +213 -0
  35. simplexui/items/combo.py +852 -0
  36. simplexui/items/falloff.py +778 -0
  37. simplexui/items/group.py +297 -0
  38. simplexui/items/progression.py +743 -0
  39. simplexui/items/shape.py +443 -0
  40. simplexui/items/simplex.py +1764 -0
  41. simplexui/items/slider.py +738 -0
  42. simplexui/items/stack.py +154 -0
  43. simplexui/items/traversal.py +966 -0
  44. simplexui/main.pyw +22 -0
  45. simplexui/menu/__init__.py +69 -0
  46. simplexui/menu/dummyPlugins/__init__.py +16 -0
  47. simplexui/menu/genericPlugins/__init__.py +16 -0
  48. simplexui/menu/genericPlugins/_builtins.py +268 -0
  49. simplexui/menu/genericPlugins/checkPossibleCombos.py +45 -0
  50. simplexui/menu/genericPlugins/exportSplit.py +59 -0
  51. simplexui/menu/genericPlugins/showFalloffs.py +24 -0
  52. simplexui/menu/genericPlugins/showTraversals.py +24 -0
  53. simplexui/menu/genericPlugins/simplexUvTransfer.py +107 -0
  54. simplexui/menu/genericPlugins/unsubdivide.py +70 -0
  55. simplexui/menu/mayaPlugins/__init__.py +16 -0
  56. simplexui/menu/mayaPlugins/exportOther.py +43 -0
  57. simplexui/menu/mayaPlugins/extractProgressives.py +65 -0
  58. simplexui/menu/mayaPlugins/freezeCombo.py +245 -0
  59. simplexui/menu/mayaPlugins/generateShapeIncrementals.py +97 -0
  60. simplexui/menu/mayaPlugins/importObjs.py +193 -0
  61. simplexui/menu/mayaPlugins/linearizeTraversal.py +48 -0
  62. simplexui/menu/mayaPlugins/makeShelfBtn.py +65 -0
  63. simplexui/menu/mayaPlugins/relaxToSelection.py +75 -0
  64. simplexui/menu/mayaPlugins/reloadDefinition.py +33 -0
  65. simplexui/menu/mayaPlugins/snapToNeutral.py +72 -0
  66. simplexui/menu/mayaPlugins/softSelectToCluster.py +200 -0
  67. simplexui/menu/mayaPlugins/tweakMix.py +134 -0
  68. simplexui/menu/mayaPlugins/updateRestShape.py +105 -0
  69. simplexui/pysimplex.dll.a +0 -0
  70. simplexui/pysimplex.pyd +0 -0
  71. simplexui/simplexDialog.py +1454 -0
  72. simplexui/travCheckDialog.py +397 -0
  73. simplexui/traversalDialog.py +271 -0
  74. simplexui/ui/comboCheckDialog.ui +475 -0
  75. simplexui/ui/falloffDialog.ui +243 -0
  76. simplexui/ui/simplexDialog.ui +1458 -0
  77. simplexui/ui/travCheckDialog.ui +488 -0
  78. simplexui/ui/traversalDialog.ui +532 -0
  79. simplexui/utils.py +320 -0
simplexui/main.pyw ADDED
@@ -0,0 +1,22 @@
1
+ import blurdev
2
+
3
+ if __name__ == "__main__":
4
+ # Ensure that my custom Qt.py import uses PyQt5
5
+ import os
6
+ import json
7
+ pref = json.loads(os.environ.get("QT_PREFERRED_BINDING_JSON", "{}"))
8
+ pref.setdefault("simplexui.Qt", ["PyQt5", "PyQt4"])
9
+ os.environ["QT_PREFERRED_BINDING_JSON"] = json.dumps(pref)
10
+ os.environ["SIMPLEX_AT_BLUR"] = "true"
11
+
12
+ from simplexui.simplexDialog import SimplexDialog
13
+ import simplexui
14
+ dlg = blurdev.launch(SimplexDialog)
15
+ try:
16
+ # Store the last simplex launch in these module variables
17
+ simplexui.SIMPLEX_UI_ROOT = dlg.parent()
18
+ simplexui.SIMPLEX_UI = dlg
19
+ except RuntimeError:
20
+ # If dlg.parent() raises a runtime error, then the ui has already been deleted
21
+ # This happens if we're running externally instead of internally
22
+ pass
@@ -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
+ import importlib
19
+ import os
20
+ import pkgutil
21
+ import sys
22
+
23
+ from Qt.QtWidgets import QMenu
24
+ from . import genericPlugins
25
+
26
+ CONTEXT = os.path.basename(sys.executable)
27
+ if CONTEXT == "maya.exe":
28
+ from . import mayaPlugins as plugins
29
+ else:
30
+ from . import dummyPlugins as plugins
31
+
32
+
33
+ def _iter_namespace(ns_pkg):
34
+ # Specifying the second argument (prefix) to iter_modules makes the
35
+ # returned name an absolute name instead of a relative one. This allows
36
+ # import_module to work without having to do additional modification to
37
+ # the name.
38
+ return pkgutil.iter_modules(ns_pkg.__path__, ns_pkg.__name__ + ".")
39
+
40
+
41
+ # Registration class
42
+ def loadPlugins():
43
+ toolModules = []
44
+ contextModules = []
45
+ imod = sorted([i[1] for i in _iter_namespace(genericPlugins)])
46
+ imod += sorted([i[1] for i in _iter_namespace(plugins)])
47
+
48
+ plugs = [importlib.import_module(name) for name in imod]
49
+ for module in plugs:
50
+ if hasattr(module, "registerTool"):
51
+ toolModules.append(module)
52
+ if hasattr(module, "registerContext"):
53
+ contextModules.append(module)
54
+
55
+ return toolModules, contextModules
56
+
57
+
58
+ def buildToolMenu(window, modules):
59
+ menu = window.menuBar.addMenu("Tools")
60
+ for m in modules:
61
+ m.registerTool(window, menu)
62
+ return menu
63
+
64
+
65
+ def buildRightClickMenu(tree, indexes, modules):
66
+ menu = QMenu()
67
+ for m in modules:
68
+ m.registerContext(tree, indexes, menu)
69
+ return menu
@@ -0,0 +1,16 @@
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/>.
@@ -0,0 +1,16 @@
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/>.
@@ -0,0 +1,268 @@
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
+ # pylint:disable=unused-variable
19
+ from functools import partial
20
+
21
+ from ...items import Combo, ComboPair, ProgPair, Progression, Slider
22
+ from Qt.QtCore import Qt
23
+ from Qt.QtWidgets import QCheckBox, QWidgetAction
24
+
25
+
26
+ def registerContext(tree, clickIdx, indexes, menu):
27
+ self = tree.window()
28
+ if tree == self.uiComboTREE:
29
+ registerComboTree(self, clickIdx, indexes, menu)
30
+ if tree == self.uiSliderTREE:
31
+ registerSliderTree(self, clickIdx, indexes, menu)
32
+
33
+
34
+ def registerSliderTree(window, clickIdx, indexes, menu):
35
+ self = window
36
+ # live = self.uiLiveShapeConnectionACT.isChecked()
37
+ items = [i.model().itemFromIndex(i) for i in indexes]
38
+ types = {}
39
+ for i in items:
40
+ types.setdefault(type(i), []).append(i)
41
+
42
+ activeCount = 0
43
+ for s in self.simplex.sliders:
44
+ if s.value != 0.0:
45
+ activeCount += 1
46
+
47
+ sel = self.simplex.DCC.getSelectedObjects()
48
+
49
+ # anywhere
50
+ addGroupACT = menu.addAction("Add Group")
51
+ addGroupACT.triggered.connect(self.newSliderGroup)
52
+ # anywhere
53
+ if indexes:
54
+ addSliderACT = menu.addAction("Add Slider")
55
+ addSliderACT.triggered.connect(self.newSlider)
56
+ # on/under slider in slider tree
57
+ if ProgPair in types or Slider in types:
58
+ addShapeACT = menu.addAction("Add Shape")
59
+ addShapeACT.triggered.connect(self.newSliderShape)
60
+
61
+ if Slider in types:
62
+ menu.addSeparator()
63
+ setGroupMenu = menu.addMenu("Set Group")
64
+ for group in window.simplex.sliderGroups:
65
+ gAct = setGroupMenu.addAction(group.name)
66
+ gAct.triggered.connect(partial(self.setSelectedSliderGroups, group))
67
+
68
+ setFalloffMenu = menu.addMenu("Set Falloffs")
69
+ sliders = list({i for i in items if isinstance(i, Slider)})
70
+
71
+ foChecks = {}
72
+ interps = set()
73
+ for slider in sliders:
74
+ for fo in slider.prog.falloffs:
75
+ foChecks.setdefault(fo, []).append(slider)
76
+ interps.add(slider.prog.interp.lower())
77
+
78
+ for falloff in window.simplex.falloffs:
79
+ cb = QCheckBox(falloff.name, setFalloffMenu)
80
+ chk = foChecks.get(falloff)
81
+ if not chk:
82
+ cb.setCheckState(Qt.CheckState.Unchecked)
83
+ elif len(chk) != len(sliders):
84
+ cb.setCheckState(Qt.CheckState.PartiallyChecked)
85
+ else:
86
+ cb.setCheckState(Qt.CheckState.Checked)
87
+
88
+ cb.stateChanged.connect(partial(self.setSelectedSliderFalloff, falloff))
89
+
90
+ fAct = QWidgetAction(setFalloffMenu)
91
+ fAct.setDefaultWidget(cb)
92
+ setFalloffMenu.addAction(fAct)
93
+
94
+ setFalloffMenu.addSeparator()
95
+ editFalloffsACT = setFalloffMenu.addAction("Edit Falloffs ...")
96
+ editFalloffsACT.triggered.connect(window.showFalloffDialog)
97
+
98
+ setInterpMenu = menu.addMenu("Set Interpolation")
99
+ for interpName, interpType in Progression.interpTypes:
100
+ act = setInterpMenu.addAction(interpName)
101
+ act.triggered.connect(partial(self.setSelectedSliderInterp, interpType))
102
+ act.setCheckable(True)
103
+ if interpType in interps:
104
+ act.setChecked(True)
105
+
106
+ menu.addSeparator()
107
+
108
+ sep = False
109
+ if activeCount >= 2:
110
+ # if 2 or more are active
111
+ comboActiveACT = menu.addAction("Combo Active")
112
+ comboActiveACT.triggered.connect(self.newActiveCombo)
113
+ sep = True
114
+
115
+ if len(types.get(Slider, [])) >= 2:
116
+ # if 2 or more are selected
117
+ comboSelectedACT = menu.addAction("Combo Selected")
118
+ comboSelectedACT.triggered.connect(self.newSelectedCombo)
119
+ sep = True
120
+
121
+ if sep:
122
+ menu.addSeparator()
123
+
124
+ # anywhere
125
+ if indexes:
126
+ deleteACT = menu.addAction("Delete Selected")
127
+ deleteACT.triggered.connect(self.sliderTreeDelete)
128
+
129
+ menu.addSeparator()
130
+
131
+ if indexes:
132
+ # anywhere
133
+ zeroACT = menu.addAction("Zero Selected")
134
+ zeroACT.triggered.connect(self.zeroSelectedSliders)
135
+ # anywhere
136
+ zeroAllACT = menu.addAction("Zero All")
137
+ zeroAllACT.triggered.connect(self.zeroAllSliders)
138
+
139
+ menu.addSeparator()
140
+
141
+ if ProgPair in types or Slider in types:
142
+ # on shape/slider
143
+ extractShapeACT = menu.addAction("Extract")
144
+ extractShapeACT.triggered.connect(self.shapeExtract)
145
+
146
+ # on shape/slider
147
+ exportShapeACT = menu.addAction("Export Selected ...")
148
+ exportShapeACT.triggered.connect(self.shapeExport)
149
+
150
+ # on shape/slider
151
+ connectShapeACT = menu.addAction("Connect By Name")
152
+ connectShapeACT.triggered.connect(self.shapeConnect)
153
+ if sel:
154
+ # on shape/slider, if there's a selection
155
+ matchShapeACT = menu.addAction("Match To Scene Selection")
156
+ matchShapeACT.triggered.connect(self.shapeMatch)
157
+ # on shape/slider
158
+ clearShapeACT = menu.addAction("Clear")
159
+ clearShapeACT.triggered.connect(self.shapeClear)
160
+
161
+ menu.addSeparator()
162
+
163
+ if indexes:
164
+ # Anywhere
165
+ isolateSelectedACT = menu.addAction("Isolate Selected")
166
+ isolateSelectedACT.triggered.connect(self.sliderIsolateSelected)
167
+
168
+ if self.isSliderIsolate():
169
+ # Anywhere
170
+ exitIsolationACT = menu.addAction("Exit Isolation")
171
+ exitIsolationACT.triggered.connect(self.sliderTreeExitIsolate)
172
+
173
+ menu.addSeparator()
174
+
175
+
176
+ def registerComboTree(window, clickIdx, indexes, menu):
177
+ self = window
178
+ # live = self.uiLiveShapeConnectionACT.isChecked()
179
+ items = [i.model().itemFromIndex(i) for i in indexes]
180
+ types = {}
181
+ for i in items:
182
+ types.setdefault(type(i), []).append(i)
183
+ sel = self.simplex.DCC.getSelectedObjects()
184
+
185
+ # anywhere
186
+ addGroupACT = menu.addAction("Add Group")
187
+ addGroupACT.triggered.connect(self.newComboGroup)
188
+
189
+ if Combo in types or ComboPair in types or ProgPair in types:
190
+ # on combo, comboPair, or shape
191
+ addShapeACT = menu.addAction("Add Shape")
192
+ addShapeACT.triggered.connect(self.newComboShape)
193
+
194
+ menu.addSeparator()
195
+
196
+ # on combo, comboPair, or shape
197
+ deleteACT = menu.addAction("Delete Selected")
198
+ deleteACT.triggered.connect(self.comboTreeDelete)
199
+
200
+ menu.addSeparator()
201
+
202
+ # combo or below
203
+ setValsACT = menu.addAction("Set Selected Values")
204
+ setValsACT.triggered.connect(self.setSliderVals)
205
+
206
+ setGroupMenu = menu.addMenu("Set Group")
207
+ for group in window.simplex.comboGroups:
208
+ gAct = setGroupMenu.addAction(group.name)
209
+ gAct.triggered.connect(partial(self.setSelectedComboGroups, group))
210
+
211
+ menu.addSeparator()
212
+
213
+ setSolveMenu = menu.addMenu("Set Solve Type")
214
+ solves = set()
215
+ combos = list({i for i in items if isinstance(i, Combo)})
216
+ for combo in combos:
217
+ solves.add(str(combo.solveType))
218
+
219
+ if "None" in solves:
220
+ solves.discard("None")
221
+ solves.add("min")
222
+
223
+ for stName, stVal in Combo.solveTypes:
224
+ if stName != "None":
225
+ act = setSolveMenu.addAction(stName)
226
+ act.setCheckable(True)
227
+ if stVal in solves:
228
+ act.setChecked(True)
229
+ act.triggered.connect(partial(self.setSelectedComboSolveType, stVal))
230
+
231
+ menu.addSeparator()
232
+
233
+ # combo or below
234
+ extractShapeACT = menu.addAction("Extract")
235
+ extractShapeACT.triggered.connect(self.shapeExtract)
236
+
237
+ # combo or below
238
+ exportShapeACT = menu.addAction("Export Selected ...")
239
+ exportShapeACT.triggered.connect(self.shapeExport)
240
+
241
+ # combo or below
242
+ connectShapeACT = menu.addAction("Connect By Name")
243
+ connectShapeACT.triggered.connect(self.shapeConnect)
244
+ if sel:
245
+ # combo or below, if there's a selection
246
+ matchShapeACT = menu.addAction("Match To Scene Selection")
247
+ matchShapeACT.triggered.connect(self.shapeMatch)
248
+ # combo or below
249
+ clearShapeACT = menu.addAction("Clear")
250
+ clearShapeACT.triggered.connect(self.shapeClear)
251
+
252
+ menu.addSeparator()
253
+
254
+ sep = False
255
+ if indexes:
256
+ # anywhere
257
+ isolateSelectedACT = menu.addAction("Isolate Selected")
258
+ isolateSelectedACT.triggered.connect(self.comboIsolateSelected)
259
+ sep = True
260
+
261
+ if self.isComboIsolate():
262
+ # anywhere
263
+ exitIsolationACT = menu.addAction("Exit Isolation")
264
+ exitIsolationACT.triggered.connect(self.comboTreeExitIsolate)
265
+ sep = True
266
+
267
+ if sep:
268
+ menu.addSeparator()
@@ -0,0 +1,45 @@
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 functools import partial
19
+
20
+ from ...comboCheckDialog import ComboCheckDialog
21
+ from ...items import Slider
22
+ from Qt.QtWidgets import QAction
23
+
24
+
25
+ def registerTool(window, menu):
26
+ checkPossibleCombosACT = QAction("Check Possible Combos ...", window)
27
+ menu.addAction(checkPossibleCombosACT)
28
+ checkPossibleCombosACT.triggered.connect(
29
+ partial(checkPossibleCombosInterface, window)
30
+ )
31
+
32
+
33
+ def registerContext(tree, clickIdx, indexes, menu):
34
+ window = tree.window()
35
+ checkPossibleCombosACT = QAction("Check Possible Combos ...", tree)
36
+ menu.addAction(checkPossibleCombosACT)
37
+ checkPossibleCombosACT.triggered.connect(
38
+ partial(checkPossibleCombosInterface, window)
39
+ )
40
+
41
+
42
+ def checkPossibleCombosInterface(window):
43
+ sliders = window.uiSliderTREE.getSelectedItems(typ=Slider)
44
+ ccd = ComboCheckDialog(sliders, parent=window)
45
+ ccd.show()
@@ -0,0 +1,59 @@
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 functools import partial
19
+
20
+ from Qt import QtCompat
21
+ from Qt.QtWidgets import QAction, QMessageBox, QProgressDialog
22
+
23
+ try:
24
+ import numpy as np
25
+ except ImportError:
26
+ np = None
27
+
28
+
29
+ def registerTool(window, menu):
30
+ if np is not None:
31
+ exportSplitACT = QAction("Export Split", window)
32
+ menu.addAction(exportSplitACT)
33
+ exportSplitACT.triggered.connect(partial(exportSplitInterface, window))
34
+
35
+
36
+ def exportSplitInterface(window):
37
+ if np is None:
38
+ QMessageBox.warning(
39
+ window,
40
+ "No Numpy",
41
+ "Numpy is not available here, an it is required to split a system",
42
+ )
43
+ return
44
+ path, _filter = QtCompat.QFileDialog.getSaveFileName(
45
+ window, "Export Split", "", "Simplex (*.smpx)"
46
+ )
47
+
48
+ if not path:
49
+ return
50
+
51
+ pBar = QProgressDialog("Exporting Split smpx File", "Cancel", 0, 100, window)
52
+ pBar.show()
53
+ try:
54
+ split = window.simplex.split(pBar)
55
+ split.exportAbc(path, pBar)
56
+ except ValueError as e:
57
+ QMessageBox.warning(window, "Unsplittable", str(e))
58
+ finally:
59
+ pBar.close()
@@ -0,0 +1,24 @@
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 Qt.QtWidgets import QAction
19
+
20
+
21
+ def registerTool(window, menu):
22
+ editFalloffsACT = QAction("Edit Falloffs ...", window)
23
+ menu.addAction(editFalloffsACT)
24
+ editFalloffsACT.triggered.connect(window.showFalloffDialog)
@@ -0,0 +1,24 @@
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 Qt.QtWidgets import QAction
19
+
20
+
21
+ def registerTool(window, menu):
22
+ showTraversalsACT = QAction("Show Traversals ...", window)
23
+ menu.addAction(showTraversalsACT)
24
+ showTraversalsACT.triggered.connect(window.showTraversalDialog)
@@ -0,0 +1,107 @@
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
+ import json
19
+
20
+ from ...commands.alembicCommon import buildSmpx, readSmpx
21
+ from ...commands.mesh import Mesh
22
+ from ...commands.uvTransfer import applyTransfer, getVertCorrelation
23
+
24
+ try:
25
+ import numpy as np
26
+ except ImportError:
27
+ np = None
28
+
29
+
30
+ def simplexUvTransfer(
31
+ srcSmpxPath, tarPath, outPath, srcUvPath=None, tol=0.0001, pBar=None
32
+ ):
33
+ """Transfer a simplex system onto a mesh through UV space
34
+
35
+ Parameters
36
+ ----------
37
+ srcSmpxPath : str
38
+ The path to the source .smpx file
39
+ tarPath : str
40
+ The path to the mesh to recieve the blendshapes
41
+ outPath : str
42
+ The .smpx path that will be written
43
+ srcUvPath : str
44
+ If the .smpx file doesn't have UV's, then the UV's
45
+ from this mesh wil be used. Defaults to None
46
+ tol : float
47
+ The tolerance for checking if a UV is outside of a poly
48
+ pBar : QProgressDialog
49
+ Optional progress bar
50
+
51
+ """
52
+ if np is None:
53
+ raise RuntimeError("UV Transfer requires Numpy. It is currently unavailable")
54
+
55
+ if pBar is not None:
56
+ pBar.setLabelText("Loading Source Mesh")
57
+ from Qt.QtWidgets import QApplication
58
+
59
+ QApplication.processEvents()
60
+
61
+ srcUvPath = srcUvPath or srcSmpxPath
62
+ if srcUvPath.endswith(".abc") or srcUvPath.endswith(".smpx"):
63
+ src = Mesh.loadAbc(srcUvPath, ensureWinding=False)
64
+ elif srcUvPath.endswith(".obj"):
65
+ src = Mesh.loadObj(srcUvPath, ensureWinding=False)
66
+
67
+ if pBar is not None:
68
+ pBar.setLabelText("Loading Target Mesh")
69
+ from Qt.QtWidgets import QApplication
70
+
71
+ QApplication.processEvents()
72
+ if tarPath.endswith(".abc"):
73
+ tar = Mesh.loadAbc(tarPath, ensureWinding=False)
74
+ elif tarPath.endswith(".obj"):
75
+ tar = Mesh.loadObj(tarPath, ensureWinding=False)
76
+
77
+ jsString, _, srcVerts, _, _, _ = readSmpx(srcSmpxPath)
78
+ js = json.loads(jsString)
79
+ name = js["systemName"]
80
+
81
+ srcFaces = src.faceVertArray
82
+ srcUvFaces = src.uvFaceMap["default"]
83
+ srcUvs = np.array(src.uvMap["default"])
84
+
85
+ tarFaces = tar.faceVertArray
86
+ tarUvFaces = tar.uvFaceMap["default"]
87
+ tarUvs = np.array(tar.uvMap["default"])
88
+ oldTarVerts = np.array(tar.vertArray)
89
+
90
+ corr = getVertCorrelation(
91
+ srcUvFaces, srcUvs, tarFaces, tarUvFaces, tarUvs, tol=tol, pBar=pBar
92
+ )
93
+ tarVerts = applyTransfer(srcVerts, srcFaces, corr, len(oldTarVerts))
94
+
95
+ # Apply as a delta
96
+ deltas = tarVerts - tarVerts[0][None, ...]
97
+ writeVerts = oldTarVerts[None, ...] + deltas
98
+
99
+ buildSmpx(
100
+ outPath,
101
+ writeVerts,
102
+ tarFaces,
103
+ jsString,
104
+ name,
105
+ uvs=tarUvs,
106
+ uvFaces=tarUvFaces,
107
+ )