Switch
Switch is a Grouping node that only renders one (or zero) child at a time. Switch can contain most nodes. (Contained nodes are now called 'children' rather than 'choice', for consistent naming among all GroupingNodeType nodes.) All child choices continue to receive and send events regardless of whichChoice is active. Hint: insert a Shape node before adding geometry or Appearance. Hint: authors can temporarily hide test geometry under an unselected child of a Switch. This is a good alternative to 'commenting out' nodes.
Inheritance
Code
XML encoding
<Switch whichChoice='-1' cycle='TRUE' bboxCenter='0 0 0' bboxSize='-1 -1 -1' render='TRUE' showBBox='FALSE' logFeature='' />
Classic encoding
Switch { whichChoice -1 cycle TRUE bboxCenter 0 0 0 bboxSize -1 -1 -1 render TRUE showBBox FALSE logFeature [""] }
Interface
Filter: X3D only | Avalon only | All
id | Name | DataType | PartType | Default | ValueType | Description |
---|---|---|---|---|---|---|
addChildren | MFNode | inputOnly | The addChildren event appends nodes to the children field of a grouping node. Any nodes passed to the addChildren inputOnly field that are already in the children list of the grouping node are ignored | |||
children | MFNode | inputOutput | Node | field that contains a list of children nodes | ||
removeChildren | MFNode | inputOnly | The removeChildren event removes nodes from the children fieldof the grouping node . Any nodes in the removeChildren event that are not in the children list of the grouping node are ignored | |||
logFeature | MFString | inputOutput | state, child, parent, route, eventIn, eventOut | controls the logging of changes, state: log state changes (e.g. live), child: log child add/remove, parent: log parent add/remove, route: log route add/remove; eventIn: log receiving of events, eventOut: log sending of events: guiView, runtime system should create node-view, guiEdit: runtime system should create node-editeverything: log everything | ||
cycle | SFBool | inputOutput | TRUE | incr/decr in a modulo manner or clamp value whichChoice | ||
render | SFBool | inputOutput | TRUE | Flag to control the visibility of the node or subtree | ||
showBBox | SFBool | inputOutput | FALSE | Show Bounding Box of Subtree. | ||
whichChoice | SFInt32 | inputOutput | -1 | Index of active child choice, counting from 0. Warning: default whichChoice= -1 means no selection (and no rendering), whichChoice=0 means initial child. | ||
metadata | SFNode | inputOutput | MetadataObject | container for payload metadata inside MetadataSet element | ||
bboxCenter | SFVec3f | initializeOnly | 0 0 0 | Bounding box center: position offset from origin of local coordinate system. | ||
bboxSize | SFVec3f | initializeOnly | -1 -1 -1 | Bounding box size: automatically calculated, can be specified as an optimization or constraint. | ||
next | XFAny | inputOnly | incr whichChoice field if value is non-negative | |||
prev | XFAny | inputOnly | decr whichChoice field if value is non-negative |