00001 // Filename: showInterval.cxx 00002 // Created by: drose (27Aug02) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 #include "showInterval.h" 00020 00021 int ShowInterval::_unique_index; 00022 TypeHandle ShowInterval::_type_handle; 00023 00024 //////////////////////////////////////////////////////////////////// 00025 // Function: ShowInterval::Constructor 00026 // Access: Published 00027 // Description: 00028 //////////////////////////////////////////////////////////////////// 00029 ShowInterval:: 00030 ShowInterval(const NodePath &node, const string &name) : 00031 CInterval(name, 0.0, true), 00032 _node(node) 00033 { 00034 nassertv(!node.is_empty()); 00035 if (_name.empty()) { 00036 ostringstream name_strm; 00037 name_strm 00038 << "ShowInterval-" << node.node()->get_name() << "-" << ++_unique_index; 00039 _name = name_strm.str(); 00040 } 00041 } 00042 00043 //////////////////////////////////////////////////////////////////// 00044 // Function: ShowInterval::instant 00045 // Access: Published, Virtual 00046 // Description: This is called in lieu of priv_initialize() .. priv_step() 00047 // .. priv_finalize(), when everything is to happen within 00048 // one frame. The interval should initialize itself, 00049 // then leave itself in the final state. 00050 //////////////////////////////////////////////////////////////////// 00051 void ShowInterval:: 00052 priv_instant() { 00053 check_stopped(get_class_type(), "priv_instant"); 00054 _node.show(); 00055 _state = S_final; 00056 } 00057 00058 //////////////////////////////////////////////////////////////////// 00059 // Function: ShowInterval::reverse_instant 00060 // Access: Published, Virtual 00061 // Description: This is called in lieu of priv_reverse_initialize() 00062 // .. priv_step() .. priv_reverse_finalize(), when everything is 00063 // to happen within one frame. The interval should 00064 // initialize itself, then leave itself in the initial 00065 // state. 00066 //////////////////////////////////////////////////////////////////// 00067 void ShowInterval:: 00068 priv_reverse_instant() { 00069 check_stopped(get_class_type(), "priv_reverse_instant"); 00070 _node.hide(); 00071 _state = S_initial; 00072 }