diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index b88b86a..73cfc1e 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 ae728c4..8ea7795 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 29dffa3..f746fff 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 48993eb..38de371 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 a9d323c..9af9e4d 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 95eb28e..53b646c 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 b76b209..51bb4db 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 710163c..ab359cd 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 8cde72d..0e283d3 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 3ed06d0..4fd7955 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 b5f835d..1aac232 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 8f3a536..435c0e8 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)