Panda3D
 All Classes Functions Variables Enumerations
modelFlattenRequest.cxx
1 // Filename: modelFlattenRequest.cxx
2 // Created by: drose (30Mar07)
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 "modelFlattenRequest.h"
16 #include "nodePath.h"
17 
18 TypeHandle ModelFlattenRequest::_type_handle;
19 
20 ////////////////////////////////////////////////////////////////////
21 // Function: ModelFlattenRequest::do_task
22 // Access: Protected, Virtual
23 // Description: Performs the task: that is, copies and flattens the
24 // model.
25 ////////////////////////////////////////////////////////////////////
26 AsyncTask::DoneStatus ModelFlattenRequest::
27 do_task() {
28  // We make another instance of the original node, so we can safely
29  // flatten that without affecting the original copy.
30  NodePath np("flatten_root");
31  np.attach_new_node(_orig);
32  np.flatten_strong();
33  _model = np.get_child(0).node();
34  _is_ready = true;
35 
36  // Don't continue the task; we're done.
37  return DS_done;
38 }
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
Definition: nodePath.h:165