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