From 166ed34b6b54b53c1d3ced26ebcf7f82cfd3381a Mon Sep 17 00:00:00 2001 From: Lars Bilke <lars.bilke@ufz.de> Date: Thu, 11 Feb 2021 21:07:32 +0100 Subject: [PATCH] Removed VtkFbxConverter functionality. Was not used anymore and is replaced by gltf format (in ParaView). --- Applications/DataExplorer/CMakeLists.txt | 4 -- Applications/DataExplorer/DataExplorer.cmake | 4 -- .../VtkVis/VtkVisPipelineItem.cpp | 42 ------------------- .../VtkVis/VtkVisPipelineView.cpp | 24 +---------- .../DataExplorer/VtkVis/VtkVisPipelineView.h | 3 -- Applications/DataExplorer/main.cpp | 15 ------- Applications/DataExplorer/mainwindow.cpp | 4 -- CMakeLists.txt | 1 - ThirdParty/CMakeLists.txt | 11 ----- scripts/cmake/Dependencies.cmake | 8 ++-- 10 files changed, 5 insertions(+), 111 deletions(-) delete mode 100644 ThirdParty/CMakeLists.txt diff --git a/Applications/DataExplorer/CMakeLists.txt b/Applications/DataExplorer/CMakeLists.txt index 82400d0e79a..d314bef25e6 100644 --- a/Applications/DataExplorer/CMakeLists.txt +++ b/Applications/DataExplorer/CMakeLists.txt @@ -2,10 +2,6 @@ if(MSVC) add_definitions(-DVTKGUISUPPORTQT_STATIC_DEFINE) endif() -if(VTKFBXCONVERTER_FOUND) - add_definitions(-DVTKFBXCONVERTER_FOUND) -endif() - include_directories(${CMAKE_CURRENT_SOURCE_DIR}) set(CMAKE_AUTOMOC TRUE) diff --git a/Applications/DataExplorer/DataExplorer.cmake b/Applications/DataExplorer/DataExplorer.cmake index 0a0d4791a4b..92d8544331c 100644 --- a/Applications/DataExplorer/DataExplorer.cmake +++ b/Applications/DataExplorer/DataExplorer.cmake @@ -73,10 +73,6 @@ if(MSVC) target_link_libraries(DataExplorer winmm) endif() -if(VTKFBXCONVERTER_FOUND) - target_link_libraries(DataExplorer ${VTKFBXCONVERTER_LIBRARIES}) -endif() - set_property(TARGET DataExplorer PROPERTY FOLDER "DataExplorer") # ---- Installation ---- diff --git a/Applications/DataExplorer/VtkVis/VtkVisPipelineItem.cpp b/Applications/DataExplorer/VtkVis/VtkVisPipelineItem.cpp index b4d7c7b4679..ff1754466e1 100644 --- a/Applications/DataExplorer/VtkVis/VtkVisPipelineItem.cpp +++ b/Applications/DataExplorer/VtkVis/VtkVisPipelineItem.cpp @@ -34,15 +34,6 @@ #include <QMessageBox> -#ifdef VTKFBXCONVERTER_FOUND -#include <fbxsdk.h> -#include "ThirdParty/VtkFbxConverter/Common.h" -#include "ThirdParty/VtkFbxConverter/VtkFbxConverter.h" - -extern FbxManager* lSdkManager; -extern FbxScene* lScene; -#endif - VtkVisPipelineItem::VtkVisPipelineItem( vtkAlgorithm* algorithm, TreeItem* parentItem, const QList<QVariant> data /*= QList<QVariant>()*/) @@ -127,39 +118,6 @@ int VtkVisPipelineItem::writeToFile(const std::string &filename) const { if (!filename.empty()) { -#ifdef VTKFBXCONVERTER_FOUND - if (filename.substr(filename.size() - 4).find("fbx") != std::string::npos) - { - if(!dynamic_cast<vtkImageActor*>(_actor)) - { - InitializeSdkObjects(lSdkManager, lScene); - - VtkFbxConverter fbxConverter(static_cast<vtkActor*>(_actor), lScene); - fbxConverter.convert(BaseLib::extractBaseNameWithoutExtension(filename)); - FbxNode* node = fbxConverter.getNode(); - if(node) - { - fbxConverter.addUserProperty("UseVertexColors", _vtkProps->GetScalarVisibility()); - lScene->GetRootNode()->AddChild(node); - // Get the file format. Use either "FBX [6.0] binary (*.fbx)" or "FBX [6.0] ascii (*.fbx)" - int fbxFormat = lSdkManager->GetIOPluginRegistry() - ->FindWriterIDByDescription("FBX 6.0 binary (*.fbx)"); - // Embed only works in "FBX 6.0 binary (*.fbx)" - const bool fbxEmbed = true; - SaveScene(lSdkManager, lScene, filename.c_str(), fbxFormat, fbxEmbed); - lScene->Clear(); - } - } - else - QMessageBox::warning( - nullptr, "Conversion to FBX not possible", - "It is not possible to convert an vtkImageData based object \ - to FBX. If you want to convert raster data import it via ' \ - File / Import / Raster Files as PolyData'!"); - return 0; - } -#endif // VTKFBXCONVERTER_FOUND - return callVTKWriter(this->algorithm(), filename); } return 0; diff --git a/Applications/DataExplorer/VtkVis/VtkVisPipelineView.cpp b/Applications/DataExplorer/VtkVis/VtkVisPipelineView.cpp index 34fe1ffcd81..66400d79003 100644 --- a/Applications/DataExplorer/VtkVis/VtkVisPipelineView.cpp +++ b/Applications/DataExplorer/VtkVis/VtkVisPipelineView.cpp @@ -109,9 +109,7 @@ void VtkVisPipelineView::contextMenuEvent( QContextMenuEvent* event ) } menu.addSeparator(); QAction* exportVtkAction = menu.addAction("Export as VTK"); -#ifdef VTKFBXCONVERTER_FOUND - QAction* exportFbxAction = menu.addAction("Export as Fbx"); -#endif + if (!isSourceItem || vtkProps->IsRemovable()) { menu.addSeparator(); @@ -123,10 +121,6 @@ void VtkVisPipelineView::contextMenuEvent( QContextMenuEvent* event ) connect(addFilterAction, SIGNAL(triggered()), this, SLOT(addPipelineFilterItem())); connect(exportVtkAction, SIGNAL(triggered()), this, SLOT(exportSelectedPipelineItemAsVtk())); -#ifdef VTKFBXCONVERTER_FOUND - connect(exportFbxAction, SIGNAL(triggered()), this, - SLOT(exportSelectedPipelineItemAsFbx())); -#endif menu.exec(event->globalPos()); } @@ -148,22 +142,6 @@ void VtkVisPipelineView::exportSelectedPipelineItemAsVtk() } } -void VtkVisPipelineView::exportSelectedPipelineItemAsFbx() -{ - QSettings settings; - QModelIndex idx = this->selectionModel()->currentIndex(); - QString filename = QFileDialog::getSaveFileName(this, "Export object to Fbx file", - settings.value("lastExportedFileDirectory"). - toString(), "Fbx file (*.fbx)"); - if (!filename.isEmpty()) - { - static_cast<VtkVisPipelineItem*>(static_cast<VtkVisPipeline*>(this->model())-> - getItem(idx))->writeToFile(filename.toStdString()); - QDir dir = QDir(filename); - settings.setValue("lastExportedFileDirectory", dir.absolutePath()); - } -} - void VtkVisPipelineView::removeSelectedPipelineItem() { emit requestRemovePipelineItem(selectionModel()->currentIndex()); diff --git a/Applications/DataExplorer/VtkVis/VtkVisPipelineView.h b/Applications/DataExplorer/VtkVis/VtkVisPipelineView.h index 70b88e8c30c..aee5b5ad677 100644 --- a/Applications/DataExplorer/VtkVis/VtkVisPipelineView.h +++ b/Applications/DataExplorer/VtkVis/VtkVisPipelineView.h @@ -63,9 +63,6 @@ private slots: /// Exports the currently selected item as a VTK file void exportSelectedPipelineItemAsVtk(); - /// Exports the currently selected item as a Fbx file. - void exportSelectedPipelineItemAsFbx(); - /// Sends an requestRemovePipelineItem() signal to remove /// the currently selected item. void removeSelectedPipelineItem(); diff --git a/Applications/DataExplorer/main.cpp b/Applications/DataExplorer/main.cpp index c229736a7b9..2c7e28772a3 100644 --- a/Applications/DataExplorer/main.cpp +++ b/Applications/DataExplorer/main.cpp @@ -4,14 +4,6 @@ #include <QSurfaceFormat> #include <QVTKOpenGLWidget.h> #include <memory> - -#ifdef VTKFBXCONVERTER_FOUND -#include <fbxsdk.h> -#include "ThirdParty/VtkFbxConverter/Common.h" -FbxManager* lSdkManager = nullptr; -FbxScene* lScene = nullptr; -#endif - #include <vtkSmartPointer.h> #include "InfoLib/GitInfo.h" @@ -19,10 +11,6 @@ FbxScene* lScene = nullptr; int main(int argc, char* argv[]) { -#ifdef VTKFBXCONVERTER_FOUND - InitializeSdkObjects(lSdkManager, lScene); -#endif - // needed to ensure appropriate OpenGL context is created for VTK rendering. QSurfaceFormat::setDefaultFormat(QVTKOpenGLWidget::defaultFormat()); @@ -45,9 +33,6 @@ int main(int argc, char* argv[]) } w->show(); int returncode = QApplication::exec(); -#ifdef VTKFBXCONVERTER_FOUND - DestroySdkObjects(lSdkManager, true); -#endif return returncode; } diff --git a/Applications/DataExplorer/mainwindow.cpp b/Applications/DataExplorer/mainwindow.cpp index ad8eb982a12..570fe109c89 100644 --- a/Applications/DataExplorer/mainwindow.cpp +++ b/Applications/DataExplorer/mainwindow.cpp @@ -855,10 +855,6 @@ QMenu* MainWindow::createImportFilesMenu() [this] { loadPetrelFiles(); }); importFiles->addAction("&Raster Files...", [this] { open(ImportFileType::RASTER); }); -#if defined VTKFBXCONVERTER_FOUND - importFiles->addAction("R&aster Files as PolyData...", - [this] { open(ImportFileType::POLYRASTER); }); -#endif importFiles->addAction("&Shape Files...", [this] { open(ImportFileType::SHAPE); }); importFiles->addAction("&TetGen Files...", diff --git a/CMakeLists.txt b/CMakeLists.txt index 49b984d7ee3..30578a13522 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -220,7 +220,6 @@ include(scripts/cmake/packaging/Pack.cmake) # ---- Subdirectories ---- # External projects -add_subdirectory(ThirdParty) include_directories( SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/ThirdParty diff --git a/ThirdParty/CMakeLists.txt b/ThirdParty/CMakeLists.txt deleted file mode 100644 index bde2cf76361..00000000000 --- a/ThirdParty/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -# VtkFbxConverter -if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/VtkFbxConverter/CMakeLists.txt - AND OGS_USE_OPTIONAL_SUBMODULES) - add_subdirectory(VtkFbxConverter) -endif() - -foreach(TARGET ${DISABLE_WARNINGS_TARGETS}) - target_compile_options(${TARGET} PRIVATE - $<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>>:-w> - $<$<CXX_COMPILER_ID:MSVC>:/W0>) -endforeach() diff --git a/scripts/cmake/Dependencies.cmake b/scripts/cmake/Dependencies.cmake index e4c1894650c..db551cff1b1 100644 --- a/scripts/cmake/Dependencies.cmake +++ b/scripts/cmake/Dependencies.cmake @@ -136,8 +136,8 @@ if(OGS_USE_XDMF) ) if(xdmf_ADDED) target_include_directories(OgsXdmf PUBLIC - ${PROJECT_SOURCE_DIR}/ThirdParty/xdmf - ${PROJECT_BINARY_DIR}/ThirdParty/xdmf + ${xdmf_SOURCE_DIR} + ${xdmf_BINARY_DIR} ) if(OGS_USE_CONAN AND UNIX AND APPLE) find_package(Iconv REQUIRED) @@ -150,8 +150,8 @@ if(OGS_USE_XDMF) target_link_libraries(OgsXdmf Boost::boost ${Iconv_LIBRARIES} ZLIB::ZLIB) endif() target_include_directories(OgsXdmfCore PUBLIC - ${PROJECT_SOURCE_DIR}/ThirdParty/xdmf/core - ${PROJECT_BINARY_DIR}/ThirdParty/xdmf/core + ${xdmf_SOURCE_DIR}/core + ${xdmf_BINARY_DIR}/core ) find_package(LibXml2 REQUIRED) # LibXml2 is a XdmfCore dependency target_link_libraries(OgsXdmfCore PUBLIC LibXml2::LibXml2) -- GitLab