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
|
@@ -0,0 +1,504 @@
|
|
|
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
|
+
# This module imports QT from PyQt4, PySide or PySide2
|
|
19
|
+
# Depending on what's available
|
|
20
|
+
from __future__ import annotations
|
|
21
|
+
|
|
22
|
+
from typing import TYPE_CHECKING
|
|
23
|
+
|
|
24
|
+
from Qt import QtCompat
|
|
25
|
+
from Qt.QtCore import (
|
|
26
|
+
QByteArray,
|
|
27
|
+
QLineF,
|
|
28
|
+
QPoint,
|
|
29
|
+
QPointF,
|
|
30
|
+
QRectF,
|
|
31
|
+
Qt,
|
|
32
|
+
Signal,
|
|
33
|
+
)
|
|
34
|
+
from Qt.QtGui import (
|
|
35
|
+
QBrush,
|
|
36
|
+
QColor,
|
|
37
|
+
QHideEvent,
|
|
38
|
+
QMouseEvent,
|
|
39
|
+
QPainter,
|
|
40
|
+
QPainterPath,
|
|
41
|
+
QPaintEvent,
|
|
42
|
+
QPalette,
|
|
43
|
+
QPen,
|
|
44
|
+
QShowEvent,
|
|
45
|
+
)
|
|
46
|
+
from Qt.QtWidgets import (
|
|
47
|
+
QComboBox,
|
|
48
|
+
QDataWidgetMapper,
|
|
49
|
+
QDialog,
|
|
50
|
+
QDoubleSpinBox,
|
|
51
|
+
QGroupBox,
|
|
52
|
+
QInputDialog,
|
|
53
|
+
QLabel,
|
|
54
|
+
QMessageBox,
|
|
55
|
+
QPushButton,
|
|
56
|
+
QSizePolicy,
|
|
57
|
+
QVBoxLayout,
|
|
58
|
+
QWidget,
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
from .interfaceModel import FalloffDataModel
|
|
62
|
+
from .items.falloff import PlanarFalloff
|
|
63
|
+
from .utils import Prefs, getNextName, getUiFile
|
|
64
|
+
|
|
65
|
+
if TYPE_CHECKING:
|
|
66
|
+
from .items import Simplex
|
|
67
|
+
from .simplexDialog import SimplexDialog
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
class CurveEditWidget(QWidget):
|
|
71
|
+
tangentUpdated = Signal(float, float)
|
|
72
|
+
|
|
73
|
+
def __init__(self, parent: QWidget | None) -> None:
|
|
74
|
+
super().__init__(parent)
|
|
75
|
+
self.leftTan: float | None = None
|
|
76
|
+
self.rightTan: float | None = None
|
|
77
|
+
self._controlPoints: list[QPointF] = [
|
|
78
|
+
QPointF(0, 1),
|
|
79
|
+
QPointF(0, 1),
|
|
80
|
+
QPointF(1, 0),
|
|
81
|
+
QPointF(1, 0),
|
|
82
|
+
]
|
|
83
|
+
self.setTangent(leftTan=1 / 3.0, rightTan=2 / 3.0)
|
|
84
|
+
|
|
85
|
+
self._activeControlPoint: int | None = None
|
|
86
|
+
self.mouseDrag: bool = False
|
|
87
|
+
self.mousePress: QPoint = QPoint()
|
|
88
|
+
self.startDragDistance: int = 20
|
|
89
|
+
|
|
90
|
+
self.canvasMargin: int = 16
|
|
91
|
+
self.setMinimumHeight(2 * self.canvasMargin)
|
|
92
|
+
|
|
93
|
+
self.bgColor: Qt.GlobalColor = Qt.GlobalColor.white
|
|
94
|
+
self.lineColor: Qt.GlobalColor = Qt.GlobalColor.black
|
|
95
|
+
self.limitColor: Qt.GlobalColor = Qt.GlobalColor.gray
|
|
96
|
+
|
|
97
|
+
def setTangent(
|
|
98
|
+
self, leftTan: float | None = None, rightTan: float | None = None
|
|
99
|
+
) -> None:
|
|
100
|
+
"""Set the falloff tangents, clamped 0 to 1
|
|
101
|
+
|
|
102
|
+
Parameters
|
|
103
|
+
----------
|
|
104
|
+
leftTan : float
|
|
105
|
+
The x-value of the left tangent point
|
|
106
|
+
rightTan : float
|
|
107
|
+
The x-value of the right tangent point
|
|
108
|
+
"""
|
|
109
|
+
if leftTan is not None:
|
|
110
|
+
self.leftTan = max(min(leftTan, 1.0), 0.0)
|
|
111
|
+
self._controlPoints[1] = QPointF(self.leftTan, 1)
|
|
112
|
+
if rightTan is not None:
|
|
113
|
+
self.rightTan = max(min(rightTan, 1.0), 0.0)
|
|
114
|
+
self._controlPoints[2] = QPointF(self.rightTan, 0)
|
|
115
|
+
self.update()
|
|
116
|
+
|
|
117
|
+
def mapToCanvas(self, point: QPointF) -> QPointF:
|
|
118
|
+
"""Map a point from widget space to canvas space
|
|
119
|
+
The "canvas" is a 0-1 parameterized space, centered in the widget
|
|
120
|
+
The size of the canvas relative to the widget is dictated by the canvasMargin
|
|
121
|
+
|
|
122
|
+
Parameters
|
|
123
|
+
----------
|
|
124
|
+
point : QPointF
|
|
125
|
+
The point to map
|
|
126
|
+
|
|
127
|
+
Returns
|
|
128
|
+
-------
|
|
129
|
+
: QPointF
|
|
130
|
+
The mapped point
|
|
131
|
+
"""
|
|
132
|
+
canvasWidth = self.width() - 2 * self.canvasMargin
|
|
133
|
+
canvasHeight = self.height() - 2 * self.canvasMargin
|
|
134
|
+
|
|
135
|
+
x = point.x() * canvasWidth + self.canvasMargin
|
|
136
|
+
y = canvasHeight - point.y() * canvasHeight + self.canvasMargin
|
|
137
|
+
return QPointF(x, y)
|
|
138
|
+
|
|
139
|
+
def mapFromCanvas(self, point: QPointF) -> QPointF:
|
|
140
|
+
"""Map a point from canvas space to widget space
|
|
141
|
+
The "canvas" is a 0-1 parameterized space, centered in the widget
|
|
142
|
+
The size of the canvas relative to the widget is dictated by the canvasMargin
|
|
143
|
+
|
|
144
|
+
Parameters
|
|
145
|
+
----------
|
|
146
|
+
point : QPointF
|
|
147
|
+
The point to map
|
|
148
|
+
|
|
149
|
+
Returns
|
|
150
|
+
-------
|
|
151
|
+
: QPointF
|
|
152
|
+
The mapped point
|
|
153
|
+
"""
|
|
154
|
+
canvasWidth = self.width() - 2 * self.canvasMargin
|
|
155
|
+
canvasHeight = self.height() - 2 * self.canvasMargin
|
|
156
|
+
|
|
157
|
+
x = (point.x() - self.canvasMargin) / float(canvasWidth)
|
|
158
|
+
y = 1.0 - (point.y() - self.canvasMargin) / float(canvasHeight)
|
|
159
|
+
return QPointF(x, y)
|
|
160
|
+
|
|
161
|
+
def _drawCleanLine(self, painter: QPainter, p1: QPointF, p2: QPointF) -> None:
|
|
162
|
+
painter.drawLine(p1 + QPointF(0.5, 0.5), p2 + QPointF(0.5, 0.5))
|
|
163
|
+
|
|
164
|
+
def _paintBG(self, painter: QPainter) -> None:
|
|
165
|
+
painter.save()
|
|
166
|
+
painter.setBrush(self.palette().color(QPalette.ColorRole.Window))
|
|
167
|
+
painter.drawRect(0, 0, self.width(), self.height())
|
|
168
|
+
painter.restore()
|
|
169
|
+
|
|
170
|
+
def _paintLimits(self, painter: QPainter) -> None:
|
|
171
|
+
painter.save()
|
|
172
|
+
# pen = QPen(self.limitColor)
|
|
173
|
+
baseColor = self.palette().color(QPalette.ColorRole.Base)
|
|
174
|
+
pen = QPen(baseColor)
|
|
175
|
+
pen.setWidth(1)
|
|
176
|
+
pen.setStyle(Qt.PenStyle.DashLine)
|
|
177
|
+
painter.setPen(pen)
|
|
178
|
+
self._drawCleanLine(
|
|
179
|
+
painter, self.mapToCanvas(QPointF(0, 0)), self.mapToCanvas(QPointF(1, 0))
|
|
180
|
+
)
|
|
181
|
+
self._drawCleanLine(
|
|
182
|
+
painter, self.mapToCanvas(QPointF(0, 1)), self.mapToCanvas(QPointF(1, 1))
|
|
183
|
+
)
|
|
184
|
+
painter.restore()
|
|
185
|
+
|
|
186
|
+
def _paintPath(
|
|
187
|
+
self, painter: QPainter, p0: QPointF, p1: QPointF, p2: QPointF, p3: QPointF
|
|
188
|
+
) -> None:
|
|
189
|
+
painter.save()
|
|
190
|
+
path = QPainterPath()
|
|
191
|
+
path.moveTo(p0)
|
|
192
|
+
path.cubicTo(p1, p2, p3)
|
|
193
|
+
# painter.strokePath(path, QPen(QBrush(self.lineColor), 2))
|
|
194
|
+
foregroundColor = self.palette().color(QPalette.ColorRole.WindowText)
|
|
195
|
+
painter.strokePath(path, QPen(QBrush(foregroundColor), 2))
|
|
196
|
+
painter.restore()
|
|
197
|
+
|
|
198
|
+
def _paintTangents(
|
|
199
|
+
self, painter: QPainter, p0: QPointF, p1: QPointF, p2: QPointF, p3: QPointF
|
|
200
|
+
) -> None:
|
|
201
|
+
# draw the tangent lines
|
|
202
|
+
foregroundColor = self.palette().color(QPalette.ColorRole.WindowText)
|
|
203
|
+
pen = QPen(foregroundColor)
|
|
204
|
+
pen.setWidth(1)
|
|
205
|
+
pen.setStyle(Qt.PenStyle.DashLine)
|
|
206
|
+
painter.setPen(pen)
|
|
207
|
+
painter.drawLine(p0, p1)
|
|
208
|
+
painter.drawLine(p3, p2)
|
|
209
|
+
|
|
210
|
+
for i in range(len(self._controlPoints)):
|
|
211
|
+
online = self.indexIsRealPoint(i)
|
|
212
|
+
active = i == self._activeControlPoint
|
|
213
|
+
self.paintControlPoint(self._controlPoints[i], painter, online, active)
|
|
214
|
+
|
|
215
|
+
def paintEvent(self, e: QPaintEvent) -> None:
|
|
216
|
+
painter = QPainter(self)
|
|
217
|
+
painter.setRenderHint(QPainter.RenderHint.Antialiasing)
|
|
218
|
+
|
|
219
|
+
self._paintBG(painter)
|
|
220
|
+
self._paintLimits(painter)
|
|
221
|
+
|
|
222
|
+
# load the points
|
|
223
|
+
p0 = self.mapToCanvas(self._controlPoints[0])
|
|
224
|
+
p1 = self.mapToCanvas(self._controlPoints[1])
|
|
225
|
+
p2 = self.mapToCanvas(self._controlPoints[2])
|
|
226
|
+
p3 = self.mapToCanvas(self._controlPoints[3])
|
|
227
|
+
|
|
228
|
+
self._paintPath(painter, p0, p1, p2, p3)
|
|
229
|
+
self._paintTangents(painter, p0, p1, p2, p3)
|
|
230
|
+
|
|
231
|
+
def indexIsRealPoint(self, i: int) -> bool:
|
|
232
|
+
return (i % 3) == 0
|
|
233
|
+
|
|
234
|
+
def paintControlPoint(
|
|
235
|
+
self, point: QPointF, painter: QPainter, real: bool, active: bool
|
|
236
|
+
) -> None:
|
|
237
|
+
pointSize = 4
|
|
238
|
+
|
|
239
|
+
if real:
|
|
240
|
+
pointSize = 6
|
|
241
|
+
painter.setBrush(QColor(80, 80, 210, 150))
|
|
242
|
+
elif active:
|
|
243
|
+
painter.setBrush(QColor(140, 140, 240, 255))
|
|
244
|
+
else:
|
|
245
|
+
painter.setBrush(QColor(120, 120, 220, 255))
|
|
246
|
+
|
|
247
|
+
painter.setPen(QColor(50, 50, 50, 140))
|
|
248
|
+
|
|
249
|
+
painter.drawRect(
|
|
250
|
+
QRectF(
|
|
251
|
+
self.mapToCanvas(point).x() - pointSize + 0.5,
|
|
252
|
+
self.mapToCanvas(point).y() - pointSize + 0.5,
|
|
253
|
+
pointSize * 2,
|
|
254
|
+
pointSize * 2,
|
|
255
|
+
)
|
|
256
|
+
)
|
|
257
|
+
|
|
258
|
+
def findControlPoint(self, point: QPointF, tolerance: int = 10) -> int | None:
|
|
259
|
+
d = QLineF(self.mapToCanvas(self._controlPoints[1]), point).length()
|
|
260
|
+
if d < tolerance:
|
|
261
|
+
return 1
|
|
262
|
+
|
|
263
|
+
d = QLineF(self.mapToCanvas(self._controlPoints[2]), point).length()
|
|
264
|
+
if d < tolerance:
|
|
265
|
+
return 2
|
|
266
|
+
return None
|
|
267
|
+
|
|
268
|
+
def mousePressEvent(self, e: QMouseEvent) -> None:
|
|
269
|
+
if e.button() == Qt.MouseButton.LeftButton:
|
|
270
|
+
self._activeControlPoint = self.findControlPoint(e.position())
|
|
271
|
+
if self._activeControlPoint is not None:
|
|
272
|
+
self.mouseMoveEvent(e)
|
|
273
|
+
self.mousePress = e.pos()
|
|
274
|
+
e.accept()
|
|
275
|
+
|
|
276
|
+
def mouseReleaseEvent(self, e: QMouseEvent) -> None:
|
|
277
|
+
if e.button() == Qt.MouseButton.LeftButton:
|
|
278
|
+
self._activeControlPoint = None
|
|
279
|
+
self.mouseDrag = False
|
|
280
|
+
e.accept()
|
|
281
|
+
|
|
282
|
+
def mouseMoveEvent(self, e: QMouseEvent) -> None:
|
|
283
|
+
if (
|
|
284
|
+
not self.mouseDrag
|
|
285
|
+
and QPoint(self.mousePress - e.pos()).manhattanLength()
|
|
286
|
+
> self.startDragDistance
|
|
287
|
+
):
|
|
288
|
+
self.mouseDrag = True
|
|
289
|
+
|
|
290
|
+
p = self.mapFromCanvas(e.position())
|
|
291
|
+
if self.mouseDrag and self._activeControlPoint is not None:
|
|
292
|
+
if self._activeControlPoint == 1:
|
|
293
|
+
self.setTangent(leftTan=min(max(p.x(), 0.0), 1.0))
|
|
294
|
+
else:
|
|
295
|
+
self.setTangent(rightTan=min(max(p.x(), 0.0), 1.0))
|
|
296
|
+
self.tangentUpdated.emit(self.leftTan, self.rightTan)
|
|
297
|
+
self.update()
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
class FalloffDialog(QDialog):
|
|
301
|
+
"""The ui for interacting with Falloffs"""
|
|
302
|
+
|
|
303
|
+
uiFalloffSettingsGRP: QGroupBox
|
|
304
|
+
uiShapeFalloffLBL: QLabel
|
|
305
|
+
uiShapeFalloffCBOX: QComboBox
|
|
306
|
+
uiShapeFalloffRenameBTN: QPushButton
|
|
307
|
+
uiShapeFalloffNewBTN: QPushButton
|
|
308
|
+
uiShapeFalloffDuplicateBTN: QPushButton
|
|
309
|
+
uiShapeFalloffDeleteBTN: QPushButton
|
|
310
|
+
uiFalloffLAY: QVBoxLayout
|
|
311
|
+
uiFalloffTypeCBOX: QComboBox
|
|
312
|
+
uiFalloffAxisCBOX: QComboBox
|
|
313
|
+
uiFalloffMaxSPN: QDoubleSpinBox
|
|
314
|
+
uiFalloffMaxHandleSPN: QDoubleSpinBox
|
|
315
|
+
uiFalloffMinHandleSPN: QDoubleSpinBox
|
|
316
|
+
uiFalloffMinSPN: QDoubleSpinBox
|
|
317
|
+
|
|
318
|
+
def __init__(self, parent: SimplexDialog) -> None:
|
|
319
|
+
super().__init__(parent)
|
|
320
|
+
uiPath = getUiFile(__file__)
|
|
321
|
+
QtCompat.loadUi(uiPath, self)
|
|
322
|
+
self.parUI: SimplexDialog = parent
|
|
323
|
+
|
|
324
|
+
self.simplex: Simplex | None = None
|
|
325
|
+
self.parUI.simplexLoaded.connect(self.loadSimplex)
|
|
326
|
+
self.foModel = FalloffDataModel(None, self)
|
|
327
|
+
|
|
328
|
+
self.uiFalloffWID = CurveEditWidget(self)
|
|
329
|
+
policy = QSizePolicy(QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Expanding)
|
|
330
|
+
# policy.setVerticalStretch(1)
|
|
331
|
+
self.uiFalloffWID.setSizePolicy(policy)
|
|
332
|
+
self.uiFalloffWID.tangentUpdated.connect(self.updateTangents)
|
|
333
|
+
|
|
334
|
+
self.uiFalloffLAY.addWidget(self.uiFalloffWID)
|
|
335
|
+
|
|
336
|
+
self._falloffMapper = QDataWidgetMapper(self)
|
|
337
|
+
self.uiShapeFalloffCBOX.currentIndexChanged.connect(
|
|
338
|
+
self._falloffMapper.setCurrentIndex
|
|
339
|
+
)
|
|
340
|
+
|
|
341
|
+
# Falloff connections
|
|
342
|
+
self.uiShapeFalloffNewBTN.clicked.connect(self.newFalloff)
|
|
343
|
+
self.uiShapeFalloffDuplicateBTN.clicked.connect(self.duplicateFalloff)
|
|
344
|
+
self.uiShapeFalloffDeleteBTN.clicked.connect(self.deleteFalloff)
|
|
345
|
+
self.uiShapeFalloffRenameBTN.clicked.connect(self.renameFalloff)
|
|
346
|
+
|
|
347
|
+
self.uiFalloffMaxHandleSPN.valueChanged.connect(self.setLeftTangent)
|
|
348
|
+
self.uiFalloffMinHandleSPN.valueChanged.connect(self.setRightTangent)
|
|
349
|
+
self.loadSimplex()
|
|
350
|
+
|
|
351
|
+
def updateTangents(self, leftTangent: float, rightTangent: float) -> None:
|
|
352
|
+
self.uiFalloffMaxHandleSPN.setValue(leftTangent)
|
|
353
|
+
self.uiFalloffMinHandleSPN.setValue(rightTangent)
|
|
354
|
+
|
|
355
|
+
cbIdx = self.uiShapeFalloffCBOX.currentIndex()
|
|
356
|
+
|
|
357
|
+
leftTanIdx = self.foModel.index(cbIdx, 5)
|
|
358
|
+
rightTanIdx = self.foModel.index(cbIdx, 4)
|
|
359
|
+
|
|
360
|
+
self.foModel.setData(leftTanIdx, leftTangent, role=Qt.ItemDataRole.EditRole)
|
|
361
|
+
self.foModel.setData(rightTanIdx, rightTangent, role=Qt.ItemDataRole.EditRole)
|
|
362
|
+
|
|
363
|
+
def setLeftTangent(self, val: float) -> None:
|
|
364
|
+
self.uiFalloffWID.setTangent(leftTan=val)
|
|
365
|
+
|
|
366
|
+
def setRightTangent(self, val: float) -> None:
|
|
367
|
+
self.uiFalloffWID.setTangent(rightTan=val)
|
|
368
|
+
|
|
369
|
+
def loadSimplex(self) -> None:
|
|
370
|
+
"""Load the Simplex system from the parent UI"""
|
|
371
|
+
system = self.parUI.simplex
|
|
372
|
+
if system == self.simplex:
|
|
373
|
+
return
|
|
374
|
+
|
|
375
|
+
if system is None:
|
|
376
|
+
self.foModel = FalloffDataModel(None, self)
|
|
377
|
+
self.uiShapeFalloffCBOX.setModel(self.foModel)
|
|
378
|
+
if self._falloffMapper is not None:
|
|
379
|
+
self._falloffMapper.clearMapping()
|
|
380
|
+
self._falloffMapper.setModel(self.foModel)
|
|
381
|
+
self.uiFalloffSettingsGRP.setEnabled(False)
|
|
382
|
+
return
|
|
383
|
+
else:
|
|
384
|
+
self.uiFalloffSettingsGRP.setEnabled(True)
|
|
385
|
+
|
|
386
|
+
self.simplex = system
|
|
387
|
+
|
|
388
|
+
# Populate Settings widgets
|
|
389
|
+
self.foModel = FalloffDataModel(self.simplex, self)
|
|
390
|
+
self.uiShapeFalloffCBOX.setModel(self.foModel)
|
|
391
|
+
self._falloffMapper.setModel(self.foModel)
|
|
392
|
+
|
|
393
|
+
currentIndex = QByteArray(b"currentIndex")
|
|
394
|
+
|
|
395
|
+
self._falloffMapper.addMapping(self.uiFalloffTypeCBOX, 1, currentIndex)
|
|
396
|
+
self._falloffMapper.addMapping(self.uiFalloffAxisCBOX, 2, currentIndex)
|
|
397
|
+
self._falloffMapper.addMapping(self.uiFalloffMinSPN, 3)
|
|
398
|
+
self._falloffMapper.addMapping(self.uiFalloffMinHandleSPN, 4)
|
|
399
|
+
self._falloffMapper.addMapping(self.uiFalloffMaxHandleSPN, 5)
|
|
400
|
+
self._falloffMapper.addMapping(self.uiFalloffMaxSPN, 6)
|
|
401
|
+
|
|
402
|
+
self.uiShapeFalloffCBOX.setCurrentIndex(0)
|
|
403
|
+
self._falloffMapper.setCurrentIndex(0)
|
|
404
|
+
|
|
405
|
+
# Falloff Settings
|
|
406
|
+
def newFalloff(self) -> None:
|
|
407
|
+
"""Create a new Falloff object"""
|
|
408
|
+
if self.simplex is None:
|
|
409
|
+
return
|
|
410
|
+
foNames = [f.name for f in self.simplex.falloffs]
|
|
411
|
+
tempName = getNextName("NewFalloff", foNames)
|
|
412
|
+
|
|
413
|
+
newName, good = QInputDialog.getText(
|
|
414
|
+
self, "Rename Falloff", "Enter a new name for the Falloff", text=tempName
|
|
415
|
+
)
|
|
416
|
+
if not good:
|
|
417
|
+
return
|
|
418
|
+
|
|
419
|
+
if not newName.isidentifier():
|
|
420
|
+
message = "Falloff name can only contain letters and numbers, and cannot start with a number"
|
|
421
|
+
QMessageBox.warning(self, "Warning", message)
|
|
422
|
+
return
|
|
423
|
+
|
|
424
|
+
nn = getNextName(newName, foNames)
|
|
425
|
+
PlanarFalloff.createPlanar(nn, self.simplex, "X", 1.0, 0.66, 0.33, -1.0)
|
|
426
|
+
|
|
427
|
+
def duplicateFalloff(self) -> None:
|
|
428
|
+
"""Duplicate the selected falloff"""
|
|
429
|
+
if self.simplex is None:
|
|
430
|
+
return
|
|
431
|
+
if not self.simplex.falloffs:
|
|
432
|
+
self.newFalloff()
|
|
433
|
+
return
|
|
434
|
+
|
|
435
|
+
idx = self.uiShapeFalloffCBOX.currentIndex()
|
|
436
|
+
if idx < 0:
|
|
437
|
+
return
|
|
438
|
+
|
|
439
|
+
fo = self.simplex.falloffs[idx]
|
|
440
|
+
|
|
441
|
+
foNames = [f.name for f in self.simplex.falloffs]
|
|
442
|
+
nn = getNextName(fo.name, foNames)
|
|
443
|
+
fo.duplicate(nn)
|
|
444
|
+
|
|
445
|
+
def deleteFalloff(self) -> None:
|
|
446
|
+
"""Delete the selected falloff"""
|
|
447
|
+
if not self.simplex or not self.simplex.falloffs:
|
|
448
|
+
return
|
|
449
|
+
idx = self.uiShapeFalloffCBOX.currentIndex()
|
|
450
|
+
if idx < 0:
|
|
451
|
+
return
|
|
452
|
+
|
|
453
|
+
fo = self.simplex.falloffs[idx]
|
|
454
|
+
fo.delete()
|
|
455
|
+
|
|
456
|
+
def renameFalloff(self) -> None:
|
|
457
|
+
"""Rename the selected falloff"""
|
|
458
|
+
if not self.simplex or not self.simplex.falloffs:
|
|
459
|
+
return
|
|
460
|
+
idx = self.uiShapeFalloffCBOX.currentIndex()
|
|
461
|
+
if idx < 0:
|
|
462
|
+
return
|
|
463
|
+
fo = self.simplex.falloffs[idx]
|
|
464
|
+
foNames = [f.name for f in self.simplex.falloffs]
|
|
465
|
+
foNames.pop(idx)
|
|
466
|
+
|
|
467
|
+
newName, good = QInputDialog.getText(
|
|
468
|
+
self, "Rename Falloff", "Enter a new name for the Falloff", text=fo.name
|
|
469
|
+
)
|
|
470
|
+
if not good:
|
|
471
|
+
return
|
|
472
|
+
|
|
473
|
+
if not newName.isidentifier():
|
|
474
|
+
message = "Falloff name can only contain letters and numbers, and cannot start with a number"
|
|
475
|
+
QMessageBox.warning(self, "Warning", message)
|
|
476
|
+
return
|
|
477
|
+
|
|
478
|
+
nn = getNextName(newName, foNames)
|
|
479
|
+
fo.name = nn
|
|
480
|
+
|
|
481
|
+
def storeSettings(self) -> None:
|
|
482
|
+
"""Store the UI settings for this dialog"""
|
|
483
|
+
pref = Prefs()
|
|
484
|
+
pref.recordProperty("fogeometry", self.saveGeometry().data())
|
|
485
|
+
pref.save()
|
|
486
|
+
|
|
487
|
+
def loadSettings(self) -> None:
|
|
488
|
+
"""Load the UI settings for this dialog"""
|
|
489
|
+
pref = Prefs()
|
|
490
|
+
geo = pref.restoreProperty("fogeometry", None)
|
|
491
|
+
if geo is not None:
|
|
492
|
+
if isinstance(geo, bytes):
|
|
493
|
+
geo = QByteArray(geo)
|
|
494
|
+
self.restoreGeometry(geo)
|
|
495
|
+
|
|
496
|
+
def hideEvent(self, event: QHideEvent) -> None:
|
|
497
|
+
"""Override the hide event to store settings"""
|
|
498
|
+
self.storeSettings()
|
|
499
|
+
super().hideEvent(event)
|
|
500
|
+
|
|
501
|
+
def showEvent(self, event: QShowEvent) -> None:
|
|
502
|
+
"""Override the show event to restore settings"""
|
|
503
|
+
super().showEvent(event)
|
|
504
|
+
self.loadSettings()
|
|
Binary file
|
simplexui/img/frozen.png
ADDED
|
Binary file
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
# This file will serve as the only place where the choice of DCC will be chosen
|
|
19
|
+
from __future__ import annotations
|
|
20
|
+
|
|
21
|
+
import os
|
|
22
|
+
import sys
|
|
23
|
+
|
|
24
|
+
CONTEXT = os.path.basename(sys.executable)
|
|
25
|
+
if CONTEXT in ("maya.exe", "mayabatch.exe", "maya.bin"):
|
|
26
|
+
from .mayaInterface import DCC, DISPATCH, rootWindow, undoContext
|
|
27
|
+
else:
|
|
28
|
+
from .dummyInterface import DCC, DISPATCH, rootWindow, undoContext
|
|
29
|
+
|
|
30
|
+
__all__ = ["DCC", "DISPATCH", "rootWindow", "undoContext"]
|