MayaFlux 1.0.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 935 of file IOManager.cpp.

936{
937 auto reader = std::make_shared<ModelReader>();
938
939 if (!reader->can_read(filepath)) {
941 "IOManager::load_mesh_network: unsupported format '{}'", filepath);
942 return nullptr;
943 }
944
945 if (!reader->open(filepath)) {
947 "IOManager::load_mesh_network: failed to open '{}' — {}",
948 filepath, reader->get_last_error());
949 return nullptr;
950 }
951
952 if (!resolver)
953 resolver = Detail::make_default_resolver(filepath);
954
955 auto net = reader->create_mesh_network(resolver);
956 reader->close();
957
958 if (!net) {
960 "IOManager::load_mesh_network: no network from '{}'", filepath);
961 return nullptr;
962 }
963
965 "IOManager::load_mesh_network: {} slots from '{}'",
966 net->slot_count(),
967 std::filesystem::path(filepath).filename().string());
968
969 return net;
970}
#define MF_INFO(comp, ctx,...)
#define MF_ERROR(comp, ctx,...)
TextureResolver make_default_resolver(const std::string &filepath)
@ FileIO
Filesystem I/O operations.
@ API
MayaFlux/API Wrapper and convenience functions.

References MayaFlux::Journal::API, MayaFlux::Journal::FileIO, MayaFlux::IO::Detail::make_default_resolver(), MF_ERROR, and MF_INFO.

+ Here is the call graph for this function: