Bläddra i källkod

Made the content warning dialog's title configurable as well.

Signed-off-by: santorac <[email protected]>
santorac 3 år sedan
förälder
incheckning
bfa6b8c7ba

+ 5 - 0
Gem/Code/Source/AtomSampleComponent.h

@@ -24,8 +24,13 @@ namespace AtomSampleViewer
         // Redefine this string in the sample component subclass to provide a sample-specific warning message.
         // Redefine this string in the sample component subclass to provide a sample-specific warning message.
         // Any non-empty string will automatically cause a warning message to be displayed before opening the sample.
         // Any non-empty string will automatically cause a warning message to be displayed before opening the sample.
         static constexpr const char* ContentWarning = "";
         static constexpr const char* ContentWarning = "";
+
+        // If the above ContentWarning is overridden with a non-empty value, this string will be used as the message box's title.
+        // Redefine this string in the sample component subclass to provide a custom title.
+        static constexpr const char* ContentWarningTitle = "Content Warning";
         
         
         // This is a common photosensitive/seizure warning that could be used for the above ContentWarning in specific samples as needed.
         // This is a common photosensitive/seizure warning that could be used for the above ContentWarning in specific samples as needed.
         static constexpr const char CommonPhotosensitiveWarning[] = "This sample includes flashing images that could cause seizures or other adverse effects in photosensitive individuals.";
         static constexpr const char CommonPhotosensitiveWarning[] = "This sample includes flashing images that could cause seizures or other adverse effects in photosensitive individuals.";
+        static constexpr const char CommonPhotosensitiveWarningTitle[] = "Photosensitive Seizure Warning";
     };
     };
 } // namespace AtomSampleViewer
 } // namespace AtomSampleViewer

+ 1 - 0
Gem/Code/Source/RHI/MultiViewportSwapchainComponent.h

