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