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,743 @@
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
+ # pylint:disable=missing-docstring,unused-argument,no-self-use
20
+ from ..utils import getNextName, nested
21
+ from .accessor import SimplexAccessor
22
+ from .stack import stackable
23
+
24
+
25
+ class ProgPair(SimplexAccessor):
26
+ """ """
27
+
28
+ classDepth = 9
29
+
30
+ def __init__(self, simplex, shape, value):
31
+ super(ProgPair, self).__init__(simplex)
32
+ self.shape = shape
33
+ self._value = value
34
+ self.prog = None
35
+ self.minValue = -1.0
36
+ self.maxValue = 1.0
37
+ self.expanded = {}
38
+ if not shape.isRest and self not in self.shape.progPairs:
39
+ self.shape.progPairs.append(self)
40
+
41
+ @property
42
+ def name(self):
43
+ """ """
44
+ return self.shape.name
45
+
46
+ @name.setter
47
+ def name(self, value):
48
+ """
49
+
50
+ Parameters
51
+ ----------
52
+ value :
53
+
54
+
55
+ Returns
56
+ -------
57
+
58
+ """
59
+ self.shape.name = value
60
+
61
+ def buildDefinition(self, simpDict, legacy):
62
+ """
63
+
64
+ Parameters
65
+ ----------
66
+ simpDict :
67
+
68
+ legacy :
69
+
70
+
71
+ Returns
72
+ -------
73
+
74
+ """
75
+ idx = self.shape.buildDefinition(simpDict, legacy)
76
+ return idx, self.value
77
+
78
+ def __lt__(self, other):
79
+ return self.value < other.value
80
+
81
+ @property
82
+ def value(self):
83
+ """ """
84
+ return self._value
85
+
86
+ @value.setter
87
+ @stackable
88
+ def value(self, val):
89
+ """
90
+
91
+ Parameters
92
+ ----------
93
+ val :
94
+
95
+
96
+ Returns
97
+ -------
98
+
99
+ """
100
+ from .slider import Slider
101
+
102
+ self._value = val
103
+ for model in self.models:
104
+ model.itemDataChanged(self)
105
+ if isinstance(self.prog.controller, Slider):
106
+ self.prog.controller.setRange()
107
+
108
+ @stackable
109
+ def delete(self):
110
+ """ """
111
+ ppairs = self.prog.pairs
112
+ ridx = ppairs.index(self)
113
+ mgrs = [model.removeItemManager(self) for model in self.models]
114
+ with nested(*mgrs):
115
+ pp = ppairs.pop(ridx)
116
+ if not pp.shape.isRest:
117
+ pp.shape.progPairs.remove(pp)
118
+ if not pp.shape.progPairs:
119
+ self.simplex.shapes.remove(pp.shape)
120
+ self.DCC.deleteShape(pp.shape)
121
+
122
+ def treeRow(self):
123
+ """ """
124
+ return self.prog.pairs.index(self)
125
+
126
+ def treeParent(self):
127
+ """ """
128
+ from .slider import Slider
129
+
130
+ par = self.prog
131
+ if isinstance(par.controller, Slider):
132
+ par = par.controller
133
+ return par
134
+
135
+ def treeData(self, column):
136
+ """
137
+
138
+ Parameters
139
+ ----------
140
+ column :
141
+
142
+
143
+ Returns
144
+ -------
145
+
146
+ """
147
+ if column == 0:
148
+ return self.name
149
+ if column == 2:
150
+ return self.value
151
+ return None
152
+
153
+
154
+ class Progression(SimplexAccessor):
155
+ """A set of shapes to interpolate between
156
+
157
+ A Progression is a collection of shape/value pairs, and an interpolation type.
158
+ Progressions don't exist on their own, they are always part of a higher-level object
159
+ like a Combo, Slider, or Traversal. The ProgPairs are always sorted by value
160
+
161
+ Progressions should always have a shape at 0 (which is almost always the rest shape)
162
+ and a shape at either -1 or 1.
163
+ They can also have other shapes at any value between 0 and the extremes.
164
+
165
+ Sliders give users direct control over the value that is passed to the progression.
166
+ Combos and Traversals use input values to control their progressions.
167
+
168
+ Progressions can use different interpolations.
169
+ The simplest is 'linear', which blends in a straight line between shapes.
170
+ The 'spline' interp uses Catmull-Rom spline values.
171
+ The 'splitspline' builds separate Catmull-Rom splines for positive and negative values
172
+
173
+ Parameters
174
+ ----------
175
+ name : str
176
+ The name for the Progression. Usually just copies the name of its controller
177
+ simplex : Simplex
178
+ The Simplex system
179
+ pairs : [ProgPair
180
+ The ProgPairs that will make up this Progression.
181
+ If None, the a default Rest at 0.0 pair will be created.
182
+ interp : str
183
+ The interpolation for this Progression. Defaults to 'spline'
184
+ falloffs : [Falloff
185
+ A list of Fallofs to apply to the progression
186
+ Defaults to None
187
+
188
+ Returns
189
+ -------
190
+
191
+ """
192
+
193
+ classDepth = 8
194
+ interpTypes = (
195
+ ("Linear", "linear"),
196
+ ("Spline", "spline"),
197
+ ("Split Spline", "splitspline"),
198
+ )
199
+
200
+ def __init__(self, name, simplex, pairs=None, interp="spline", falloffs=None):
201
+ super(Progression, self).__init__(simplex)
202
+ with self.stack.store(self):
203
+ self._name = name
204
+ self._interp = interp
205
+ self.falloffs = falloffs or []
206
+ self.controller = None
207
+
208
+ if pairs is None:
209
+ self.pairs = [ProgPair(self.simplex, self.simplex.restShape, 0.0)]
210
+ else:
211
+ self.pairs = pairs
212
+
213
+ for pair in self.pairs:
214
+ pair.prog = self
215
+
216
+ for falloff in self.falloffs:
217
+ falloff.children.append(self)
218
+ self._buildIdx = None
219
+ self.expanded = {}
220
+
221
+ @property
222
+ def interp(self):
223
+ """Get the interp for this Progression"""
224
+ return self._interp
225
+
226
+ @interp.setter
227
+ @stackable
228
+ def interp(self, value):
229
+ """Set the interp for this Progression
230
+
231
+ Parameters
232
+ ----------
233
+ value :
234
+
235
+
236
+ Returns
237
+ -------
238
+
239
+ """
240
+ self._interp = value
241
+
242
+ def treeChild(self, row):
243
+ """
244
+
245
+ Parameters
246
+ ----------
247
+ row :
248
+
249
+
250
+ Returns
251
+ -------
252
+
253
+ """
254
+ return self.pairs[row]
255
+
256
+ def treeRow(self):
257
+ """ """
258
+ from .combo import Combo
259
+ from .traversal import Traversal
260
+
261
+ if isinstance(self.controller, Traversal):
262
+ # Show the progression after the mult and prog
263
+ return 2
264
+ elif isinstance(self.controller, Combo):
265
+ # Show the progression after the comboPairs
266
+ return len(self.controller.pairs)
267
+ return None
268
+
269
+ def treeParent(self):
270
+ """ """
271
+ return self.controller
272
+
273
+ def treeChildCount(self):
274
+ """ """
275
+ return len(self.pairs)
276
+
277
+ def treeData(self, column):
278
+ """
279
+
280
+ Parameters
281
+ ----------
282
+ column :
283
+
284
+
285
+ Returns
286
+ -------
287
+
288
+ """
289
+ if column == 0:
290
+ return "SHAPES"
291
+ return None
292
+
293
+ def getShapeIndex(self, shape):
294
+ """Get the index of the given shape in this progression
295
+
296
+ Parameters
297
+ ----------
298
+ shape : Shape
299
+ The shape to get the index of
300
+
301
+ Returns
302
+ -------
303
+ : int
304
+ The index of the ProgPair that contains the given shape
305
+
306
+ """
307
+ for i, p in enumerate(self.pairs):
308
+ if p.shape == shape:
309
+ return i
310
+ raise ValueError("Provided shape:{0} is not in the list".format(shape.name))
311
+
312
+ def getShapes(self):
313
+ """Return the Shapes in this Progression
314
+
315
+ Parameters
316
+ ----------
317
+
318
+ Returns
319
+ -------
320
+ : type
321
+ ([Shape, ....]): The shapes in the Progression
322
+
323
+ """
324
+ return [i.shape for i in self.pairs]
325
+
326
+ def getValues(self):
327
+ """Return the values in this Progression
328
+
329
+ Parameters
330
+ ----------
331
+
332
+ Returns
333
+ -------
334
+ : type
335
+ ([float, ....]): The values in the Progression
336
+
337
+ """
338
+ return [i.value for i in self.pairs]
339
+
340
+ def getInsertIndex(self, tVal):
341
+ """Get the index to insert a pair with value tVal
342
+
343
+ Parameters
344
+ ----------
345
+ tVal : float
346
+ The value to get the insertion index for
347
+
348
+ Returns
349
+ -------
350
+ : int
351
+ The insertion index
352
+
353
+ """
354
+ values = self.getValues()
355
+ if not values:
356
+ return 0
357
+ elif tVal <= values[0]:
358
+ return 0
359
+ elif tVal >= values[-1]:
360
+ return len(self.pairs)
361
+ else:
362
+ for i in range(1, len(values)):
363
+ if values[i - 1] <= tVal < values[i]:
364
+ return i
365
+ return 0
366
+
367
+ def getShapeAtValue(self, val, tol=0.0001):
368
+ """Return the shape at the given value
369
+
370
+ Parameters
371
+ ----------
372
+ val :
373
+ float
374
+ tol :
375
+ float (Default value = 0.0001)
376
+
377
+ Returns
378
+ -------
379
+ : type
380
+ (Shape or None): The shape found with the given value, or None if nothing was found
381
+
382
+ """
383
+ for pp in self.pairs:
384
+ if abs(pp.value - val) < tol:
385
+ return pp.shape
386
+ return None
387
+
388
+ @classmethod
389
+ def loadV2(cls, simplex, data):
390
+ """Load the data from a version2 formatted json dictionary
391
+
392
+ Parameters
393
+ ----------
394
+ simplex : Simplex
395
+ The Simplex system that's being built
396
+ data : dict
397
+ The chunk of the json dict used to build this object
398
+
399
+ Returns
400
+ -------
401
+ : Progression
402
+ The specified Progression
403
+
404
+ """
405
+ name = data["name"]
406
+ pairs = data["pairs"]
407
+ interp = data.get("interp", "spline")
408
+ foIdxs = data.get("falloffs", [])
409
+ pairs = [ProgPair(simplex, simplex.shapes[s], v) for s, v in pairs]
410
+ fos = [simplex.falloffs[i] for i in foIdxs]
411
+ return cls(name, simplex, pairs=pairs, interp=interp, falloffs=fos)
412
+
413
+ def buildDefinition(self, simpDict, legacy):
414
+ """Output a dictionary definition of this object
415
+
416
+ Parameters
417
+ ----------
418
+ simpDict : dict
419
+ The dictionary that is being built
420
+ legacy : bool
421
+ Whether to write out the legacy definition, or the newer one
422
+
423
+ Returns
424
+ -------
425
+
426
+ """
427
+ if self._buildIdx is None:
428
+ idxPairs = [pair.buildDefinition(simpDict, legacy) for pair in self.pairs]
429
+ idxPairs.sort(key=lambda x: x[1])
430
+ idxs, values = list(zip(*idxPairs))
431
+ foIdxs = [f.buildDefinition(simpDict, legacy) for f in self.falloffs]
432
+ self._buildIdx = len(simpDict["progressions"])
433
+ if legacy:
434
+ x = [self.name, idxs, values, self.interp, foIdxs]
435
+ simpDict.setdefault("progressions", []).append(x)
436
+ else:
437
+ x = {
438
+ "name": self.name,
439
+ "pairs": idxPairs,
440
+ "interp": self.interp,
441
+ "falloffs": foIdxs,
442
+ }
443
+ simpDict.setdefault("progressions", []).append(x)
444
+ return self._buildIdx
445
+
446
+ def clearBuildIndex(self):
447
+ """Clear the build index of this object
448
+
449
+ The buildIndex is stored when building a definition dictionary
450
+ that keeps track of its index for later referencing
451
+
452
+ Parameters
453
+ ----------
454
+
455
+ Returns
456
+ -------
457
+
458
+ """
459
+ self._buildIdx = None
460
+ for pair in self.pairs:
461
+ pair.shape.clearBuildIndex()
462
+ for fo in self.falloffs:
463
+ fo.clearBuildIndex()
464
+
465
+ @stackable
466
+ def moveShapeToProgression(self, shapePair):
467
+ """Remove the shapePair from its current progression and set it in a new progression
468
+
469
+ Parameters
470
+ ----------
471
+ shapePair : progPair
472
+ The ProgPair to take
473
+ shapePair): ### Moves Rows (Slider :
474
+
475
+ Combo :
476
+
477
+
478
+ Returns
479
+ -------
480
+
481
+ """
482
+ oldProg = shapePair.prog
483
+ oldProg.pairs.remove(shapePair)
484
+ self.pairs.append(shapePair)
485
+ shapePair.prog = self
486
+
487
+ @stackable
488
+ def setShapesValues(self, values):
489
+ """Set all the Shape's values
490
+
491
+ Parameters
492
+ ----------
493
+ values : [float
494
+ The values to set
495
+
496
+ Returns
497
+ -------
498
+
499
+ """
500
+ from .slider import Slider
501
+
502
+ for pp, val in zip(self.pairs, values):
503
+ pp.value = val
504
+ for model in self.models:
505
+ model.itemDataChanged(pp)
506
+
507
+ if isinstance(self.controller, Slider):
508
+ self.controller.updateRange()
509
+ for model in self.models:
510
+ model.itemDataChanged(self.controller)
511
+
512
+ def siblingRename(self, shape, newName, currentLinks):
513
+ """
514
+
515
+ Parameters
516
+ ----------
517
+ shape :
518
+
519
+ newName :
520
+
521
+ currentLinks :
522
+
523
+
524
+ Returns
525
+ -------
526
+
527
+ """
528
+ # This is part of the in-progress linked naming system
529
+ # get name change
530
+ pass
531
+
532
+ @stackable
533
+ def addFalloff(self, falloff):
534
+ """Add a falloff to a slider's falloff list
535
+
536
+ Parameters
537
+ ----------
538
+ falloff : Falloff
539
+ The falloff to add
540
+
541
+ Returns
542
+ -------
543
+
544
+ """
545
+ if falloff not in self.falloffs:
546
+ self.falloffs.append(falloff)
547
+ falloff.children.append(self)
548
+ self.DCC.addProgFalloff(self, falloff)
549
+
550
+ @stackable
551
+ def removeFalloff(self, falloff):
552
+ """Remove a falloff from a slider's falloff list
553
+
554
+ Parameters
555
+ ----------
556
+ falloff : Falloff
557
+ The falloff to remove
558
+
559
+ Returns
560
+ -------
561
+
562
+ """
563
+ if falloff in self.falloffs:
564
+ self.falloffs.remove(falloff)
565
+ falloff.children.remove(self)
566
+ self.DCC.removeProgFalloff(self, falloff)
567
+
568
+ @stackable
569
+ def createShape(self, shapeName=None, tVal=None):
570
+ """Create a shape and add it to a progression
571
+
572
+ Parameters
573
+ ----------
574
+ shapeName : str or None
575
+ The name to give the shape
576
+ If None, give it a default value
577
+ tVal : float or None
578
+ The value to give the new ProgPair
579
+ if None, give it a "smart" default
580
+
581
+ Returns
582
+ -------
583
+ : ProgPair
584
+ The newly created ProgPair
585
+
586
+ """
587
+ from .slider import Slider
588
+
589
+ pp, idx = self.newProgPair(shapeName, tVal)
590
+ mgrs = [model.insertItemManager(self, idx) for model in self.models]
591
+ with nested(*mgrs):
592
+ pp.prog = self
593
+ self.pairs.insert(idx, pp)
594
+
595
+ if isinstance(self.controller, Slider):
596
+ self.controller.updateRange()
597
+
598
+ return pp
599
+
600
+ def newProgPair(self, shapeName=None, tVal=None):
601
+ """Create a shape and DO NOT add it to a progression
602
+
603
+ Parameters
604
+ ----------
605
+ shapeName : str or None
606
+ The name to give the shape
607
+ If None, give it a default value
608
+ tVal : float or None
609
+ The value to give the new ProgPair
610
+ if None, give it a "smart" default
611
+
612
+ Returns
613
+ -------
614
+ : ProgPair
615
+ The newly created ProgPair
616
+ : int
617
+ The insertion index for this ProgPair into this Progression
618
+
619
+ """
620
+ from .shape import Shape
621
+
622
+ if tVal is None:
623
+ tVal = self.guessNextTVal()
624
+
625
+ if shapeName is None:
626
+ if abs(tVal) == 1.0:
627
+ shapeName = self.controller.name
628
+ else:
629
+ neg = "n" if tVal < 0.0 else ""
630
+ shapeName = "{0}_{1}{2}".format(
631
+ self.controller.name, neg, int(abs(tVal) * 100)
632
+ )
633
+
634
+ currentNames = [i.name for i in self.simplex.shapes]
635
+ shapeName = getNextName(shapeName, currentNames)
636
+
637
+ idx = self.getInsertIndex(tVal)
638
+ shape = Shape(shapeName, self.simplex)
639
+ pp = ProgPair(self.simplex, shape, tVal)
640
+ return pp, idx
641
+
642
+ def guessNextTVal(self):
643
+ """Given the current progression values, make an educated guess what's next.
644
+
645
+ Parameters
646
+ ----------
647
+
648
+ Returns
649
+ -------
650
+ : float
651
+ The "smart" guess for the next tVal
652
+
653
+ """
654
+ # The question remains if negative or
655
+ # intermediate values are more important
656
+ # I think intermediate
657
+ vals = [i.value for i in self.pairs]
658
+ mnv = min(vals)
659
+ mxv = max(vals)
660
+ if mnv == 0.0 and mxv == 1.0:
661
+ for c in [0.5, 0.25, 0.75, -1.0]:
662
+ if c not in vals:
663
+ return c
664
+ if mnv == -1.0 and mxv == 1.0:
665
+ for c in [0.5, -0.5, 0.25, -0.25, 0.75, -0.75]:
666
+ if c not in vals:
667
+ return c
668
+ return 1.0
669
+
670
+ @stackable
671
+ def deleteShape(self, shape):
672
+ """Delete a shape from the system and the DCC
673
+
674
+ Parameters
675
+ ----------
676
+ shape : Shape
677
+ The shape to delete
678
+
679
+ Returns
680
+ -------
681
+
682
+ """
683
+ ridx = None
684
+ for i, pp in enumerate(self.pairs):
685
+ if pp.shape == shape:
686
+ ridx = i
687
+ if ridx is None:
688
+ raise RuntimeError("Shape does not exist to remove")
689
+
690
+ pp = self.pairs[ridx]
691
+ mgrs = [model.removeItemManager(pp) for model in self.models]
692
+ with nested(*mgrs):
693
+ self.pairs.pop(ridx)
694
+ if not shape.isRest:
695
+ self.simplex.shapes.remove(shape)
696
+ self.DCC.deleteShape(shape)
697
+
698
+ @stackable
699
+ def delete(self):
700
+ """Delete the Progression and all its Shapes"""
701
+ mgrs = [model.removeItemManager(self) for model in self.models]
702
+ with nested(*mgrs):
703
+ for pp in self.pairs[:]:
704
+ if pp.shape.isRest:
705
+ continue
706
+ self.simplex.shapes.remove(pp.shape)
707
+ self.DCC.deleteShape(pp.shape)
708
+
709
+ def getRange(self):
710
+ """Get the range for this Progression
711
+
712
+ Parameters
713
+ ----------
714
+
715
+ Returns
716
+ -------
717
+ : float
718
+ The minimum value
719
+ : float
720
+ The maximum value
721
+
722
+ """
723
+ vals = [i.value for i in self.pairs]
724
+ return min(vals), max(vals)
725
+
726
+ def getExtremePairs(self):
727
+ """Get the ProgPairs where the value is -1 or 1
728
+
729
+ Parameters
730
+ ----------
731
+
732
+ Returns
733
+ -------
734
+ : [ProgPair, ...]
735
+ ProgPairs whose values are -1 or 1
736
+
737
+ """
738
+ ret = []
739
+ for pp in self.pairs:
740
+ if abs(pp.value) != 1.0:
741
+ continue
742
+ ret.append(pp)
743
+ return ret