From cccdedc0728f4ee33a8e4188bf282e8ea329dd70 Mon Sep 17 00:00:00 2001 From: Mathieu Westphal Date: Sun, 30 Apr 2023 10:45:05 +0200 Subject: [PATCH 1/5] Better cmake logic for coloring support --- .github/workflows/ci.yml | 1 + application/testing/CMakeLists.txt | 5 +---- plugins/occt/CMakeLists.txt | 13 +++++++++---- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2e5d284f8f..05ee6ccc2a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -137,6 +137,7 @@ jobs: -DF3D_PLUGIN_BUILD_ASSIMP=ON -DF3D_PLUGIN_BUILD_DRACO=ON -DF3D_PLUGIN_BUILD_OCCT=ON + -DF3D_PLUGIN_OCCT_COLORING_SUPPORT=${{ runner.os == 'macOS' && 'OFF' || 'ON' }} # Not supported on macOS because of #792 -DF3D_STRICT_BUILD=ON -DF3D_WINDOWS_GUI=ON ${{ runner.os == 'Windows' && '-Ax64 -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL' || null }} diff --git a/application/testing/CMakeLists.txt b/application/testing/CMakeLists.txt index a97c625c0b..b9abf89f0f 100644 --- a/application/testing/CMakeLists.txt +++ b/application/testing/CMakeLists.txt @@ -425,10 +425,7 @@ if(F3D_PLUGIN_BUILD_OCCT) f3d_test(NAME TestSTEP DATA f3d.stp DEFAULT_LIGHTS ARGS --load-plugins=occt --up=+Z) f3d_test(NAME TestIGES DATA f3d.igs DEFAULT_LIGHTS ARGS --load-plugins=occt --up=+Z) - # Following tests are failing if OpenCascade was built without coloring support - # They are also failing with F3D_MACOS_BUNDLE because of config file mechanism - # and failing more generally on macOS because of #795 - if(NOT F3D_MACOS_BUNDLE AND NOT APPLE) + if(F3D_PLUGIN_OCCT_COLORING_SUPPORT AND NOT F3D_MACOS_BUNDLE) file(COPY "${CMAKE_SOURCE_DIR}/plugins/occt/configs/config.d/" DESTINATION "${CMAKE_BINARY_DIR}/share/f3d/configs/config_build.d") f3d_test(NAME TestDefaultConfigFileOCCT DATA f3d.stp CONFIG config_build DEFAULT_LIGHTS) diff --git a/plugins/occt/CMakeLists.txt b/plugins/occt/CMakeLists.txt index 340967d171..6fe2eb485d 100644 --- a/plugins/occt/CMakeLists.txt +++ b/plugins/occt/CMakeLists.txt @@ -25,10 +25,15 @@ endif() message(STATUS "Plugin: OpenCASCADE ${OpenCASCADE_VERSION} found") -if((TARGET "TKXDESTEP") AND (TARGET "TKXDEIGES")) - set(F3D_PLUGIN_OCCT_XCAF 1) -else() - message(WARNING "OpenCASCADE: TKXDESTEP and TKXDEIGES are not found. Parts color and name are not supported.") +option(F3D_PLUGIN_OCCT_COLORING_SUPPORT "Enable coloring support in occt plugin" ON) +mark_as_advanced(F3D_PLUGIN_OCCT_COLORING_SUPPORT) + +if(F3D_PLUGIN_OCCT_COLORING_SUPPORT) + if ((TARGET "TKXDESTEP") AND (TARGET "TKXDEIGES")) + set(F3D_PLUGIN_OCCT_XCAF 1) + else() + message(FATAL_ERROR "occt plugin: TKXDESTEP and TKXDEIGES OCCT modules are not found. Turn off F3D_PLUGIN_OCCT_COLORING_SUPPORT or enable them in your OpenCascade build.") + endif() endif() f3d_plugin_init() From 5b2da4605d5cedf8ce0efe40f85e34a78fa90886 Mon Sep 17 00:00:00 2001 From: Mathieu Westphal Date: Sun, 30 Apr 2023 10:58:24 +0200 Subject: [PATCH 2/5] Add doc --- doc/user/LIMITATIONS_AND_TROUBLESHOOTING.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/user/LIMITATIONS_AND_TROUBLESHOOTING.md b/doc/user/LIMITATIONS_AND_TROUBLESHOOTING.md index eea7b6ad5c..d616da23ff 100644 --- a/doc/user/LIMITATIONS_AND_TROUBLESHOOTING.md +++ b/doc/user/LIMITATIONS_AND_TROUBLESHOOTING.md @@ -93,3 +93,7 @@ Set the codepage to UTF-8, run `chcp 65001`. > Using the binary release, I'm unable to run F3D because macOS warns about F3D not being signed. F3D is not signed by Apple yet so macOS shows this warning. To run F3D, right click on the app and click "open", then click "open" again to be able to run F3D. + +> I'm unable to get coloring right with step files + +F3D on macOS does not support coloring on cells because of a [VTK issue](https://gitlab.kitware.com/vtk/vtk/-/issues/18969) From f7105b7be8444e927b1cd4442dbaa7ec5b8e664b Mon Sep 17 00:00:00 2001 From: Mathieu Westphal Date: Sun, 30 Apr 2023 16:22:43 +0200 Subject: [PATCH 3/5] fixup CI --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 05ee6ccc2a..354794552b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -111,6 +111,7 @@ jobs: shell: powershell run: echo "PATH=$env:PATH;$(pwd)\dependencies\install\bin\;$(pwd)\install\bin\;"| Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + # occt coloring not supported on macOS because of #792 - name: Configure working-directory: ${{github.workspace}}/build shell: bash @@ -137,7 +138,7 @@ jobs: -DF3D_PLUGIN_BUILD_ASSIMP=ON -DF3D_PLUGIN_BUILD_DRACO=ON -DF3D_PLUGIN_BUILD_OCCT=ON - -DF3D_PLUGIN_OCCT_COLORING_SUPPORT=${{ runner.os == 'macOS' && 'OFF' || 'ON' }} # Not supported on macOS because of #792 + -DF3D_PLUGIN_OCCT_COLORING_SUPPORT=${{ runner.os == 'macOS' && 'OFF' || 'ON' }} -DF3D_STRICT_BUILD=ON -DF3D_WINDOWS_GUI=ON ${{ runner.os == 'Windows' && '-Ax64 -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL' || null }} From d32073b5ada2c47f5f5c98ecc5a09e271bd96e1d Mon Sep 17 00:00:00 2001 From: Mathieu Westphal Date: Sun, 30 Apr 2023 09:32:08 +0200 Subject: [PATCH 4/5] Improve occt UVs code --- plugins/occt/module/vtkF3DOCCTReader.cxx | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/plugins/occt/module/vtkF3DOCCTReader.cxx b/plugins/occt/module/vtkF3DOCCTReader.cxx index f6c5fa4954..67191da6fe 100644 --- a/plugins/occt/module/vtkF3DOCCTReader.cxx +++ b/plugins/occt/module/vtkF3DOCCTReader.cxx @@ -220,11 +220,8 @@ class vtkF3DOCCTReader::vtkInternals } else { - float fn[3] = { 0.0, 0.0 }; - for (Standard_Integer i = 1; i <= nbV; i++) - { - uvs->InsertNextTypedTuple(fn); - } + uvs->SetNumberOfTuples(nbV); + uvs->Fill(0.0); } for (int i = 1; i <= nbT; i++) From b6284e4d505ea23d29ee028fd21340401d4cf3a9 Mon Sep 17 00:00:00 2001 From: Mathieu Westphal Date: Sun, 30 Apr 2023 16:26:22 +0200 Subject: [PATCH 5/5] fixup cmake --- plugins/occt/CMakeLists.txt | 6 +----- plugins/occt/module/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/plugins/occt/CMakeLists.txt b/plugins/occt/CMakeLists.txt index 6fe2eb485d..3da6ad57bc 100644 --- a/plugins/occt/CMakeLists.txt +++ b/plugins/occt/CMakeLists.txt @@ -13,8 +13,6 @@ endif() find_package(OpenCASCADE REQUIRED) -set(F3D_PLUGIN_OCCT_XCAF 0) - if("${OpenCASCADE_VERSION}" VERSION_LESS "7.5.0") message(FATAL_ERROR "Plugin: OpenCASCADE: ${OpenCASCADE_VERSION} is not supported by F3D, please update your OpenCASCADE installation.") endif() @@ -29,9 +27,7 @@ option(F3D_PLUGIN_OCCT_COLORING_SUPPORT "Enable coloring support in occt plugin" mark_as_advanced(F3D_PLUGIN_OCCT_COLORING_SUPPORT) if(F3D_PLUGIN_OCCT_COLORING_SUPPORT) - if ((TARGET "TKXDESTEP") AND (TARGET "TKXDEIGES")) - set(F3D_PLUGIN_OCCT_XCAF 1) - else() + if (NOT (TARGET "TKXDESTEP") OR NOT (TARGET "TKXDEIGES")) message(FATAL_ERROR "occt plugin: TKXDESTEP and TKXDEIGES OCCT modules are not found. Turn off F3D_PLUGIN_OCCT_COLORING_SUPPORT or enable them in your OpenCascade build.") endif() endif() diff --git a/plugins/occt/module/CMakeLists.txt b/plugins/occt/module/CMakeLists.txt index bea3c41394..e726f8a6f3 100644 --- a/plugins/occt/module/CMakeLists.txt +++ b/plugins/occt/module/CMakeLists.txt @@ -14,7 +14,7 @@ vtk_module_link(f3d::VTKExtensionsOCCTReader PRIVATE ${OpenCASCADE_LIBRARIES}) -if(F3D_PLUGIN_OCCT_XCAF) +if(F3D_PLUGIN_OCCT_COLORING_SUPPORT) vtk_module_definitions(f3d::VTKExtensionsOCCTReader PRIVATE F3D_PLUGIN_OCCT_XCAF) endif()