Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Support Wavefront OBJ files with TGA Textures #1719

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions application/F3DStarter.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -1126,6 +1129,10 @@ void F3DStarter::LoadFileGroup(int index, bool relativeIndex, bool forceClear)
void F3DStarter::LoadFileGroup(
const std::vector<fs::path>& 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)
{
Expand Down Expand Up @@ -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<fs::path> localPaths;
Expand Down Expand Up @@ -1210,6 +1217,7 @@ void F3DStarter::LoadFileGroup(
}
else
{
f3d::log::info("[gapry][issues][1281][", __PRETTY_FUNCTION__, "] ", tmpPath.string());
localPaths.emplace_back(tmpPath);
}
}
Expand All @@ -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(
Expand Down
8 changes: 6 additions & 2 deletions library/src/scene_impl.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ class scene_impl::internals

void Load(const std::vector<vtkSmartPointer<vtkImporter>>& importers)
{
log::info(std::string("[gapry][issues][1281][") + __PRETTY_FUNCTION__ + "]");

for (const vtkSmartPointer<vtkImporter>& importer : importers)
{
this->MetaImporter->AddImporter(importer);
Expand Down Expand Up @@ -243,6 +245,8 @@ scene& scene_impl::add(const std::vector<fs::path>& 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)
Expand All @@ -259,14 +263,14 @@ scene& scene_impl::add(const std::vector<fs::path>& 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<vtkF3DGenericImporter> genericImporter =
vtkSmartPointer<vtkF3DGenericImporter>::New();
genericImporter->SetInternalReader(vtkReader);
importer = genericImporter;
}
importers.emplace_back(importer);
importers.emplace_back(importer); // [gapry][issues][1281]
}

log::debug("\nLoading files: ");
Expand Down
2 changes: 2 additions & 0 deletions vtkext/private/module/vtkF3DGenericImporter.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 3 additions & 1 deletion vtkext/private/module/vtkF3DMetaImporter.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ void vtkF3DMetaImporter::Clear()
//----------------------------------------------------------------------------
void vtkF3DMetaImporter::AddImporter(const vtkSmartPointer<vtkImporter>& 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
Expand Down
Loading