Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[3d] Expose 3d algorithms provider to Python
Otherwise this provider cannot be initialized from standalone Python
scripts

Fixes #36661

Also cleanup 3d sip generation by correctly defining SIP_NO_FILE
in headers we don't want to expose, so that the sip_include script
can do its magic
  • Loading branch information
nyalldawson committed May 28, 2020
1 parent 0496ce5 commit 1f835df
Show file tree
Hide file tree
Showing 48 changed files with 184 additions and 4 deletions.
1 change: 1 addition & 0 deletions python/3d/3d_auto.sip
@@ -1,4 +1,5 @@
// Include auto-generated SIP files
%Include auto_generated/processing/qgs3dalgorithms.sip
%Include auto_generated/qgs3dmapsettings.sip
%Include auto_generated/qgs3dtypes.sip
%Include auto_generated/qgsabstractvectorlayer3drenderer.sip
Expand Down
58 changes: 58 additions & 0 deletions python/3d/auto_generated/processing/qgs3dalgorithms.sip.in
@@ -0,0 +1,58 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/3d/processing/qgs3dalgorithms.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/




class Qgs3DAlgorithms: QgsProcessingProvider
{
%Docstring
QGIS 3D processing algorithm provider.

.. versionadded:: 3.0
%End

%TypeHeaderCode
#include "qgs3dalgorithms.h"
%End
public:

Qgs3DAlgorithms( QObject *parent = 0 );
%Docstring
Constructor for Qgs3DAlgorithms.
%End

virtual QIcon icon() const;

virtual QString svgIconPath() const;

virtual QString id() const;

virtual QString helpId() const;

virtual QString name() const;

virtual bool supportsNonFileBasedOutput() const;


protected:

virtual void loadAlgorithms();


};



/************************************************************************
* This file has been generated automatically from *
* *
* src/3d/processing/qgs3dalgorithms.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
1 change: 1 addition & 0 deletions python/CMakeLists.txt
Expand Up @@ -247,6 +247,7 @@ IF (WITH_3D)
INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}/src/3d
${CMAKE_SOURCE_DIR}/src/3d/chunks
${CMAKE_SOURCE_DIR}/src/3d/processing
${CMAKE_SOURCE_DIR}/src/3d/symbols
${CMAKE_SOURCE_DIR}/src/3d/terrain
${CMAKE_BINARY_DIR}/src/3d
Expand Down
2 changes: 1 addition & 1 deletion scripts/sip_include.sh
Expand Up @@ -34,7 +34,7 @@ fi
if [[ -n $1 ]]; then
modules=("$1")
else
modules=(core gui analysis server)
modules=(core gui analysis server 3d)
fi
sources=(HDRS MOC_HDRS SRCS)

Expand Down
3 changes: 3 additions & 0 deletions src/3d/chunks/qgschunkboundsentity_p.h
Expand Up @@ -36,10 +36,13 @@
class QgsAABB;
class AABBMesh;

#define SIP_NO_FILE


/**
* \ingroup 3d
* Draws bounds of axis aligned bounding boxes
* \note Not available in Python bindings
* \since QGIS 3.0
*/
class QgsChunkBoundsEntity : public Qt3DCore::QEntity
Expand Down
2 changes: 2 additions & 0 deletions src/3d/chunks/qgschunkedentity_p.h
Expand Up @@ -29,6 +29,8 @@

#include <Qt3DCore/QEntity>

#define SIP_NO_FILE

class QgsAABB;
class QgsChunkNode;
class QgsChunkList;
Expand Down
5 changes: 5 additions & 0 deletions src/3d/chunks/qgschunklist_p.h
Expand Up @@ -27,11 +27,16 @@
// version without notice, or even be removed.
//

#define SIP_NO_FILE

class QgsChunkNode;

/**
* \ingroup 3d
* Element of a double-linked list
*
* \note Not available in Python bindings
*
* \since QGIS 3.0
*/
struct QgsChunkListEntry
Expand Down
5 changes: 5 additions & 0 deletions src/3d/chunks/qgschunkloader_p.h
Expand Up @@ -29,9 +29,14 @@

#include "qgschunkqueuejob_p.h"

#define SIP_NO_FILE

/**
* \ingroup 3d
* Base class for jobs that load chunks
*
* \note Not available in Python bindings
*
* \since QGIS 3.0
*/
class QgsChunkLoader : public QgsChunkQueueJob
Expand Down
2 changes: 2 additions & 0 deletions src/3d/chunks/qgschunknode_p.h
Expand Up @@ -31,6 +31,8 @@

#include <QTime>

#define SIP_NO_FILE

