Skip to content

Commit

Permalink
[3d] Default shadows to first available directional light, instead
Browse files Browse the repository at this point in the history
of forcing users to explicitly select this light after enabling shadows
  • Loading branch information
nyalldawson committed Nov 4, 2020
1 parent 8b7fe31 commit b335617
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/3d/qgsshadowsettings.h
Expand Up @@ -95,7 +95,7 @@ class _3D_EXPORT QgsShadowSettings

private:
bool mRenderShadows = false;
int mSelectedDirectionalLight = -1;
int mSelectedDirectionalLight = 0;
double mMaximumShadowRenderingDistance = 500.0;
double mShadowBias = 0.00001;
int mShadowMapResolution = 2048;
Expand Down
1 change: 1 addition & 0 deletions src/app/3d/qgslightswidget.cpp
Expand Up @@ -201,6 +201,7 @@ void QgsLightsWidget::onAddDirectionalLight()
const QModelIndex newIndex = mLightsModel->addDirectionalLight( QgsDirectionalLightSettings() );
mLightsListView->selectionModel()->select( newIndex, QItemSelectionModel::ClearAndSelect );
emit lightsAdded();
emit directionalLightsCountChanged( mLightsModel->directionalLights().size() );
}

void QgsLightsWidget::onRemoveLight()
Expand Down
2 changes: 1 addition & 1 deletion src/app/3d/qgsshadowrenderingsettingswidget.cpp
Expand Up @@ -56,7 +56,7 @@ void QgsShadowRenderingSettingsWidget::onDirectionalLightsCountChanged( int newC
while ( usedDirectionalLightComboBox->count() > newCount )
usedDirectionalLightComboBox->removeItem( usedDirectionalLightComboBox->count() - 1 );
if ( previousItemIndex < 0 || previousItemIndex >= usedDirectionalLightComboBox->count() )
usedDirectionalLightComboBox->setCurrentIndex( -1 );
usedDirectionalLightComboBox->setCurrentIndex( 0 );
else
usedDirectionalLightComboBox->setCurrentIndex( previousItemIndex );
}

0 comments on commit b335617

Please sign in to comment.