Skip to content

Commit

Permalink
Add sip casting code for material types
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Aug 3, 2020
1 parent b07e0a2 commit cafa347
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
Expand Up @@ -85,6 +85,28 @@ Abstract base class for material settings.

%TypeHeaderCode
#include "qgsabstractmaterialsettings.h"
%End
%ConvertToSubClassCode
if ( sipCpp->type() == QLatin1String( "gooch" ) )
{
sipType = sipType_QgsGoochMaterialSettings;
}
else if ( sipCpp->type() == QLatin1String( "phong" ) )
{
sipType = sipType_QgsPhongMaterialSettings;
}
else if ( sipCpp->type() == "phongtextured" )
{
sipType = sipType_QgsPhongTexturedMaterialSettings;
}
else if ( sipCpp->type() == "simpleline" )
{
sipType = sipType_QgsSimpleLineMaterialSettings;
}
else
{
sipType = 0;
}
%End
public:

Expand Down
26 changes: 26 additions & 0 deletions src/3d/materials/qgsabstractmaterialsettings.h
Expand Up @@ -103,6 +103,32 @@ class _3D_EXPORT QgsMaterialContext
*/
class _3D_EXPORT QgsAbstractMaterialSettings SIP_ABSTRACT
{

#ifdef SIP_RUN
SIP_CONVERT_TO_SUBCLASS_CODE
if ( sipCpp->type() == QLatin1String( "gooch" ) )
{
sipType = sipType_QgsGoochMaterialSettings;
}
else if ( sipCpp->type() == QLatin1String( "phong" ) )
{
sipType = sipType_QgsPhongMaterialSettings;
}
else if ( sipCpp->type() == "phongtextured" )
{
sipType = sipType_QgsPhongTexturedMaterialSettings;
}
else if ( sipCpp->type() == "simpleline" )
{
sipType = sipType_QgsSimpleLineMaterialSettings;
}
else
{
sipType = 0;
}
SIP_END
#endif

public:

virtual ~QgsAbstractMaterialSettings() = default;
Expand Down

0 comments on commit cafa347

Please sign in to comment.