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
@@ -0,0 +1,335 @@
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 itertools import combinations, product
21
+
22
+ from six.moves import range, zip
23
+
24
+ from .dragFilter import DragFilter
25
+ from .items import Combo, Slider
26
+ from Qt import QtCompat
27
+ from Qt.QtCore import Qt
28
+ from Qt.QtGui import QBrush, QColor
29
+ from Qt.QtWidgets import QDialog, QListWidgetItem, QTreeWidgetItem
30
+ from .utils import getUiFile
31
+
32
+
33
+ class TooManyPossibilitiesError(Exception):
34
+ """Error raised when there are too many possibilities
35
+ Basically used as a stop-iteration
36
+ """
37
+
38
+ pass
39
+
40
+
41
+ def buildPossibleCombos(
42
+ simplex, sliders, minDepth, maxDepth, lockDict=None, maxPoss=100
43
+ ):
44
+ """Build a list of possible combos
45
+
46
+ Parameters
47
+ ----------
48
+ simplex : Simplex
49
+ The simplex system to check
50
+ sliders : Slider
51
+ The sliders to check
52
+ minDepth : int
53
+ The minimum number of sliders that will go into any combo
54
+ maxDepth : int
55
+ The maximum number of sliders that will go into any combo
56
+ lockDict : {Slider: (float, ...), ...}
57
+ An optional per-slider dict of possible values
58
+ maxPoss : float
59
+ The Maximum number of possibilities to return.(Default value = 100)
60
+
61
+ Returns
62
+ -------
63
+ bool
64
+ True if the maximum number of possibilities was exceeded
65
+ [([(Slider, float), ...], Combo), ...]
66
+ Grouped slider/value pairs to existing (or None) Combos
67
+
68
+ """
69
+ # Get the range values for each slider
70
+ allRanges = {}
71
+ sliderDict = {}
72
+ lockDict = lockDict or {}
73
+
74
+ for slider in sliders:
75
+ rng = set(lockDict.get(slider, slider.prog.getRange()))
76
+ rng.discard(0) # ignore the zeros
77
+ allRanges[slider] = sorted(rng)
78
+ sliderDict[slider.name] = slider
79
+
80
+ poss = []
81
+ tooMany = False
82
+ try:
83
+ for size in range(minDepth, maxDepth + 1):
84
+ for grp in combinations(sliders, size):
85
+ names = [i.name for i in grp]
86
+ ranges = [allRanges[s] for s in grp]
87
+ for vals in product(*ranges):
88
+ poss.append(frozenset(list(zip(names, vals))))
89
+ if len(poss) > maxPoss:
90
+ raise TooManyPossibilitiesError("Don't melt your computer")
91
+ except TooManyPossibilitiesError:
92
+ tooMany = True
93
+
94
+ # Get the "only" combo sets
95
+ onlys = {}
96
+ for combo in simplex.combos:
97
+ sls = [i.slider for i in combo.pairs]
98
+ if all(r in sliders for r in sls):
99
+ key = frozenset([(i.slider.name, i.value) for i in combo.pairs])
100
+ onlys[key] = combo
101
+
102
+ toAdd = []
103
+ for p in poss:
104
+ truePairs = [(sliderDict[n], v) for n, v in p]
105
+ toAdd.append((truePairs, onlys.get(p)))
106
+ return tooMany, toAdd
107
+
108
+
109
+ class ComboCheckItem(QListWidgetItem):
110
+ def __init__(self, pairs, combo, *args, **kwargs):
111
+ super(ComboCheckItem, self).__init__(*args, **kwargs)
112
+ self.pairs = pairs
113
+ self.combo = combo
114
+
115
+ if self.combo is None:
116
+ # We can create it!!
117
+ sliders, vals = list(zip(*self.pairs))
118
+ newName = Combo.buildComboName(sliders, vals)
119
+ self.setText(newName)
120
+ else:
121
+ self.setText(self.combo.name)
122
+ self.setForeground(QBrush(QColor(128, 128, 128)))
123
+
124
+
125
+ class ComboCheckDialog(QDialog):
126
+ """Dialog for checking what possible combos exist, and picking new combos
127
+
128
+ This dialog displays the available combos for a number of input sliders
129
+
130
+ In 'Create' mode, it provides a quick way of choosing the one specific combo
131
+ that the user is looking for
132
+
133
+ In 'Check' mode, it provides a convenient way to explore the possibilites
134
+ and create any missing combos directly
135
+
136
+ Parameters
137
+ ----------
138
+ sliders : [Slider, ...]
139
+ A list of sliders to check
140
+ values : {Slider: (float, ...), ...}
141
+ A dictionary of values to use per slider
142
+ mode : str
143
+ The mode to display the dialog. Defaults to 'create'
144
+ parent : QObject
145
+ The Parent of the dialog. Must be a SimplexDialog
146
+
147
+ Returns
148
+ -------
149
+
150
+ """
151
+
152
+ def __init__(self, sliders, values=None, mode="create", parent=None):
153
+ super(ComboCheckDialog, self).__init__(parent)
154
+
155
+ uiPath = getUiFile(__file__)
156
+ QtCompat.loadUi(uiPath, self)
157
+ self.mode = mode.lower()
158
+
159
+ # Store the Parent UI rather than relying on Qt's .parent()
160
+ # Could cause crashes otherwise
161
+ self.parUI = parent
162
+
163
+ self.uiCreateSelectedBTN.clicked.connect(self.createMissing)
164
+ self.uiMinLimitSPIN.valueChanged.connect(self.populateWithoutUpdate)
165
+ self.uiMaxLimitSPIN.valueChanged.connect(self.populateWithoutUpdate)
166
+ self.uiCancelBTN.clicked.connect(self.close)
167
+ self.uiManualUpdateBTN.clicked.connect(self.populateWithUpdate)
168
+ self.uiEditTREE.itemChanged.connect(self.populateWithoutUpdate)
169
+
170
+ self.dragFilter = DragFilter(self)
171
+ self.uiEditTREE.viewport().installEventFilter(self.dragFilter)
172
+ self.dragFilter.dragTick.connect(self.dragTick)
173
+
174
+ self.parUI.uiSliderTREE.selectionModel().selectionChanged.connect(
175
+ self.populateWithCheck
176
+ )
177
+
178
+ self.valueDict = values or {}
179
+ self.setSliders(sliders)
180
+ if self.mode == "create":
181
+ self.uiAutoUpdateCHK.setCheckState(Qt.Unchecked)
182
+ self.uiAutoUpdateCHK.hide()
183
+ self.uiManualUpdateBTN.hide()
184
+
185
+ self.uiMaxLimitSPIN.setValue(max(len(sliders), 2))
186
+ self.uiMinLimitSPIN.setValue(max(len(sliders) - 2, 2))
187
+
188
+ if sliders is None:
189
+ self.populateWithUpdate()
190
+ else:
191
+ self._populate()
192
+
193
+ def dragTick(self, ticks, mul):
194
+ """Deal with the ticks coming from the drag handler
195
+
196
+ Parameters
197
+ ----------
198
+ ticks : int
199
+ The number of ticks since the last update
200
+ mul : float
201
+ The multiplier value from the drag handler
202
+
203
+ Returns
204
+ -------
205
+
206
+ """
207
+ items = self.uiEditTREE.selectedItems()
208
+ for item in items:
209
+ val = item.data(3, Qt.EditRole)
210
+ val += (0.05) * ticks * mul
211
+ if abs(val) < 1.0e-5:
212
+ val = 0.0
213
+ val = max(min(val, 1.0), -1.0)
214
+ item.setData(3, Qt.EditRole, val)
215
+ self.uiEditTREE.viewport().update()
216
+
217
+ def setSliders(self, val):
218
+ """Set the sliders displayed in this UI
219
+
220
+ Parameters
221
+ ----------
222
+ val : [Slider, ...]
223
+ The sliders to be displayed
224
+
225
+ Returns
226
+ -------
227
+
228
+ """
229
+ self.uiEditTREE.clear()
230
+ dvs = [None, -1.0, 1.0, 0.5]
231
+ roles = [Qt.UserRole, Qt.UserRole, Qt.UserRole, Qt.EditRole]
232
+ val = val or []
233
+ for slider in val:
234
+ item = QTreeWidgetItem(self.uiEditTREE, [slider.name])
235
+ item.setFlags(item.flags() | Qt.ItemIsEditable)
236
+ vvv = self.valueDict.get(slider, [-1.0, 1.0])
237
+ mvs = [i for i in vvv if abs(i) != 1.0]
238
+ mvs = mvs[0] if mvs else 0.5
239
+
240
+ item.setData(0, Qt.UserRole, slider)
241
+ for col in range(1, 4):
242
+ val = mvs if col == 3 else dvs[col]
243
+ item.setData(col, roles[col], val)
244
+ rng = slider.prog.getRange()
245
+ if val in rng or col == 3:
246
+ chk = Qt.Checked if val in vvv else Qt.Unchecked
247
+ item.setCheckState(col, chk)
248
+
249
+ for col in reversed(list(range(4))):
250
+ self.uiEditTREE.resizeColumnToContents(col)
251
+
252
+ def closeEvent(self, event):
253
+ """Override the Qt close event"""
254
+ self.parUI.uiSliderTREE.selectionModel().selectionChanged.disconnect(
255
+ self.populateWithCheck
256
+ )
257
+ super(ComboCheckDialog, self).closeEvent(event)
258
+
259
+ def populateWithUpdate(self):
260
+ """Populate the list from the main dialog selection"""
261
+ self.setSliders(self.parUI.uiSliderTREE.getSelectedItems(typ=Slider))
262
+ self._populate()
263
+
264
+ def populateWithoutUpdate(self):
265
+ """Populate the list and but don't look at the main dialog"""
266
+ self._populate()
267
+
268
+ def populateWithCheck(self):
269
+ """Populate the list from the main dialog selection, only if the AutoUpdate checkbox is checked"""
270
+ if self.uiAutoUpdateCHK.isChecked():
271
+ self.setSliders(self.parUI.uiSliderTREE.getSelectedItems(typ=Slider))
272
+ self._populate()
273
+
274
+ def _populate(self):
275
+ """Populate the list widgets in the UI"""
276
+ minDepth = self.uiMinLimitSPIN.value()
277
+ maxDepth = self.uiMaxLimitSPIN.value()
278
+ maxPoss = 100
279
+
280
+ root = self.uiEditTREE.invisibleRootItem()
281
+ lockDict = {}
282
+ sliderList = []
283
+ roles = [Qt.UserRole, Qt.UserRole, Qt.UserRole, Qt.EditRole]
284
+ for row in range(root.childCount()):
285
+ item = root.child(row)
286
+ slider = item.data(0, Qt.UserRole)
287
+ if slider is not None:
288
+ sliderList.append(slider)
289
+ lv = [
290
+ item.data(col, roles[col])
291
+ for col in range(1, 4)
292
+ if item.checkState(col)
293
+ ]
294
+ lockDict[slider] = lv
295
+
296
+ tooMany, toAdd = buildPossibleCombos(
297
+ self.parUI.simplex,
298
+ sliderList,
299
+ minDepth,
300
+ maxDepth,
301
+ lockDict=lockDict,
302
+ maxPoss=maxPoss,
303
+ )
304
+
305
+ lbl = (
306
+ "Too many possibilities. Limiting to {0}".format(maxPoss) if tooMany else ""
307
+ )
308
+ self.uiWarningLBL.setText(lbl)
309
+
310
+ self.uiComboCheckLIST.clear()
311
+ for pairs, combo in reversed(toAdd):
312
+ item = ComboCheckItem(pairs, combo)
313
+ self.uiComboCheckLIST.addItem(item)
314
+
315
+ if self.mode == "create":
316
+ if self.uiComboCheckLIST.count() > 0:
317
+ self.uiComboCheckLIST.item(0).setSelected(True)
318
+
319
+ def createMissing(self):
320
+ """Create selected combos if they don't already exist"""
321
+ simplex = self.parUI.simplex
322
+ created = []
323
+ for item in self.uiComboCheckLIST.selectedItems():
324
+ name = item.text()
325
+ sliders, vals = list(zip(*item.pairs))
326
+ # Double check that the user didn't create any extra sliders
327
+ if Combo.comboAlreadyExists(simplex, sliders, vals) is None:
328
+ c = Combo.createCombo(name, simplex, sliders, vals)
329
+ created.append(c)
330
+
331
+ self.parUI.uiComboTREE.setItemSelection(created)
332
+ if self.mode == "create":
333
+ self.close()
334
+ else:
335
+ self.populateWithoutUpdate()
@@ -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/>.