namespace Qt3DCore
{
class QEntity;
Expand Down
2 changes: 2 additions & 0 deletions src/3d/chunks/qgschunkqueuejob_p.h
Expand Up @@ -34,6 +34,8 @@ namespace Qt3DCore
class QEntity;
}

#define SIP_NO_FILE

#include <QObject>

/**
Expand Down
2 changes: 2 additions & 0 deletions src/3d/mesh/qgsmesh3dentity_p.h
Expand Up @@ -36,6 +36,8 @@
// version without notice, or even be removed.
//

#define SIP_NO_FILE

class Qgs3DMapSettings;
class QgsTessellatedPolygonGeometry;
class QgsMesh3DSymbol;
Expand Down
2 changes: 2 additions & 0 deletions src/3d/mesh/qgsmesh3dgeometry_p.h
Expand Up @@ -40,6 +40,8 @@
// version without notice, or even be removed.
//

#define SIP_NO_FILE

namespace Qt3DRender
{
class QAttribute;
Expand Down
2 changes: 2 additions & 0 deletions src/3d/mesh/qgsmesh3dmaterial_p.h
Expand Up @@ -38,6 +38,8 @@
// version without notice, or even be removed.
//

#define SIP_NO_FILE

class QgsMeshLayer;

/**
Expand Down
3 changes: 3 additions & 0 deletions src/3d/qgs3danimationsettings.h
Expand Up @@ -26,10 +26,13 @@ class QDomDocument;
class QDomElement;
class QgsReadWriteContext;

#define SIP_NO_FILE

/**
* \ingroup 3d
* Class that holds information about animation in 3D view. The animation is defined
* as a series of keyframes
* \note Not available in Python bindings
* \since QGIS 3.8
*/
class _3D_EXPORT Qgs3DAnimationSettings
Expand Down
2 changes: 2 additions & 0 deletions src/3d/qgs3dmapscene.h
Expand Up @@ -49,10 +49,12 @@ class Qgs3DMapSettings;
class QgsTerrainEntity;
class QgsChunkedEntity;

#define SIP_NO_FILE

/**
* \ingroup 3d
* Entity that encapsulates our 3D scene - contains all other entities (such as terrain) as children.
* \note Not available in Python bindings
* \since QGIS 3.0
*/
class _3D_EXPORT Qgs3DMapScene : public Qt3DCore::QEntity
Expand Down
5 changes: 2 additions & 3 deletions src/3d/qgs3dutils.h
Expand Up @@ -38,11 +38,12 @@ namespace Qt3DExtras

#include <memory>

#ifndef SIP_RUN
#define SIP_NO_FILE

/**
* \ingroup 3d
* Miscellaneous utility functions used from 3D code.
* \note Not available in Python bindings
* \since QGIS 3.0
*/
class _3D_EXPORT Qgs3DUtils
Expand Down Expand Up @@ -178,6 +179,4 @@ class _3D_EXPORT Qgs3DUtils
static Qt3DExtras::QPhongMaterial *phongMaterial( const QgsPhongMaterialSettings &settings );
};

#endif

#endif // QGS3DUTILS_H
3 changes: 3 additions & 0 deletions src/3d/qgsaabb.h
Expand Up @@ -22,9 +22,12 @@
#include <QList>
#include <QVector3D>

#define SIP_NO_FILE

/**
* \ingroup 3d
* Axis-aligned bounding box - in world coords.
* \note Not available in Python bindings
* \since QGIS 3.0
*/
class _3D_EXPORT QgsAABB
Expand Down
3 changes: 3 additions & 0 deletions src/3d/qgsabstract3dengine.h
Expand Up @@ -20,6 +20,8 @@

#include <QObject>

#define SIP_NO_FILE

class QColor;
class QRect;
class QSurface;
Expand All @@ -46,6 +48,7 @@ namespace Qt3DRender
* - QgsWindow3DEngine - used for rendering on display (has a QWindow that can be embedded into QWidget)
* - QgsOffscreen3DEngine - renders scene to images
*
* \note Not available in Python bindings
* \since QGIS 3.4
*/
class _3D_EXPORT QgsAbstract3DEngine : public QObject
Expand Down
3 changes: 3 additions & 0 deletions src/3d/qgscameracontroller.h
Expand Up @@ -48,9 +48,12 @@ class QgsCameraPose;
class QgsTerrainEntity;
class QgsVector3D;

#define SIP_NO_FILE

/**
* \ingroup 3d
* Object that controls camera movement based on user input
* \note Not available in Python bindings
* \since QGIS 3.0
*/
class _3D_EXPORT QgsCameraController : public Qt3DCore::QEntity
Expand Down
4 changes: 4 additions & 0 deletions src/3d/qgsfeature3dhandler_p.h
Expand Up @@ -36,10 +36,14 @@ class QgsFeature;

