Panda3D
 All Classes Functions Variables Enumerations
showInterval.cxx
1 // Filename: showInterval.cxx
2 // Created by: drose (27Aug02)
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 #include "showInterval.h"
16 
17 int ShowInterval::_unique_index;
18 TypeHandle ShowInterval::_type_handle;
19 
20 ////////////////////////////////////////////////////////////////////
21 // Function: ShowInterval::Constructor
22 // Access: Published
23 // Description:
24 ////////////////////////////////////////////////////////////////////
25 ShowInterval::
26 ShowInterval(const NodePath &node, const string &name) :
27  CInterval(name, 0.0, true),
28  _node(node)
29 {
30  nassertv(!node.is_empty());
31  if (_name.empty()) {
32  ostringstream name_strm;
33  name_strm
34  << "ShowInterval-" << node.node()->get_name() << "-" << ++_unique_index;
35  _name = name_strm.str();
36  }
37 }
38 
39 ////////////////////////////////////////////////////////////////////
40 // Function: ShowInterval::instant
41 // Access: Published, Virtual
42 // Description: This is called in lieu of priv_initialize() .. priv_step()
43 // .. priv_finalize(), when everything is to happen within
44 // one frame. The interval should initialize itself,
45 // then leave itself in the final state.
46 ////////////////////////////////////////////////////////////////////
47 void ShowInterval::
49  check_stopped(get_class_type(), "priv_instant");
50  _node.show();
51  _state = S_final;
52 }
53 
54 ////////////////////////////////////////////////////////////////////
55 // Function: ShowInterval::reverse_instant
56 // Access: Published, Virtual
57 // Description: This is called in lieu of priv_reverse_initialize()
58 // .. priv_step() .. priv_reverse_finalize(), when everything is
59 // to happen within one frame. The interval should
60 // initialize itself, then leave itself in the initial
61 // state.
62 ////////////////////////////////////////////////////////////////////
63 void ShowInterval::
65  check_stopped(get_class_type(), "priv_reverse_instant");
66  _node.hide();
67  _state = S_initial;
68 }
virtual void priv_instant()
This is called in lieu of priv_initialize() .
The base class for timeline components.
Definition: cInterval.h:39
PandaNode * node() const
Returns the referenced node of the path.
Definition: nodePath.I:284
void show()
Undoes the effect of a previous hide() on this node: makes the referenced node (and the entire subgra...
Definition: nodePath.I:2202
bool is_empty() const
Returns true if the NodePath contains no nodes.
Definition: nodePath.I:236
virtual void priv_reverse_instant()
This is called in lieu of priv_reverse_initialize()
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
void hide()
Makes the referenced node (and the entire subgraph below this node) invisible to all cameras...
Definition: nodePath.I:2270
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
Definition: nodePath.h:165