Skip to content

Commit 2412f57

Browse files
committed
Set input dimension for all effects
Signed-off-by: martinRenou <[email protected]>
1 parent 58de12e commit 2412f57

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

ipygany/ipygany.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,10 @@ class RGB(Effect):
546546

547547
_model_name = Unicode('RGBModel').tag(sync=True)
548548

549-
input = Union((Tuple(trait=Unicode, minlen=2, maxlen=2), Unicode(), CFloat(0.))).tag(sync=True)
549+
@property
550+
def input_dim(self):
551+
"""Input dimension."""
552+
return 3
550553

551554

552555
class IsoColor(Effect):
@@ -568,48 +571,45 @@ class IsoSurface(Effect):
568571

569572
_model_name = Unicode('IsoSurfaceModel').tag(sync=True)
570573

571-
input = Union((Tuple(trait=Unicode, minlen=2, maxlen=2), Unicode(), CFloat(0.))).tag(sync=True)
572-
573574
value = CFloat(0.).tag(sync=True)
574575
dynamic = Bool(False).tag(sync=True)
575576

576-
@default('input')
577-
def _default_input(self):
578-
return self.parent.data[0].name
577+
@property
578+
def input_dim(self):
579+
"""Input dimension."""
580+
return 1
579581

580582

581583
class Threshold(Effect):
582584
"""An Threshold effect to another block."""
583585

584586
_model_name = Unicode('ThresholdModel').tag(sync=True)
585587

586-
input = Union((Tuple(trait=Unicode, minlen=2, maxlen=2), Unicode(), CFloat(0.))).tag(sync=True)
587-
588588
min = CFloat(0.).tag(sync=True)
589589
max = CFloat(0.).tag(sync=True)
590590
dynamic = Bool(False).tag(sync=True)
591591
inclusive = Bool(True).tag(sync=True)
592592

593-
@default('input')
594-
def _default_input(self):
595-
return self.parent.data[0].name
593+
@property
594+
def input_dim(self):
595+
"""Input dimension."""
596+
return 1
596597

597598

598599
class UnderWater(Effect):
599600
"""An nice UnderWater effect to another block."""
600601

601602
_model_name = Unicode('UnderWaterModel').tag(sync=True)
602603

603-
input = Union((Tuple(trait=Unicode, minlen=2, maxlen=2), Unicode(), CFloat(0.))).tag(sync=True)
604-
605604
default_color = Color('#F2FFD2').tag(sync=True)
606605
texture = Instance(Image, allow_none=True, default_value=None).tag(sync=True, **widget_serialization)
607606
texture_scale = CFloat(2.).tag(sync=True)
608607
texture_position = Tuple(minlen=2, maxlen=2, default_value=(1., 1., 0.)).tag(sync=True)
609608

610-
@default('input')
611-
def _default_input(self):
612-
return self.parent.data[0].name
609+
@property
610+
def input_dim(self):
611+
"""Input dimension."""
612+
return 1
613613

614614

615615
class Water(Effect):

0 commit comments

Comments
 (0)