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