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.
- simplex_solver-3.2.2.dist-info/DELVEWHEEL +2 -0
- simplex_solver-3.2.2.dist-info/METADATA +94 -0
- simplex_solver-3.2.2.dist-info/RECORD +84 -0
- simplex_solver-3.2.2.dist-info/WHEEL +5 -0
- simplex_solver.libs/.load-order-simplex_solver-3.2.2 +1 -0
- simplex_solver.libs/msvcp140-a4c2229bdc2a2a630acdc095b4d86008.dll +0 -0
- simplexui/__init__.py +86 -0
- simplexui/_version.py +1 -0
- simplexui/channelBox.py +867 -0
- simplexui/comboCheckDialog.py +396 -0
- simplexui/commands/__init__.py +16 -0
- simplexui/commands/alembicCommon.py +1148 -0
- simplexui/commands/alembic_walker.py +299 -0
- simplexui/commands/applyCorrectives.py +452 -0
- simplexui/commands/correctiveInterface.py +259 -0
- simplexui/commands/expandedExport.py +434 -0
- simplexui/commands/hdf5Convert.py +62 -0
- simplexui/commands/mayaCorrectiveInterface.py +159 -0
- simplexui/commands/mayatonumpy.py +416 -0
- simplexui/commands/mesh.py +1085 -0
- simplexui/commands/poseblendlib.py +168 -0
- simplexui/commands/reorderSimplexPoints.py +102 -0
- simplexui/commands/replaceDefinitionJson.py +74 -0
- simplexui/commands/rigidAlign.py +97 -0
- simplexui/commands/unsubdivide.py +1222 -0
- simplexui/commands/uvTransfer.py +976 -0
- simplexui/dragFilter.py +334 -0
- simplexui/falloffDialog.py +504 -0
- simplexui/img/ChefHead.png +0 -0
- simplexui/img/frozen.png +0 -0
- simplexui/interface/__init__.py +30 -0
- simplexui/interface/dummyInterface.py +1313 -0
- simplexui/interface/mayaInterface.py +2294 -0
- simplexui/interfaceModel.py +655 -0
- simplexui/interfaceModelTrees.py +456 -0
- simplexui/items/__init__.py +50 -0
- simplexui/items/accessor.py +145 -0
- simplexui/items/combo.py +645 -0
- simplexui/items/dragItem.py +44 -0
- simplexui/items/falloff.py +748 -0
- simplexui/items/group.py +267 -0
- simplexui/items/progression.py +613 -0
- simplexui/items/shape.py +384 -0
- simplexui/items/simplex.py +1734 -0
- simplexui/items/slider.py +632 -0
- simplexui/items/stack.py +147 -0
- simplexui/items/traversal.py +780 -0
- simplexui/items/treeItem.py +441 -0
- simplexui/main.pyw +22 -0
- simplexui/menu/__init__.py +73 -0
- simplexui/menu/dummyPlugins/__init__.py +16 -0
- simplexui/menu/genericPlugins/__init__.py +16 -0
- simplexui/menu/genericPlugins/_builtins.py +270 -0
- simplexui/menu/genericPlugins/checkPossibleCombos.py +48 -0
- simplexui/menu/genericPlugins/exportSplit.py +67 -0
- simplexui/menu/genericPlugins/showFalloffs.py +26 -0
- simplexui/menu/genericPlugins/showTraversals.py +26 -0
- simplexui/menu/genericPlugins/simplexUvTransfer.py +106 -0
- simplexui/menu/genericPlugins/unsubdivide.py +72 -0
- simplexui/menu/mayaPlugins/__init__.py +16 -0
- simplexui/menu/mayaPlugins/exportOther.py +53 -0
- simplexui/menu/mayaPlugins/extractProgressives.py +68 -0
- simplexui/menu/mayaPlugins/freezeCombo.py +247 -0
- simplexui/menu/mayaPlugins/generateShapeIncrementals.py +99 -0
- simplexui/menu/mayaPlugins/importObjs.py +199 -0
- simplexui/menu/mayaPlugins/linearizeTraversal.py +60 -0
- simplexui/menu/mayaPlugins/makeShelfBtn.py +67 -0
- simplexui/menu/mayaPlugins/relaxToSelection.py +76 -0
- simplexui/menu/mayaPlugins/reloadDefinition.py +44 -0
- simplexui/menu/mayaPlugins/snapToNeutral.py +71 -0
- simplexui/menu/mayaPlugins/softSelectToCluster.py +201 -0
- simplexui/menu/mayaPlugins/tweakMix.py +136 -0
- simplexui/menu/mayaPlugins/updateRestShape.py +113 -0
- simplexui/pysimplex.lib +0 -0
- simplexui/pysimplex.pyd +0 -0
- simplexui/simplexDialog.py +1547 -0
- simplexui/travCheckDialog.py +419 -0
- simplexui/traversalDialog.py +299 -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 +307 -0
simplexui/utils.py
ADDED
|
@@ -0,0 +1,307 @@
|
|
|
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
|
+
"""Utility functions."""
|
|
19
|
+
|
|
20
|
+
from __future__ import annotations
|
|
21
|
+
|
|
22
|
+
import os
|
|
23
|
+
import re
|
|
24
|
+
import sys
|
|
25
|
+
from typing import Any, Callable, Sequence, TypeVar, cast
|
|
26
|
+
|
|
27
|
+
from Qt import IsPyQt6, IsPySide6
|
|
28
|
+
from Qt.QtCore import QObject, QPoint, QSettings, QTimer
|
|
29
|
+
from Qt.QtGui import QIcon
|
|
30
|
+
from Qt.QtWidgets import QMenu
|
|
31
|
+
|
|
32
|
+
AT_BLUR = os.environ.get("SIMPLEX_AT_BLUR") == "true"
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def execmenu(act: QMenu, pos: QPoint) -> None:
|
|
36
|
+
if IsPySide6 or IsPyQt6:
|
|
37
|
+
act.exec(pos)
|
|
38
|
+
else:
|
|
39
|
+
act.exec_()
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def execwid(wid) -> None:
|
|
43
|
+
if IsPySide6 or IsPyQt6:
|
|
44
|
+
wid.exec()
|
|
45
|
+
else:
|
|
46
|
+
wid.exec_()
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def getUiFile(fileVar: str, subFolder: str = "ui", uiName: str | None = None) -> str:
|
|
50
|
+
"""Get the path to the .ui file
|
|
51
|
+
|
|
52
|
+
Parameters
|
|
53
|
+
----------
|
|
54
|
+
fileVar : str
|
|
55
|
+
The __file__ variable passed from the invocation
|
|
56
|
+
subFolder : str
|
|
57
|
+
The folder to look in for the ui files. Defaults to 'ui'
|
|
58
|
+
uiName : str or None
|
|
59
|
+
The name of the .ui file. Defaults to the basename of
|
|
60
|
+
fileVar with .ui instead of .py
|
|
61
|
+
|
|
62
|
+
Returns
|
|
63
|
+
-------
|
|
64
|
+
str
|
|
65
|
+
The path to the .ui file
|
|
66
|
+
"""
|
|
67
|
+
uiFolder, filename = os.path.split(fileVar)
|
|
68
|
+
if uiName is None:
|
|
69
|
+
uiName = os.path.splitext(filename)[0]
|
|
70
|
+
if not subFolder:
|
|
71
|
+
raise ValueError("A subfolder must be provided")
|
|
72
|
+
uiFile = os.path.join(uiFolder, subFolder, uiName + ".ui")
|
|
73
|
+
return uiFile
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def getNextName(name: str, currentNames: Sequence[str]) -> str:
|
|
77
|
+
"""Get the next available number-incremented name
|
|
78
|
+
|
|
79
|
+
Parameters
|
|
80
|
+
----------
|
|
81
|
+
name : str
|
|
82
|
+
The name I want to check
|
|
83
|
+
currentNames : list
|
|
84
|
+
The names that currently exist
|
|
85
|
+
|
|
86
|
+
Returns
|
|
87
|
+
-------
|
|
88
|
+
str
|
|
89
|
+
The next available number-incremented name
|
|
90
|
+
"""
|
|
91
|
+
i = 0
|
|
92
|
+
s = set(currentNames)
|
|
93
|
+
while True:
|
|
94
|
+
if not i:
|
|
95
|
+
nn = name
|
|
96
|
+
else:
|
|
97
|
+
nn = name + str(i)
|
|
98
|
+
if nn not in s:
|
|
99
|
+
return nn
|
|
100
|
+
i += 1
|
|
101
|
+
return name
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def clearPathSymbols(paths: list[str], keepers: list[str] | None = None) -> None:
|
|
105
|
+
"""Removes path symbols from the environment.
|
|
106
|
+
|
|
107
|
+
This means I can unload my tools from the current process and re-import them
|
|
108
|
+
rather than dealing with the always finicky reload()
|
|
109
|
+
|
|
110
|
+
We use directory paths rather than module names because it gives us more control
|
|
111
|
+
over what is unloaded
|
|
112
|
+
|
|
113
|
+
Parameters
|
|
114
|
+
----------
|
|
115
|
+
paths : list
|
|
116
|
+
List of directory paths that will have their modules removed
|
|
117
|
+
keepers : list or None
|
|
118
|
+
List of module names that will not be removed (Default value = None)
|
|
119
|
+
"""
|
|
120
|
+
keepers = keepers or []
|
|
121
|
+
paths = [os.path.normcase(os.path.normpath(p)) for p in paths]
|
|
122
|
+
|
|
123
|
+
for key, value in sys.modules.items():
|
|
124
|
+
protected = False
|
|
125
|
+
|
|
126
|
+
# Used by multiprocessing library, don't remove this.
|
|
127
|
+
if key == "__parents_main__":
|
|
128
|
+
protected = True
|
|
129
|
+
|
|
130
|
+
# Protect submodules of protected packages
|
|
131
|
+
if key in keepers:
|
|
132
|
+
protected = True
|
|
133
|
+
|
|
134
|
+
ckey = key
|
|
135
|
+
while not protected and "." in ckey:
|
|
136
|
+
ckey = ckey.rsplit(".", 1)[0]
|
|
137
|
+
if ckey in keepers:
|
|
138
|
+
protected = True
|
|
139
|
+
|
|
140
|
+
if protected:
|
|
141
|
+
continue
|
|
142
|
+
|
|
143
|
+
try:
|
|
144
|
+
packPath = value.__file__
|
|
145
|
+
except AttributeError:
|
|
146
|
+
continue
|
|
147
|
+
if packPath is None:
|
|
148
|
+
continue
|
|
149
|
+
|
|
150
|
+
packPath = os.path.normcase(os.path.normpath(packPath))
|
|
151
|
+
|
|
152
|
+
isEnvPackage = any(packPath.startswith(p) for p in paths)
|
|
153
|
+
if isEnvPackage:
|
|
154
|
+
sys.modules.pop(key)
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
def caseSplit(name: str) -> list[str]:
|
|
158
|
+
"""Split CamelCase and dromedaryCase words
|
|
159
|
+
Taken From https://stackoverflow.com/questions/29916065/how-to-do-camelcase-split-in-python
|
|
160
|
+
|
|
161
|
+
Parameters
|
|
162
|
+
----------
|
|
163
|
+
name : str
|
|
164
|
+
The string to split
|
|
165
|
+
|
|
166
|
+
Returns
|
|
167
|
+
-------
|
|
168
|
+
list
|
|
169
|
+
The split string
|
|
170
|
+
"""
|
|
171
|
+
matches = re.finditer(".+?(?:(?<=[a-z])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])|$)", name)
|
|
172
|
+
return [m.group(0) for m in matches]
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
F = TypeVar('F', bound=Callable)
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
class singleShot(QObject):
|
|
179
|
+
"""Decorator class used to implement a QTimer.singleShot(0, function)
|
|
180
|
+
|
|
181
|
+
This is useful so your refresh function only gets called once even if
|
|
182
|
+
its connected to a signal that gets emitted several times at once.
|
|
183
|
+
|
|
184
|
+
Note:
|
|
185
|
+
The values passed to the decorated method will be accumulated
|
|
186
|
+
and run all at once, then reset for the next go-round
|
|
187
|
+
|
|
188
|
+
From the Qt Docs:
|
|
189
|
+
As a special case, a QTimer with a timeout of 0 will time out as
|
|
190
|
+
soon as all the events in the window system's event queue have
|
|
191
|
+
been processed. This can be used to do heavy work while providing
|
|
192
|
+
a snappy user interface
|
|
193
|
+
"""
|
|
194
|
+
|
|
195
|
+
def __init__(self) -> None:
|
|
196
|
+
super().__init__()
|
|
197
|
+
self._function: Callable | None = None
|
|
198
|
+
self._callScheduled: bool = False
|
|
199
|
+
self._args = []
|
|
200
|
+
self._inst = None
|
|
201
|
+
|
|
202
|
+
def __call__(self, function: F) -> F:
|
|
203
|
+
self._function = function
|
|
204
|
+
|
|
205
|
+
def newFunction(inst, *args) -> None:
|
|
206
|
+
self._args.extend(args)
|
|
207
|
+
self._args = makeUnique(self._args)
|
|
208
|
+
if not self._callScheduled:
|
|
209
|
+
self._inst = inst
|
|
210
|
+
self._callScheduled = True
|
|
211
|
+
QTimer.singleShot(0, self.callback)
|
|
212
|
+
|
|
213
|
+
newFunction.__name__ = function.__name__
|
|
214
|
+
newFunction.__doc__ = function.__doc__
|
|
215
|
+
|
|
216
|
+
# 'cast' tricks the typechecker into preserving exact types, docstrings,
|
|
217
|
+
# and autocomplete features for the caller
|
|
218
|
+
return cast(F, newFunction)
|
|
219
|
+
|
|
220
|
+
def callback(self) -> None:
|
|
221
|
+
"""Calls the decorated function and resets singleShot for the next group of calls"""
|
|
222
|
+
self._callScheduled = False
|
|
223
|
+
# self._args needs to be cleared before we call self._function
|
|
224
|
+
args = self._args
|
|
225
|
+
inst = self._inst
|
|
226
|
+
self._inst = None
|
|
227
|
+
self._args = []
|
|
228
|
+
if self._function is not None:
|
|
229
|
+
self._function(inst, *args)
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
T = TypeVar('T')
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
def makeUnique(seq: Sequence[T]) -> Sequence[T]:
|
|
236
|
+
"""Make a sequence unique, keeping the first time each item is seen
|
|
237
|
+
|
|
238
|
+
Parameters
|
|
239
|
+
----------
|
|
240
|
+
seq : list or tuple
|
|
241
|
+
A python sequence
|
|
242
|
+
|
|
243
|
+
Returns
|
|
244
|
+
-------
|
|
245
|
+
list
|
|
246
|
+
A list with unique items
|
|
247
|
+
"""
|
|
248
|
+
seen = set()
|
|
249
|
+
seen_add = seen.add # only resolve the method lookup once
|
|
250
|
+
return [x for x in seq if not (x in seen or seen_add(x))]
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
def naturalSortKey(
|
|
254
|
+
s: str, _nsre: re.Pattern[str] = re.compile("([0-9]+)")
|
|
255
|
+
) -> list[str | int]:
|
|
256
|
+
"""Get a sort key that puts strings with numbers in numerical order
|
|
257
|
+
This is accomplished by splitting the string into groups of digits, and non-digits,
|
|
258
|
+
then converting the digit groups into integers.
|
|
259
|
+
|
|
260
|
+
Parameters
|
|
261
|
+
----------
|
|
262
|
+
s : str
|
|
263
|
+
The string to get the key for
|
|
264
|
+
_nsre :
|
|
265
|
+
A hack argument to hold the compiled regex
|
|
266
|
+
|
|
267
|
+
Returns
|
|
268
|
+
-------
|
|
269
|
+
list
|
|
270
|
+
A list containing both strings and integers.
|
|
271
|
+
"""
|
|
272
|
+
return [int(text) if text.isdigit() else text.lower() for text in _nsre.split(s)]
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
def getIcon(iconName: str) -> QIcon:
|
|
276
|
+
path = os.path.join(os.path.dirname(__file__), "img", iconName)
|
|
277
|
+
return QIcon(path)
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
class Prefs:
|
|
281
|
+
"""A wrapper for reading/writing prefs both internal and external to blur"""
|
|
282
|
+
|
|
283
|
+
def __init__(self) -> None:
|
|
284
|
+
if AT_BLUR:
|
|
285
|
+
import blurdev.prefs
|
|
286
|
+
|
|
287
|
+
self._pref = blurdev.prefs.find("tools/simplex3")
|
|
288
|
+
else:
|
|
289
|
+
self._pref = QSettings("Blur", "Simplex3")
|
|
290
|
+
|
|
291
|
+
def restoreProperty(self, prop: str, default: str | None = None) -> Any:
|
|
292
|
+
if isinstance(self._pref, QSettings):
|
|
293
|
+
return self._pref.value(prop, default)
|
|
294
|
+
else:
|
|
295
|
+
return self._pref.restoreProperty(prop, default)
|
|
296
|
+
|
|
297
|
+
def recordProperty(self, prop: str, val: Any) -> None:
|
|
298
|
+
if isinstance(self._pref, QSettings):
|
|
299
|
+
self._pref.setValue(prop, val)
|
|
300
|
+
else:
|
|
301
|
+
self._pref.recordProperty(prop, val)
|
|
302
|
+
|
|
303
|
+
def save(self) -> None:
|
|
304
|
+
if isinstance(self._pref, QSettings):
|
|
305
|
+
self._pref.sync()
|
|
306
|
+
else:
|
|
307
|
+
self._pref.save()
|