From 1874f164d796a20bd30c9875b546c866f7e3523c Mon Sep 17 00:00:00 2001 From: gapry Date: Sun, 17 Nov 2024 23:43:02 +0800 Subject: [PATCH] [PoC][Part01] Issues 1281, Support Obj's with TGA Textures --- application/F3DStarter.cxx | 12 ++++++++++-- library/src/scene_impl.cxx | 8 ++++++-- vtkext/private/module/vtkF3DGenericImporter.cxx | 2 ++ vtkext/private/module/vtkF3DMetaImporter.cxx | 4 +++- 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/application/F3DStarter.cxx b/application/F3DStarter.cxx index e1cc563a83..ce8beafe46 100644 --- a/application/F3DStarter.cxx +++ b/application/F3DStarter.cxx @@ -934,6 +934,7 @@ int F3DStarter::Start(int argc, char** argv) // Add all input files for (auto& file : inputFiles) { + f3d::log::info("[gapry][issues][1281][", __PRETTY_FUNCTION__, "] ", file); this->AddFile(fs::path(file)); } @@ -1081,6 +1082,8 @@ int F3DStarter::Start(int argc, char** argv) //---------------------------------------------------------------------------- void F3DStarter::LoadFileGroup(int index, bool relativeIndex, bool forceClear) { + f3d::log::info("[gapry][issues][1281][", __PRETTY_FUNCTION__, "] ", index, relativeIndex, forceClear); + int groupIndex = this->Internals->CurrentFilesGroupIndex; if (relativeIndex) { @@ -1126,6 +1129,10 @@ void F3DStarter::LoadFileGroup(int index, bool relativeIndex, bool forceClear) void F3DStarter::LoadFileGroup( const std::vector& paths, bool clear, const std::string& groupIdx) { + for(auto& p: paths) { + f3d::log::info("[gapry][issues][1281][", __PRETTY_FUNCTION__, "] " , p.string(), clear, groupIdx); + } + // Make sure the animation is stopped before trying to load any file if (!this->Internals->AppOptions.NoRender) { @@ -1158,7 +1165,7 @@ void F3DStarter::LoadFileGroup( dynamicOptionsDict, fs::path(), "dynamic options"); // Recover file information - f3d::scene& scene = this->Internals->Engine->getScene(); + f3d::scene& scene = this->Internals->Engine->getScene(); // [gapry][issues][1281] bool unsupported = false; std::vector localPaths; @@ -1210,6 +1217,7 @@ void F3DStarter::LoadFileGroup( } else { + f3d::log::info("[gapry][issues][1281][", __PRETTY_FUNCTION__, "] ", tmpPath.string()); localPaths.emplace_back(tmpPath); } } @@ -1224,7 +1232,7 @@ void F3DStarter::LoadFileGroup( if (!localPaths.empty()) { // Add files to the scene - scene.add(localPaths); + scene.add(localPaths); // [gapry][issues][1281] // Update loaded files std::copy( diff --git a/library/src/scene_impl.cxx b/library/src/scene_impl.cxx index 1a7e1f08c0..ecd17d42fb 100644 --- a/library/src/scene_impl.cxx +++ b/library/src/scene_impl.cxx @@ -89,6 +89,8 @@ class scene_impl::internals void Load(const std::vector>& importers) { + log::info(std::string("[gapry][issues][1281][") + __PRETTY_FUNCTION__ + "]"); + for (const vtkSmartPointer& importer : importers) { this->MetaImporter->AddImporter(importer); @@ -243,6 +245,8 @@ scene& scene_impl::add(const std::vector& filePaths) throw scene::load_failure_exception(filePath.string() + " does not exists"); } + f3d::log::info("[gapry][issues][1281][", __PRETTY_FUNCTION__, "] ", filePath.string()); + // Recover the importer for the provided file path f3d::reader* reader = f3d::factory::instance()->getReader(filePath.string()); if (reader) @@ -259,14 +263,14 @@ scene& scene_impl::add(const std::vector& filePaths) if (!importer) { // XXX: F3D Plugin CMake logic ensure there is either a scene reader or a geometry reader - auto vtkReader = reader->createGeometryReader(filePath.string()); + auto vtkReader = reader->createGeometryReader(filePath.string()); // [gapry][issues][1281] assert(vtkReader); vtkSmartPointer genericImporter = vtkSmartPointer::New(); genericImporter->SetInternalReader(vtkReader); importer = genericImporter; } - importers.emplace_back(importer); + importers.emplace_back(importer); // [gapry][issues][1281] } log::debug("\nLoading files: "); diff --git a/vtkext/private/module/vtkF3DGenericImporter.cxx b/vtkext/private/module/vtkF3DGenericImporter.cxx index d888d35ca3..4139877735 100644 --- a/vtkext/private/module/vtkF3DGenericImporter.cxx +++ b/vtkext/private/module/vtkF3DGenericImporter.cxx @@ -172,6 +172,8 @@ void vtkF3DGenericImporter::ImportActors(vtkRenderer* ren) //---------------------------------------------------------------------------- void vtkF3DGenericImporter::SetInternalReader(vtkAlgorithm* reader) { + F3DLog::Print(F3DLog::Severity::Info, std::string("[gapry][issues][1281][") + __PRETTY_FUNCTION__ + "]"); + if (reader) { this->Pimpl->Reader = reader; diff --git a/vtkext/private/module/vtkF3DMetaImporter.cxx b/vtkext/private/module/vtkF3DMetaImporter.cxx index 4cb32c6706..d8f6896cc4 100644 --- a/vtkext/private/module/vtkF3DMetaImporter.cxx +++ b/vtkext/private/module/vtkF3DMetaImporter.cxx @@ -75,7 +75,9 @@ void vtkF3DMetaImporter::Clear() //---------------------------------------------------------------------------- void vtkF3DMetaImporter::AddImporter(const vtkSmartPointer& importer) { - this->Pimpl->Importers.emplace_back(vtkF3DMetaImporter::Internals::ImporterPair {importer, false}); + F3DLog::Print(F3DLog::Severity::Info, std::string("[gapry][issues][1281][") + __PRETTY_FUNCTION__ + "] "); + + this->Pimpl->Importers.emplace_back(vtkF3DMetaImporter::Internals::ImporterPair {importer, false}); // [gapry][issues][1281] this->Modified(); // Add a progress event observer