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,334 @@
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 enum import Enum
20
+
21
+ from Qt.QtCore import QEvent, QObject, QPoint, QRect, Qt, Signal
22
+ from Qt.QtGui import QCursor, QGuiApplication, QMouseEvent
23
+ from Qt.QtWidgets import QApplication, QWidget
24
+
25
+
26
+ class DragType(Enum):
27
+ DRAG_NONE = 0
28
+ DRAG_HORIZONTAL = 1
29
+ DRAG_VERTICAL = 2
30
+
31
+
32
+ class DragCursor(Enum):
33
+ CURSOR_NONE = 0
34
+ CURSOR_BLANK = 1
35
+ CURSOR_ARROWS = 2
36
+
37
+
38
+ class DragFilter(QObject):
39
+ """Drag Event Filter
40
+
41
+ This class provides an event filter that can be installed
42
+ on a Qt Widget to take click/drag events and give them slider
43
+ type interaction.
44
+
45
+ Signals:
46
+ dragPressed = Signal()
47
+ Emitted when the drag passes the startSensitivity
48
+ dragTick (int, float):
49
+ NumberOfTicks, TickMultiplier
50
+ Emitted after dragPressed every time the drag passes dragSensitivity
51
+ dragReleased = Signal()
52
+ Emitted when the mouse is released after dragPressed
53
+
54
+ Instance Options:
55
+ dragSensitivity(int): default=5
56
+ The number of pixels the cursor has to travel to emit a tick
57
+ startSensitivity(int): default=10
58
+ The number of pixels the cursor has to travel to enter into drag mode
59
+ cursorLock(bool): default=False
60
+ Whether the cursor returns to its start position every tick
61
+ wrapBoundary(int): default=10
62
+ When wrapping around the current screen, this is the number of pixels
63
+ in from the edge of the screen that the cursor will appear
64
+ dragCursor(int): default=self.CURSOR_ARROWS
65
+ The cursor that will be displayed while dragging
66
+ CURSOR_ARROWS will show horizontal/vertical drag
67
+ CURSOR_BLANK will hid the cursor
68
+ dragButton(Qt.MouseButton): default=Qt.MouseButton.MiddleButton
69
+ The button that will kick off the drag behavior
70
+ fastModifier(Qt.KeyboardModifier): default=Qt.KeyboardModifier.ControlModifier
71
+ The modifier key that will cause the multiplier to emit with the signal
72
+ fastMultiplier(float): default=5.0
73
+ The size of the multiplier
74
+ slowModifier(Qt.KeyboardModifier): default=Qt.KeyboardModifier.ShiftModifier
75
+ The modifier key that will cause the divisor to emit with the signal
76
+ slowDivisor(float): default=5.0
77
+ The size of the divisor
78
+ isSpinbox(bool): default=False
79
+ This must be set to True if you are setting this as the handler
80
+ for a QSpinBox. The QSpinBox will tick every 0.25s as long as your mouse is
81
+ held down. This option turns that off
82
+ """
83
+
84
+ DRAG_ENABLED: int = 0
85
+
86
+ dragTick: Signal = Signal(int, float) # NumberOfTicks, TickMultiplier
87
+ dragPressed: Signal = Signal()
88
+ dragReleased: Signal = Signal()
89
+
90
+ def __init__(self, parent: QWidget | None) -> None:
91
+ self._parent: QWidget | None = parent # Hold onto this to keep the qwidget type
92
+ super().__init__(parent)
93
+
94
+ self.dragSensitivity: int = 5 # pixels for one step
95
+ self.startSensitivity: int = 10 # pixel move to start the dragging
96
+ self.cursorLock: bool = False
97
+ self.wrapBoundary: int = 10 # wrap when within boundary of screen edge
98
+ self.dragCursor: DragCursor = DragCursor.CURSOR_ARROWS
99
+ self.dragButton: Qt.MouseButton = Qt.MouseButton.MiddleButton
100
+
101
+ # The QSpinbox has an option where, if you hold down the mouse button
102
+ # it will continually increment. This flag enables a workaround
103
+ # for that problem
104
+ self.isSpinbox: bool = False
105
+
106
+ self.fastModifier: Qt.KeyboardModifier = Qt.KeyboardModifier.ControlModifier
107
+ self.slowModifier: Qt.KeyboardModifier = Qt.KeyboardModifier.ShiftModifier
108
+
109
+ self.fastMultiplier: float = 5.0
110
+ self.slowDivisor: float = 5.0
111
+
112
+ # private vars
113
+ self._lastPos: QPoint | None = None
114
+ self._leftover: float = 0.0
115
+ self._dragStart: QPoint | None = None
116
+ self._firstDrag: bool = False
117
+ self._dragType: DragType = DragType.DRAG_NONE
118
+ self._overridden: bool = False
119
+ self._screen: QRect | None = None
120
+ self._isDragging: bool = False
121
+
122
+ def doOverrideCursor(self) -> None:
123
+ """Change the cursor based on the current drag type"""
124
+ if self._overridden:
125
+ return
126
+ if self.dragCursor == DragCursor.CURSOR_BLANK:
127
+ QApplication.setOverrideCursor(Qt.CursorShape.BlankCursor)
128
+ elif self.dragCursor == DragCursor.CURSOR_ARROWS:
129
+ if self._dragType == DragType.DRAG_VERTICAL:
130
+ QApplication.setOverrideCursor(Qt.CursorShape.SizeVerCursor)
131
+ elif self._dragType == DragType.DRAG_HORIZONTAL:
132
+ QApplication.setOverrideCursor(Qt.CursorShape.SizeHorCursor)
133
+
134
+ self._overridden = True
135
+
136
+ def restoreOverrideCursor(self) -> None:
137
+ """Restore the cursor to the normal pointer"""
138
+ if not self._overridden:
139
+ return
140
+ QApplication.restoreOverrideCursor()
141
+ self._overridden = False
142
+
143
+ def doDrag(self, o: QObject, e: QMouseEvent) -> None:
144
+ """Handle a mouse drag event
145
+
146
+ Parameters
147
+ ----------
148
+ o : QObject
149
+ The object that is being dragged
150
+ e : QEvent
151
+ The QEvent of the mouse drag
152
+ """
153
+ delta = 0.0
154
+ epos = e.position().toPoint()
155
+
156
+ if self._lastPos is not None:
157
+ if self._dragType == DragType.DRAG_HORIZONTAL:
158
+ delta = epos.x() - self._lastPos.x()
159
+ else:
160
+ delta = self._lastPos.y() - epos.y()
161
+
162
+ self._leftover += delta
163
+ self._lastPos = epos
164
+
165
+ count = int(self._leftover / self.dragSensitivity)
166
+ if count:
167
+ mul = 1.0
168
+ if e.modifiers() & self.fastModifier:
169
+ mul = self.fastMultiplier
170
+ elif e.modifiers() & self.slowModifier:
171
+ mul = 1.0 / self.slowDivisor
172
+ self.dragTick.emit(count, mul)
173
+
174
+ # If we start off with negative leftover, then this modulo
175
+ # needs to return negative leftover steps
176
+ neg = self._leftover < 0
177
+ self._leftover %= self.dragSensitivity
178
+ if neg and self._leftover > 0:
179
+ self._leftover -= self.dragSensitivity
180
+
181
+ if self.cursorLock:
182
+ if self._dragStart is not None and self._parent is not None:
183
+ QCursor.setPos(self._parent.mapToGlobal(self._dragStart))
184
+ self._lastPos = self._dragStart
185
+ else:
186
+ if self._screen is None:
187
+ raise RuntimeError("Could not determine screen")
188
+ r = self._screen
189
+ b = self.wrapBoundary
190
+ p = e.globalPosition().toPoint()
191
+
192
+ # when wrapping move to the other side in by 2*boundary
193
+ # so we don't loop the wrapping
194
+ if p.x() > r.right() - b:
195
+ p.setX(r.left() + 2 * b)
196
+
197
+ if p.x() < r.left() + b:
198
+ p.setX(r.right() - 2 * b)
199
+
200
+ if p.y() > r.bottom() - b:
201
+ p.setY(r.top() + 2 * b)
202
+
203
+ if p.y() < r.top() + b:
204
+ p.setY(r.bottom() - 2 * b)
205
+
206
+ if p != e.globalPosition().toPoint():
207
+ QCursor.setPos(p)
208
+ self._leftover = 0
209
+ par = self._parent
210
+ if par is not None:
211
+ self._lastPos = par.mapFromGlobal(p)
212
+ else:
213
+ self._lastPos = None
214
+
215
+ def getCurrentScreen(self, o: QObject, global_pos: QPoint) -> QRect:
216
+ screen = QGuiApplication.screenAt(global_pos)
217
+ if screen is None:
218
+ if self._parent is not None:
219
+ screen = self._parent.windowHandle().screen()
220
+ else:
221
+ screen = QGuiApplication.primaryScreen()
222
+ self._screen = screen.availableGeometry()
223
+ return self._screen
224
+
225
+ def startDrag(self, o: QObject, e: QMouseEvent) -> None:
226
+ """Start the drag event handling
227
+
228
+ Parameters
229
+ ----------
230
+ o : QObject
231
+ The object that is being dragged
232
+ e : QEvent
233
+ The QEvent of the mouse drag
234
+ """
235
+
236
+ epos = e.position().toPoint()
237
+ if self._dragStart is None:
238
+ self._dragStart = epos
239
+ global_pos = e.globalPosition().toPoint()
240
+ self.getCurrentScreen(o, global_pos)
241
+
242
+ if abs(epos.x() - self._dragStart.x()) > self.startSensitivity:
243
+ self._dragType = DragType.DRAG_HORIZONTAL
244
+ elif abs(epos.y() - self._dragStart.y()) > self.startSensitivity:
245
+ self._dragType = DragType.DRAG_VERTICAL
246
+
247
+ if self._dragType:
248
+ self._leftover = 0
249
+ self._firstDrag = True
250
+
251
+ self.dragPressed.emit()
252
+ self.doOverrideCursor()
253
+
254
+ if self.isSpinbox and (e.buttons() & self.dragButton):
255
+ # Send mouseRelease to spin buttons when dragging
256
+ # otherwise the spinbox will keep ticking. @longClickFix
257
+ # There's gotta be a better way to do this :-/
258
+ mouseup = QMouseEvent(
259
+ QEvent.Type.MouseButtonRelease,
260
+ epos,
261
+ self.dragButton,
262
+ e.buttons(),
263
+ e.modifiers(),
264
+ )
265
+ QApplication.sendEvent(o, mouseup)
266
+
267
+ def myendDrag(self, o: QObject, e: QMouseEvent) -> None:
268
+ """End the drag event handling. Can't call it endDrag because that's taken
269
+
270
+ Parameters
271
+ ----------
272
+ o : QObject
273
+ The object that is being dragged
274
+ e : QEvent
275
+ The QEvent of the mouse drag
276
+ """
277
+
278
+ # Only end dragging if it's *not* the first mouse release. See @longClickFix
279
+ if self._firstDrag and self.isSpinbox:
280
+ self._firstDrag = False
281
+
282
+ elif self._dragType:
283
+ self.restoreOverrideCursor()
284
+ self._dragType = DragType.DRAG_NONE
285
+ self._lastPos = None
286
+ self._dragStart = None
287
+ self._screen = None
288
+ self.dragReleased.emit()
289
+
290
+ def eventFilter(self, o: QObject, e: QEvent) -> bool:
291
+ """Overridden Qt eventFilter
292
+
293
+ Parameters
294
+ ----------
295
+ o : QObject
296
+ The object that is being dragged
297
+ e : QEvent
298
+ The QEvent of the mouse drag
299
+ """
300
+
301
+ # Qt keeps references around and I don't know how to properly remove them
302
+ # so If I don't do this check for DRAG_ENABLED then
303
+ # Qt starts throwing errors when the UI gets deleted
304
+ if hasattr(self, "DRAG_ENABLED"):
305
+ if e.type() == QEvent.Type.MouseMove:
306
+ assert isinstance(e, QMouseEvent)
307
+ if self._isDragging:
308
+ try:
309
+ if self._dragType != DragType.DRAG_NONE:
310
+ self.doDrag(o, e)
311
+ elif e.buttons() & self.dragButton:
312
+ self.startDrag(o, e)
313
+ except Exception:
314
+ # fix the cursor if there's an error during dragging
315
+ self.restoreOverrideCursor()
316
+ raise # re-raise the exception
317
+ return True
318
+
319
+ elif e.type() == QEvent.Type.MouseButtonRelease:
320
+ assert isinstance(e, QMouseEvent)
321
+ self.myendDrag(o, e)
322
+ if e.button() & self.dragButton:
323
+ # Catch any dragbutton releases and handle them
324
+ self._isDragging = False
325
+ return True
326
+
327
+ elif e.type() == QEvent.Type.MouseButtonPress:
328
+ assert isinstance(e, QMouseEvent)
329
+ if e.button() & self.dragButton:
330
+ # Catch any dragbutton presses and handle them
331
+ self._isDragging = True
332
+ return True
333
+
334
+ return super().eventFilter(o, e)