diff --git a/CMakeLists.txt b/CMakeLists.txt index 3e11ab904a..247c295899 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,8 @@ cmake_minimum_required(VERSION 3.13) -# Verify that your CMake version is exactly 3.31.x series or lower on windows -if ( ((MSVC) OR (WIN32)) AND (${CMAKE_VERSION} VERSION_GREATER_EQUAL "4.0") ) - message(FATAL_ERROR "Only cmake versions between 3.13.x and 3.31.x is supported on windows. Detected version: ${CMAKE_VERSION}") +# Verify that your CMake version is exactly 3.5 series or higher on windows +if ( (MSVC OR WIN32) AND (${CMAKE_VERSION} VERSION_LESS "3.5") ) + message(FATAL_ERROR "CMake current version ${CMAKE_VERSION} is too old. Minimum required is 3.5.") endif() if (WIN32) diff --git a/build_release_vs2022.bat b/build_release_vs2022.bat index ce4390f621..cde00008ff 100644 --- a/build_release_vs2022.bat +++ b/build_release_vs2022.bat @@ -46,6 +46,8 @@ if "%1"=="slicer" ( echo "building deps.." echo on +REM Set minimum CMake policy to avoid <3.5 errors +set CMAKE_POLICY_VERSION_MINIMUM=3.5 cmake ../ -G "Visual Studio 17 2022" -A x64 -DCMAKE_BUILD_TYPE=%build_type% cmake --build . --config %build_type% --target deps -- -m @echo off diff --git a/doc/developer-reference/How-to-build.md b/doc/developer-reference/How-to-build.md index f8e2d997b4..21957f4a31 100644 --- a/doc/developer-reference/How-to-build.md +++ b/doc/developer-reference/How-to-build.md @@ -22,12 +22,13 @@ Whether you're a contributor or just want a custom build, this guide will help y - [Common dependencies across distributions](#common-dependencies-across-distributions) - [Additional dependencies for specific distributions](#additional-dependencies-for-specific-distributions) - [Linux Instructions](#linux-instructions) + - [Unit Testing](#unit-testing) - [Portable User Configuration](#portable-user-configuration) - [Example folder structure](#example-folder-structure) ## Windows 64-bit -How to building with Visual Studio 2022 on Windows 64-bit. +How to building with Visual Studio on Windows 64-bit. ### Windows Tools Required @@ -35,9 +36,9 @@ How to building with Visual Studio 2022 on Windows 64-bit. ```shell winget install --id=Microsoft.VisualStudio.2022.Professional -e ``` -- [CMake (version 3.31)](https://cmake.org/) — **⚠️ version 3.31.x is mandatory** +- [CMake](https://cmake.org/) ```shell - winget install --id=Kitware.CMake -v "3.31.6" -e + winget install --id=Kitware.CMake -e ``` - [Strawberry Perl](https://strawberryperl.com/) ```shell @@ -58,6 +59,14 @@ How to building with Visual Studio 2022 on Windows 64-bit. > winget install --id=GitHub.GitHubDesktop -e > ``` +> [!IMPORTANT] +> Check your CMake version. Run `cmake --version` in your terminal and verify it returns a **4.x** version. +> If you see an older version (e.g. 3.29), it's likely due to another copy in your system's PATH (e.g. from Strawberry Perl). +> You can run where cmake to check the active paths and rearrange your **System Environment Variables** > PATH, ensuring the correct CMake (e.g. C:\Program Files\CMake\bin) appears before others like C:\Strawberry\c\bin. + +![windows_variables_path](https://github.com/SoftFever/OrcaSlicer/blob/main/doc/images/develop/windows_variables_path.png?raw=true) +![windows_variables_order](https://github.com/SoftFever/OrcaSlicer/blob/main/doc/images/develop/windows_variables_order.png?raw=true) + ### Windows Instructions 1. Clone the repository: @@ -72,16 +81,33 @@ How to building with Visual Studio 2022 on Windows 64-bit. git lfs pull ``` 2. Open the appropriate command prompt: - - For Visual Studio 2019: - Open **x64 Native Tools Command Prompt for VS 2019** and run: - ```shell - build_release.bat + - Visual Studio 2022: + ```MD + x64 Native Tools Command Prompt for VS 2022 ``` - - For Visual Studio 2022: - Open **x64 Native Tools Command Prompt for VS 2022** and run: - ```shell - build_release_vs2022.bat + - Visual Studio 2019: + ```MD + x64 Native Tools Command Prompt for VS 2019 ``` + 1. Navigate to correct drive (if needed), e.g.: + ```shell + N: + ``` + 2. Change directory to the cloned repository, e.g.: + ```shell + cd N:\Repos\OrcaSlicer + ``` + 3. Run the build script: + - Visual Studio 2022: + ```shell + build_release_vs2022.bat + ``` + - Visual Studio 2019: + ```shell + build_release.bat + ``` + +![vs2022cmd](https://github.com/SoftFever/OrcaSlicer/blob/main/doc/images/develop/vs2022cmd.png?raw=true) > [!NOTE] > The build process will take a long time depending on your system but even with high-end hardware it can take up to 40 minutes. @@ -106,11 +132,6 @@ How to building with Visual Studio 2022 on Windows 64-bit. > Changes to .hpp files take longer, depending on what you change. > If you switch back and forth between branches, it also takes a long time to rebuild, even if you haven't made any changes. -> [!IMPORTANT] -> Make sure that CMake version 3.31.x is actually being used. Run `cmake --version` and verify it returns a **3.31.x** version. -> If you see an older version (e.g. 3.29), it's likely due to another copy in your system's PATH (e.g. from Strawberry Perl). -> You can run where cmake to check the active paths and rearrange your **System Environment Variables** > PATH, ensuring the correct CMake (e.g. C:\Program Files\CMake\bin) appears before others like C:\Strawberry\c\bin. - > [!TIP] > If the build fails, try deleting the `build/` and `deps/build/` directories to clear any cached build data. Rebuilding after a clean-up is usually sufficient to resolve most issues. diff --git a/doc/images/develop/vs2022cmd.png b/doc/images/develop/vs2022cmd.png new file mode 100644 index 0000000000..29b5de5152 Binary files /dev/null and b/doc/images/develop/vs2022cmd.png differ diff --git a/doc/images/develop/windows_variables_order.png b/doc/images/develop/windows_variables_order.png new file mode 100644 index 0000000000..75018d2caf Binary files /dev/null and b/doc/images/develop/windows_variables_order.png differ diff --git a/doc/images/develop/windows_variables_path.png b/doc/images/develop/windows_variables_path.png new file mode 100644 index 0000000000..4de101d064 Binary files /dev/null and b/doc/images/develop/windows_variables_path.png differ diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 9ca363e866..4b37fd8e91 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -34,7 +34,6 @@ #include "DailyTips.hpp" #include "FilamentMapDialog.hpp" -#include "slic3r/GUI/CameraUtils.hpp" #include "slic3r/GUI/Gizmos/GLGizmoPainterBase.hpp" #include "slic3r/Utils/UndoRedo.hpp" #include "slic3r/Utils/MacDarkMode.hpp" @@ -4695,7 +4694,6 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) m_camera_movement = true; m_mouse.drag.start_position_2D = pos; - m_mouse.drag.move_start_threshold_position_2D = pos; } } else if ((evt.LeftUp() || evt.MiddleUp() || evt.RightUp()) || @@ -9378,18 +9376,12 @@ Vec3d GLCanvas3D::_mouse_to_3d(const Point& mouse_pos, float* z) if (m_canvas == nullptr) return Vec3d(DBL_MAX, DBL_MAX, DBL_MAX); - const Camera& camera = wxGetApp().plater()->get_camera(); - if (z == nullptr) { - const SceneRaycaster::HitResult hit = m_scene_raycaster.hit(mouse_pos.cast(), camera, nullptr); + const SceneRaycaster::HitResult hit = m_scene_raycaster.hit(mouse_pos.cast(), wxGetApp().plater()->get_camera(), nullptr); return hit.is_valid() ? hit.position.cast() : _mouse_to_bed_3d(mouse_pos); } - // Orca: Handling of the particular case, if we want to get the position for Z = 0 - else if (is_approx(static_cast(*z), 0.)) { - Vec2d position = CameraUtils::get_z0_position(camera, Vec2d(mouse_pos.x(), mouse_pos.y())); - return Vec3d(position.x(), position.y(), *z); - } else { + const Camera& camera = wxGetApp().plater()->get_camera(); const Vec4i32 viewport(camera.get_viewport().data()); Vec3d out; igl::unproject(Vec3d(mouse_pos.x(), viewport[3] - mouse_pos.y(), *z), camera.get_view_matrix().matrix(), camera.get_projection_matrix().matrix(), viewport, out);