MCPcopy Create free account
hub / github.com/ddiakopoulos/polymer / import_scene

Method import_scene

apps/editor/editor-app.cpp:248–281  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

246}
247
248void scene_editor_app::import_scene(const std::string & path)
249{
250 if (!path.empty())
251 {
252 gizmo->clear();
253 renderer_payload.reset();
254
255 int width, height;
256 glfwGetWindowSize(window, &width, &height);
257 the_scene.reset({ width, height }, false); // don't create implicit objects if importing
258
259 the_scene.import_environment(path);
260
261 auto asset_base = global_asset_dir::get()->get_asset_dir();
262
263 // Resolve polymer-local assets
264 the_scene.resolver->add_search_path(asset_base);
265
266 // Resolve project assets
267 const auto parent_dir = parent_directory_from_filepath(path);
268 log::get()->engine_log->info("resolving local `{}` directory.", parent_dir);
269 the_scene.resolver->add_search_path(parent_dir);
270
271 the_scene.resolver->resolve();
272
273 glfwSetWindowTitle(window, path.c_str());
274 }
275 else
276 {
277 throw std::invalid_argument("path was empty...?");
278 }
279
280 polymer::global_debug_mesh_manager::get()->initialize_resources(&the_scene);
281}
282
283void scene_editor_app::open_material_editor()
284{

Callers

nothing calls this directly

Calls 9

import_environmentMethod · 0.80
get_asset_dirMethod · 0.80
initialize_resourcesMethod · 0.80
emptyMethod · 0.45
clearMethod · 0.45
resetMethod · 0.45
add_search_pathMethod · 0.45
resolveMethod · 0.45

Tested by

no test coverage detected