00001 // Filename: loader.I 00002 // Created by: mike (09Jan97) 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 00020 //////////////////////////////////////////////////////////////////// 00021 // Function: Loader::Results::Constructor 00022 // Access: Published 00023 // Description: 00024 //////////////////////////////////////////////////////////////////// 00025 INLINE Loader::Results:: 00026 Results() { 00027 } 00028 00029 //////////////////////////////////////////////////////////////////// 00030 // Function: Loader::Results::Copy Constructor 00031 // Access: Published 00032 // Description: 00033 //////////////////////////////////////////////////////////////////// 00034 INLINE Loader::Results:: 00035 Results(const Loader::Results ©) : 00036 _files(copy._files) 00037 { 00038 } 00039 00040 //////////////////////////////////////////////////////////////////// 00041 // Function: Loader::Results::Copy Assignment Operator 00042 // Access: Published 00043 // Description: 00044 //////////////////////////////////////////////////////////////////// 00045 INLINE void Loader::Results:: 00046 operator = (const Loader::Results ©) { 00047 _files = copy._files; 00048 } 00049 00050 //////////////////////////////////////////////////////////////////// 00051 // Function: Loader::Results::Destructor 00052 // Access: Published 00053 // Description: 00054 //////////////////////////////////////////////////////////////////// 00055 INLINE Loader::Results:: 00056 ~Results() { 00057 } 00058 00059 //////////////////////////////////////////////////////////////////// 00060 // Function: Loader::Results::clear 00061 // Access: Published 00062 // Description: Removes all the files from the list. 00063 //////////////////////////////////////////////////////////////////// 00064 INLINE void Loader::Results:: 00065 clear() { 00066 _files.clear(); 00067 } 00068 00069 //////////////////////////////////////////////////////////////////// 00070 // Function: Loader::Results::get_num_files 00071 // Access: Published 00072 // Description: Returns the number of files on the result list. 00073 //////////////////////////////////////////////////////////////////// 00074 INLINE int Loader::Results:: 00075 get_num_files() const { 00076 return _files.size(); 00077 } 00078 00079 //////////////////////////////////////////////////////////////////// 00080 // Function: Loader::Results::get_file 00081 // Access: Published 00082 // Description: Returns the nth file on the result list. 00083 //////////////////////////////////////////////////////////////////// 00084 INLINE const Filename &Loader::Results:: 00085 get_file(int n) const { 00086 nassertr(n >= 0 && n < (int)_files.size(), _files[0]._path); 00087 return _files[n]._path; 00088 } 00089 00090 //////////////////////////////////////////////////////////////////// 00091 // Function: Loader::Results::get_file_type 00092 // Access: Published 00093 // Description: Returns the file type of the nth file on the result 00094 // list. 00095 //////////////////////////////////////////////////////////////////// 00096 INLINE LoaderFileType *Loader::Results:: 00097 get_file_type(int n) const { 00098 nassertr(n >= 0 && n < (int)_files.size(), NULL); 00099 return _files[n]._type; 00100 } 00101 00102 //////////////////////////////////////////////////////////////////// 00103 // Function: Loader::Results::add_file 00104 // Access: Published 00105 // Description: Adds a new file to the result list. 00106 //////////////////////////////////////////////////////////////////// 00107 INLINE void Loader::Results:: 00108 add_file(const Filename &file, LoaderFileType *type) { 00109 ConsiderFile cf; 00110 cf._path = file; 00111 cf._type = type; 00112 _files.push_back(cf); 00113 } 00114 00115 //////////////////////////////////////////////////////////////////// 00116 // Function: Loader::load_sync 00117 // Access: Published 00118 // Description: Loads the file immediately, waiting for it to 00119 // complete. 00120 // 00121 // If search is true, the file is searched for along the 00122 // model path; otherwise, only the exact filename is 00123 // loaded. 00124 //////////////////////////////////////////////////////////////////// 00125 INLINE PT(PandaNode) Loader:: 00126 load_sync(const Filename &filename, bool search) const { 00127 if (!_file_types_loaded) { 00128 load_file_types(); 00129 } 00130 return load_file(filename, search); 00131 }