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.
Files changed (79) hide show
  1. simplex_solver-3.1.0.dist-info/METADATA +90 -0
  2. simplex_solver-3.1.0.dist-info/RECORD +79 -0
  3. simplex_solver-3.1.0.dist-info/WHEEL +5 -0
  4. simplexui/__init__.py +53 -0
  5. simplexui/_version.py +1 -0
  6. simplexui/channelBox.py +858 -0
  7. simplexui/comboCheckDialog.py +343 -0
  8. simplexui/commands/__init__.py +16 -0
  9. simplexui/commands/alembicCommon.py +991 -0
  10. simplexui/commands/applyCorrectives.py +451 -0
  11. simplexui/commands/correctiveInterface.py +261 -0
  12. simplexui/commands/expandedExport.py +436 -0
  13. simplexui/commands/hdf5Convert.py +60 -0
  14. simplexui/commands/mayaCorrectiveInterface.py +161 -0
  15. simplexui/commands/mayatonumpy.py +375 -0
  16. simplexui/commands/mesh.py +1081 -0
  17. simplexui/commands/numpytoimath.py +319 -0
  18. simplexui/commands/poseblendlib.py +166 -0
  19. simplexui/commands/reorderSimplexPoints.py +102 -0
  20. simplexui/commands/rigidAlign.py +99 -0
  21. simplexui/commands/smpxBlend.py +629 -0
  22. simplexui/commands/unsubdivide.py +1227 -0
  23. simplexui/commands/uvTransfer.py +977 -0
  24. simplexui/dragFilter.py +299 -0
  25. simplexui/falloffDialog.py +471 -0
  26. simplexui/img/ChefHead.png +0 -0
  27. simplexui/img/frozen.png +0 -0
  28. simplexui/interface/__init__.py +28 -0
  29. simplexui/interface/dummyInterface.py +1585 -0
  30. simplexui/interface/mayaInterface.py +3271 -0
  31. simplexui/interfaceModel.py +1053 -0
  32. simplexui/interfaceModelTrees.py +441 -0
  33. simplexui/items/__init__.py +42 -0
  34. simplexui/items/accessor.py +213 -0
  35. simplexui/items/combo.py +852 -0
  36. simplexui/items/falloff.py +778 -0
  37. simplexui/items/group.py +297 -0
  38. simplexui/items/progression.py +743 -0
  39. simplexui/items/shape.py +443 -0
  40. simplexui/items/simplex.py +1764 -0
  41. simplexui/items/slider.py +738 -0
  42. simplexui/items/stack.py +154 -0
  43. simplexui/items/traversal.py +966 -0
  44. simplexui/main.pyw +22 -0
  45. simplexui/menu/__init__.py +69 -0
  46. simplexui/menu/dummyPlugins/__init__.py +16 -0
  47. simplexui/menu/genericPlugins/__init__.py +16 -0
  48. simplexui/menu/genericPlugins/_builtins.py +268 -0
  49. simplexui/menu/genericPlugins/checkPossibleCombos.py +45 -0
  50. simplexui/menu/genericPlugins/exportSplit.py +59 -0
  51. simplexui/menu/genericPlugins/showFalloffs.py +24 -0
  52. simplexui/menu/genericPlugins/showTraversals.py +24 -0
  53. simplexui/menu/genericPlugins/simplexUvTransfer.py +107 -0
  54. simplexui/menu/genericPlugins/unsubdivide.py +70 -0
  55. simplexui/menu/mayaPlugins/__init__.py +16 -0
  56. simplexui/menu/mayaPlugins/exportOther.py +43 -0
  57. simplexui/menu/mayaPlugins/extractProgressives.py +65 -0
  58. simplexui/menu/mayaPlugins/freezeCombo.py +245 -0
  59. simplexui/menu/mayaPlugins/generateShapeIncrementals.py +97 -0
  60. simplexui/menu/mayaPlugins/importObjs.py +193 -0
  61. simplexui/menu/mayaPlugins/linearizeTraversal.py +48 -0
  62. simplexui/menu/mayaPlugins/makeShelfBtn.py +65 -0
  63. simplexui/menu/mayaPlugins/relaxToSelection.py +75 -0
  64. simplexui/menu/mayaPlugins/reloadDefinition.py +33 -0
  65. simplexui/menu/mayaPlugins/snapToNeutral.py +72 -0
  66. simplexui/menu/mayaPlugins/softSelectToCluster.py +200 -0
  67. simplexui/menu/mayaPlugins/tweakMix.py +134 -0
  68. simplexui/menu/mayaPlugins/updateRestShape.py +105 -0
  69. simplexui/pysimplex.dll.a +0 -0
  70. simplexui/pysimplex.pyd +0 -0
  71. simplexui/simplexDialog.py +1454 -0
  72. simplexui/travCheckDialog.py +397 -0
  73. simplexui/traversalDialog.py +271 -0
  74. simplexui/ui/comboCheckDialog.ui +475 -0
  75. simplexui/ui/falloffDialog.ui +243 -0
  76. simplexui/ui/simplexDialog.ui +1458 -0
  77. simplexui/ui/travCheckDialog.ui +488 -0
  78. simplexui/ui/traversalDialog.ui +532 -0
  79. simplexui/utils.py +320 -0
