Skip to content
Permalink
Browse files

[feature] Allow 3d material texture files to be embedded in style/pro…

…ject

Users can opt to embed images into the project to avoid placing dependancies
on external resources
  • Loading branch information
nyalldawson committed Jul 10, 2020
1 parent 3d1b819 commit 1bbf43d3703001c414f3e06551d887556298379e
Showing with 6 additions and 9 deletions.
  1. +3 −6 src/app/3d/qgsphongmaterialwidget.cpp
  2. +3 −3 src/ui/3d/phongmaterialwidget.ui
@@ -24,9 +24,6 @@ QgsPhongMaterialWidget::QgsPhongMaterialWidget( QWidget *parent )
setupUi( this );

setMaterial( QgsPhongMaterialSettings() );

textureFile->setFilter( "Images (*.png *.xpm *.jpg *.jpeg *.bmp)" );

textureScaleSpinBox->setClearValue( 0 );
textureRotationSpinBox->setClearValue( 0 );

@@ -35,7 +32,7 @@ QgsPhongMaterialWidget::QgsPhongMaterialWidget( QWidget *parent )
connect( btnSpecular, &QgsColorButton::colorChanged, this, &QgsPhongMaterialWidget::changed );
connect( spinShininess, static_cast<void ( QDoubleSpinBox::* )( double )>( &QDoubleSpinBox::valueChanged ), this, &QgsPhongMaterialWidget::changed );
connect( useDiffuseCheckBox, &QCheckBox::stateChanged, this, &QgsPhongMaterialWidget::changed );
connect( textureFile, &QgsFileWidget::fileChanged, this, &QgsPhongMaterialWidget::changed );
connect( textureFile, &QgsImageSourceLineEdit::sourceChanged, this, &QgsPhongMaterialWidget::changed );
connect( textureScaleSpinBox, static_cast<void ( QDoubleSpinBox::* )( double )>( &QDoubleSpinBox::valueChanged ), this, &QgsPhongMaterialWidget::changed );
connect( textureRotationSpinBox, static_cast<void ( QDoubleSpinBox::* )( double )>( &QDoubleSpinBox::valueChanged ), this, &QgsPhongMaterialWidget::changed );
this->activateTexturingUI( false );
@@ -59,7 +56,7 @@ void QgsPhongMaterialWidget::setMaterial( const QgsPhongMaterialSettings &materi
btnSpecular->setColor( material.specular() );
spinShininess->setValue( material.shininess() );
useDiffuseCheckBox->setCheckState( material.diffuseTextureEnabled() ? Qt::CheckState::Checked : Qt::CheckState::Unchecked );
textureFile->setFilePath( material.texturePath() );
textureFile->setSource( material.texturePath() );
textureScaleSpinBox->setValue( material.textureScale() );
textureRotationSpinBox->setValue( material.textureRotation() );
}
@@ -72,7 +69,7 @@ QgsPhongMaterialSettings QgsPhongMaterialWidget::material() const
m.setSpecular( btnSpecular->color() );
m.setShininess( spinShininess->value() );
m.setDiffuseTextureEnabled( useDiffuseCheckBox->checkState() == Qt::CheckState::Checked );
m.setTexturePath( textureFile->filePath() );
m.setTexturePath( textureFile->source() );
m.setTextureScale( textureScaleSpinBox->value() );
m.setTextureRotation( textureRotationSpinBox->value() );
return m;
@@ -108,7 +108,7 @@
</widget>
</item>
<item row="4" column="1">
<widget class="QgsFileWidget" name="textureFile" native="true"/>
<widget class="QgsImageSourceLineEdit" name="textureFile" native="true"/>
</item>
<item row="5" column="0">
<widget class="QLabel" name="lblTextureScale">
@@ -171,9 +171,9 @@
<container>1</container>
</customwidget>
<customwidget>
<class>QgsFileWidget</class>
<class>QgsImageSourceLineEdit</class>
<extends>QWidget</extends>
<header>qgsfilewidget.h</header>
<header>qgsfilecontentsourcelineedit.h</header>
<container>1</container>
</customwidget>
</customwidgets>

0 comments on commit 1bbf43d

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