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