Merge pull request #4361 from aws-lumberyard-dev/Atom/guthadam/material_editor_add_toggle_alternate_skybox_to_toolbar3

Material Editor: Added alternate skybox toggle to the toolbar
This commit is contained in:
Guthrie Adams
2021-10-01 16:17:11 -05:00
committed by GitHub
4 changed files with 32 additions and 1 deletions
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 53.2 (72643) - https://sketchapp.com -->
<title>icon / Environmental / Sky Highlight</title>
<desc>Created with Sketch.</desc>
<defs>
<path d="M10.875,5.34332825 L10.875,2.625 C10.875,2.00367966 11.3786797,1.5 12,1.5 C12.6213203,1.5 13.125,2.00367966 13.125,2.625 L13.125,5.34332825 C12.7591405,5.28194865 12.3833012,5.25 12,5.25 C11.6166988,5.25 11.2408595,5.28194865 10.875,5.34332825 L10.875,5.34332825 Z M15.9111012,6.49790859 L17.8336309,4.5753788 C18.2729708,4.13603897 18.9852814,4.13603897 19.4246212,4.5753788 C19.863961,5.01471863 19.863961,5.72702923 19.4246212,6.16636906 L17.5020914,8.08889885 C17.0642544,7.47406324 16.5259368,6.93574556 15.9111012,6.49790859 L15.9111012,6.49790859 Z M18.6566718,10.875 L21.375,10.875 C21.9963203,10.875 22.5,11.3786797 22.5,12 C22.5,12.6213203 21.9963203,13.125 21.375,13.125 L18.6566718,13.125 C18.7180514,12.7591405 18.75,12.3833012 18.75,12 C18.75,11.6166988 18.7180514,11.2408595 18.6566718,10.875 L18.6566718,10.875 Z M17.5020914,15.9111012 L19.4246212,17.8336309 C19.863961,18.2729708 19.863961,18.9852814 19.4246212,19.4246212 C18.9852814,19.863961 18.2729708,19.863961 17.8336309,19.4246212 L15.9111012,17.5020914 C16.5259368,17.0642544 17.0642544,16.5259368 17.5020914,15.9111012 L17.5020914,15.9111012 Z M13.125,18.6566718 L13.125,21.375 C13.125,21.9963203 12.6213203,22.5 12,22.5 C11.3786797,22.5 10.875,21.9963203 10.875,21.375 L10.875,18.6566718 C11.2408595,18.7180514 11.6166988,18.75 12,18.75 C12.3833012,18.75 12.7591405,18.7180514 13.125,18.6566718 L13.125,18.6566718 Z M8.08889885,17.5020914 L6.16636906,19.4246212 C5.72702923,19.863961 5.01471863,19.863961 4.5753788,19.4246212 C4.13603897,18.9852814 4.13603897,18.2729708 4.5753788,17.8336309 L6.49790859,15.9111012 C6.93574556,16.5259368 7.47406324,17.0642544 8.08889885,17.5020914 L8.08889885,17.5020914 Z M5.34332825,13.125 L2.625,13.125 C2.00367966,13.125 1.5,12.6213203 1.5,12 C1.5,11.3786797 2.00367966,10.875 2.625,10.875 L5.34332825,10.875 C5.28194865,11.2408595 5.25,11.6166988 5.25,12 C5.25,12.3833012 5.28194865,12.7591405 5.34332825,13.125 L5.34332825,13.125 Z M6.49790859,8.08889885 L4.5753788,6.16636906 C4.13603897,5.72702923 4.13603897,5.01471863 4.5753788,4.5753788 C5.01471863,4.13603897 5.72702923,4.13603897 6.16636906,4.5753788 L8.08889885,6.49790859 C7.47406324,6.93574556 6.93574556,7.47406324 6.49790859,8.08889885 Z M12,16 C9.790861,16 8,14.209139 8,12 C8,9.790861 9.790861,8 12,8 C14.209139,8 16,9.790861 16,12 C16,14.209139 14.209139,16 12,16 Z" id="path-1"></path>
</defs>
<g id="icon-/-Environmental-/-Sky-Highlight" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<mask id="mask-2" fill="white">
<use xlink:href="#path-1"></use>
</mask>
<use id="Shape" fill="#8BDD15" xlink:href="#path-1"></use>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.0 KiB

@@ -19,6 +19,7 @@
<file>Icons/texture_edit.png</file>
<file>Icons/grid.svg</file>
<file>Icons/shadow.svg</file>
<file>Icons/skybox.svg</file>
<file>Icons/toneMapping.svg</file>
<file>Icons/View.svg</file>
</qresource>
@@ -50,8 +50,16 @@ namespace MaterialEditor
});
m_toggleShadowCatcher->setChecked(viewportSettings->m_enableShadowCatcher);
// Add mapping selection button
// Add toggle alternate skybox button
m_toggleAlternateSkybox = addAction(QIcon(":/Icons/skybox.svg"), "Toggle Alternate Skybox");
m_toggleAlternateSkybox->setCheckable(true);
connect(m_toggleAlternateSkybox, &QAction::triggered, [this]() {
MaterialViewportRequestBus::Broadcast(
&MaterialViewportRequestBus::Events::SetAlternateSkyboxEnabled, m_toggleAlternateSkybox->isChecked());
});
m_toggleAlternateSkybox->setChecked(viewportSettings->m_enableAlternateSkybox);
// Add mapping selection button
QToolButton* toneMappingButton = new QToolButton(this);
QMenu* toneMappingMenu = new QMenu(toneMappingButton);
@@ -105,6 +113,11 @@ namespace MaterialEditor
m_toggleGrid->setChecked(enable);
}
void MaterialEditorToolBar::OnAlternateSkyboxEnabledChanged(bool enable)
{
m_toggleAlternateSkybox->setChecked(enable);
}
void MaterialEditorToolBar::OnDisplayMapperOperationTypeChanged(AZ::Render::DisplayMapperOperationType operationType)
{
for (auto operationActionPair : m_operationActions)
@@ -29,10 +29,12 @@ namespace MaterialEditor
// MaterialViewportNotificationBus::Handler overrides...
void OnShadowCatcherEnabledChanged([[maybe_unused]] bool enable) override;
void OnGridEnabledChanged([[maybe_unused]] bool enable) override;
void OnAlternateSkyboxEnabledChanged([[maybe_unused]] bool enable) override;
void OnDisplayMapperOperationTypeChanged(AZ::Render::DisplayMapperOperationType operationType) override;
QAction* m_toggleGrid = {};
QAction* m_toggleShadowCatcher = {};
QAction* m_toggleAlternateSkybox = {};
AZStd::unordered_map<AZ::Render::DisplayMapperOperationType, QString> m_operationNames;
AZStd::unordered_map<AZ::Render::DisplayMapperOperationType, QAction*> m_operationActions;