From 75c0724a9b12f7872f0af6a35a2061048bee217c Mon Sep 17 00:00:00 2001 From: Romain Janvier Date: Thu, 1 Oct 2026 10:12:05 +0200 Subject: [PATCH] Remove CCShareable / + custom holders in favor of std::shared_ptr --- .github/workflows/Build.yml | 6 +- .github/workflows/CodeQL.yml | 2 +- docs/stubfiles/cccorelib.pyi | 132 +++-- docs/stubfiles/pycc.pyi | 568 ++++++++++++---------- src/PythonHighlighter.cpp | 2 +- wrapper/cccorelib/CMakeLists.txt | 2 +- wrapper/cccorelib/src/CCShareable.cpp | 39 -- wrapper/cccorelib/src/CMakeLists.txt | 1 - wrapper/cccorelib/src/ScalarField.cpp | 6 +- wrapper/cccorelib/src/cccorelib.cpp | 4 - wrapper/cccorelib/src/wrappers.h | 49 +- wrapper/pycc/CMakeLists.txt | 2 +- wrapper/pycc/src/qcc_db/ccPointCloud.cpp | 2 +- wrapper/pycc/src/qcc_db/ccScalarField.cpp | 4 +- wrapper/pycc/src/qcc_db/qcc_db.cpp | 8 +- 15 files changed, 423 insertions(+), 404 deletions(-) delete mode 100644 wrapper/cccorelib/src/CCShareable.cpp diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index 958c2dae..b88b86a3 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: 04942bfd61458d9b67b10beb0690dcefdb2debb4 + ref: 5d00ea5d4040d9485b0b52c769f0b0aae01de296 submodules: recursive - name: Clone PythonRuntime @@ -80,7 +80,7 @@ jobs: uses: actions/checkout@v4 with: repository: 'CloudCompare/CloudCompare' - ref: 04942bfd61458d9b67b10beb0690dcefdb2debb4 + ref: 5d00ea5d4040d9485b0b52c769f0b0aae01de296 submodules: recursive - name: Clone PythonRuntime @@ -149,7 +149,7 @@ jobs: uses: actions/checkout@v4 with: repository: 'CloudCompare/CloudCompare' - ref: 04942bfd61458d9b67b10beb0690dcefdb2debb4 + ref: 5d00ea5d4040d9485b0b52c769f0b0aae01de296 submodules: recursive - name: Clone PythonRuntime diff --git a/.github/workflows/CodeQL.yml b/.github/workflows/CodeQL.yml index d12e4bee..ae728c47 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: 04942bfd61458d9b67b10beb0690dcefdb2debb4 + ref: 5d00ea5d4040d9485b0b52c769f0b0aae01de296 submodules: recursive - name: Clone PythonRuntime diff --git a/docs/stubfiles/cccorelib.pyi b/docs/stubfiles/cccorelib.pyi index 9499fac3..178b3542 100644 --- a/docs/stubfiles/cccorelib.pyi +++ b/docs/stubfiles/cccorelib.pyi @@ -1,7 +1,7 @@ -from typing import Iterable, Iterator, Tuple +from typing import Iterable, Iterator, Tuple, overload -from typing import overload import numpy + CC_LOCAL_MODEL_MIN_SIZE: int NAN_VALUE: float PC_NAN: float @@ -75,12 +75,6 @@ class CCMiscTools: def TriBoxOverlap(self, *args, **kwargs) -> Any: ... def TriBoxOverlapd(self, *args, **kwargs) -> Any: ... -class CCShareable: - def __init__(self) -> None: ... - def getLinkCount(self) -> int: ... - def link(self) -> None: ... - def release(self) -> None: ... - class CCVector2: @overload def __init__(self) -> None: ... @@ -194,7 +188,9 @@ class CHAMFER_DISTANCE_TYPE: class ChamferDistanceTransform(Grid3Dus): def __init__(self, *args, **kwargs) -> None: ... def init(self, gridSize: Tuple3ui) -> bool: ... - def propagateDistance(self, type: CHAMFER_DISTANCE_TYPE, progressCb: GenericProgressCallback = ...) -> int: ... + def propagateDistance( + self, type: CHAMFER_DISTANCE_TYPE, progressCb: GenericProgressCallback = ... + ) -> int: ... @property def MAX_DIST(self) -> Any: ... @@ -221,7 +217,9 @@ class Delaunay2dMesh(GenericIndexedMesh): def Available(self, *args, **kwargs) -> Any: ... def TesselateContour(self, *args, **kwargs) -> Any: ... @overload - def buildMesh(self, points2D, std, pointCountToUse: int, outputErrorStr: str) -> bool: ... + def buildMesh( + self, points2D, std, pointCountToUse: int, outputErrorStr: str + ) -> bool: ... @overload def buildMesh(*args, **kwargs) -> Any: ... def getAssociatedCloud(self) -> GenericIndexedCloud: ... @@ -231,7 +229,9 @@ class Delaunay2dMesh(GenericIndexedMesh): def getTriangleVertIndexesArray(self, maxEdgeLength: float) -> bool: ... @overload def getTriangleVertIndexesArray(*args, **kwargs) -> Any: ... - def linkMeshWith(self, aCloud: GenericIndexedCloud, passOwnership: bool = ...) -> None: ... + def linkMeshWith( + self, aCloud: GenericIndexedCloud, passOwnership: bool = ... + ) -> None: ... def removeOuterTriangles(self, *args, **kwargs) -> Any: ... @property def USE_ALL_POINTS(self) -> Any: ... @@ -248,7 +248,14 @@ class DgmOctree(GenericOctree): @overload def build(self, progressCb: GenericProgressCallback = ...) -> int: ... @overload - def build(self, octreeMin: CCVector3, octreeMax: CCVector3, pointsMinFilter: CCVector3 = ..., pointsMaxFilter: CCVector3 = ..., progressCb: GenericProgressCallback = ...) -> int: ... + def build( + self, + octreeMin: CCVector3, + octreeMax: CCVector3, + pointsMinFilter: CCVector3 = ..., + pointsMaxFilter: CCVector3 = ..., + progressCb: GenericProgressCallback = ..., + ) -> int: ... @overload def build(*args, **kwargs) -> Any: ... def clear(self) -> None: ... @@ -299,7 +306,7 @@ class FastMarching: class GenericCloud: def __init__(self, *args, **kwargs) -> None: ... def enableScalarField(self) -> bool: ... - def setPointScalarValues(self, action: Callable[[float],None]) -> None: ... + def setPointScalarValues(self, action: Callable[[float], None]) -> None: ... def getBoundingBox(self, arg0: CCVector3, arg1: CCVector3) -> None: ... def getNextPoint(self) -> CCVector3: ... def getPointScalarValue(self, arg0: int) -> float: ... @@ -312,7 +319,9 @@ class GenericCloud: class GenericDistribution: ScalarContainer: Any = ... def __init__(self, *args, **kwargs) -> None: ... - def computeChi2Dist(self, Yk: GenericCloud, numberOfClasses: int, histo: int = ...) -> float: ... + def computeChi2Dist( + self, Yk: GenericCloud, numberOfClasses: int, histo: int = ... + ) -> float: ... @overload def computeP(self, x: float) -> float: ... @overload @@ -342,7 +351,9 @@ class GenericIndexedMesh(GenericMesh): def _getTriangle(self, triangleIndex: int) -> GenericTriangle: ... def getNextTriangleVertIndexes(self) -> VerticesIndexes: ... def getTriangleVertIndexes(self, triangleIndex: int) -> VerticesIndexes: ... - def getTriangleVertices(self, triangleIndex: int, A: CCVector3, B: CCVector3, C: CCVector3) -> None: ... + def getTriangleVertices( + self, triangleIndex: int, A: CCVector3, B: CCVector3, C: CCVector3 + ) -> None: ... class GenericMesh: def __init__(self, *args, **kwargs) -> None: ... @@ -432,25 +443,43 @@ class ICPRegistrationTools(RegistrationTools): class Jacobi: @staticmethod - def ComputeEigenValuesAndVectors(matrix: SquareMatrixd, absoluteValues: bool = ..., maxIterationCount: int = ...) -> Tuple[SquareMatrixd, list[float]]: ... + def ComputeEigenValuesAndVectors( + matrix: SquareMatrixd, absoluteValues: bool = ..., maxIterationCount: int = ... + ) -> Tuple[SquareMatrixd, list[float]]: ... @staticmethod - def SortEigenValuesAndVectors(eigenVectors: SquareMatrixd, eigenValues: list[float]) -> Tuple[SquareMatrixd, list[float]]: ... + def SortEigenValuesAndVectors( + eigenVectors: SquareMatrixd, eigenValues: list[float] + ) -> Tuple[SquareMatrixd, list[float]]: ... @staticmethod def GetEigenVector(eigenVectors: SquareMatrixd, index: int) -> list[float]: ... @staticmethod - def GetMaxEigenValueAndVector(eigenVectors: SquareMatrixd, eigenValues: list[float]) -> Tuple[float, list[float]]: ... + def GetMaxEigenValueAndVector( + eigenVectors: SquareMatrixd, eigenValues: list[float] + ) -> Tuple[float, list[float]]: ... @staticmethod - def GetMinEigenValueAndVector(eigenVectors: SquareMatrixd, eigenValues: list[float]) -> Tuple[float, list[float]]: ... + def GetMinEigenValueAndVector( + eigenVectors: SquareMatrixd, eigenValues: list[float] + ) -> Tuple[float, list[float]]: ... @staticmethod - def TestEigenVecAndValues(matrix: SquareMatrixd, eigenVectors: SquareMatrixd, eigenValues: list[float]) -> bool: ... + def TestEigenVecAndValues( + matrix: SquareMatrixd, eigenVectors: SquareMatrixd, eigenValues: list[float] + ) -> bool: ... class KDTree: IndicesVector: Any = ... def __init__(self) -> None: ... - def buildFromCloud(self, cloud: GenericIndexedCloud, progressCb: GenericProgressCallback = ...) -> bool: ... + def buildFromCloud( + self, cloud: GenericIndexedCloud, progressCb: GenericProgressCallback = ... + ) -> bool: ... def findNearestNeighbour(self, queryPoint: sequence, maxDist: float) -> object: ... def findPointBelowDistance(self, queryPoint: sequence, maxDist: float) -> bool: ... - def findPointsLyingToDistance(self, queryPoint: sequence, distance: float, tolerance: float, points: KDTree.IndicesVector) -> int: ... + def findPointsLyingToDistance( + self, + queryPoint: sequence, + distance: float, + tolerance: float, + points: KDTree.IndicesVector, + ) -> int: ... def getAssociatedCloud(self) -> GenericIndexedCloud: ... class KMeanClass: @@ -490,7 +519,9 @@ class LOCAL_MODEL_TYPES: class LocalModel: def __init__(self, *args, **kwargs) -> None: ... - def computeDistanceFromModelToPoint(self, P: CCVector3, nearestPoint: CCVector3 = ...) -> float: ... + def computeDistanceFromModelToPoint( + self, P: CCVector3, nearestPoint: CCVector3 = ... + ) -> float: ... def getCenter(self) -> CCVector3: ... def getSquareSize(self) -> float: ... def getType(self) -> LOCAL_MODEL_TYPES: ... @@ -521,7 +552,9 @@ class MeshSamplingTools: @staticmethod def flagMeshVerticesByType(mesh: GenericIndexedMesh, flags: ScalarField) -> Any: ... @staticmethod - def samplePointsOnMesh(mesh: GenericMesh, *args, **kwargs) -> Tuple[PointCloud, list[int]]: ... + def samplePointsOnMesh( + mesh: GenericMesh, *args, **kwargs + ) -> Tuple[PointCloud, list[int]]: ... class Neighbourhood: GeomElement: Any = ... @@ -563,7 +596,9 @@ class Neighbourhood: def computeFeature(self, feature: Any) -> float: ... def computeLargestRadius(self) -> float: ... def computeMomentOrder1(self, P: CCVector3) -> float: ... - def computeRoughness(self, P: CCVector3, roughnessUpDir: CCVector3 = ...) -> float: ... + def computeRoughness( + self, P: CCVector3, roughnessUpDir: CCVector3 = ... + ) -> float: ... def getGravityCenter(self) -> Any: ... def getLSPlane(self) -> Any: ... def getLSPlaneNormal(self) -> Any: ... @@ -574,8 +609,12 @@ class Neighbourhood: def reset(self) -> None: ... def setGravityCenter(self, G: CCVector3) -> None: ... def setLSPlane(self, *args, **kwargs) -> None: ... - def triangulateFromQuadric(self, stepsX: int, stepsY: int) -> GenericIndexedMesh: ... - def triangulateOnPlane(self, duplicateVertices: bool, maxEdgeLength: float) -> Any: ... + def triangulateFromQuadric( + self, stepsX: int, stepsY: int + ) -> GenericIndexedMesh: ... + def triangulateOnPlane( + self, duplicateVertices: bool, maxEdgeLength: float + ) -> Any: ... class NormalDistribution(GenericDistribution): @overload @@ -585,17 +624,29 @@ class NormalDistribution(GenericDistribution): @overload def __init__(*args, **kwargs) -> Any: ... def computeParameters(self, cloud: GenericCloud) -> bool: ... - def computeRobustParameters(self, values: GenericDistribution.ScalarContainer, nSigma: float) -> bool: ... + def computeRobustParameters( + self, values: GenericDistribution.ScalarContainer, nSigma: float + ) -> bool: ... def getMu(self) -> float: ... - def getParameters(self) -> Tuple[float,float]: ... + def getParameters(self) -> Tuple[float, float]: ... def getSigma2(self) -> float: ... def setParameters(self, _mu: float, _sigma2: float) -> bool: ... class NormalizedProgress: - def __init__(self, callback: GenericProgressCallback, totalSteps: int, totalPercentage: int = ...) -> None: ... + def __init__( + self, + callback: GenericProgressCallback, + totalSteps: int, + totalPercentage: int = ..., + ) -> None: ... def oneStep(self) -> bool: ... def reset(self) -> None: ... - def scale(self, totalSteps: int, totalPercentage: int = ..., updateCurrentProgress: bool = ...) -> None: ... + def scale( + self, + totalSteps: int, + totalPercentage: int = ..., + updateCurrentProgress: bool = ..., + ) -> None: ... def steps(self, arg0: int) -> bool: ... class NumpyCloud(GenericIndexedCloud): @@ -707,7 +758,7 @@ class RegistrationTools: def __init__(self, *args, **kwargs) -> None: ... def FilterTransformation(self, *args, **kwargs) -> Any: ... -class ScalarField(CCShareable): +class ScalarField: def __init__(self, name: str) -> None: ... def NaN(self, *args, **kwargs) -> Any: ... def ValidValue(self, *args, **kwargs) -> Any: ... @@ -727,7 +778,9 @@ class ScalarField(CCShareable): def invert(self) -> None: ... def reserveSafe(self, count: int) -> bool: ... def resetOffset(self) -> None: ... - def resizeSafe(self, count: int, initNewElements: bool = ..., valueForNewElements: float = ...) -> bool: ... + def resizeSafe( + self, count: int, initNewElements: bool = ..., valueForNewElements: float = ... + ) -> bool: ... def setLocalValue(self, index: int, value: float) -> None: ... def setName(self, arg0: str) -> None: ... def setOffset(self, offset: float) -> None: ... @@ -751,7 +804,9 @@ class ScalarFieldTools: def multiplyScalarFields(self, *args, **kwargs) -> Any: ... class SimpleMesh(GenericIndexedMesh): - def __init__(self, theVertices: GenericIndexedCloud, linkVerticesWithMesh: bool = ...) -> None: ... + def __init__( + self, theVertices: GenericIndexedCloud, linkVerticesWithMesh: bool = ... + ) -> None: ... def addTriangle(self, i1: int, i2: int, i3: int) -> None: ... def capacity(self) -> int: ... def clear(self) -> None: ... @@ -849,7 +904,14 @@ class TrueKdTree: Node: Any = ... def __init__(self, cloud: GenericIndexedCloudPersist) -> None: ... def associatedCloud(self) -> GenericIndexedCloudPersist: ... - def build(self, maxError: float, errorMeasure: DistanceComputationTools.ERRPOR_MEASURES = ..., minPointCountPerCell: int = ..., maxPointCountPerCell: int = ..., progressCb: GenericProgressCallback = ...) -> bool: ... + def build( + self, + maxError: float, + errorMeasure: DistanceComputationTools.ERRPOR_MEASURES = ..., + minPointCountPerCell: int = ..., + maxPointCountPerCell: int = ..., + progressCb: GenericProgressCallback = ..., + ) -> bool: ... def clear(self) -> None: ... def getLeaves(self, leaves: TrueKdTree.LeafVector) -> bool: ... def getMaxErrorType(self) -> DistanceComputationTools.ERRPOR_MEASURES: ... diff --git a/docs/stubfiles/pycc.pyi b/docs/stubfiles/pycc.pyi index fd3af1b2..6391bd7d 100644 --- a/docs/stubfiles/pycc.pyi +++ b/docs/stubfiles/pycc.pyi @@ -1,6 +1,5 @@ -from typing import Iterable, Iterator, List +from typing import Iterable, Iterator, List, overload -from typing import overload import cccorelib class FileIOFilter: @@ -41,7 +40,7 @@ class QWidget: class Rgba: def __init__(self, *args, **kwargs) -> None: ... -class _NormsIndexesArrayType(_VectorCompressedNormType, cccorelib.CCShareable, ccHObject): +class _NormsIndexesArrayType(_VectorCompressedNormType, ccHObject): def __init__(self, *args, **kwargs) -> None: ... class _VectorCompressedNormType: @@ -104,8 +103,10 @@ class __ccGenericPointCloudTpl(ccGenericPointCloud): def deleteAllScalarFields(self) -> None: ... def deleteScalarField(self, index: int) -> None: ... def enableScalarField(self) -> bool: ... - def setPointScalarValues(self, action: Callable[[float],None]) -> None: ... - def getBoundingBox(self, bbMin: cccorelib.CCVector3, bbMax: cccorelib.CCVector3) -> None: ... + def setPointScalarValues(self, action: Callable[[float], None]) -> None: ... + def getBoundingBox( + self, bbMin: cccorelib.CCVector3, bbMax: cccorelib.CCVector3 + ) -> None: ... def getCurrentInScalarField(self) -> cccorelib.ScalarField: ... def getCurrentInScalarFieldIndex(self) -> int: ... def getCurrentOutScalarField(self) -> cccorelib.ScalarField: ... @@ -132,9 +133,17 @@ class cc2DLabel(ccHObject, ccInteractor): PickedPoint: Any = ... def __init__(self, name: QString = ...) -> None: ... @overload - def addPickedPoint(self, cloud: ccGenericPointCloud, pointIndex: int, entityCenter: bool = ...) -> bool: ... + def addPickedPoint( + self, cloud: ccGenericPointCloud, pointIndex: int, entityCenter: bool = ... + ) -> bool: ... @overload - def addPickedPoint(self, cloud: ccGenericMesh, triangleIndex: int, uv: cccorelib.CCVector2d, entityCenter: bool = ...) -> bool: ... + def addPickedPoint( + self, + cloud: ccGenericMesh, + triangleIndex: int, + uv: cccorelib.CCVector2d, + entityCenter: bool = ..., + ) -> bool: ... @overload def addPickedPoint(self, pp: cc2DLabel.PickedPoint) -> bool: ... @overload @@ -155,12 +164,25 @@ class cc2DLabel(ccHObject, ccInteractor): def size(self) -> int: ... class ccBox(ccGenericPrimitive): - def __init__(self, dims: cccorelib.CCVector3, transMat: ccGLMatrix = ..., name: QString = ...) -> None: ... + def __init__( + self, dims: cccorelib.CCVector3, transMat: ccGLMatrix = ..., name: QString = ... + ) -> None: ... def getDimensions(self) -> cccorelib.CCVector3: ... def setDimensions(self, dims: cccorelib.CCVector3) -> None: ... class ccCone(ccGenericPrimitive): - def __init__(self, bottomRadius: float, topRadius: float, height: float, xOff: float = ..., yOff: float = ..., transMat: ccGLMatrix = ..., name: QString = ..., precision: int = ..., uniqueID: int = ...) -> None: ... + def __init__( + self, + bottomRadius: float, + topRadius: float, + height: float, + xOff: float = ..., + yOff: float = ..., + transMat: ccGLMatrix = ..., + name: QString = ..., + precision: int = ..., + uniqueID: int = ..., + ) -> None: ... def getBottomCenter(self) -> cccorelib.CCVector3: ... def getBottomRadius(self) -> float: ... def getHeight(self) -> float: ... @@ -176,10 +198,26 @@ class ccCone(ccGenericPrimitive): def setTopRadius(self, radius: float) -> None: ... class ccCylinder(ccCone): - def __init__(self, radius: float, height: float, transMat: ccGLMatrix = ..., name: QString = ..., precision: int = ..., uniqueID: int = ...) -> None: ... + def __init__( + self, + radius: float, + height: float, + transMat: ccGLMatrix = ..., + name: QString = ..., + precision: int = ..., + uniqueID: int = ..., + ) -> None: ... class ccDish(ccGenericPrimitive): - def __init__(self, radius: float, height: float, radius2: float = ..., transMat: ccGLMatrix = ..., name: QString = ..., precision: int = ...) -> None: ... + def __init__( + self, + radius: float, + height: float, + radius2: float = ..., + transMat: ccGLMatrix = ..., + name: QString = ..., + precision: int = ..., + ) -> None: ... class ccDrawableObject: def __init__(self, *args, **kwargs) -> None: ... @@ -236,15 +274,29 @@ class ccDrawableObject: class ccGLCameraParameters: def __init__(self) -> None: ... @overload - def project(self, input3D: cccorelib.CCVector3d, output2D: cccorelib.CCVector3d, checkInFrustrum: bool = ...) -> bool: ... + def project( + self, + input3D: cccorelib.CCVector3d, + output2D: cccorelib.CCVector3d, + checkInFrustrum: bool = ..., + ) -> bool: ... @overload - def project(self, input3D: cccorelib.CCVector3, output2D: cccorelib.CCVector3d, checkInFrustrum: bool = ...) -> bool: ... + def project( + self, + input3D: cccorelib.CCVector3, + output2D: cccorelib.CCVector3d, + checkInFrustrum: bool = ..., + ) -> bool: ... @overload def project(*args, **kwargs) -> Any: ... @overload - def unproject(self, input3D: cccorelib.CCVector3d, output2D: cccorelib.CCVector3d) -> bool: ... + def unproject( + self, input3D: cccorelib.CCVector3d, output2D: cccorelib.CCVector3d + ) -> bool: ... @overload - def unproject(self, input3D: cccorelib.CCVector3, output2D: cccorelib.CCVector3d) -> bool: ... + def unproject( + self, input3D: cccorelib.CCVector3, output2D: cccorelib.CCVector3d + ) -> bool: ... @overload def unproject(*args, **kwargs) -> Any: ... @property @@ -278,8 +330,23 @@ class ccGenericGLDisplay: TextAlign: Any = ... def __init__(self, *args, **kwargs) -> None: ... def deprecate3DLayer(self) -> None: ... - def display3DLabel(self, str: QString, pos3D: cccorelib.CCVector3, color: Rgba = ..., font: QFont = ...) -> None: ... - def displayText(self, text: QString, x: int, y: int, align: int = ..., bkgAlpha: float = ..., color: Rgba = ..., font: QFont = ...) -> None: ... + def display3DLabel( + self, + str: QString, + pos3D: cccorelib.CCVector3, + color: Rgba = ..., + font: QFont = ..., + ) -> None: ... + def displayText( + self, + text: QString, + x: int, + y: int, + align: int = ..., + bkgAlpha: float = ..., + color: Rgba = ..., + font: QFont = ..., + ) -> None: ... def getGLCameraParameters(self, params: ccGLCameraParameters) -> None: ... def getLabelDisplayFont(self) -> QFont: ... def getScreenSize(self) -> QSize: ... @@ -340,7 +407,9 @@ class ccHObject(ccObject, ccDrawableObject): class ccInteractor: def __init__(self, *args, **kwargs) -> None: ... def acceptClick(self, x: int, y: int, button) -> bool: ... - def move2D(self, x: int, y: int, dx: int, dy: int, screenWidth: int, screenHeight: int) -> bool: ... + def move2D( + self, x: int, y: int, dx: int, dy: int, screenWidth: int, screenHeight: int + ) -> bool: ... def move3D(self, u: cccorelib.CCVector3d) -> bool: ... class ccLog: @@ -377,7 +446,13 @@ class ccPlanarEntityInterface: def showNormalVector(self, state: bool) -> None: ... class ccPlane(ccGenericPrimitive, ccPlanarEntityInterface): - def __init__(self, xWidth: float, yWidth: float, transMat: ccGLMatrix = ..., name: QString = ...) -> None: ... + def __init__( + self, + xWidth: float, + yWidth: float, + transMat: ccGLMatrix = ..., + name: QString = ..., + ) -> None: ... def Fit(self, *args, **kwargs) -> Any: ... def flip(self) -> None: ... def getCenter(self) -> cccorelib.CCVector3: ... @@ -391,7 +466,9 @@ class ccPointCloud(__ccGenericPointCloudTpl): def __init__(self, name: QString = ..., uniqueID: int = ...) -> None: ... def getCurrentDisplayedScalarField(self) -> ccScalarField: ... def getCurrentDisplayedScalarFieldIndex(self) -> int: ... - def partialClone(self, reference: cccorelib.ReferenceCloud, warnings: int = ...) -> ccPointCloud: ... + def partialClone( + self, reference: cccorelib.ReferenceCloud, warnings: int = ... + ) -> ccPointCloud: ... def reserveTheNormsTable(self) -> bool: ... def reserveThePointsTable(self, _numberOfPoints: int) -> bool: ... @overload @@ -428,511 +505,480 @@ class ccShiftedObject(ccHObject): def setGlobalShift(*args, **kwargs) -> Any: ... class ccDisc(ccGenericPrimitive): - def __init__(self, radius: float, transMat: ccGLMatrix = ..., name: QString = ..., precision: int = ..., uniqueId: int = ...) -> None: ... + 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 __init__( + self, + radius: float, + transMat: ccGLMatrix = ..., + name: QString = ..., + precision: int = ..., + uniqueId: int = ..., + ) -> None: ... def getRadius(self) -> float: ... def setRadius(self, radius: float) -> None: ... class ccTorus(ccGenericPrimitive): - def __init__(self, insideRadius: float, outsideRadius: float, angleRad: float = ..., rectangularSection: bool = ..., rectSectionHeight: float = ..., transMat: ccGLMatrix = ..., name: QString = ..., precision: int = ..., uniqueId: int = ...) -> None: ... -from typing import Union, List + def __init__( + self, + insideRadius: float, + outsideRadius: float, + angleRad: float = ..., + rectangularSection: bool = ..., + rectSectionHeight: float = ..., + transMat: ccGLMatrix = ..., + name: QString = ..., + precision: int = ..., + uniqueId: int = ..., + ) -> None: ... + +from typing import List, Union class ccPythonInstance: def haveSelection(self) -> bool: ... - def haveOneSelection(self) -> bool: ... - def getSelectedEntites(self) -> List[Union[ccHObject, ccPointCloud, ccMesh]]: ... - def GetInstance() -> ccPythonInstance: ... -from typing import Union, List -class ccPythonInstance: +from typing import List, Union +class ccPythonInstance: def getMainWindow() -> QMainWindow: ... - def getActiveGLWindow() -> ccGLWindow: ... - def haveSelection(self) -> bool: ... - def haveOneSelection(self) -> bool: ... - def getSelectedEntities(self) -> List[Union[ccHObject, ccPointCloud, ccMesh]]: ... - - def addToDB(self, obj: ccHObject, updateZoom: bool = False, autoExpandDBTree: bool = True, checkDimensions: bool = False, autoRedeaw: bool = True) -> None: ... - + def addToDB( + self, + obj: ccHObject, + updateZoom: bool = False, + autoExpandDBTree: bool = True, + checkDimensions: bool = False, + autoRedeaw: bool = True, + ) -> None: ... def redrawAll(only2D: bool = False) -> None: ... - def refreshAll(only2D: bool = False) -> None: ... - def disableAll() -> None: ... - def updateUI() -> None: ... - def freezeUI(state: bool) -> None: ... def GetInstance() -> ccPythonInstance: ... -from typing import Union, List -class ccPythonInstance: +from typing import List, Union +class ccPythonInstance: def getMainWindow() -> QMainWindow: ... - def getActiveGLWindow() -> ccGLWindow: ... - def haveSelection(self) -> bool: ... - def haveOneSelection(self) -> bool: ... - def getSelectedEntities(self) -> List[Union[ccHObject, ccPointCloud, ccMesh]]: ... - - def addToDB(self, obj: ccHObject, updateZoom: bool = False, autoExpandDBTree: bool = True, checkDimensions: bool = False, autoRedeaw: bool = True) -> None: ... - + def addToDB( + self, + obj: ccHObject, + updateZoom: bool = False, + autoExpandDBTree: bool = True, + checkDimensions: bool = False, + autoRedeaw: bool = True, + ) -> None: ... def redrawAll(only2D: bool = False) -> None: ... - def refreshAll(only2D: bool = False) -> None: ... - def disableAll() -> None: ... - def updateUI() -> None: ... - def freezeUI(state: bool) -> None: ... def GetInstance() -> ccPythonInstance: ... -from typing import Union, List -class ccPythonInstance: +from typing import List, Union +class ccPythonInstance: def getMainWindow() -> QMainWindow: ... - def getActiveGLWindow() -> ccGLWindow: ... - def haveSelection(self) -> bool: ... - def haveOneSelection(self) -> bool: ... - def getSelectedEntities(self) -> List[Union[ccHObject, ccPointCloud, ccMesh]]: ... - - def addToDB(self, obj: ccHObject, updateZoom: bool = False, autoExpandDBTree: bool = True, checkDimensions: bool = False, autoRedeaw: bool = True) -> None: ... - + def addToDB( + self, + obj: ccHObject, + updateZoom: bool = False, + autoExpandDBTree: bool = True, + checkDimensions: bool = False, + autoRedeaw: bool = True, + ) -> None: ... def redrawAll(only2D: bool = False) -> None: ... - def refreshAll(only2D: bool = False) -> None: ... - def disableAll() -> None: ... - def updateUI() -> None: ... - def freezeUI(state: bool) -> None: ... def GetInstance() -> ccPythonInstance: ... -from typing import Union, List -class ccPythonInstance: +from typing import List, Union +class ccPythonInstance: def getMainWindow() -> QMainWindow: ... - def getActiveGLWindow() -> ccGLWindow: ... - def haveSelection(self) -> bool: ... - def haveOneSelection(self) -> bool: ... - def getSelectedEntities(self) -> List[Union[ccHObject, ccPointCloud, ccMesh]]: ... - - def addToDB(self, obj: ccHObject, updateZoom: bool = False, autoExpandDBTree: bool = True, checkDimensions: bool = False, autoRedeaw: bool = True) -> None: ... - + def addToDB( + self, + obj: ccHObject, + updateZoom: bool = False, + autoExpandDBTree: bool = True, + checkDimensions: bool = False, + autoRedeaw: bool = True, + ) -> None: ... def redrawAll(only2D: bool = False) -> None: ... - def refreshAll(only2D: bool = False) -> None: ... - def disableAll() -> None: ... - def updateUI() -> None: ... - def freezeUI(state: bool) -> None: ... def GetInstance() -> ccPythonInstance: ... -from typing import Union, List -class ccPythonInstance: +from typing import List, Union +class ccPythonInstance: def getMainWindow() -> QMainWindow: ... - def getActiveGLWindow() -> ccGLWindow: ... - def haveSelection(self) -> bool: ... - def haveOneSelection(self) -> bool: ... - def getSelectedEntities(self) -> List[Union[ccHObject, ccPointCloud, ccMesh]]: ... - - def addToDB(self, obj: ccHObject, updateZoom: bool = False, autoExpandDBTree: bool = True, checkDimensions: bool = False, autoRedeaw: bool = True) -> None: ... - + def addToDB( + self, + obj: ccHObject, + updateZoom: bool = False, + autoExpandDBTree: bool = True, + checkDimensions: bool = False, + autoRedeaw: bool = True, + ) -> None: ... def redrawAll(only2D: bool = False) -> None: ... - def refreshAll(only2D: bool = False) -> None: ... - def disableAll() -> None: ... - def updateUI() -> None: ... - def freezeUI(state: bool) -> None: ... def GetInstance() -> ccPythonInstance: ... -from typing import Union, List -class ccPythonInstance: +from typing import List, Union +class ccPythonInstance: def getMainWindow() -> QMainWindow: ... - def getActiveGLWindow() -> ccGLWindow: ... - def haveSelection(self) -> bool: ... - def haveOneSelection(self) -> bool: ... - def getSelectedEntities(self) -> List[Union[ccHObject, ccPointCloud, ccMesh]]: ... - - def addToDB(self, obj: ccHObject, updateZoom: bool = False, autoExpandDBTree: bool = True, checkDimensions: bool = False, autoRedeaw: bool = True) -> None: ... - + def addToDB( + self, + obj: ccHObject, + updateZoom: bool = False, + autoExpandDBTree: bool = True, + checkDimensions: bool = False, + autoRedeaw: bool = True, + ) -> None: ... def redrawAll(only2D: bool = False) -> None: ... - def refreshAll(only2D: bool = False) -> None: ... - def disableAll() -> None: ... - def updateUI() -> None: ... - def freezeUI(state: bool) -> None: ... def GetInstance() -> ccPythonInstance: ... -from typing import Union, List -class ccPythonInstance: +from typing import List, Union +class ccPythonInstance: def getMainWindow() -> QMainWindow: ... - def getActiveGLWindow() -> ccGLWindow: ... - def haveSelection(self) -> bool: ... - def haveOneSelection(self) -> bool: ... - def getSelectedEntities(self) -> List[Union[ccHObject, ccPointCloud, ccMesh]]: ... - - def addToDB(self, obj: ccHObject, updateZoom: bool = False, autoExpandDBTree: bool = True, checkDimensions: bool = False, autoRedeaw: bool = True) -> None: ... - + def addToDB( + self, + obj: ccHObject, + updateZoom: bool = False, + autoExpandDBTree: bool = True, + checkDimensions: bool = False, + autoRedeaw: bool = True, + ) -> None: ... def redrawAll(only2D: bool = False) -> None: ... - def refreshAll(only2D: bool = False) -> None: ... - def disableAll() -> None: ... - def updateUI() -> None: ... - def freezeUI(state: bool) -> None: ... def GetInstance() -> ccPythonInstance: ... -from typing import Union, List -class ccPythonInstance: +from typing import List, Union +class ccPythonInstance: def getMainWindow() -> QMainWindow: ... - def getActiveGLWindow() -> ccGLWindow: ... - def haveSelection(self) -> bool: ... - def haveOneSelection(self) -> bool: ... - def getSelectedEntities(self) -> List[Union[ccHObject, ccPointCloud, ccMesh]]: ... - - def addToDB(self, obj: ccHObject, updateZoom: bool = False, autoExpandDBTree: bool = True, checkDimensions: bool = False, autoRedeaw: bool = True) -> None: ... - + def addToDB( + self, + obj: ccHObject, + updateZoom: bool = False, + autoExpandDBTree: bool = True, + checkDimensions: bool = False, + autoRedeaw: bool = True, + ) -> None: ... def redrawAll(only2D: bool = False) -> None: ... - def refreshAll(only2D: bool = False) -> None: ... - def disableAll() -> None: ... - def updateUI() -> None: ... - def freezeUI(state: bool) -> None: ... def GetInstance() -> ccPythonInstance: ... -from typing import Union, List -class ccPythonInstance: +from typing import List, Union +class ccPythonInstance: def getMainWindow() -> QMainWindow: ... - def getActiveGLWindow() -> ccGLWindow: ... - def haveSelection(self) -> bool: ... - def haveOneSelection(self) -> bool: ... - def getSelectedEntities(self) -> List[Union[ccHObject, ccPointCloud, ccMesh]]: ... - - def addToDB(self, obj: ccHObject, updateZoom: bool = False, autoExpandDBTree: bool = True, checkDimensions: bool = False, autoRedeaw: bool = True) -> None: ... - + def addToDB( + self, + obj: ccHObject, + updateZoom: bool = False, + autoExpandDBTree: bool = True, + checkDimensions: bool = False, + autoRedeaw: bool = True, + ) -> None: ... def redrawAll(only2D: bool = False) -> None: ... - def refreshAll(only2D: bool = False) -> None: ... - def disableAll() -> None: ... - def updateUI() -> None: ... - def freezeUI(state: bool) -> None: ... def GetInstance() -> ccPythonInstance: ... -from typing import Union, List -class ccPythonInstance: +from typing import List, Union +class ccPythonInstance: def getMainWindow() -> QMainWindow: ... - def getActiveGLWindow() -> ccGLWindow: ... - def haveSelection(self) -> bool: ... - def haveOneSelection(self) -> bool: ... - def getSelectedEntities(self) -> List[Union[ccHObject, ccPointCloud, ccMesh]]: ... - - def addToDB(self, obj: ccHObject, updateZoom: bool = False, autoExpandDBTree: bool = True, checkDimensions: bool = False, autoRedeaw: bool = True) -> None: ... - + def addToDB( + self, + obj: ccHObject, + updateZoom: bool = False, + autoExpandDBTree: bool = True, + checkDimensions: bool = False, + autoRedeaw: bool = True, + ) -> None: ... def redrawAll(only2D: bool = False) -> None: ... - def refreshAll(only2D: bool = False) -> None: ... - def disableAll() -> None: ... - def updateUI() -> None: ... - def freezeUI(state: bool) -> None: ... def GetInstance() -> ccPythonInstance: ... -from typing import Union, List -class ccPythonInstance: +from typing import List, Union +class ccPythonInstance: def getMainWindow() -> QMainWindow: ... - def getActiveGLWindow() -> ccGLWindow: ... - def haveSelection(self) -> bool: ... - def haveOneSelection(self) -> bool: ... - def getSelectedEntities(self) -> List[Union[ccHObject, ccPointCloud, ccMesh]]: ... - - def addToDB(self, obj: ccHObject, updateZoom: bool = False, autoExpandDBTree: bool = True, checkDimensions: bool = False, autoRedeaw: bool = True) -> None: ... - + def addToDB( + self, + obj: ccHObject, + updateZoom: bool = False, + autoExpandDBTree: bool = True, + checkDimensions: bool = False, + autoRedeaw: bool = True, + ) -> None: ... def redrawAll(only2D: bool = False) -> None: ... - def refreshAll(only2D: bool = False) -> None: ... - def disableAll() -> None: ... - def updateUI() -> None: ... - def freezeUI(state: bool) -> None: ... def GetInstance() -> ccPythonInstance: ... -from typing import Union, List -class ccPythonInstance: +from typing import List, Union +class ccPythonInstance: def getMainWindow() -> QMainWindow: ... - def getActiveGLWindow() -> ccGLWindow: ... - def haveSelection(self) -> bool: ... - def haveOneSelection(self) -> bool: ... - def getSelectedEntities(self) -> List[Union[ccHObject, ccPointCloud, ccMesh]]: ... - - def addToDB(self, obj: ccHObject, updateZoom: bool = False, autoExpandDBTree: bool = True, checkDimensions: bool = False, autoRedeaw: bool = True) -> None: ... - + def addToDB( + self, + obj: ccHObject, + updateZoom: bool = False, + autoExpandDBTree: bool = True, + checkDimensions: bool = False, + autoRedeaw: bool = True, + ) -> None: ... def redrawAll(only2D: bool = False) -> None: ... - def refreshAll(only2D: bool = False) -> None: ... - def disableAll() -> None: ... - def updateUI() -> None: ... - def freezeUI(state: bool) -> None: ... def GetInstance() -> ccPythonInstance: ... -from typing import Union, List -class ccPythonInstance: +from typing import List, Union +class ccPythonInstance: def getMainWindow() -> QMainWindow: ... - def getActiveGLWindow() -> ccGLWindow: ... - def haveSelection(self) -> bool: ... - def haveOneSelection(self) -> bool: ... - def getSelectedEntities(self) -> List[Union[ccHObject, ccPointCloud, ccMesh]]: ... - - def addToDB(self, obj: ccHObject, updateZoom: bool = False, autoExpandDBTree: bool = True, checkDimensions: bool = False, autoRedeaw: bool = True) -> None: ... - + def addToDB( + self, + obj: ccHObject, + updateZoom: bool = False, + autoExpandDBTree: bool = True, + checkDimensions: bool = False, + autoRedeaw: bool = True, + ) -> None: ... def redrawAll(only2D: bool = False) -> None: ... - def refreshAll(only2D: bool = False) -> None: ... - def disableAll() -> None: ... - def updateUI() -> None: ... - def freezeUI(state: bool) -> None: ... def GetInstance() -> ccPythonInstance: ... -from typing import Union, List -class ccPythonInstance: +from typing import List, Union +class ccPythonInstance: def getMainWindow() -> QMainWindow: ... - def getActiveGLWindow() -> ccGLWindow: ... - def haveSelection(self) -> bool: ... - def haveOneSelection(self) -> bool: ... - def getSelectedEntities(self) -> List[Union[ccHObject, ccPointCloud, ccMesh]]: ... - - def addToDB(self, obj: ccHObject, updateZoom: bool = False, autoExpandDBTree: bool = True, checkDimensions: bool = False, autoRedeaw: bool = True) -> None: ... - + def addToDB( + self, + obj: ccHObject, + updateZoom: bool = False, + autoExpandDBTree: bool = True, + checkDimensions: bool = False, + autoRedeaw: bool = True, + ) -> None: ... def redrawAll(only2D: bool = False) -> None: ... - def refreshAll(only2D: bool = False) -> None: ... - def disableAll() -> None: ... - def updateUI() -> None: ... - def freezeUI(state: bool) -> None: ... def GetInstance() -> ccPythonInstance: ... -from typing import Union, List -class ccPythonInstance: +from typing import List, Union +class ccPythonInstance: def getMainWindow() -> QMainWindow: ... - def getActiveGLWindow() -> ccGLWindow: ... - def haveSelection(self) -> bool: ... - def haveOneSelection(self) -> bool: ... - def getSelectedEntities(self) -> List[Union[ccHObject, ccPointCloud, ccMesh]]: ... - - def addToDB(self, obj: ccHObject, updateZoom: bool = False, autoExpandDBTree: bool = True, checkDimensions: bool = False, autoRedeaw: bool = True) -> None: ... - + def addToDB( + self, + obj: ccHObject, + updateZoom: bool = False, + autoExpandDBTree: bool = True, + checkDimensions: bool = False, + autoRedeaw: bool = True, + ) -> None: ... def redrawAll(only2D: bool = False) -> None: ... - def refreshAll(only2D: bool = False) -> None: ... - def disableAll() -> None: ... - def updateUI() -> None: ... - def freezeUI(state: bool) -> None: ... def GetInstance() -> ccPythonInstance: ... -from typing import Union, List -class ccPythonInstance: +from typing import List, Union +class ccPythonInstance: def getMainWindow() -> QMainWindow: ... - def getActiveGLWindow() -> ccGLWindow: ... - def haveSelection(self) -> bool: ... - def haveOneSelection(self) -> bool: ... - def getSelectedEntities(self) -> List[Union[ccHObject, ccPointCloud, ccMesh]]: ... - - def addToDB(self, obj: ccHObject, updateZoom: bool = False, autoExpandDBTree: bool = True, checkDimensions: bool = False, autoRedeaw: bool = True) -> None: ... - + def addToDB( + self, + obj: ccHObject, + updateZoom: bool = False, + autoExpandDBTree: bool = True, + checkDimensions: bool = False, + autoRedeaw: bool = True, + ) -> None: ... def redrawAll(only2D: bool = False) -> None: ... - def refreshAll(only2D: bool = False) -> None: ... - def disableAll() -> None: ... - def updateUI() -> None: ... - def freezeUI(state: bool) -> None: ... def GetInstance() -> ccPythonInstance: ... -from typing import Union, List -class ccPythonInstance: +from typing import List, Union +class ccPythonInstance: def getMainWindow() -> QMainWindow: ... - def getActiveGLWindow() -> ccGLWindow: ... - def haveSelection(self) -> bool: ... - def haveOneSelection(self) -> bool: ... - def getSelectedEntities(self) -> List[Union[ccHObject, ccPointCloud, ccMesh]]: ... - - def addToDB(self, obj: ccHObject, updateZoom: bool = False, autoExpandDBTree: bool = True, checkDimensions: bool = False, autoRedeaw: bool = True) -> None: ... - + def addToDB( + self, + obj: ccHObject, + updateZoom: bool = False, + autoExpandDBTree: bool = True, + checkDimensions: bool = False, + autoRedeaw: bool = True, + ) -> None: ... def redrawAll(only2D: bool = False) -> None: ... - def refreshAll(only2D: bool = False) -> None: ... - def disableAll() -> None: ... - def updateUI() -> None: ... - def freezeUI(state: bool) -> None: ... def GetInstance() -> ccPythonInstance: ... -from typing import Union, List -class ccPythonInstance: +from typing import List, Union +class ccPythonInstance: def getMainWindow() -> QMainWindow: ... - def getActiveGLWindow() -> ccGLWindow: ... - def haveSelection(self) -> bool: ... - def haveOneSelection(self) -> bool: ... - def getSelectedEntities(self) -> List[Union[ccHObject, ccPointCloud, ccMesh]]: ... - - def addToDB(self, obj: ccHObject, updateZoom: bool = False, autoExpandDBTree: bool = True, checkDimensions: bool = False, autoRedeaw: bool = True) -> None: ... - + def addToDB( + self, + obj: ccHObject, + updateZoom: bool = False, + autoExpandDBTree: bool = True, + checkDimensions: bool = False, + autoRedeaw: bool = True, + ) -> None: ... def redrawAll(only2D: bool = False) -> None: ... - def refreshAll(only2D: bool = False) -> None: ... - def disableAll() -> None: ... - def updateUI() -> None: ... - def freezeUI(state: bool) -> None: ... def GetInstance() -> ccPythonInstance: ... diff --git a/src/PythonHighlighter.cpp b/src/PythonHighlighter.cpp index 81a2efd7..52fa84ea 100644 --- a/src/PythonHighlighter.cpp +++ b/src/PythonHighlighter.cpp @@ -244,4 +244,4 @@ bool PythonHighlighter::matchMultiLine(const QString &text, const HighlightingRu } return currentBlockState() == rule.matchIndex; -} \ No newline at end of file +} diff --git a/wrapper/cccorelib/CMakeLists.txt b/wrapper/cccorelib/CMakeLists.txt index 55810ea1..ba27bdfc 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 623f09efd65dbeef0f06830ff9b9bbb7cc07142c + GIT_TAG 8f83c8be6d9270cd83c79d33c74a24c1a96f309f ) FetchContent_GetProperties(CCCoreLib) diff --git a/wrapper/cccorelib/src/CCShareable.cpp b/wrapper/cccorelib/src/CCShareable.cpp deleted file mode 100644 index 6fb15a13..00000000 --- a/wrapper/cccorelib/src/CCShareable.cpp +++ /dev/null @@ -1,39 +0,0 @@ -// ########################################################################## -// # # -// # 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 "wrappers.h" - -namespace py = pybind11; -using namespace pybind11::literals; - -void define_CCShareable(py::module &cccorelib) -{ - py::class_>(cccorelib, "CCShareable") - .def(py::init<>()) - .def("link", &CCShareable::link) - .def("release", &CCShareable::release) - .def("getLinkCount", &CCShareable::getLinkCount) -#ifdef CC_TRACK_ALIVE_SHARED_OBJECTS - .def_static("GetAliveCount", &CCShareable::GetAliveCount); -#else - ; -#endif -} diff --git a/wrapper/cccorelib/src/CMakeLists.txt b/wrapper/cccorelib/src/CMakeLists.txt index 942d0ee0..9f23a0ee 100644 --- a/wrapper/cccorelib/src/CMakeLists.txt +++ b/wrapper/cccorelib/src/CMakeLists.txt @@ -8,7 +8,6 @@ set(cccorelib_sources ${CMAKE_CURRENT_LIST_DIR}/CCGeom.cpp ${CMAKE_CURRENT_LIST_DIR}/CCMath.cpp ${CMAKE_CURRENT_LIST_DIR}/CCMiscTools.cpp - ${CMAKE_CURRENT_LIST_DIR}/CCShareable.cpp ${CMAKE_CURRENT_LIST_DIR}/ChamferDistanceTransform.cpp ${CMAKE_CURRENT_LIST_DIR}/CloudSamplingTools.cpp ${CMAKE_CURRENT_LIST_DIR}/Delaynay2dMesh.cpp diff --git a/wrapper/cccorelib/src/ScalarField.cpp b/wrapper/cccorelib/src/ScalarField.cpp index 0f1b0da2..1e142894 100644 --- a/wrapper/cccorelib/src/ScalarField.cpp +++ b/wrapper/cccorelib/src/ScalarField.cpp @@ -194,9 +194,9 @@ void define_ScalarField(py::module &cccorelib) .def("__getitem__", &ScalarFieldView::get_item, py::return_value_policy::reference_internal) .def("__setitem__", &ScalarFieldView::set_item); - py::class_>(cccorelib, - "ScalarField", - R"doc( + py::class_>(cccorelib, + "ScalarField", + R"doc( ScalarField .. note:: diff --git a/wrapper/cccorelib/src/cccorelib.cpp b/wrapper/cccorelib/src/cccorelib.cpp index f1cb05d9..901345a2 100644 --- a/wrapper/cccorelib/src/cccorelib.cpp +++ b/wrapper/cccorelib/src/cccorelib.cpp @@ -50,8 +50,6 @@ void define_CCConst(py::module &); void define_SquareMatrix(py::module &); -void define_CCShareable(py::module &); - void define_ChamferDistanceTransform(py::module &); void define_CloudSamplingTools(py::module &); @@ -293,8 +291,6 @@ void define_cccorelib(py::module &m) // MathTools.h: empty - define_CCShareable(m); - define_CCGeom(m); define_CCMath(m); define_CCConst(m); diff --git a/wrapper/cccorelib/src/wrappers.h b/wrapper/cccorelib/src/wrappers.h index 11fd575a..95610bf1 100644 --- a/wrapper/cccorelib/src/wrappers.h +++ b/wrapper/cccorelib/src/wrappers.h @@ -18,7 +18,6 @@ #ifndef PYTHON_PLUGIN_WRAPPERS_H #define PYTHON_PLUGIN_WRAPPERS_H -#include #include #include @@ -32,52 +31,6 @@ namespace py = pybind11; using namespace pybind11::literals; /// A unique_ptr that never free its ptr. -template using observer_ptr = std::unique_ptr; - -/// A holder type for any type that inherits CCShareable -/// -/// CCShareable is CC's ref counted mechanism. -/// It works by inheritance + manual call to link/release. -template class CCShareableHolder -{ - public: - static_assert(std::is_base_of::value == true, "T must be a subclass of CCShareable"); - - CCShareableHolder() = default; - - explicit CCShareableHolder(T *obj) : m_ptr(obj) - { - if (m_ptr) - { - m_ptr->link(); - } - } - - T *get() - { - return m_ptr; - } - - const T *get() const - { - return m_ptr; - } - - ~CCShareableHolder() - { - if (m_ptr) - { - m_ptr->release(); - m_ptr = nullptr; - } - } - - private: - T *m_ptr = nullptr; -}; - -PYBIND11_DECLARE_HOLDER_TYPE(T, CCShareableHolder); - namespace PyCC { inline void NoOpDelete(void *) {} @@ -257,7 +210,7 @@ static const constexpr char SIZE_SCALAR_FIELD_DOCSTRING[] = R"doc( throw py::value_error("value must have the same len as the poinc cloud size"); \ } \ auto values_u = values.unchecked<1>(); \ - CCCoreLib::ScalarField *sf = self.getScalarField(idx); \ + CCCoreLib::ScalarField::Shared sf = self.getScalarField(idx); \ for (py::ssize_t i{0}; i < values.size(); ++i) \ { \ sf->setValue(i, values_u(i)); \ diff --git a/wrapper/pycc/CMakeLists.txt b/wrapper/pycc/CMakeLists.txt index 06d0ede8..a9d323c4 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 04942bfd61458d9b67b10beb0690dcefdb2debb4 + GIT_TAG 5d00ea5d4040d9485b0b52c769f0b0aae01de296 GIT_SHALLOW OFF GIT_SUBMODULES ) diff --git a/wrapper/pycc/src/qcc_db/ccPointCloud.cpp b/wrapper/pycc/src/qcc_db/ccPointCloud.cpp index 3e195a03..5ce8685e 100644 --- a/wrapper/pycc/src/qcc_db/ccPointCloud.cpp +++ b/wrapper/pycc/src/qcc_db/ccPointCloud.cpp @@ -383,7 +383,7 @@ void define_ccPointCloud(py::module &m) "colors", [](ccPointCloud &self) -> py::object { - RGBAColorsTableType *colorsTable = self.rgbaColors(); + RGBAColorsTableType::Shared colorsTable = self.rgbaColors(); if (colorsTable == nullptr) { return py::none(); diff --git a/wrapper/pycc/src/qcc_db/ccScalarField.cpp b/wrapper/pycc/src/qcc_db/ccScalarField.cpp index 5da6b4b5..dcbf8f2f 100644 --- a/wrapper/pycc/src/qcc_db/ccScalarField.cpp +++ b/wrapper/pycc/src/qcc_db/ccScalarField.cpp @@ -28,8 +28,8 @@ using namespace pybind11::literals; void define_ccScalarField(py::module &m) { - py::class_> - pyScalarField(m, "ccScalarField"); + py::class_> pyScalarField( + m, "ccScalarField"); py::class_(pyScalarField, "Range") .def(py::init<>()) diff --git a/wrapper/pycc/src/qcc_db/qcc_db.cpp b/wrapper/pycc/src/qcc_db/qcc_db.cpp index 941c3c22..ea822dab 100644 --- a/wrapper/pycc/src/qcc_db/qcc_db.cpp +++ b/wrapper/pycc/src/qcc_db/qcc_db.cpp @@ -138,12 +138,14 @@ void define_qcc_db(py::module &m) m, "_VectorCompressedNormType", py::module_local(true)); #endif - // Cannot have CCShareable as we would require CCShareable holder, but - // VectorCompressedNormType does not have 'non-default holder type'. // We need to do a proper ccArray wrapping + // The holder can't be another holder than std::unique_ptr because + // type "_NormsIndexesArrayType" has a non-default holder type while its base + // "std::vector >" does not have one + // (and older is only possible for custom types) + // with obverver_ptr, the array is always managed by the CC/C++ side. py::class_>(m, "_NormsIndexesArrayType"); // py::class_(m, "NormsIndexesTableType")