From a0acb1eb6a103aeeeb9dc41a38651490bfeb0dfc Mon Sep 17 00:00:00 2001 From: tmontaigu Date: Tue, 25 Nov 2025 22:31:57 +0100 Subject: [PATCH 1/2] update refs --- .github/workflows/Build.yml | 8 ++++---- .github/workflows/Wheels.yml | 2 +- wrapper/cccorelib/CMakeLists.txt | 2 +- wrapper/pycc/CMakeLists.txt | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index 44cb056..079841a 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -17,7 +17,7 @@ jobs: uses: actions/checkout@v4 with: repository: 'CloudCompare/CloudCompare' - ref: a452997aabb81f3a9d80b982946bff50f9384d00 + ref: fc2fe88a33ca9e406aab43b3bda6a9c6d38a2313 submodules: recursive - name: Clone PythonRuntime @@ -35,7 +35,7 @@ jobs: - name: Install Dependencies run: | - conda install -c conda-forge qt>=6.9.* ninja doxygen + conda install -c conda-forge qt6-main==6.8.3 ninja doxygen pip install pytest pybind11<3.0 numpy - name: Configure MSVC console @@ -80,7 +80,7 @@ jobs: uses: actions/checkout@v4 with: repository: 'CloudCompare/CloudCompare' - ref: a452997aabb81f3a9d80b982946bff50f9384d00 + ref: fc2fe88a33ca9e406aab43b3bda6a9c6d38a2313 submodules: recursive - name: Clone PythonRuntime @@ -148,7 +148,7 @@ jobs: uses: actions/checkout@v4 with: repository: 'CloudCompare/CloudCompare' - ref: a452997aabb81f3a9d80b982946bff50f9384d00 + ref: fc2fe88a33ca9e406aab43b3bda6a9c6d38a2313 submodules: recursive - name: Clone PythonRuntime diff --git a/.github/workflows/Wheels.yml b/.github/workflows/Wheels.yml index ed9de0f..c09f29e 100644 --- a/.github/workflows/Wheels.yml +++ b/.github/workflows/Wheels.yml @@ -24,7 +24,7 @@ jobs: - name: Install Dependencies run: | - conda install -c conda-forge qt=6.9.* + conda install -c conda-forge qt6-main==6.8.3 python -m pip install --upgrade pip pip install pytest diff --git a/wrapper/cccorelib/CMakeLists.txt b/wrapper/cccorelib/CMakeLists.txt index c921453..b31f5b2 100644 --- a/wrapper/cccorelib/CMakeLists.txt +++ b/wrapper/cccorelib/CMakeLists.txt @@ -25,7 +25,7 @@ if(CCCORELIB_PYTHON_IS_MASTER_PROJECT) GIT_REPOSITORY https://github.com/CloudCompare/CCCoreLib GIT_PROGRESS ON GIT_SHALLOW OFF - GIT_TAG 0a7b892193575f58241b56c1828eb38ece11e02b + GIT_TAG 52dc573bf8a782d60c95c36f3eed41654debeadc ) FetchContent_GetProperties(CCCoreLib) diff --git a/wrapper/pycc/CMakeLists.txt b/wrapper/pycc/CMakeLists.txt index 627842e..c956060 100644 --- a/wrapper/pycc/CMakeLists.txt +++ b/wrapper/pycc/CMakeLists.txt @@ -31,7 +31,7 @@ if(PYCC_IS_MASTER_PROJECT) GIT_REPOSITORY https://github.com/CloudCompare/CloudCompare GIT_SUBMODULES "libs/qCC_db/extern/CCCoreLib;libs/CCAppCommon/QDarkStyleSheet" GIT_PROGRESS ON - GIT_TAG a452997aabb81f3a9d80b982946bff50f9384d00 + GIT_TAG fc2fe88a33ca9e406aab43b3bda6a9c6d38a2313 GIT_SHALLOW OFF GIT_SUBMODULES ) From fbaba7d8396f065c404e5fc8a3a91e274fa84196 Mon Sep 17 00:00:00 2001 From: Paul Leroy Date: Wed, 1 Oct 2025 11:52:37 +0200 Subject: [PATCH 2/2] Add ccDisc primitive --- CMakeLists.txt | 3 ++ cmake/Helpers.cmake | 19 ++++++-- docs/python/pycc/primitives.rst | 8 ++++ docs/stubfiles/pycc.pyi | 5 ++ tests/test_cmdline.py | 7 --- wrapper/pycc/src/qcc_db/CMakeLists.txt | 1 + wrapper/pycc/src/qcc_db/ccDisc.cpp | 64 ++++++++++++++++++++++++++ wrapper/pycc/src/qcc_db/qcc_db.cpp | 2 + wrapper/pycc/tests/test_primitives.py | 13 ++++++ 9 files changed, 111 insertions(+), 11 deletions(-) create mode 100644 wrapper/pycc/src/qcc_db/ccDisc.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 06a87cd..cecd87c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,6 +7,9 @@ include(cmake/CloudCompareVariables.cmake) option(PLUGIN_PYTHON "Install Python Plugin" OFF) +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + if(PLUGIN_PYTHON) project(PythonRuntime) diff --git a/cmake/Helpers.cmake b/cmake/Helpers.cmake index 2a1e2ef..804add8 100644 --- a/cmake/Helpers.cmake +++ b/cmake/Helpers.cmake @@ -40,13 +40,24 @@ function(copy_python_dll) DEBUG "Python DLL: = ${Python_RUNTIME_LIBRARY_DIRS}/python${Python_VERSION_MAJOR}${Python_VERSION_MINOR}.dll" ) - install( - FILES "${Python_RUNTIME_LIBRARY_DIRS}/python${Python_VERSION_MAJOR}${Python_VERSION_MINOR}.dll" + if(CMAKE_BUILD_TYPE STREQUAL "Debug") + message(STATUS "Debug build") + install( + FILES "${Python_RUNTIME_LIBRARY_DIRS}/python${Python_VERSION_MAJOR}${Python_VERSION_MINOR}_d.dll" + # install the python3 base dll as well because some libs will try to + # find it (PySide and PyQT for example) + "${Python_RUNTIME_LIBRARY_DIRS}/python${Python_VERSION_MAJOR}_d.dll" + DESTINATION ${CLOUDCOMPARE_DEST_FOLDER} + ) + else() + install( + FILES "${Python_RUNTIME_LIBRARY_DIRS}/python${Python_VERSION_MAJOR}${Python_VERSION_MINOR}.dll" # install the python3 base dll as well because some libs will try to # find it (PySide and PyQT for example) "${Python_RUNTIME_LIBRARY_DIRS}/python${Python_VERSION_MAJOR}.dll" - DESTINATION ${CLOUDCOMPARE_DEST_FOLDER} - ) + DESTINATION ${CLOUDCOMPARE_DEST_FOLDER} + ) + endif() endfunction() function(manage_windows_install) diff --git a/docs/python/pycc/primitives.rst b/docs/python/pycc/primitives.rst index 5c4406a..b2735e1 100644 --- a/docs/python/pycc/primitives.rst +++ b/docs/python/pycc/primitives.rst @@ -9,6 +9,14 @@ __________________ :undoc-members: :show-inheritance: +ccDisc +________ + +.. autoclass:: pycc.ccDisc + :members: + :undoc-members: + :show-inheritance: + ccSphere ________ diff --git a/docs/stubfiles/pycc.pyi b/docs/stubfiles/pycc.pyi index d6d75ed..e2ad490 100644 --- a/docs/stubfiles/pycc.pyi +++ b/docs/stubfiles/pycc.pyi @@ -427,6 +427,11 @@ class ccShiftedObject(ccHObject): @overload def setGlobalShift(*args, **kwargs) -> Any: ... +class ccDisc(ccGenericPrimitive): + def __init__(self, radius: float, transMat: ccGLMatrix = ..., name: QString = ..., precision: int = ..., uniqueId: int = ...) -> None: ... + def getRadius(self) -> float: ... + def setRadius(self, radius: float) -> None: ... + class ccSphere(ccGenericPrimitive): def __init__(self, radius: float, transMat: ccGLMatrix = ..., name: QString = ..., precision: int = ..., uniqueId: int = ...) -> None: ... def getRadius(self) -> float: ... diff --git a/tests/test_cmdline.py b/tests/test_cmdline.py index 68d51c6..1e3ab5e 100644 --- a/tests/test_cmdline.py +++ b/tests/test_cmdline.py @@ -45,13 +45,6 @@ def test_normal_kdtree(cloudcompare_exe): cloudcompare_exe, "-SILENT", "-O", f"{abspath}/data/a_cloud.bin", "-PYTHON_SCRIPT", os.path.join(abspath, "scripts", "kdtree.py")) - -def test_normal_kdtree(cloudcompare_exe): - assert_command_runs( - cloudcompare_exe, "-SILENT", "-O", f"{abspath}/data/a_cloud.bin", "-PYTHON_SCRIPT", - os.path.join(abspath, "scripts", "true_kdtree.py")) - - def test_cloud_for_each(cloudcompare_exe): assert_command_runs( cloudcompare_exe, "-SILENT", "-O", f"{abspath}/data/a_cloud.bin", "-PYTHON_SCRIPT", diff --git a/wrapper/pycc/src/qcc_db/CMakeLists.txt b/wrapper/pycc/src/qcc_db/CMakeLists.txt index eb2a6e6..5e928ba 100644 --- a/wrapper/pycc/src/qcc_db/CMakeLists.txt +++ b/wrapper/pycc/src/qcc_db/CMakeLists.txt @@ -8,6 +8,7 @@ set(pycc_db_sources ${CMAKE_CURRENT_LIST_DIR}/ccColorScalesManager.cpp ${CMAKE_CURRENT_LIST_DIR}/ccCone.cpp ${CMAKE_CURRENT_LIST_DIR}/ccCylinder.cpp + ${CMAKE_CURRENT_LIST_DIR}/ccDisc.cpp ${CMAKE_CURRENT_LIST_DIR}/ccDish.cpp ${CMAKE_CURRENT_LIST_DIR}/ccDrawableObject.cpp ${CMAKE_CURRENT_LIST_DIR}/ccGBLSensor.cpp diff --git a/wrapper/pycc/src/qcc_db/ccDisc.cpp b/wrapper/pycc/src/qcc_db/ccDisc.cpp new file mode 100644 index 0000000..81ccf55 --- /dev/null +++ b/wrapper/pycc/src/qcc_db/ccDisc.cpp @@ -0,0 +1,64 @@ +// ########################################################################## +// # # +// # CLOUDCOMPARE PLUGIN: PythonRuntime # +// # # +// # This program is free software; you can redistribute it and/or modify # +// # it under the terms of the GNU General Public License as published by # +// # the Free Software Foundation; version 2 of the License. # +// # # +// # This program is distributed in the hope that it will be useful, # +// # but WITHOUT ANY WARRANTY; without even the implied warranty of # +// # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +// # GNU General Public License for more details. # +// # # +// # COPYRIGHT: Thomas Montaigu # +// # # +// ########################################################################## + +#include +#include +#include + +#include + +#include "../casters.h" + +namespace py = pybind11; +using namespace pybind11::literals; + +void define_ccDisc(py::module &m) +{ + py::class_(m, "ccDisc", R"doc( + ccDisc + + Parameters + ---------- + radius : PointCoordinateType + radius of the disc + transMat : , optional + optional 3D transformation (can be set afterwards with ccDrawableObject::setGLTransformation) + name : str, default: Disc + name of the disc object + precision : int, default: 24 + drawing precision (angular step = 360/precision) + uniqueID : int, optional + unique ID (handle with care) + + Example + ------- + + .. code:: Python + + disc = pycc.ccDisc(3.0) + disc2 = pycc.ccDisc(5.0, name="Disc2") +)doc") + .def( + py::init(), + "radius"_a, + "transMat"_a = nullptr, + "name"_a = QString("Disc"), + "precision"_a = 24, + "uniqueId"_a = []() { return ccUniqueIDGenerator::InvalidUniqueID; }()) + .def("getRadius", &ccDisc::getRadius) + .def("setRadius", &ccDisc::setRadius, "radius"_a); +} diff --git a/wrapper/pycc/src/qcc_db/qcc_db.cpp b/wrapper/pycc/src/qcc_db/qcc_db.cpp index eca05cd..941c3c2 100644 --- a/wrapper/pycc/src/qcc_db/qcc_db.cpp +++ b/wrapper/pycc/src/qcc_db/qcc_db.cpp @@ -44,6 +44,7 @@ void define_ccIndexedTransformation(py::module &m); void define_ccPlane(py::module &); void define_ccTorus(py::module &); void define_ccBox(py::module &); +void define_ccDisc(py::module &); void define_ccDish(py::module &); void define_ccCone(py::module &); void define_ccCylinder(py::module &); @@ -155,6 +156,7 @@ void define_qcc_db(py::module &m) define_ccPlane(m); define_ccTorus(m); define_ccBox(m); + define_ccDisc(m); define_ccDish(m); define_ccCone(m); define_ccCylinder(m); diff --git a/wrapper/pycc/tests/test_primitives.py b/wrapper/pycc/tests/test_primitives.py index 0e79cf6..fb1744b 100644 --- a/wrapper/pycc/tests/test_primitives.py +++ b/wrapper/pycc/tests/test_primitives.py @@ -2,6 +2,19 @@ import cccorelib +def test_cc_disc(): + disc = pycc.ccDisc(3.0) + assert disc.getTypeName() == "Disc" + assert disc.getName() == "Disc" + assert disc.getRadius() == 3.0 + disc.setRadius(10.0) + assert disc.getRadius() == 10.0 + + disc2 = pycc.ccDisc(5.0, name="Disc2") + assert disc2.getTypeName() == "Disc" + assert disc2.getName() == "Disc2" + + def test_cc_sphere(): sphere = pycc.ccSphere(3.0) assert sphere.getTypeName() == "Sphere"