From 82879eecf20886b361358d1a32afe0d1b52499b7 Mon Sep 17 00:00:00 2001 From: Romain Janvier Date: Wed, 7 Oct 2026 16:25:44 +0200 Subject: [PATCH] Update Log and singleton to match latest CC updates. --- .github/workflows/Build.yml | 6 +++--- .github/workflows/CodeQL.yml | 2 +- src/PythonPlugin.cpp | 2 +- src/Utilities.h | 4 ++-- wrapper/pycc/CMakeLists.txt | 2 +- wrapper/pycc/src/PyPrintLogger.cpp | 4 ++-- wrapper/pycc/src/PyPrintLogger.h | 2 +- wrapper/pycc/src/pycc.cpp | 4 ++-- wrapper/pycc/src/qcc_db/ccColorScalesManager.cpp | 1 - wrapper/pycc/src/qcc_db/ccGenericMesh.cpp | 6 +++--- wrapper/pycc/src/qcc_db/ccLog.cpp | 5 ++++- wrapper/pycc/src/qcc_db/ccNormalVectors.cpp | 1 - 12 files changed, 20 insertions(+), 19 deletions(-) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index b88b86a3..73cfc1ea 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: 5d00ea5d4040d9485b0b52c769f0b0aae01de296 + ref: d977b9460fd2ed13d3c82925c4521cca49e79da8 submodules: recursive - name: Clone PythonRuntime @@ -80,7 +80,7 @@ jobs: uses: actions/checkout@v4 with: repository: 'CloudCompare/CloudCompare' - ref: 5d00ea5d4040d9485b0b52c769f0b0aae01de296 + ref: d977b9460fd2ed13d3c82925c4521cca49e79da8 submodules: recursive - name: Clone PythonRuntime @@ -149,7 +149,7 @@ jobs: uses: actions/checkout@v4 with: repository: 'CloudCompare/CloudCompare' - ref: 5d00ea5d4040d9485b0b52c769f0b0aae01de296 + ref: d977b9460fd2ed13d3c82925c4521cca49e79da8 submodules: recursive - name: Clone PythonRuntime diff --git a/.github/workflows/CodeQL.yml b/.github/workflows/CodeQL.yml index ae728c47..8ea7795a 100755 --- a/.github/workflows/CodeQL.yml +++ b/.github/workflows/CodeQL.yml @@ -34,7 +34,7 @@ jobs: uses: actions/checkout@v4 with: repository: 'CloudCompare/CloudCompare' - ref: 5d00ea5d4040d9485b0b52c769f0b0aae01de296 + ref: d977b9460fd2ed13d3c82925c4521cca49e79da8 submodules: recursive - name: Clone PythonRuntime diff --git a/src/PythonPlugin.cpp b/src/PythonPlugin.cpp index 29dffa3c..f746fff7 100644 --- a/src/PythonPlugin.cpp +++ b/src/PythonPlugin.cpp @@ -259,7 +259,7 @@ QList PythonPlugin::getActions() QStringList loaded_paths = settings->value(QStringLiteral("RegisterListPath")).value(); - for (QString path : loaded_paths) + for (const QString& path : loaded_paths) { QFileInfo fi(path); if (!fi.exists()) diff --git a/src/Utilities.h b/src/Utilities.h index 48993eb9..38de371b 100644 --- a/src/Utilities.h +++ b/src/Utilities.h @@ -139,7 +139,7 @@ inline void LogPythonPath() char *cPythonPath = Py_EncodeLocale(pythonPath, &errPos); if (cPythonPath) { - ccLog::Print("[PythonRuntime] PythonPath is set to: %s", cPythonPath); + ccLog::Printf("[PythonRuntime] PythonPath is set to: %s", cPythonPath); PyMem_Free(cPythonPath); } else @@ -163,7 +163,7 @@ inline void LogPythonHome() char *cPythonHome = Py_EncodeLocale(pythonHome, &errPos); if (cPythonHome) { - ccLog::Print("[PythonRuntime] PythonHome is set to: %s", cPythonHome); + ccLog::Printf("[PythonRuntime] PythonHome is set to: %s", cPythonHome); PyMem_Free(cPythonHome); } else diff --git a/wrapper/pycc/CMakeLists.txt b/wrapper/pycc/CMakeLists.txt index a9d323c4..9af9e4da 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;plugins/core/IO/MeshIO;" GIT_PROGRESS ON - GIT_TAG 5d00ea5d4040d9485b0b52c769f0b0aae01de296 + GIT_TAG d977b9460fd2ed13d3c82925c4521cca49e79da8 GIT_SHALLOW OFF GIT_SUBMODULES ) diff --git a/wrapper/pycc/src/PyPrintLogger.cpp b/wrapper/pycc/src/PyPrintLogger.cpp index 95eb28ee..53b646c6 100644 --- a/wrapper/pycc/src/PyPrintLogger.cpp +++ b/wrapper/pycc/src/PyPrintLogger.cpp @@ -1,8 +1,8 @@ #include "PyPrintLogger.h" -void PyPrintLogger::logMessage(const QString &message, int level) +void PyPrintLogger::logMessage(const Message &message) { std::lock_guard guard(m_lock); - const std::string stdMsg = message.toStdString(); + const std::string stdMsg = message.text.toStdString(); py::print(stdMsg.c_str()); } diff --git a/wrapper/pycc/src/PyPrintLogger.h b/wrapper/pycc/src/PyPrintLogger.h index b76b2091..51bb4db6 100644 --- a/wrapper/pycc/src/PyPrintLogger.h +++ b/wrapper/pycc/src/PyPrintLogger.h @@ -23,7 +23,7 @@ class PyPrintLogger : public ccLog ~PyPrintLogger() override = default; - void logMessage(const QString &message, int level) override; + void logMessage(const Message &message) override; private: std::mutex m_lock; diff --git a/wrapper/pycc/src/pycc.cpp b/wrapper/pycc/src/pycc.cpp index 710163ca..ab359cdb 100644 --- a/wrapper/pycc/src/pycc.cpp +++ b/wrapper/pycc/src/pycc.cpp @@ -205,7 +205,7 @@ void define_pycc(py::module &m) } catch (std::exception &e) { - ccLog::Print("Failed to import wrapped plugins: ", e.what()); + ccLog::Printf("Failed to import wrapped plugins: %s", e.what()); } #ifdef DEFINE_PYCC_RUNTIME @@ -215,7 +215,7 @@ void define_pycc(py::module &m) } catch (std::exception &e) { - ccLog::Print("Failed to import pycc_runtime content: ", e.what()); + ccLog::Printf("Failed to import pycc_runtime content: %s", e.what()); } #endif } diff --git a/wrapper/pycc/src/qcc_db/ccColorScalesManager.cpp b/wrapper/pycc/src/qcc_db/ccColorScalesManager.cpp index 8cde72da..0e283d3a 100644 --- a/wrapper/pycc/src/qcc_db/ccColorScalesManager.cpp +++ b/wrapper/pycc/src/qcc_db/ccColorScalesManager.cpp @@ -54,7 +54,6 @@ void define_ccColorScalesManager(py::module &m) .def_static("GetUniqueInstance", &ccColorScalesManager::GetUniqueInstance, py::return_value_policy::reference) - .def_static("ReleaseUniqueInstance", &ccColorScalesManager::ReleaseUniqueInstance) .def_static("GetDefaultScaleUUID", &ccColorScalesManager::GetDefaultScaleUUID, "scale"_a) .def_static("GetDefaultScale", &ccColorScalesManager::GetDefaultScale, diff --git a/wrapper/pycc/src/qcc_db/ccGenericMesh.cpp b/wrapper/pycc/src/qcc_db/ccGenericMesh.cpp index 3ed06d00..4fd7955c 100644 --- a/wrapper/pycc/src/qcc_db/ccGenericMesh.cpp +++ b/wrapper/pycc/src/qcc_db/ccGenericMesh.cpp @@ -45,9 +45,9 @@ void define_ccGenericMesh(py::module &m) "getTriangleTexCoordinates", [](ccGenericMesh &self, unsigned triIndex) { - TexCoords2D *tx1, *tx2, *tx3; + const TexCoords2D *tx1, *tx2, *tx3; self.getTriangleTexCoordinates(triIndex, tx1, tx2, tx3); - return py::make_tuple(tx1, tx2, tx2); + return py::make_tuple(tx1, tx2, tx3); }, "triIndex"_a, py::return_value_policy::reference) @@ -75,7 +75,7 @@ void define_ccGenericMesh(py::module &m) "getTriangleNormals", [](ccGenericMesh &self, unsigned triangleIndex) { - CCVector3 Na, Nb, Nc; + const CCVector3 *Na = nullptr, *Nb = nullptr, *Nc = nullptr; self.getTriangleNormals(triangleIndex, Na, Nb, Nc); return py::make_tuple(Na, Nb, Nc); }, diff --git a/wrapper/pycc/src/qcc_db/ccLog.cpp b/wrapper/pycc/src/qcc_db/ccLog.cpp index b5f835da..1aac232e 100644 --- a/wrapper/pycc/src/qcc_db/ccLog.cpp +++ b/wrapper/pycc/src/qcc_db/ccLog.cpp @@ -34,7 +34,7 @@ void define_ccLog(py::module &m) Use one of the static method to log a message )pbdoc"); PyccLog.def_static("TheInstance", &ccLog::TheInstance, py::return_value_policy::reference); - PyccLog.def_static("LogMessage", &ccLog::LogMessage, "message"_a, "level"_a, R"pbdoc( + PyccLog.def_static("LogMessage", &ccLog::LogMessage, "message"_a, "level"_a, "time_ns"_a=-1, R"pbdoc( Logs a message with the given level. Parameters @@ -43,6 +43,9 @@ void define_ccLog(py::module &m) The message to log level: pycc.ccLog.MessageLevelFlags The severity level of the message + time_ns: int + Timestamp in nanoseconds. default to -1, compute the timestamp as the elapsed time since + ccLog::statt(). Example ------- diff --git a/wrapper/pycc/src/qcc_db/ccNormalVectors.cpp b/wrapper/pycc/src/qcc_db/ccNormalVectors.cpp index 8f3a5361..435c0e85 100644 --- a/wrapper/pycc/src/qcc_db/ccNormalVectors.cpp +++ b/wrapper/pycc/src/qcc_db/ccNormalVectors.cpp @@ -30,7 +30,6 @@ void define_ccNormalVectors(py::module &m) py::class_ pyNormalVectors(m, "ccNormalVectors"); pyNormalVectors.def_static("GetUniqueInstance", &ccNormalVectors::GetUniqueInstance) - .def_static("ReleaseUniqueInstance", &ccNormalVectors::ReleaseUniqueInstance) .def_static("GetNumberOfVectors", &ccNormalVectors::GetNumberOfVectors) .def_static("GetNormal", &ccNormalVectors::GetNormal, "normIndex"_a) .def("getNormal", &ccNormalVectors::getNormal, "normIndex"_a)