@@ -0,0 +1,443 @@
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 ..interface import DCC, undoContext
20
+
21
+ # pylint:disable=missing-docstring,unused-argument,no-self-use
22
+ from Qt.QtGui import QColor
23
+ from .accessor import SimplexAccessor
24
+ from .stack import stackable
25
+
26
+
27
+ class Shape(SimplexAccessor):
28
+ """A representation of a single blendshape
29
+
30
+ For every Shape object in a system, there will be one blendshape.
31
+ The Simplex solver takes an ordered list of Slider values, and outputs
32
+ an ordered list of shape values.
33
+
34
+ Shapes hold references to their DCC objects, and can also hold
35
+ the vertex positions in certain cases
36
+
37
+ Parameters
38
+ ----------
39
+ name : str
40
+ The name for the new Shape
41
+ simplex : Simplex
42
+ The Simplex system
43
+ create : bool
44
+ Whether to create the DCC Shape, or look for it already in-scene
45
+ color : QColor
46
+ The color of this item in the Ui
47
+
48
+ Returns
49
+ -------
50
+
51
+ """
52
+
53
+ classDepth = 10
54
+
55
+ def __init__(self, name, simplex, create=True, color=None):
56
+ super(Shape, self).__init__(simplex)
57
+ color = QColor(128, 128, 128) if color is None else color
58
+ with self.stack.store(self):
59
+ self._thing = None
60
+ self._verts = None
61
+ self._thingRepr = None
62
+ self._name = name
63
+ self._buildIdx = None
64
+ simplex.shapes.append(self)
65
+ self.isRest = False
66
+ self.expanded = {}
67
+ self.color = color
68
+ self.progPairs = []
69
+
70
+ newThing = self.DCC.getShapeThing(self._name)
71
+ if newThing is None:
72
+ if create:
73
+ self.thing = self.DCC.createShape(self)
74
+ else:
75
+ raise RuntimeError(
76
+ "Unable to find existing shape: {0}".format(self.name)
77
+ )
78
+ else:
79
+ self.thing = newThing
80
+
81
+ @classmethod
82
+ def createShape(cls, name, simplex, slider=None):
83
+ """Convenience method for creating a new shape
84
+ This will create all required parent objects to have a new shape
85
+
86
+ Parameters
87
+ ----------
88
+ name : str
89
+ The name for the new Shape
90
+ simplex : Simplex
91
+ The Simplex system
92
+ slider : Slider or None
93
+ The slider to add this shape to.
94
+ If None, A new Slider will be created (Default value = None)
95
+
96
+ Returns
97
+ -------
98
+ : Shape
99
+ The new Shape
100
+
101
+ """
102
+ if simplex.restShape is None:
103
+ raise RuntimeError("Simplex system is missing rest shape")
104
+
105
+ if slider is None:
106
+ # Implicitly creates a shape
107
+ from .slider import Slider
108
+
109
+ slider = Slider.createSlider(name, simplex)
110
+ for p in slider.prog.pairs:
111
+ if p.shape.name == name:
112
+ return p.shape
113
+ raise RuntimeError("Problem creating shape with proper name")
114
+ else:
115
+ if slider.simplex != simplex:
116
+ raise RuntimeError("Slider does not belong to the provided Simplex")
117
+ tVal = slider.prog.guessNextTVal()
118
+ pp = slider.prog.createShape(name, tVal)
119
+ return pp.shape
120
+
121
+ @classmethod
122
+ def buildRest(cls, simplex):
123
+ """Create/find the system's rest shape
124
+
125
+ Parameters
126
+ ----------
127
+ simplex : Simplex
128
+ The Simplex system
129
+
130
+ Returns
131
+ -------
132
+ : Shape
133
+ The system's rest Shape
134
+
135
+ """
136
+ rest = cls(simplex.getRestName(), simplex, create=True)
137
+ rest.isRest = True
138
+ return rest
139
+
140
+ @property
141
+ def name(self):
142
+ """Get the Shape's name"""
143
+ return self._name
144
+
145
+ @name.setter
146
+ @stackable
147
+ def name(self, value):
148
+ """Set the Shape's name
149
+
150
+ Parameters
151
+ ----------
152
+ value :
153
+
154
+
155
+ Returns
156
+ -------
157
+
158
+ """
159
+ if value == self._name:
160
+ return
161
+ self.DCC.renameShape(self, value)
162
+ self._name = value
163
+ for model in self.models:
164
+ model.itemDataChanged(self)
165
+
166
+ def strippedName(self):
167
+ """Get the name of this shape with any progressive numbers stripped from the end"""
168
+ sp = self.name.split("_")
169
+ if self.isNumberField(sp[-1]):
170
+ sp = sp[:-1]
171
+ return "_".join(sp)
172
+
173
+ def _buildLinkedRename(self, newName, maxDepth, currentLinks):
174
+ """
175
+
176
+ Parameters
177
+ ----------
178
+ newName :
179
+
180
+ maxDepth :
181
+
182
+ currentLinks :
183
+
184
+
185
+ Returns
186
+ -------
187
+
188
+ """
189
+ # Now that all the bookkeeping has been handled by the main method
190
+ # I can handle recursing for the object specific stuff here
191
+ shape = None # TEMP
192
+
193
+ from .combo import Combo
194
+ from .slider import Slider
195
+ from .traversal import Traversal
196
+
197
+ for pp in self.progPairs:
198
+ currentLinks = pp.prog.siblingRename(shape, newName, currentLinks)
199
+
200
+ ctrl = pp.prog.controller
201
+ if isinstance(ctrl, Slider):
202
+ nn = None
203
+ currentLinks = ctrl.buildLinkedRename(
204
+ nn, maxDepth=maxDepth - 1, currentLinks=currentLinks
205
+ )
206
+ elif isinstance(ctrl, Combo):
207
+ nn = None
208
+ currentLinks = ctrl.buildLinkedRename(
209
+ nn, maxDepth=maxDepth - 1, currentLinks=currentLinks
210
+ )
211
+ elif isinstance(ctrl, Traversal):
212
+ nn = None
213
+ currentLinks = ctrl.buildLinkedRename(
214
+ nn, maxDepth=maxDepth - 1, currentLinks=currentLinks
215
+ )
216
+
217
+ return currentLinks
218
+
219
+ # First, check for a slider rename,
220
+ # if so, recurse into that slider
221
+ # Check for combo renames (because combos use the shape names)
222
+
223
+ # if isinstance(item, Shape):
224
+ # Check if the parent is a slider
225
+ # Check if the slider needs renamed
226
+ # Check if the item's siblings need renamed
227
+ # Check if there are any combos that depend on this shape name
228
+ # If so, rename *both* the combo and its linked children
229
+ # Check if the parent is a combo
230
+ # Check if the combo needs renamed
231
+ # If so, check if the item's siblings need renamed too
232
+ # Check if the parent is a traversal
233
+ # Check if the traversal needs renamed
234
+ # If so, check if the item's siblings need renamed too
235
+ # elif isinstance(item, Slider):
236
+ # Check if the name change is linked to any of my shapes
237
+ # Go through the shape linked rename for one of those instead, maybe?
238
+ # There are possible ambiguities if you do a *full* slider rename
239
+ # with both positive and negatively named shapes.
240
+ # Otherwise
241
+ # Check for linked combos, and rename down that branch
242
+ # Check for linked traversals, and rename down that branch
243
+ # elif isinstance(item, Combo):
244
+ # pass
245
+ # elif isinstance(item, Traversal):
246
+ # pass
247
+
248
+ @property
249
+ def thing(self):
250
+ """Get the stored reference to the DCC object"""
251
+ # if this is a deepcopied object, then self._thing will
252
+ # be None. Rebuild the thing connection by its representation
253
+ if self._thing is None and self._thingRepr:
254
+ self._thing = DCC.loadPersistentShape(self._thingRepr)
255
+ return self._thing
256
+
257
+ @thing.setter
258
+ def thing(self, value):
259
+ """Set the stored reference to the DCC object
260
+
261
+ Parameters
262
+ ----------
263
+ value :
264
+
265
+
266
+ Returns
267
+ -------
268
+
269
+ """
270
+ self._thing = value
271
+ self._thingRepr = self.DCC.getPersistentShape(value)
272
+
273
+ @classmethod
274
+ def loadV2(cls, simplex, data, create):
275
+ """Load the data from a version2 formatted json dictionary
276
+
277
+ Parameters
278
+ ----------
279
+ simplex : Simplex
280
+ The Simplex system that's being built
281
+ data : dict
282
+ The chunk of the json dict used to build this object
283
+ create : bool
284
+ Whether to create the DCC Shape, or look for it already in-scene
285
+
286
+ Returns
287
+ -------
288
+ : Shape
289
+ The specified Shape
290
+
291
+ """
292
+ return cls(data["name"], simplex, create, QColor(*data.get("color", (0, 0, 0))))
293
+
294
+ def buildDefinition(self, simpDict, legacy):
295
+ """Output a dictionary definition of this object
296
+
297
+ Parameters
298
+ ----------
299
+ simpDict : dict
300
+ The dictionary that is being built
301
+ legacy : bool
302
+ Whether to write out the legacy definition, or the newer one
303
+
304
+ Returns
305
+ -------
306
+
307
+ """
308
+ if self._buildIdx is None:
309
+ self._buildIdx = len(simpDict["shapes"])
310
+ if legacy:
311
+ simpDict.setdefault("shapes", []).append(self.name)
312
+ else:
313
+ x = {
314
+ "name": self.name,
315
+ "color": self.color.getRgb()[:3],
316
+ }
317
+ simpDict.setdefault("shapes", []).append(x)
318
+ return self._buildIdx
319
+
320
+ def clearBuildIndex(self):
321
+ """Clear the build index of this object
322
+
323
+ The buildIndex is stored when building a definition dictionary
324
+ that keeps track of its index for later referencing
325
+
326
+ Parameters
327
+ ----------
328
+
329
+ Returns
330
+ -------
331
+
332
+ """
333
+ self._buildIdx = None
334
+
335
+ def zeroShape(self):
336
+ """Set the shape to be equal to the rest shape"""
337
+ self.DCC.zeroShape(self)
338
+
339
+ @staticmethod
340
+ def zeroShapes(shapes):
341
+ """Set the shapes to be equal to the rest shape
342
+
343
+ Parameters
344
+ ----------
345
+ shapes : [Shape
346
+ Shapes to be zeroed
347
+
348
+ Returns
349
+ -------
350
+
351
+ """
352
+ for shape in shapes:
353
+ if not shape.isRest:
354
+ shape.zeroShape()
355
+
356
+ def connectShape(self, mesh=None, live=False, delete=False):
357
+ """Force a shape to match a mesh
358
+ The "connect shape" button is: mesh=None, delete=True
359
+ The "match shape" button is: mesh=someMesh, delete=False
360
+ There is a possibility of a "make live" button: live=True, delete=False
361
+
362
+ Parameters
363
+ ----------
364
+ mesh : object or None
365
+ The DCC Mesh object. If None, it's searched for by name in scene (Default value = None)
366
+ live : bool
367
+ Whether or not to create a live connection in the DCC. Defaults False
368
+ delete : bool
369
+ Whether to delete the DCC Mesh after its connection. Defaults False
370
+
371
+ Returns
372
+ -------
373
+
374
+ """
375
+ self.DCC.connectShape(self, mesh, live, delete)
376
+
377
+ @staticmethod
378
+ def connectShapes(shapes, meshes, live=False, delete=False):
379
+ """Connect multiple meshes to multiple Shapes
380
+
381
+ Parameters
382
+ ----------
383
+ shapes : [Shape
384
+ The shapes to connect to
385
+ meshes : [object
386
+ The DCC Meshes
387
+ live : bool
388
+ Whether or not to create a live connection in the DCC. Defaults False
389
+ delete : bool
390
+ Whether to delete the DCC Mesh after its connection. Defaults False
391
+
392
+ Returns
393
+ -------
394
+
395
+ """
396
+ with undoContext():
397
+ for shape, mesh in zip(shapes, meshes):
398
+ shape.connectShape(mesh, live, delete)
399
+
400
+ @staticmethod
401
+ def isNumberField(val):
402
+ """A utility function to check if a field is numeric
403
+ Also, this allows for the "n" prefix for negative numbers because
404
+ many DCC's don't allow "-" in an object name
405
+
406
+ Parameters
407
+ ----------
408
+ val : str
409
+ The string to check
410
+
411
+ Returns
412
+ -------
413
+ : bool
414
+ Whether the field is numeric
415
+
416
+ """
417
+ if not val:
418
+ return False
419
+ if val[0].lower() == "n":
420
+ val = val[1:]
421
+ return val.isdigit()
422
+
423
+ @property
424
+ def verts(self):
425
+ """Get the stored vertices"""
426
+ if self._verts is None:
427
+ self._verts = self.DCC.getShapeVertices(self)
428
+ return self._verts
429
+
430
+ @verts.setter
431
+ def verts(self, value):
432
+ """Set the stored vertices
433
+
434
+ Parameters
435
+ ----------
436
+ value :
437
+
438
+
439
+ Returns
440
+ -------
441
+
442
+ """
443
+ self._verts = value