Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
try to assign 3d renderer to output point cloud layers
  • Loading branch information
alexbruy committed May 2, 2023
1 parent 694759c commit cbc6922
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions python/plugins/processing/gui/Postprocessing.py
Expand Up @@ -91,6 +91,19 @@ def handleAlgorithmResults(alg, context, feedback=None, showResults=True, parame
if style:
layer.loadNamedStyle(style)

try:
from qgis._3d import QgsPointCloudLayer3DRenderer
if layer.type() == QgsMapLayerType.PointCloudLayer:
if layer.renderer3D() is None:
# If the layer has no 3D renderer and syncing 3D to 2D renderer is enabled,
# we create a renderer and set it up with the 2D renderer
if layer.sync3DRendererTo2DRenderer():
renderer3D = QgsPointCloudLayer3DRenderer()
renderer3D.convertFrom2DRenderer(layer.renderer())
layer.setRenderer3D(renderer3D)
except ImportError as e:
QgsMessageLog.logMessage(QCoreApplication.translate("Postprocessing", "3D library is not available, can't assign a 3d renderer to a layer."))

# Load layer to layer tree root or to a specific group
mapLayer = context.temporaryLayerStore().takeMapLayer(layer)
group_name = ProcessingConfig.getSetting(ProcessingConfig.RESULTS_GROUP_NAME)
Expand Down

0 comments on commit cbc6922

Please sign in to comment.