Skip to content
Permalink
Browse files

fix lost of property definition

  • Loading branch information
vcloarec authored and nyalldawson committed Nov 15, 2020
1 parent 8e4d9ca commit 7485141f84b973f1a740c0d9e6b713916e9869e6
@@ -13,8 +13,7 @@
QgsAbstractMaterialSettings.TrianglesWithFixedTexture.__doc__ = "Triangle based rendering, using a fixed, non-user-configurable texture (e.g. for terrain rendering)"
QgsAbstractMaterialSettings.TrianglesFromModel = QgsMaterialSettingsRenderingTechnique.TrianglesFromModel
QgsAbstractMaterialSettings.TrianglesFromModel.__doc__ = "Triangle based rendering, using a model object source"
QgsMaterialSettingsRenderingTechnique.__doc__ = 'Material rendering techniques\n\n.. versionadded:: 3.16\n\n' + '* ``Triangles``: ' + QgsMaterialSettingsRenderingTechnique.Triangles.__doc__ + '\n' + '* ``Lines``: ' + QgsMaterialSettingsRenderingTechnique.Lines.__doc__ + '\n' + '* ``InstancedPoints``: ' + QgsMaterialSettingsRenderingTechnique.InstancedPoints.__doc__ + '\n' + '* ``Points``: ' + QgsMaterialSettingsRenderingTechnique.Points.__doc__ + '\n' + '* ``TrianglesWithFixedTexture``: ' + QgsMaterialSettingsRenderingTechnique.TrianglesWithFixedTexture.__doc__ + '\n' + '* ``TrianglesFromModel``: ' + QgsMaterialSettingsRenderingTechnique.TrianglesFromModel.__doc__
QgsAbstractMaterialSettings.TrianglesDataDefined = QgsMaterialSettingsRenderingTechnique.TrianglesDataDefined
QgsAbstractMaterialSettings.TrianglesDataDefined.__doc__ = "Triangle based rendering with possibility of datadefined color \since QGIS 3.18"
QgsMaterialSettingsRenderingTechnique.__doc__ = 'Material rendering techniques\n\n.. versionadded:: 3.16\n\n' + '* ``Triangles``: ' + QgsMaterialSettingsRenderingTechnique.Triangles.__doc__ + '\n' + '* ``Lines``: ' + QgsMaterialSettingsRenderingTechnique.Lines.__doc__ + '\n' + '* ``InstancedPoints``: ' + QgsMaterialSettingsRenderingTechnique.InstancedPoints.__doc__ + '\n' + '* ``Points``: ' + QgsMaterialSettingsRenderingTechnique.Points.__doc__ + '\n' + '* ``TrianglesWithFixedTexture``: ' + QgsMaterialSettingsRenderingTechnique.TrianglesWithFixedTexture.__doc__ + '\n' + '* ``TrianglesDataDefined``: ' + QgsMaterialSettingsRenderingTechnique.TrianglesDataDefined.__doc__
QgsMaterialSettingsRenderingTechnique.__doc__ = 'Material rendering techniques\n\n.. versionadded:: 3.16\n\n' + '* ``Triangles``: ' + QgsMaterialSettingsRenderingTechnique.Triangles.__doc__ + '\n' + '* ``Lines``: ' + QgsMaterialSettingsRenderingTechnique.Lines.__doc__ + '\n' + '* ``InstancedPoints``: ' + QgsMaterialSettingsRenderingTechnique.InstancedPoints.__doc__ + '\n' + '* ``Points``: ' + QgsMaterialSettingsRenderingTechnique.Points.__doc__ + '\n' + '* ``TrianglesWithFixedTexture``: ' + QgsMaterialSettingsRenderingTechnique.TrianglesWithFixedTexture.__doc__ + '\n' + '* ``TrianglesFromModel``: ' + QgsMaterialSettingsRenderingTechnique.TrianglesFromModel.__doc__ + '\n' + '* ``TrianglesDataDefined``: ' + QgsMaterialSettingsRenderingTechnique.TrianglesDataDefined.__doc__
# --
@@ -64,10 +64,12 @@ void QgsGoochMaterialWidget::setSettings( const QgsAbstractMaterialSettings *set
spinAlpha->setValue( goochMaterial->alpha() );
spinBeta->setValue( goochMaterial->beta() );

mDiffuseDataDefinedButton->init( QgsAbstractMaterialSettings::Diffuse, settings->dataDefinedProperties(), settings->propertyDefinitions(), layer, true );
mWarmDataDefinedButton->init( QgsAbstractMaterialSettings::Warm, settings->dataDefinedProperties(), settings->propertyDefinitions(), layer, true );
mCoolDataDefinedButton->init( QgsAbstractMaterialSettings::Cool, settings->dataDefinedProperties(), settings->propertyDefinitions(), layer, true );
mSpecularDataDefinedButton->init( QgsAbstractMaterialSettings::Specular, settings->dataDefinedProperties(), settings->propertyDefinitions(), layer, true );
mPropertyCollection = settings->dataDefinedProperties();

mDiffuseDataDefinedButton->init( QgsAbstractMaterialSettings::Diffuse, mPropertyCollection, settings->propertyDefinitions(), layer, true );
mWarmDataDefinedButton->init( QgsAbstractMaterialSettings::Warm, mPropertyCollection, settings->propertyDefinitions(), layer, true );
mCoolDataDefinedButton->init( QgsAbstractMaterialSettings::Cool, mPropertyCollection, settings->propertyDefinitions(), layer, true );
mSpecularDataDefinedButton->init( QgsAbstractMaterialSettings::Specular, mPropertyCollection, settings->propertyDefinitions(), layer, true );
}