@@ -31,6 +31,7 @@ namespace AtomSampleViewer
     {
     {
     public:
     public:
         static constexpr const char* ContentWarning = CommonPhotosensitiveWarning;
         static constexpr const char* ContentWarning = CommonPhotosensitiveWarning;
+        static constexpr const char* ContentWarningTitle = CommonPhotosensitiveWarningTitle;
 
 
         AZ_COMPONENT(MultiViewportSwapchainComponent, "{45118741-F7DB-4EE0-9EBF-59B85D7F6194}", AZ::Component);
         AZ_COMPONENT(MultiViewportSwapchainComponent, "{45118741-F7DB-4EE0-9EBF-59B85D7F6194}", AZ::Component);
         AZ_DISABLE_COPY(MultiViewportSwapchainComponent);
         AZ_DISABLE_COPY(MultiViewportSwapchainComponent);

+ 1 - 0
Gem/Code/Source/RHI/SwapchainExampleComponent.h

@@ -19,6 +19,7 @@ namespace AtomSampleViewer
     {
     {
     public:
     public:
         static constexpr const char* ContentWarning = CommonPhotosensitiveWarning;
         static constexpr const char* ContentWarning = CommonPhotosensitiveWarning;
+        static constexpr const char* ContentWarningTitle = CommonPhotosensitiveWarningTitle;
 
 
         AZ_COMPONENT(SwapchainExampleComponent, "{F8A990AD-63C0-43D8-AE9B-FB9D84CB58E2}", AZ::Component);
         AZ_COMPONENT(SwapchainExampleComponent, "{F8A990AD-63C0-43D8-AE9B-FB9D84CB58E2}", AZ::Component);
 
 

+ 4 - 3
Gem/Code/Source/SampleComponentManager.cpp

@@ -166,6 +166,7 @@ namespace AtomSampleViewer
         entry.m_parentMenuName = menuName;
         entry.m_parentMenuName = menuName;
         entry.m_fullName = entry.m_parentMenuName + '/' + entry.m_sampleName;
         entry.m_fullName = entry.m_parentMenuName + '/' + entry.m_sampleName;
         entry.m_contentWarning = T::ContentWarning;
         entry.m_contentWarning = T::ContentWarning;
+        entry.m_contentWarningTitle = T::ContentWarningTitle;
 
 
         return entry;
         return entry;
     }
     }
@@ -469,7 +470,7 @@ namespace AtomSampleViewer
                         else
                         else
                         {
                         {
                             m_contentWarningDialog.OpenPopupConfirmation(
                             m_contentWarningDialog.OpenPopupConfirmation(
-                                "Sample Content Warning",
+                                m_availableSamples[i].m_contentWarningTitle,
                                 m_availableSamples[i].m_contentWarning,
                                 m_availableSamples[i].m_contentWarning,
                                 [this, i]() {
                                 [this, i]() {
                                     m_selectedSampleIndex = i;
                                     m_selectedSampleIndex = i;
@@ -929,7 +930,7 @@ namespace AtomSampleViewer
                                 else
                                 else
                                 {
                                 {
                                     m_contentWarningDialog.OpenPopupConfirmation(
                                     m_contentWarningDialog.OpenPopupConfirmation(
-                                        "Sample Content Warning",
+                                        sample.m_contentWarningTitle,
                                         sample.m_contentWarning,
                                         sample.m_contentWarning,
                                         [this, index]() {
                                         [this, index]() {
                                             m_sampleChangeRequest = true;
                                             m_sampleChangeRequest = true;
@@ -958,7 +959,7 @@ namespace AtomSampleViewer
 
 
             if (ImGui::BeginMenu("Automation"))
             if (ImGui::BeginMenu("Automation"))
             {
             {
-                const char* AutomationContentWarningTitle = "Sample Content Warning";
+                const char* AutomationContentWarningTitle = AtomSampleComponent::CommonPhotosensitiveWarningTitle;
                 const char* AutomationContentWarning = "Running automated scripts will trigger flashing images that could cause seizures or other adverse effects in photosensitive individuals.";
                 const char* AutomationContentWarning = "Running automated scripts will trigger flashing images that could cause seizures or other adverse effects in photosensitive individuals.";
 
 
                 if (ImGui::MenuItem("Run Script..."))
                 if (ImGui::MenuItem("Run Script..."))

+ 1 - 0
Gem/Code/Source/SampleComponentManager.h

@@ -69,6 +69,7 @@ namespace AtomSampleViewer
         SamplePipelineType m_pipelineType = SamplePipelineType::RHI;
         SamplePipelineType m_pipelineType = SamplePipelineType::RHI;
         AZ::ComponentDescriptor* m_componentDescriptor;
         AZ::ComponentDescriptor* m_componentDescriptor;
         AZStd::string m_contentWarning;
         AZStd::string m_contentWarning;
+        AZStd::string m_contentWarningTitle;
 
 
         bool operator==(const SampleEntry& other)
         bool operator==(const SampleEntry& other)
         {
         {

+ 2 - 1
Gem/Code/Source/SceneReloadSoakTestComponent.h

@@ -30,7 +30,8 @@ namespace AtomSampleViewer
 
 
         // Instead of using the CommonPhotosensitiveWarning, I used a custom message here that specifically calls out headaches and nausea
         // Instead of using the CommonPhotosensitiveWarning, I used a custom message here that specifically calls out headaches and nausea
         // as I've personally experienced those while looking at this sample, even though I don't otherwise consider myself to be photosensitive.
         // as I've personally experienced those while looking at this sample, even though I don't otherwise consider myself to be photosensitive.
-        static constexpr const char ContentWarning[] = "This sample has lots of flashing, may cause headaches and nausea, or may cause seizures for people with certain photosensitivity.";
+        static constexpr const char* ContentWarning = "This sample has lots of flashing, may cause headaches and nausea, or may cause seizures for people with certain photosensitivity.";
+        static constexpr const char* ContentWarningTitle = CommonPhotosensitiveWarningTitle;
 
 
         SceneReloadSoakTestComponent() = default;
         SceneReloadSoakTestComponent() = default;