Skip to content

Commit a58a998

Browse files
committed
Refactoring duplicated codes
1 parent dcc01dd commit a58a998

File tree

1 file changed

+1
-15
lines changed

1 file changed

+1
-15
lines changed

src/rppanda/showbase/loader.cpp

+1-15
Original file line numberDiff line numberDiff line change
@@ -122,21 +122,7 @@ Loader& Loader::operator=(Loader&&) = default;
122122
NodePath Loader::load_model(const Filename& model_path, const LoaderOptions& loader_options,
123123
boost::optional<bool> no_cache, bool allow_instance, boost::optional<bool> ok_missing)
124124
{
125-
rppanda_showbase_cat.debug() << "Loading model: " << model_path << std::endl;
126-
127-
LoaderOptions this_options(loader_options);
128-
bool this_ok_missing;
129-
impl_->pre_load_model(this_options, this_ok_missing, no_cache, allow_instance, ok_missing);
130-
131-
PT(PandaNode) node = impl_->loader_->load_sync(model_path, this_options);
132-
NodePath result;
133-
if (node)
134-
result = NodePath(node);
135-
136-
if (!this_ok_missing && result.is_empty())
137-
throw std::runtime_error(std::string("Could not load model file(s): ") + model_path.c_str());
138-
139-
return result;
125+
return load_model(std::vector<Filename>{model_path}, loader_options, no_cache, allow_instance, ok_missing).front();
140126
}
141127

142128
std::vector<NodePath> Loader::load_model(const std::vector<Filename>& model_list, const LoaderOptions& loader_options,

0 commit comments

Comments
 (0)