Skip to content
Permalink
Browse files

[3d] Default shadows to first available directional light, instead

of forcing users to explicitly select this light after enabling shadows
  • Loading branch information
nyalldawson committed Nov 4, 2020
1 parent 8b7fe31 commit b3356176290789c60746e875fadfc5a7ad6b6aa3
@@ -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;
@@ -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()
@@ -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.
You can’t perform that action at this time.