MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ load_mesh_network()

std::shared_ptr< Nodes::Network::MeshNetwork > MayaFlux::IO::IOManager::load_mesh_network ( const std::string &  filepath,
TextureResolver  resolver = nullptr 
)

Load a 3D model file as a MeshNetwork.

One MeshSlot per aiMesh. Per-slot diffuse textures resolved via resolver. Null resolver uses the default: ImageReader::load_texture relative to the model file's directory.

Parameters
filepathPath to the model file.
resolverOptional texture resolver.
Returns
Populated MeshNetwork, or nullptr on failure.

Definition at line 419 of file IOManager.cpp.

420{
421 auto reader = std::make_shared<ModelReader>();
422
423 if (!reader->can_read(filepath)) {
425 "IOManager::load_mesh_network: unsupported format '{}'", filepath);
426 return nullptr;
427 }
428
429 if (!reader->open(filepath)) {
431 "IOManager::load_mesh_network: failed to open '{}' — {}",
432 filepath, reader->get_last_error());
433 return nullptr;
434 }
435
436 if (!resolver)
437 resolver = make_default_resolver(filepath);
438
439 auto net = reader->create_mesh_network(resolver);
440 reader->close();
441
442 if (!net) {
444 "IOManager::load_mesh_network: no network from '{}'", filepath);
445 return nullptr;
446 }
447
449 "IOManager::load_mesh_network: {} slots from '{}'",
450 net->slot_count(),
451 std::filesystem::path(filepath).filename().string());
452
453 return net;
454}
#define MF_INFO(comp, ctx,...)
#define MF_ERROR(comp, ctx,...)
@ FileIO
Filesystem I/O operations.
@ API
MayaFlux/API Wrapper and convenience functions.

References MayaFlux::Journal::API, MayaFlux::Journal::FileIO, MF_ERROR, and MF_INFO.