simplex-solver 3.2.2__cp39-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 (84) hide show
  1. simplex_solver-3.2.2.dist-info/DELVEWHEEL +2 -0
  2. simplex_solver-3.2.2.dist-info/METADATA +94 -0
  3. simplex_solver-3.2.2.dist-info/RECORD +84 -0
  4. simplex_solver-3.2.2.dist-info/WHEEL +5 -0
  5. simplex_solver.libs/.load-order-simplex_solver-3.2.2 +1 -0
  6. simplex_solver.libs/msvcp140-a4c2229bdc2a2a630acdc095b4d86008.dll +0 -0
  7. simplexui/__init__.py +86 -0
  8. simplexui/_version.py +1 -0
  9. simplexui/channelBox.py +867 -0
  10. simplexui/comboCheckDialog.py +396 -0
  11. simplexui/commands/__init__.py +16 -0
  12. simplexui/commands/alembicCommon.py +1148 -0
  13. simplexui/commands/alembic_walker.py +299 -0
  14. simplexui/commands/applyCorrectives.py +452 -0
  15. simplexui/commands/correctiveInterface.py +259 -0
  16. simplexui/commands/expandedExport.py +434 -0
  17. simplexui/commands/hdf5Convert.py +62 -0
  18. simplexui/commands/mayaCorrectiveInterface.py +159 -0
  19. simplexui/commands/mayatonumpy.py +416 -0
  20. simplexui/commands/mesh.py +1085 -0
  21. simplexui/commands/poseblendlib.py +168 -0
  22. simplexui/commands/reorderSimplexPoints.py +102 -0
  23. simplexui/commands/replaceDefinitionJson.py +74 -0
  24. simplexui/commands/rigidAlign.py +97 -0
  25. simplexui/commands/unsubdivide.py +1222 -0
  26. simplexui/commands/uvTransfer.py +976 -0
  27. simplexui/dragFilter.py +334 -0
  28. simplexui/falloffDialog.py +504 -0
  29. simplexui/img/ChefHead.png +0 -0
  30. simplexui/img/frozen.png +0 -0
  31. simplexui/interface/__init__.py +30 -0
  32. simplexui/interface/dummyInterface.py +1313 -0
  33. simplexui/interface/mayaInterface.py +2294 -0
  34. simplexui/interfaceModel.py +655 -0
  35. simplexui/interfaceModelTrees.py +456 -0
  36. simplexui/items/__init__.py +50 -0
  37. simplexui/items/accessor.py +145 -0
  38. simplexui/items/combo.py +645 -0
  39. simplexui/items/dragItem.py +44 -0
  40. simplexui/items/falloff.py +748 -0
  41. simplexui/items/group.py +267 -0
  42. simplexui/items/progression.py +613 -0
  43. simplexui/items/shape.py +384 -0
  44. simplexui/items/simplex.py +1734 -0
  45. simplexui/items/slider.py +632 -0
  46. simplexui/items/stack.py +147 -0
  47. simplexui/items/traversal.py +780 -0
  48. simplexui/items/treeItem.py +441 -0
  49. simplexui/main.pyw +22 -0
  50. simplexui/menu/__init__.py +73 -0
  51. simplexui/menu/dummyPlugins/__init__.py +16 -0
  52. simplexui/menu/genericPlugins/__init__.py +16 -0
  53. simplexui/menu/genericPlugins/_builtins.py +270 -0
  54. simplexui/menu/genericPlugins/checkPossibleCombos.py +48 -0
  55. simplexui/menu/genericPlugins/exportSplit.py +67 -0
  56. simplexui/menu/genericPlugins/showFalloffs.py +26 -0
  57. simplexui/menu/genericPlugins/showTraversals.py +26 -0
  58. simplexui/menu/genericPlugins/simplexUvTransfer.py +106 -0
  59. simplexui/menu/genericPlugins/unsubdivide.py +72 -0
  60. simplexui/menu/mayaPlugins/__init__.py +16 -0
  61. simplexui/menu/mayaPlugins/exportOther.py +53 -0
  62. simplexui/menu/mayaPlugins/extractProgressives.py +68 -0
  63. simplexui/menu/mayaPlugins/freezeCombo.py +247 -0
  64. simplexui/menu/mayaPlugins/generateShapeIncrementals.py +99 -0
  65. simplexui/menu/mayaPlugins/importObjs.py +199 -0
  66. simplexui/menu/mayaPlugins/linearizeTraversal.py +60 -0
  67. simplexui/menu/mayaPlugins/makeShelfBtn.py +67 -0
  68. simplexui/menu/mayaPlugins/relaxToSelection.py +76 -0
  69. simplexui/menu/mayaPlugins/reloadDefinition.py +44 -0
  70. simplexui/menu/mayaPlugins/snapToNeutral.py +71 -0
  71. simplexui/menu/mayaPlugins/softSelectToCluster.py +201 -0
  72. simplexui/menu/mayaPlugins/tweakMix.py +136 -0
  73. simplexui/menu/mayaPlugins/updateRestShape.py +113 -0
  74. simplexui/pysimplex.lib +0 -0
  75. simplexui/pysimplex.pyd +0 -0
  76. simplexui/simplexDialog.py +1547 -0
  77. simplexui/travCheckDialog.py +419 -0
  78. simplexui/traversalDialog.py +299 -0
  79. simplexui/ui/comboCheckDialog.ui +475 -0
  80. simplexui/ui/falloffDialog.ui +243 -0
  81. simplexui/ui/simplexDialog.ui +1458 -0
  82. simplexui/ui/travCheckDialog.ui +488 -0
  83. simplexui/ui/traversalDialog.ui +532 -0
  84. simplexui/utils.py +307 -0
