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