void QgsGoochMaterialWidget::setTechnique( QgsMaterialSettingsRenderingTechnique technique )
@@ -107,12 +109,11 @@ QgsAbstractMaterialSettings *QgsGoochMaterialWidget::settings()
m->setAlpha( spinAlpha->value() );
m->setBeta( spinBeta->value() );

QgsPropertyCollection dataDefinedProperties;
dataDefinedProperties.setProperty( QgsAbstractMaterialSettings::Diffuse, mDiffuseDataDefinedButton->toProperty() );
dataDefinedProperties.setProperty( QgsAbstractMaterialSettings::Warm, mWarmDataDefinedButton->toProperty() );
dataDefinedProperties.setProperty( QgsAbstractMaterialSettings::Cool, mCoolDataDefinedButton->toProperty() );
dataDefinedProperties.setProperty( QgsAbstractMaterialSettings::Specular, mSpecularDataDefinedButton->toProperty() );
m->setDataDefinedProperties( dataDefinedProperties );
mPropertyCollection.setProperty( QgsAbstractMaterialSettings::Diffuse, mDiffuseDataDefinedButton->toProperty() );
mPropertyCollection.setProperty( QgsAbstractMaterialSettings::Warm, mWarmDataDefinedButton->toProperty() );
mPropertyCollection.setProperty( QgsAbstractMaterialSettings::Cool, mCoolDataDefinedButton->toProperty() );
mPropertyCollection.setProperty( QgsAbstractMaterialSettings::Specular, mSpecularDataDefinedButton->toProperty() );
m->setDataDefinedProperties( mPropertyCollection );

return m.release();
}
@@ -101,9 +101,11 @@ void QgsPhongMaterialWidget::setSettings( const QgsAbstractMaterialSettings *set
btnSpecular->setColor( phongMaterial->specular() );
spinShininess->setValue( phongMaterial->shininess() );

mDiffuseDataDefinedButton->init( QgsAbstractMaterialSettings::Diffuse, settings->dataDefinedProperties(), settings->propertyDefinitions(), layer, true );
mAmbientDataDefinedButton->init( QgsAbstractMaterialSettings::Ambient, settings->dataDefinedProperties(), settings->propertyDefinitions(), layer, true );
mSpecularDataDefinedButton->init( QgsAbstractMaterialSettings::Specular, settings->dataDefinedProperties(), settings->propertyDefinitions(), layer, true );
mPropertyCollection = settings->dataDefinedProperties();

mDiffuseDataDefinedButton->init( QgsAbstractMaterialSettings::Diffuse, mPropertyCollection, settings->propertyDefinitions(), layer, true );
mAmbientDataDefinedButton->init( QgsAbstractMaterialSettings::Ambient, mPropertyCollection, settings->propertyDefinitions(), layer, true );
mSpecularDataDefinedButton->init( QgsAbstractMaterialSettings::Specular, mPropertyCollection, settings->propertyDefinitions(), layer, true );
}

QgsAbstractMaterialSettings *QgsPhongMaterialWidget::settings()
@@ -114,12 +116,10 @@ QgsAbstractMaterialSettings *QgsPhongMaterialWidget::settings()
m->setSpecular( btnSpecular->color() );
m->setShininess( spinShininess->value() );

QgsPropertyCollection dataDefinedProperty;

dataDefinedProperty.setProperty( QgsAbstractMaterialSettings::Diffuse, mDiffuseDataDefinedButton->toProperty() );
dataDefinedProperty.setProperty( QgsAbstractMaterialSettings::Ambient, mAmbientDataDefinedButton->toProperty() );
dataDefinedProperty.setProperty( QgsAbstractMaterialSettings::Specular, mSpecularDataDefinedButton->toProperty() );
m->setDataDefinedProperties( dataDefinedProperty );
mPropertyCollection.setProperty( QgsAbstractMaterialSettings::Diffuse, mDiffuseDataDefinedButton->toProperty() );
mPropertyCollection.setProperty( QgsAbstractMaterialSettings::Ambient, mAmbientDataDefinedButton->toProperty() );
mPropertyCollection.setProperty( QgsAbstractMaterialSettings::Specular, mSpecularDataDefinedButton->toProperty() );
m->setDataDefinedProperties( mPropertyCollection );

return m.release();
}
@@ -52,6 +52,8 @@ void QgsPhongTexturedMaterialWidget::setSettings( const QgsAbstractMaterialSetti
textureFile->setSource( phongMaterial->diffuseTexturePath() );
textureScaleSpinBox->setValue( 100.0 / phongMaterial->textureScale() );
textureRotationSpinBox->setValue( phongMaterial->textureRotation() );

mPropertyCollection = settings->dataDefinedProperties();
}

QgsAbstractMaterialSettings *QgsPhongTexturedMaterialWidget::settings()
@@ -63,6 +65,8 @@ QgsAbstractMaterialSettings *QgsPhongTexturedMaterialWidget::settings()
m->setDiffuseTexturePath( textureFile->source() );
m->setTextureScale( 100.0 / textureScaleSpinBox->value() );
m->setTextureRotation( textureRotationSpinBox->value() );
m->setDataDefinedProperties( mPropertyCollection );

return m.release();
}

@@ -20,6 +20,8 @@
#include "qgis_gui.h"
#include "qgis_sip.h"

#include "qgspropertycollection.h"

#define SIP_NO_FILE

class QgsAbstractMaterialSettings SIP_EXTERNAL;
@@ -68,6 +70,9 @@ class GUI_EXPORT QgsMaterialSettingsWidget : public QWidget
* Emitted when the material definition is changed.
*/
void changed();

protected:
QgsPropertyCollection mPropertyCollection;
};

#endif // QGSMATERIALSETTINGSWIDGET_H

0 comments on commit 7485141

Please sign in to comment.
You can’t perform that action at this time.