Panda3D
 All Classes Functions Variables Enumerations
switchNode.I
1 // Filename: switchNode.I
2 // Created by: drose (31Jul02)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 
16 ////////////////////////////////////////////////////////////////////
17 // Function: SwitchNode::CData::Constructor
18 // Access: Public
19 // Description:
20 ////////////////////////////////////////////////////////////////////
21 INLINE SwitchNode::CData::
22 CData() {
23  _visible_child = 0;
24 }
25 
26 ////////////////////////////////////////////////////////////////////
27 // Function: SwitchNode::CData::Copy Constructor
28 // Access: Public
29 // Description:
30 ////////////////////////////////////////////////////////////////////
31 INLINE SwitchNode::CData::
32 CData(const SwitchNode::CData &copy) :
33  _visible_child(copy._visible_child)
34 {
35 }
36 
37 ////////////////////////////////////////////////////////////////////
38 // Function: SwitchNode::Constructor
39 // Access: Published
40 // Description:
41 ////////////////////////////////////////////////////////////////////
42 INLINE SwitchNode::
43 SwitchNode(const string &name) :
44  SelectiveChildNode(name)
45 {
46  set_cull_callback();
47 }
48 
49 ////////////////////////////////////////////////////////////////////
50 // Function: SwitchNode::set_visible_child
51 // Access: Published
52 // Description: Specifies the particular child of this node, by
53 // index, that will be visible.
54 ////////////////////////////////////////////////////////////////////
55 INLINE void SwitchNode::
56 set_visible_child(int index) {
57  nassertv(index >= 0);
58  CDWriter cdata(_cycler);
59  cdata->_visible_child = index;
60 }
A base class for nodes like LODNode and SequenceNode that select only one visible child at a time...
This template class calls PipelineCycler::write() in the constructor and PipelineCycler::release_writ...
void set_visible_child(int index)
Specifies the particular child of this node, by index, that will be visible.
Definition: switchNode.I:56