class Qgs3DMapSettings;

#define SIP_NO_FILE


/**
* \ingroup 3d
* Rendering context for preparation of 3D entities.
*
* \note Not available in Python bindings
*/
class Qgs3DRenderContext
{
Expand Down
3 changes: 3 additions & 0 deletions src/3d/qgsmeshlayer3drenderer.h
Expand Up @@ -27,6 +27,8 @@

#include <QObject>

#define SIP_NO_FILE

class QgsMeshLayer;


Expand All @@ -36,6 +38,7 @@ class QgsMeshLayer;
*
* \warning This is not considered stable API, and may change in future QGIS releases
*
* \note Not available in Python bindings
* \since QGIS 3.6
*/
class _3D_EXPORT QgsMeshLayer3DRendererMetadata : public Qgs3DRendererAbstractMetadata
Expand Down
3 changes: 3 additions & 0 deletions src/3d/qgsoffscreen3dengine.h
Expand Up @@ -48,6 +48,7 @@ namespace Qt3DLogic
class QLogicAspect;
}

#define SIP_NO_FILE

/**
* \ingroup 3d
Expand All @@ -56,6 +57,8 @@ namespace Qt3DLogic
* \note While the on-screen 3D engine also allows capturing of images, its limitation is that
* the captured images are of the size of the on-screen window.
*
* \note Not available in Python bindings
*
* \since QGIS 3.4
*/
class _3D_EXPORT QgsOffscreen3DEngine : public QgsAbstract3DEngine
Expand Down
2 changes: 2 additions & 0 deletions src/3d/qgsraycastingutils_p.h
Expand Up @@ -29,6 +29,8 @@

#include <QVector3D>

#define SIP_NO_FILE

class QgsAABB;

namespace Qt3DRender
Expand Down
2 changes: 2 additions & 0 deletions src/3d/qgsrulebasedchunkloader_p.h
Expand Up @@ -32,6 +32,8 @@
#include "qgschunkedentity_p.h"
#include "qgsrulebased3drenderer.h"

#define SIP_NO_FILE

class Qgs3DMapSettings;
class QgsVectorLayer;
class QgsVectorLayerFeatureSource;
Expand Down
4 changes: 4 additions & 0 deletions src/3d/qgstessellatedpolygongeometry.h
Expand Up @@ -26,13 +26,17 @@ namespace Qt3DRender
class QBuffer;
}

#define SIP_NO_FILE

/**
* \ingroup 3d
* Class derived from Qt3DRender::QGeometry that represents polygons tessellated into 3D geometry.
*
* Takes a list of polygons as input, internally it does tessellation and writes output to the internal
* vertex buffer. Optionally it can add "walls" if the extrusion height is non-zero.
*
* \note Not available in Python bindings
*
* \since QGIS 3.0
*/
class QgsTessellatedPolygonGeometry : public Qt3DRender::QGeometry
Expand Down
3 changes: 3 additions & 0 deletions src/3d/qgstilingscheme.h
Expand Up @@ -23,10 +23,13 @@

class QgsRectangle;

#define SIP_NO_FILE

/**
* \ingroup 3d
* The class encapsulates tiling scheme (just like with WMTS / TMS / XYZ layers).
* The origin (tile [0,0]) is in bottom-left corner.
* \note Not available in Python bindings
* \since QGIS 3.0
*/
class _3D_EXPORT QgsTilingScheme
Expand Down
2 changes: 2 additions & 0 deletions src/3d/qgsvectorlayerchunkloader_p.h
Expand Up @@ -31,6 +31,8 @@
#include "qgsfeature3dhandler_p.h"
#include "qgschunkedentity_p.h"

#define SIP_NO_FILE

class Qgs3DMapSettings;
class QgsVectorLayer;
class QgsVectorLayer3DTilingSettings;
Expand Down
4 changes: 4 additions & 0 deletions src/3d/qgswindow3dengine.h
Expand Up @@ -32,11 +32,15 @@ namespace Qt3DExtras
class QWindow;


#define SIP_NO_FILE

/**
* \ingroup 3d
* On-screen 3D engine: it creates OpenGL window (QWindow) and displays rendered 3D scene there.
* The window can be embedded into a QWidget-based application with QWidget::createWindowContainer().
*
* \note Not available in Python bindings
*
* \since QGIS 3.4
*/
class _3D_EXPORT QgsWindow3DEngine : public QgsAbstract3DEngine
Expand Down

0 comments on commit 1f835df

Please sign in to comment.