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,855 @@
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
+ from six.moves import zip
19
+
20
+ from ..interface import undoContext
21
+
22
+ # pylint:disable=missing-docstring,unused-argument,no-self-use
23
+ from Qt.QtGui import QColor
24
+ from ..utils import getIcon, nested
25
+ from .accessor import SimplexAccessor
26
+ from .stack import stackable
27
+
28
+
29
+ # Abstract Items
30
+ class ComboPair(SimplexAccessor):
31
+ """A Slider/Value pair for use in Combos"""
32
+
33
+ classDepth = 6
34
+
35
+ def __init__(self, slider, value):
36
+ simplex = slider.simplex
37
+ super(ComboPair, self).__init__(simplex)
38
+ self.slider = slider
39
+ self._value = float(value)
40
+ self.minValue = -1.0
41
+ self.maxValue = 1.0
42
+ self.combo = None
43
+ self.expanded = {}
44
+
45
+ @property
46
+ def models(self):
47
+ """ """
48
+ return self.combo.simplex.models
49
+
50
+ @property
51
+ def name(self):
52
+ """ """
53
+ return self.slider.name
54
+
55
+ @property
56
+ def value(self):
57
+ """ """
58
+ return self._value
59
+
60
+ @value.setter
61
+ @stackable
62
+ def value(self, val):
63
+ """
64
+
65
+ Parameters
66
+ ----------
67
+ val :
68
+
69
+
70
+ Returns
71
+ -------
72
+
73
+ """
74
+ self._value = val
75
+ for model in self.models:
76
+ model.itemDataChanged(self)
77
+
78
+ def buildDefinition(self, simpDict, legacy):
79
+ """
80
+
81
+ Parameters
82
+ ----------
83
+ simpDict :
84
+
85
+ legacy :
86
+
87
+
88
+ Returns
89
+ -------
90
+
91
+ """
92
+ sIdx = self.slider.buildDefinition(simpDict, legacy)
93
+ return sIdx, self.value
94
+
95
+ def treeRow(self):
96
+ """ """
97
+ return self.combo.pairs.index(self)
98
+
99
+ def treeParent(self):
100
+ """ """
101
+ return self.combo
102
+
103
+ def treeData(self, column):
104
+ """
105
+
106
+ Parameters
107
+ ----------
108
+ column :
109
+
110
+
111
+ Returns
112
+ -------
113
+
114
+ """
115
+ if column == 0:
116
+ return self.name
117
+ if column == 1:
118
+ return self.value
119
+ return None
120
+
121
+
122
+ class Combo(SimplexAccessor):
123
+ """A group of Slider/Value pairs that control a Progression through some solver
124
+
125
+ Combos allow for fixit shapes to be created for any number of user inputs.
126
+ They also allow for fixits along the progression, and in "floating space" where
127
+ the inputs are not -1 or 1
128
+
129
+ Parameters
130
+ ----------
131
+ name : str
132
+ The name of this Combo
133
+ simplex : Simplex
134
+ The parent Simplex system
135
+ pairs : [ComboPair
136
+ The Slider/Value pairs that make up this combo
137
+ prog : Progression
138
+ The Progression that this Combo controls
139
+ group : Group
140
+ The Group to create this combo in
141
+ solveType : str
142
+ The solve type for this combo. See Combo.solveTypes for a list
143
+ color : QColor
144
+ The color of this item in the UI
145
+
146
+ Returns
147
+ -------
148
+
149
+ """
150
+
151
+ classDepth = 5
152
+ solveTypes = (
153
+ ("Minimum", "min"),
154
+ ("Multiply All", "allMul"),
155
+ ("Multiply Extremes", "extMul"),
156
+ ("Multiply Avg of Extremes", "mulAvgExt"),
157
+ ("Multiply Avg", "mulAvgAll"),
158
+ ("None", "min"),
159
+ )
160
+ _freezeIcon = None
161
+
162
+ def __init__(
163
+ self, name, simplex, pairs, prog, group, solveType, color=QColor(128, 128, 128)
164
+ ):
165
+ super(Combo, self).__init__(simplex)
166
+ with self.stack.store(self):
167
+ if group.groupType != type(self):
168
+ raise ValueError("Cannot add this slider to a combo group")
169
+ self._name = name
170
+ self.pairs = pairs
171
+ self.prog = prog
172
+ self._solveType = solveType
173
+ self._buildIdx = None
174
+ self.expanded = {}
175
+ self._enabled = True
176
+ self.color = color
177
+
178
+ self._freezeThing = None
179
+
180
+ mgrs = [model.insertItemManager(group) for model in self.models]
181
+ with nested(*mgrs):
182
+
183
+ self.group = group
184
+ for p in self.pairs:
185
+ p.combo = self
186
+ self.prog.controller = self
187
+ self.group.items.append(self)
188
+ self.simplex.combos.append(self)
189
+
190
+ @property
191
+ def enabled(self):
192
+ """Get whether this Combo is evaluated in the solver"""
193
+ return self._enabled
194
+
195
+ @enabled.setter
196
+ @stackable
197
+ def enabled(self, value):
198
+ """Set whether this Combo is evaluated in the solver"""
199
+ self._enabled = value
200
+ for model in self.models:
201
+ model.itemDataChanged(self)
202
+
203
+ @property
204
+ def frozen(self):
205
+ """Get whether this Combo is frozen"""
206
+ return bool(self.freezeThing)
207
+
208
+ @property
209
+ def freezeThing(self):
210
+ """Get whether this Combo is frozen"""
211
+ if self._freezeThing is None:
212
+ self._freezeThing = self.DCC.getFreezeThing(self)
213
+ return self._freezeThing
214
+
215
+ @freezeThing.setter
216
+ def freezeThing(self, value):
217
+ self._freezeThing = value
218
+ for model in self.models:
219
+ model.itemDataChanged(self)
220
+
221
+ def icon(self):
222
+ if self.frozen:
223
+ if self._freezeIcon is None:
224
+ type(self)._freezeIcon = getIcon("frozen.png")
225
+ return self._freezeIcon
226
+ return None
227
+
228
+ @classmethod
229
+ def comboAlreadyExists(cls, simplex, sliders, values):
230
+ """Classmethod to check whether a combo already exists with these sliders and values
231
+
232
+ Parameters
233
+ ----------
234
+ simplex : Simplex
235
+ The system to check within
236
+ sliders : [Slider
237
+ The Sliders to check
238
+ values : [float
239
+ The values to zip with the sliders
240
+
241
+ Returns
242
+ -------
243
+ : Combo or None
244
+ The combo that exists with the given values, or None if none exist
245
+
246
+ """
247
+ checker = set([(s.name, v) for s, v in zip(sliders, values)])
248
+ for combo in simplex.combos:
249
+ tester = set([(p.slider.name, p.value) for p in combo.pairs])
250
+ if checker == tester:
251
+ return combo
252
+ return None
253
+
254
+ @classmethod
255
+ def createCombo(
256
+ cls,
257
+ name,
258
+ simplex,
259
+ sliders,
260
+ values,
261
+ group=None,
262
+ shape=None,
263
+ solveType=None,
264
+ tVal=1.0,
265
+ ):
266
+ """Classmethod to create Combo with some hard-coded defaults
267
+
268
+ Parameters
269
+ ----------
270
+ name : str
271
+ The name of the Combo
272
+ simplex : Simplex
273
+ The Simplex system
274
+ sliders : [Slider
275
+ The Sliders that will control this combo
276
+ values : [float
277
+ The values at which the sliders will activate this combo
278
+ group : Group or None
279
+ A Group to organize this combo.
280
+ If None, the combo will be sorted into a "DEPTH" group (Default value = None)
281
+ shape : Shape or None
282
+ A Shape for this Combo's Progression. If None, then a default shape will be created
283
+ solveType : str or None
284
+ The solve type for this Combo. if None, defaults to 'min' in the solver
285
+ tVal : float
286
+ The slideValue where the Shape will be created/added. Defaults to 1.0
287
+
288
+ Returns
289
+ -------
290
+ : Combo
291
+ The newly created Combo
292
+
293
+ """
294
+ if simplex.restShape is None:
295
+ raise RuntimeError("Simplex system is missing rest shape")
296
+
297
+ # Make sure to check if this combo already exists. If so, just return it
298
+ exist = cls.comboAlreadyExists(simplex, sliders, values)
299
+ if exist is not None:
300
+ return exist
301
+ from .group import Group
302
+ from .progression import ProgPair, Progression
303
+
304
+ if group is None:
305
+ gname = "DEPTH_{0}".format(len(sliders))
306
+ matches = [i for i in simplex.comboGroups if i.name == gname]
307
+ if matches:
308
+ group = matches[0]
309
+ else:
310
+ group = Group(gname, simplex, Combo)
311
+
312
+ cPairs = [ComboPair(slider, value) for slider, value in zip(sliders, values)]
313
+ prog = Progression(name, simplex)
314
+ if shape:
315
+ prog.pairs.append(ProgPair(simplex, shape, tVal))
316
+
317
+ cmb = Combo(name, simplex, cPairs, prog, group, solveType)
318
+
319
+ if shape is None:
320
+ pp = prog.createShape(name, tVal)
321
+ simplex.DCC.zeroShape(pp.shape)
322
+
323
+ return cmb
324
+
325
+ @staticmethod
326
+ def buildComboName(sliders, values):
327
+ """Build the name for a combo based on the input Sliders and values
328
+ The sliders will be alphabetically sorted
329
+ Values not at Shape increments within the progression will get numeric
330
+ suffixes. Negative values will have suffixes like "n75"
331
+
332
+ Parameters
333
+ ----------
334
+ sliders : [Slider
335
+ The sliders to check
336
+ values : [float
337
+ The values for the sliders
338
+
339
+ Returns
340
+ -------
341
+ : str
342
+ The suggested combo name
343
+
344
+ """
345
+ pairs = list(zip(sliders, values))
346
+ pairs = sorted(pairs, key=lambda x: x[0].name)
347
+ parts = []
348
+ for slider, value in pairs:
349
+ shape = slider.prog.getShapeAtValue(value)
350
+ if shape is not None:
351
+ parts.append(shape.name)
352
+ else:
353
+ # get the extreme shape and percentage-ize its name
354
+ extVal = 1.0 if value > 0.0 else -1.0
355
+
356
+ valName = "{}".format(abs(int(value * 100)))
357
+ valName = "n" + valName if value < 0.0 else valName
358
+
359
+ shape = slider.prog.getShapeAtValue(extVal)
360
+ if shape is not None:
361
+ sn = shape.name
362
+ sn = sn.split("_")
363
+ if sn[-1].isnumeric() or (
364
+ sn[-1][0] == "n" and sn[-1][1:].isnumeric()
365
+ ):
366
+ sn[-1] = valName
367
+ else:
368
+ sn.append(valName)
369
+ nsn = "_".join(sn)
370
+ parts.append(nsn)
371
+ else:
372
+ parts.append(slider.name)
373
+
374
+ return "_".join(parts)
375
+
376
+ @property
377
+ def name(self):
378
+ """Get the name of a combo"""
379
+ return self._name
380
+
381
+ @name.setter
382
+ @stackable
383
+ def name(self, value):
384
+ """Set the name of a combo
385
+
386
+ Parameters
387
+ ----------
388
+ value :
389
+
390
+
391
+ Returns
392
+ -------
393
+
394
+ """
395
+ self._name = value
396
+ self.prog.name = value
397
+ self.DCC.renameCombo(self, value)
398
+ for model in self.models:
399
+ model.itemDataChanged(self)
400
+
401
+ @property
402
+ def solveType(self):
403
+ """ """
404
+ return self._solveType
405
+
406
+ @solveType.setter
407
+ @stackable
408
+ def solveType(self, newType):
409
+ """Set the solveType of the combo
410
+
411
+ Parameters
412
+ ----------
413
+ newType :
414
+
415
+
416
+ Returns
417
+ -------
418
+
419
+ """
420
+ stNames, stVals = list(zip(*self.solveTypes))
421
+ if newType not in stVals:
422
+ raise ValueError(
423
+ "Solve Type {0} not in allowed types {1}".format(newType, stVals)
424
+ )
425
+ self._solveType = newType
426
+ for model in self.models:
427
+ model.itemDataChanged(self)
428
+
429
+ def treeChild(self, row):
430
+ """
431
+
432
+ Parameters
433
+ ----------
434
+ row :
435
+
436
+
437
+ Returns
438
+ -------
439
+ type
440
+
441
+
442
+ """
443
+ if row == len(self.pairs):
444
+ return self.prog
445
+ return self.pairs[row]
446
+
447
+ def treeRow(self):
448
+ """ """
449
+ return self.group.items.index(self)
450
+
451
+ def treeParent(self):
452
+ """ """
453
+ return self.group
454
+
455
+ def treeChildCount(self):
456
+ """ """
457
+ return len(self.pairs) + 1
458
+
459
+ def treeChecked(self):
460
+ """ """
461
+ return self.enabled
462
+
463
+ def sliderNameLinks(self):
464
+ """ """
465
+ sliNames = ["_{0}_".format(i.slider.name) for i in self.pairs]
466
+ surr = "_{0}_".format(self.name)
467
+ return [sn in surr for sn in sliNames]
468
+
469
+ def nameLinks(self):
470
+ """
471
+
472
+ Parameters
473
+ ----------
474
+
475
+ Returns
476
+ -------
477
+ : type
478
+ progression depends on this slider's name
479
+
480
+ """
481
+ # In this case, these names will *NOT* have the possibility of
482
+ # a pos/neg name. Only the combo name, and possibly a percentage
483
+ shapeNames = []
484
+ shapes = [i.shape for i in self.prog.pairs]
485
+ for s in shapes:
486
+ x = s.name.rsplit("_", 1)
487
+ if len(x) == 2:
488
+ base, sfx = x
489
+ x = base if sfx.isdigit() else s.name
490
+ shapeNames.append(x)
491
+ return [i == self.name for i in shapeNames]
492
+
493
+ def getSliderIndex(self, slider):
494
+ """
495
+
496
+ Parameters
497
+ ----------
498
+ slider :
499
+
500
+
501
+ Returns
502
+ -------
503
+ type
504
+
505
+
506
+ """
507
+ for i, p in enumerate(self.pairs):
508
+ if p.slider == slider:
509
+ return i
510
+ raise ValueError("Provided slider:{0} is not in the list".format(slider.name))
511
+
512
+ def isFloating(self):
513
+ """
514
+
515
+ Parameters
516
+ ----------
517
+
518
+ Returns
519
+ -------
520
+ : type
521
+ Floating combos are combos that Slider values that are between 0 and 1
522
+
523
+ """
524
+ for pair in self.pairs:
525
+ if abs(pair.value) != 1.0:
526
+ return True
527
+ return False
528
+
529
+ def getSliders(self):
530
+ """ """
531
+ return [i.slider for i in self.pairs]
532
+
533
+ @classmethod
534
+ def loadV2(cls, simplex, progs, data):
535
+ """Load the data from a version2 formatted json dictionary
536
+
537
+ Parameters
538
+ ----------
539
+ simplex : Simplex
540
+ The Simplex system that's being built
541
+ progs : [Progression
542
+ The progressions that have already been built
543
+ data : dict
544
+ The chunk of the json dict used to build this object
545
+
546
+ Returns
547
+ -------
548
+ : Combo
549
+ The specified combo
550
+
551
+ """
552
+ name = data["name"]
553
+ prog = progs[data["prog"]]
554
+ group = simplex.groups[data.get("group", 1)]
555
+ color = QColor(*data.get("color", (128, 128, 128)))
556
+ pairs = [ComboPair(simplex.sliders[s], v) for s, v in data["pairs"]]
557
+ solveType = data.get("solveType")
558
+ return cls(name, simplex, pairs, prog, group, solveType, color=color)
559
+
560
+ def buildDefinition(self, simpDict, legacy):
561
+ """Output a dictionary definition of this object
562
+
563
+ Parameters
564
+ ----------
565
+ simpDict : dict
566
+ The dictionary that is being built
567
+ legacy : bool
568
+ Whether to write out the legacy definition, or the newer one
569
+
570
+ Returns
571
+ -------
572
+
573
+ """
574
+ if self._buildIdx is None:
575
+ self._buildIdx = len(simpDict["combos"])
576
+ if legacy:
577
+ gIdx = self.group.buildDefinition(simpDict, legacy)
578
+ pIdx = self.prog.buildDefinition(simpDict, legacy)
579
+ idxPairs = [p.buildDefinition(simpDict, legacy) for p in self.pairs]
580
+ x = [self.name, pIdx, idxPairs, gIdx]
581
+ simpDict.setdefault("combos", []).append(x)
582
+ else:
583
+ x = {
584
+ "name": self.name,
585
+ "prog": self.prog.buildDefinition(simpDict, legacy),
586
+ "pairs": [p.buildDefinition(simpDict, legacy) for p in self.pairs],
587
+ "group": self.group.buildDefinition(simpDict, legacy),
588
+ "color": self.color.getRgb()[:3],
589
+ "enabled": self._enabled,
590
+ "solveType": str(self._solveType),
591
+ }
592
+ simpDict.setdefault("combos", []).append(x)
593
+ return self._buildIdx
594
+
595
+ def clearBuildIndex(self):
596
+ """Clear the build index of this object
597
+
598
+ The buildIndex is stored when building a definition dictionary
599
+ that keeps track of its index for later referencing
600
+
601
+ Parameters
602
+ ----------
603
+
604
+ Returns
605
+ -------
606
+
607
+ """
608
+ self._buildIdx = None
609
+ self.prog.clearBuildIndex()
610
+ self.group.clearBuildIndex()
611
+
612
+ def extractProgressive(self, live=True, offset=10.0, separation=5.0):
613
+ """
614
+
615
+ Parameters
616
+ ----------
617
+ live :
618
+ (Default value = True)
619
+ offset :
620
+ (Default value = 10.0)
621
+ separation :
622
+ (Default value = 5.0)
623
+
624
+ Returns
625
+ -------
626
+
627
+ """
628
+ raise RuntimeError("Currently just copied from Sliders, Not actually real")
629
+ with undoContext(self.DCC):
630
+ pos, neg = [], []
631
+ for pp in sorted(self.prog.pairs):
632
+ if pp.value < 0.0:
633
+ neg.append((pp.value, pp.shape, offset))
634
+ offset += separation
635
+ elif pp.value > 0.0:
636
+ pos.append((pp.value, pp.shape, offset))
637
+ offset += separation
638
+ # skip the rest value at == 0.0
639
+ neg = reversed(neg)
640
+
641
+ for prog in [pos, neg]:
642
+ xtVal, shape, shift = prog[-1]
643
+ ext, deltaShape = self.DCC.extractWithDeltaShape(shape, live, shift)
644
+ for value, shape, shift in prog[:-1]:
645
+ self.DCC.extractWithDeltaConnection(
646
+ shape, deltaShape, value / xtVal, live, shift
647
+ )
648
+
649
+ def extractShape(self, shape, live=True, offset=10.0):
650
+ """Extract a shape from a combo progression
651
+
652
+ Parameters
653
+ ----------
654
+ shape : Shape
655
+ The Shape object to extract as a mesh
656
+ live : bool
657
+ Whether to maintain a live connection to the extracted mesh in the DCC (Default value = True)
658
+ offset : float
659
+ The offset to give the extracted mesh in the DCC (Default value = 10.0)
660
+
661
+ Returns
662
+ -------
663
+ : object
664
+ The DCC mesh just created
665
+
666
+ """
667
+ return self.DCC.extractComboShape(self, shape, live, offset)
668
+
669
+ def connectShape(self, shape, mesh=None, live=False, delete=False):
670
+ """Connect a shape into a combo progression
671
+
672
+ Parameters
673
+ ----------
674
+ shape : Shape
675
+ The shape to connect the mesh to
676
+ mesh : object or None
677
+ A DCC mesh to connect into a Shape
678
+ If None, tries to connect by name (Default value = None)
679
+ live : bool
680
+ Whether to maintain a live connecto to the mesh in the DCC (Default value = False)
681
+ delete : bool
682
+ Whether to delete the DCC mesh after it was connected (Default value = False)
683
+
684
+ Returns
685
+ -------
686
+
687
+ """
688
+ self.DCC.connectComboShape(self, shape, mesh, live, delete)
689
+
690
+ @stackable
691
+ def delete(self):
692
+ """Delete this combo and any shapes it contains"""
693
+ self.simplex.deleteDownstream(self)
694
+ mgrs = [model.removeItemManager(self) for model in self.models]
695
+ with nested(*mgrs):
696
+ g = self.group
697
+ if self not in g.items:
698
+ return # Can happen when deleting multiple groups
699
+ g.items.remove(self)
700
+ self.group = None
701
+ self.simplex.combos.remove(self)
702
+ pairs = self.prog.pairs[:] # gotta make a copy
703
+ for pp in pairs:
704
+ if not pp.shape.isRest:
705
+ self.simplex.shapes.remove(pp.shape)
706
+ self.DCC.deleteShape(pp.shape)
707
+
708
+ @stackable
709
+ def setInterpolation(self, interp):
710
+ """Set the interpolation of a combo
711
+
712
+ Parameters
713
+ ----------
714
+ interp : str
715
+ The interpolation for this combo's progression
716
+
717
+ Returns
718
+ -------
719
+
720
+ """
721
+ self.prog.interp = interp
722
+ for model in self.models:
723
+ model.itemDataChanged(self)
724
+
725
+ @stackable
726
+ def setComboValue(self, slider, value):
727
+ """Set the Slider/value pairs for a combo
728
+
729
+ Parameters
730
+ ----------
731
+ slider : Slider
732
+ The slider to set the value for
733
+ value : float
734
+ The value to set the Slider to
735
+
736
+ Returns
737
+ -------
738
+
739
+ """
740
+ idx = self.getSliderIndex(slider)
741
+ pair = self.pairs[idx]
742
+ pair.value = value
743
+ for model in self.models:
744
+ model.itemDataChanged(pair)
745
+
746
+ @stackable
747
+ def appendComboValue(self, slider, value):
748
+ """Append a Slider/value pair for a combo
749
+
750
+ Parameters
751
+ ----------
752
+ slider : Slider
753
+ The slider to insert
754
+ value : float
755
+ The value to set the Slider to
756
+
757
+ Returns
758
+ -------
759
+
760
+ """
761
+ cp = ComboPair(slider, value)
762
+ mgrs = [model.insertItemManager(self) for model in self.models]
763
+ with nested(*mgrs):
764
+ self.pairs.append(cp)
765
+ cp.combo = self
766
+
767
+ @stackable
768
+ def deleteComboPair(self, comboPair):
769
+ """Delete a Slider/value pair for a combo
770
+
771
+ Parameters
772
+ ----------
773
+ comboPair : ComboPair
774
+ The ComboPair to delete
775
+
776
+ Returns
777
+ -------
778
+
779
+ """
780
+ mgrs = [model.removeItemManager(comboPair) for model in self.models]
781
+ with nested(*mgrs):
782
+ # We specifically don't move the combo to the proper depth group
783
+ # That way the user can make multiple changes to the combo without
784
+ # it popping all over in the heirarchy
785
+ self.pairs.remove(comboPair)
786
+ comboPair.combo = None
787
+
788
+ @stackable
789
+ def setGroup(self, grp):
790
+ """Set the group for this Combo
791
+
792
+ Parameters
793
+ ----------
794
+ grp : Group
795
+ The group to set
796
+
797
+ Returns
798
+ -------
799
+
800
+ """
801
+ if grp.groupType is None:
802
+ grp.groupType = type(self)
803
+
804
+ if not isinstance(self, grp.groupType):
805
+ raise ValueError(
806
+ "All items in this group must be of type: {}".format(grp.groupType)
807
+ )
808
+
809
+ mgrs = [model.moveItemManager(self, grp) for model in self.models]
810
+ with nested(*mgrs):
811
+ if self.group:
812
+ self.group.items.remove(self)
813
+ grp.items.append(self)
814
+ self.group = grp
815
+
816
+ @stackable
817
+ def createShape(self, shapeName=None, tVal=None):
818
+ """Create a shape and add it to a progression
819
+
820
+ Parameters
821
+ ----------
822
+ shapeName : str or None
823
+ The name of the shape to create.
824
+ If None, give it a default name
825
+ tVal : float or None
826
+ The progression value to set for the new Shape.
827
+ If None, it gets a "smart" default value
828
+
829
+ Returns
830
+ -------
831
+
832
+ """
833
+ pp, idx = self.prog.newProgPair(shapeName, tVal)
834
+ mgrs = [model.insertItemManager(self.prog, idx) for model in self.models]
835
+ with nested(*mgrs):
836
+ pp.prog = self.prog
837
+ self.prog.pairs.insert(idx, pp)
838
+ return pp
839
+
840
+ def getInputVector(self):
841
+ """Get the input to the Solver that would fully activate this Combo
842
+
843
+ Parameters
844
+ ----------
845
+
846
+ Returns
847
+ -------
848
+ : [float, ...]
849
+ The ordered slider values
850
+
851
+ """
852
+ inVec = [0.0] * len(self.simplex.sliders)
853
+ for cp in self.pairs:
854
+ inVec[self.simplex.sliders.index(cp.slider)] = cp.value
855
+ return inVec