@@ -0,0 +1,396 @@
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
+ from __future__ import annotations
18
+
19
+ from itertools import combinations, product
20
+ from typing import TYPE_CHECKING
21
+
22
+ from Qt import QtCompat
23
+ from Qt.QtCore import Qt
24
+ from Qt.QtGui import QBrush, QColor
25
+ from Qt.QtWidgets import (
26
+ QCheckBox,
27
+ QDialog,
28
+ QGroupBox,
29
+ QLabel,
30
+ QListWidget,
31
+ QListWidgetItem,
32
+ QPushButton,
33
+ QSpinBox,
34
+ QTreeWidget,
35
+ QTreeWidgetItem,
36
+ QWidget,
37
+ )
38
+
39
+ from .dragFilter import DragFilter
40
+ from .items import Combo, Slider
41
+ from .utils import getUiFile
42
+
43
+ if TYPE_CHECKING:
44
+ from Qt.QtGui import QCloseEvent
45
+
46
+ from .items import Simplex
47
+ from .simplexDialog import SimplexDialog
48
+
49
+
50
+ class TooManyPossibilitiesError(Exception):
51
+ """Error raised when there are too many possibilities
52
+ Basically used as a stop-iteration
53
+ """
54
+
55
+ pass
56
+
57
+
58
+ def buildPossibleCombos(
59
+ simplex: Simplex,
60
+ sliders: list[Slider],
61
+ minDepth: int,
62
+ maxDepth: int,
63
+ lockDict: dict[Slider, tuple[float, ...]] | None = None,
64
+ maxPoss: int = 100,
65
+ ) -> tuple[bool, list[tuple[list[tuple[Slider, float]], Combo]]]:
66
+ """Build a list of possible combos
67
+
68
+ Parameters
69
+ ----------
70
+ simplex : Simplex
71
+ The simplex system to check
72
+ sliders : Slider
73
+ The sliders to check
74
+ minDepth : int
75
+ The minimum number of sliders that will go into any combo
76
+ maxDepth : int
77
+ The maximum number of sliders that will go into any combo
78
+ lockDict : {Slider: (float, ...), ...}
79
+ An optional per-slider dict of possible values
80
+ maxPoss : float
81
+ The Maximum number of possibilities to return.(Default value = 100)
82
+
83
+ Returns
84
+ -------
85
+ bool
86
+ True if the maximum number of possibilities was exceeded
87
+ [([(Slider, float), ...], Combo), ...]
88
+ Grouped slider/value pairs to existing (or None) Combos
89
+ """
90
+ # Get the range values for each slider
91
+ allRanges = {}
92
+ sliderDict = {}
93
+ lockDict = lockDict or {}
94
+
95
+ for slider in sliders:
96
+ rng = set(lockDict.get(slider, slider.prog.getRange()))
97
+ rng.discard(0) # ignore the zeros
98
+ allRanges[slider] = sorted(rng)
99
+ sliderDict[slider.name] = slider
100
+
101
+ poss = []
102
+ tooMany = False
103
+ try:
104
+ for size in range(minDepth, maxDepth + 1):
105
+ for grp in combinations(sliders, size):
106
+ names = [i.name for i in grp]
107
+ ranges = [allRanges[s] for s in grp]
108
+ for vals in product(*ranges):
109
+ poss.append(frozenset(list(zip(names, vals))))
110
+ if len(poss) > maxPoss:
111
+ raise TooManyPossibilitiesError("Don't melt your computer")
112
+ except TooManyPossibilitiesError:
113
+ tooMany = True
114
+
115
+ # Get the "only" combo sets
116
+ onlys = {}
117
+ for combo in simplex.combos:
118
+ sls = [i.slider for i in combo.pairs]
119
+ if all(r in sliders for r in sls):
120
+ key = frozenset([(i.slider.name, i.value) for i in combo.pairs])
121
+ onlys[key] = combo
122
+
123
+ toAdd = []
124
+ for p in poss:
125
+ truePairs = [(sliderDict[n], v) for n, v in p]
126
+ toAdd.append((truePairs, onlys.get(p)))
127
+
128
+ return tooMany, toAdd
129
+
130
+
131
+ class ComboCheckItem(QListWidgetItem):
132
+ def __init__(
133
+ self, pairs: list[tuple[Slider, float]], combo: Combo, *args, **kwargs
134
+ ) -> None:
135
+ super().__init__(*args, **kwargs)
136
+ self.pairs = pairs
137
+ self.combo = combo
138
+
139
+ if self.combo is None:
140
+ # We can create it!!
141
+ sliders, vals = list(zip(*self.pairs))
142
+ newName = Combo.buildComboName(sliders, vals)
143
+ self.setText(newName)
144
+ else:
145
+ self.setText(self.combo.name)
146
+ self.setForeground(QBrush(QColor(128, 128, 128)))
147
+
148
+
149
+ class ComboCheckDialog(QDialog):
150
+ """Dialog for checking what possible combos exist, and picking new combos
151
+
152
+ This dialog displays the available combos for a number of input sliders
153
+
154
+ In 'Create' mode, it provides a quick way of choosing the one specific combo
155
+ that the user is looking for
156
+
157
+ In 'Check' mode, it provides a convenient way to explore the possibilites
158
+ and create any missing combos directly
159
+
160
+ Parameters
161
+ ----------
162
+ sliders : [Slider, ...]
163
+ A list of sliders to check
164
+ values : {Slider: (float, ...), ...}
165
+ A dictionary of values to use per slider
166
+ mode : str
167
+ The mode to display the dialog. Defaults to 'create'
168
+ parent : QObject
169
+ The Parent of the dialog. Must be a SimplexDialog
170
+
171
+ Returns
172
+ -------
173
+
174
+ """
175
+
176
+ uiHeaderWID: QWidget
177
+ uiLimitGRP: QGroupBox
178
+ uiMinLimitSPIN: QSpinBox
179
+ uiMaxLimitSPIN: QSpinBox
180
+ uiAutoUpdateCHK: QCheckBox
181
+ uiManualUpdateBTN: QPushButton
182
+ uiEditTREE: QTreeWidget
183
+ uiComboCheckLIST: QListWidget
184
+ uiWarningLBL: QLabel
185
+ uiCancelBTN: QPushButton
186
+ uiCreateSelectedBTN: QPushButton
187
+
188
+ def __init__(
189
+ self,
190
+ sliders: list[Slider],
191
+ values: dict[Slider, list[float]] | None = None,
192
+ mode: str = "create",
193
+ parent: SimplexDialog | None = None,
194
+ ) -> None:
195
+ if parent is None:
196
+ raise ValueError("Parent must not be None")
197
+ super().__init__(parent)
198
+
199
+ uiPath = getUiFile(__file__)
200
+ QtCompat.loadUi(uiPath, self)
201
+ self.mode = mode.lower()
202
+
203
+ # Store the Parent UI rather than relying on Qt's .parent()
204
+ # Could cause crashes otherwise
205
+ self.parUI = parent
206
+ if self.parUI.simplex is None:
207
+ self.setDisabled(True)
208
+ return
209
+
210
+ self.uiCreateSelectedBTN.clicked.connect(self.createMissing)
211
+ self.uiMinLimitSPIN.valueChanged.connect(self.populateWithoutUpdate)
212
+ self.uiMaxLimitSPIN.valueChanged.connect(self.populateWithoutUpdate)
213
+ self.uiCancelBTN.clicked.connect(self.close)
214
+ self.uiManualUpdateBTN.clicked.connect(self.populateWithUpdate)
215
+ self.uiEditTREE.itemChanged.connect(self.populateWithoutUpdate)
216
+
217
+ self.dragFilter = DragFilter(self)
218
+ self.uiEditTREE.viewport().installEventFilter(self.dragFilter)
219
+ self.dragFilter.dragTick.connect(self.dragTick)
220
+
221
+ self.parUI.uiSliderTREE.selectionModel().selectionChanged.connect(
222
+ self.populateWithCheck
223
+ )
224
+
225
+ self.valueDict = values or {}
226
+ self.setSliders(sliders)
227
+ if self.mode == "create":
228
+ self.uiAutoUpdateCHK.setCheckState(Qt.CheckState.Unchecked)
229
+ self.uiAutoUpdateCHK.hide()
230
+ self.uiManualUpdateBTN.hide()
231
+
232
+ self.uiMaxLimitSPIN.setValue(max(len(sliders), 2))
233
+ self.uiMinLimitSPIN.setValue(max(len(sliders) - 2, 2))
234
+
235
+ if sliders is None:
236
+ self.populateWithUpdate()
237
+ else:
238
+ self._populate()
239
+
240
+ def dragTick(self, ticks: int, mul: float) -> None:
241
+ """Deal with the ticks coming from the drag handler
242
+
243
+ Parameters
244
+ ----------
245
+ ticks : int
246
+ The number of ticks since the last update
247
+ mul : float
248
+ The multiplier value from the drag handler
249
+ """
250
+ items = self.uiEditTREE.selectedItems()
251
+ for item in items:
252
+ val = item.data(3, Qt.ItemDataRole.EditRole)
253
+ val += (0.05) * ticks * mul
254
+ if abs(val) < 1.0e-5:
255
+ val = 0.0
256
+ val = max(min(val, 1.0), -1.0)
257
+ item.setData(3, Qt.ItemDataRole.EditRole, val)
258
+ self.uiEditTREE.viewport().update()
259
+
260
+ def setSliders(self, sliders: list[Slider]) -> None:
261
+ """Set the sliders displayed in this UI
262
+
263
+ Parameters
264
+ ----------
265
+ sliders : [Slider, ...]
266
+ The sliders to be displayed
267
+ """
268
+ self.uiEditTREE.clear()
269
+ defaultVals = [-1.0, 1.0, 0.5]
270
+ roles = [
271
+ Qt.ItemDataRole.UserRole,
272
+ Qt.ItemDataRole.UserRole,
273
+ Qt.ItemDataRole.UserRole,
274
+ Qt.ItemDataRole.EditRole,
275
+ ]
276
+
277
+ sliders = sliders or []
278
+ for slider in sliders:
279
+ # item = QTreeWidgetItem(self.uiEditTREE, [slider.name])
280
+ item = QTreeWidgetItem([slider.name])
281
+ item.setFlags(item.flags() | Qt.ItemFlag.ItemIsEditable)
282
+
283
+ valRange = self.valueDict.get(slider, [-1.0, 1.0])
284
+ midVals = [i for i in valRange if abs(i) != 1.0]
285
+ slidef = defaultVals[:]
286
+ slidef[-1] = midVals[0] if midVals else 0.5
287
+
288
+ item.setData(0, Qt.ItemDataRole.UserRole, slider)
289
+ for col in range(1, 4):
290
+ slival = slidef[col - 1]
291
+ item.setData(col, roles[col], slival)
292
+ rng = slider.prog.getRange()
293
+ if slival in rng or col == 3:
294
+ chk = (
295
+ Qt.CheckState.Checked
296
+ if slival in valRange
297
+ else Qt.CheckState.Unchecked
298
+ )
299
+ item.setCheckState(col, chk)
300
+ self.uiEditTREE.addTopLevelItem(item)
301
+
302
+ for col in reversed(list(range(4))):
303
+ self.uiEditTREE.resizeColumnToContents(col)
304
+
305
+ def closeEvent(self, event: QCloseEvent) -> None:
306
+ """Override the Qt close event"""
307
+ if self.isEnabled():
308
+ self.parUI.uiSliderTREE.selectionModel().selectionChanged.disconnect(
309
+ self.populateWithCheck
310
+ )
311
+ super().closeEvent(event)
312
+
313
+ def populateWithUpdate(self) -> None:
314
+ """Populate the list from the main dialog selection"""
315
+ self.setSliders(self.parUI.uiSliderTREE.getSelectedItems(typ=Slider))
316
+ self._populate()
317
+
318
+ def populateWithoutUpdate(self) -> None:
319
+ """Populate the list and but don't look at the main dialog"""
320
+ self._populate()
321
+
322
+ def populateWithCheck(self) -> None:
323
+ """Populate the list from the main dialog selection, only if the AutoUpdate checkbox is checked"""
324
+ if self.uiAutoUpdateCHK.isChecked():
325
+ self.setSliders(self.parUI.uiSliderTREE.getSelectedItems(typ=Slider))
326
+ self._populate()
327
+
328
+ def _populate(self) -> None:
329
+ """Populate the list widgets in the UI"""
330
+ if self.parUI.simplex is None:
331
+ return
332
+
333
+ minDepth = self.uiMinLimitSPIN.value()
334
+ maxDepth = self.uiMaxLimitSPIN.value()
335
+ maxPoss = 100
336
+
337
+ root = self.uiEditTREE.invisibleRootItem()
338
+ lockDict = {}
339
+ sliderList = []
340
+ roles = [
341
+ Qt.ItemDataRole.UserRole,
342
+ Qt.ItemDataRole.UserRole,
343
+ Qt.ItemDataRole.UserRole,
344
+ Qt.ItemDataRole.EditRole,
345
+ ]
346
+
347
+ for row in range(root.childCount()):
348
+ item = root.child(row)
349
+ slider = item.data(0, Qt.ItemDataRole.UserRole)
350
+ if slider is not None:
351
+ sliderList.append(slider)
352
+ lv = [
353
+ item.data(col, roles[col])
354
+ for col in range(1, 4)
355
+ if item.checkState(col) == Qt.CheckState.Checked
356
+ ]
357
+ lockDict[slider] = lv
358
+
359
+ tooMany, toAdd = buildPossibleCombos(
360
+ self.parUI.simplex,
361
+ sliderList,
362
+ minDepth,
363
+ maxDepth,
364
+ lockDict=lockDict,
365
+ maxPoss=maxPoss,
366
+ )
367
+
368
+ lbl = f"Too many possibilities. Limiting to {maxPoss}" if tooMany else ""
369
+ self.uiWarningLBL.setText(lbl)
370
+
371
+ self.uiComboCheckLIST.clear()
372
+ for pairs, combo in reversed(toAdd):
373
+ item = ComboCheckItem(pairs, combo)
374
+ self.uiComboCheckLIST.addItem(item)
375
+
376
+ if self.mode == "create":
377
+ if self.uiComboCheckLIST.count() > 0:
378
+ self.uiComboCheckLIST.item(0).setSelected(True)
379
+
380
+ def createMissing(self) -> None:
381
+ """Create selected combos if they don't already exist"""
382
+ simplex = self.parUI.simplex
383
+ created = []
384
+ for item in self.uiComboCheckLIST.selectedItems():
385
+ name = item.text()
386
+ sliders, vals = list(zip(*item.pairs))
387
+ # Double check that the user didn't create any extra sliders
388
+ if Combo.comboAlreadyExists(simplex, sliders, vals) is None:
389
+ c = Combo.createCombo(name, simplex, sliders, vals)
390
+ created.append(c)
391
+
392
+ self.parUI.uiComboTREE.setItemSelection(created)
393
+ if self.mode == "create":
394
+ self.close()
395
+ else:
396
+ 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/>.