Преглед на файлове

Merge branch 'development' into Atom/dmcdiar/ATOM-5702

Doug McDiarmid преди 4 години
родител
ревизия
b4cc7a3f1b

+ 1 - 1
Gem/Code/Source/LightCullingExampleComponent.cpp

@@ -218,7 +218,7 @@ namespace AtomSampleViewer
     {
         m_meshChangedHandler.Disconnect();
         m_worldModelAssetLoaded = true;
-        m_worldModelAABB = model->GetAabb();
+        m_worldModelAABB = model->GetModelAsset()->GetAabb();
 
         InitLightArrays();
         CreateLightsAndDecals();

+ 1 - 1
Gem/Code/Source/MultiSceneExampleComponent.cpp

@@ -167,7 +167,7 @@ namespace AtomSampleViewer
                 m_shaderBallMeshHandles.push_back(LoadMesh("objects/shaderball_simple.azmodel"));
                 auto updateShaderBallTransform = [this, i](Data::Instance<RPI::Model> model)
                 {
-                    const Aabb& aabb = model->GetAabb();
+                    const Aabb& aabb = model->GetModelAsset()->GetAabb();
                     const Vector3 translation{ 0.0f, -aabb.GetMin().GetZ() * aznumeric_cast<float>(i), -aabb.GetMin().GetY() };
                     const auto transform = Transform::CreateTranslation(translation);
                     m_meshFeatureProcessor->SetTransform(m_shaderBallMeshHandles[i], transform);

+ 11 - 0
Gem/Code/Source/SampleComponentManager.cpp

@@ -783,6 +783,14 @@ namespace AtomSampleViewer
     {
         if (ImGui::BeginMainMenuBar())
         {
+            // If imgui doesn't have enough room to render a menu, it will fall back to the safe area which
+            // is typically 3 pixels. This causes the menu to overlap the menu bar, and makes it easy to
+            // accidentally select the first item on that menu bar. By altering the safe area temporarily
+            // while drawing the menu, this problem can be avoided.
+            
+            ImVec2 cachedSafeArea = ImGui::GetStyle().DisplaySafeAreaPadding;
+            ImGui::GetStyle().DisplaySafeAreaPadding = ImVec2(cachedSafeArea.x, cachedSafeArea.y + 16.0f);
+
             if (ImGui::BeginMenu("File"))
             {
                 if (ImGui::MenuItem("Exit", "Ctrl-Q"))
@@ -950,6 +958,9 @@ namespace AtomSampleViewer
                 ImGui::EndMenu();
             }
 
+            // Restore original safe area.
+            ImGui::GetStyle().DisplaySafeAreaPadding = cachedSafeArea;
+
             ImGui::EndMainMenuBar();
         }
     }

+ 2 - 2
Gem/Code/Source/ShadowExampleComponent.cpp

@@ -355,7 +355,7 @@ namespace AtomSampleViewer
 
         auto updateFloorTransform = [&](Data::Instance<RPI::Model> model)
         {
-            const AZ::Aabb& aabb = model->GetAabb();
+            const AZ::Aabb& aabb = model->GetModelAsset()->GetAabb();
             const float maxZ = aabb.GetMax().GetZ();
             const AZ::Vector3 nonUniformScale{ 12.f, 12.f, 0.1f };
             const AZ::Vector3 translation{ 0.f, 0.f, -maxZ * nonUniformScale.GetZ() };
@@ -371,7 +371,7 @@ namespace AtomSampleViewer
 
         auto updateBunnyTransform = [&](Data::Instance<RPI::Model> model)
         {
-            const AZ::Aabb& aabb = model->GetAabb();
+            const AZ::Aabb& aabb = model->GetModelAsset()->GetAabb();
             const float minZ = aabb.GetMin().GetZ();
             const AZ::Vector3 translation{ 0.f, 0.f, -minZ };
             auto transform = AZ::Transform::CreateTranslation(translation);

+ 1 - 1
Gem/Code/Source/ShadowedSponzaExampleComponent.cpp

@@ -175,7 +175,7 @@ namespace AtomSampleViewer
     void ShadowedSponzaExampleComponent::OnModelReady(AZ::Data::Instance<AZ::RPI::Model> model)
     {
         m_sponzaExteriorAssetLoaded = true;
-        m_worldAabb = model->GetAabb();
+        m_worldAabb = model->GetModelAsset()->GetAabb();
         UpdateDiskLightCount(DiskLightCountDefault);
 
         // Now that the models are initialized, we can allow the script to continue.

+ 24 - 0
Scripts/build/Jenkins/Jenkinsfile

@@ -419,6 +419,18 @@ def TestMetrics(Map options, String workspace, String branchName, String repoNam
     }
 }
 
+def ExportTestScreenshots(Map options, String workspace, String platformName, String jobName, Map params) {
+    catchError(message: "Error exporting test screenshots (this won't fail the build)", buildResult: 'SUCCESS', stageResult: 'FAILURE') {
+        def screenshotsFolder = '${workspace}/${PROJECT_REPOSITORY_NAME}/user/Scripts/Screenshots'
+        def s3Uploader = '${workspace}/${ENGINE_REPOSITORY_NAME}/scripts/build/tools/upload_to_s3.py'
+        def command = '${options.PYTHON_DIR}/python.cmd -u ${s3Uploader} --base_dir ${screenshotsFolder} ' +
+                      '--file_regex "(.*png$|.*ppm$)" --bucket ${env.TEST_SCREENSHOT_BUCKET} '
+                      '--search_subdirectories True --key_prefix ${branchName}_${env.BUILD_NUMBER}'
+        bat label: "Uploading test screenshots for ${jobName}",
+            script: command
+    }
+}
+
 def PostBuildCommonSteps(String workspace, boolean mount = true) {
     echo 'Starting post-build common steps...'
 
@@ -461,6 +473,14 @@ def CreateTestMetricsStage(Map pipelineConfig, String branchName, Map environmen
     }
 }
 
+def CreateExportTestScreenshotsStage(Map pipelineConfig, String platformName, String jobName, Map environmentVars, Map params) {
+    return {
+        stage("${jobName}_screenshots") {
+            ExportTestScreenshots(pipelineConfig, environmentVars['WORKSPACE'], platformName, jobName, params)
+        }
+    }
+}
+
 def CreateTeardownStage(Map environmentVars) {
     return {
         stage("Teardown") {
@@ -596,6 +616,10 @@ try {
                                 }
                             }
                             finally {
+                                def params = platform.value.build_types[build_job_name].PARAMETERS
+                                if (params && params.containsKey('TEST_SCREENSHOTS') && params.TEST_SCREENSHOTS == 'True' && currentResult == 'FAILURE') {
+                                     CreateExportTestScreenshotsStage(pipelineConfig,  platform.key, build_job_name, envVars, params).call()
+                                 }
                                 CreateTeardownStage(envVars).call()
                             }
                         }