Kaynağa Gözat

[Terrain] Misc Bugfixes (#10629)

* Fixed an assert that was overly aggressive.

Signed-off-by: Mike Balfour <[email protected]>

* Expose GetVertex and GetVertexCount to Script Canvas.

Signed-off-by: Mike Balfour <[email protected]>

* Fixed bug where Surface Query Resolution wasn't getting serialized.

Signed-off-by: Mike Balfour <[email protected]>

* Initialize the result to 0 in case the vertex isn't found.

Signed-off-by: Mike Balfour <[email protected]>
Mike Balfour 3 yıl önce
ebeveyn
işleme
6897f20963

+ 9 - 1
Gems/LmbrCentral/Code/Source/Shape/SplineComponent.cpp

@@ -195,7 +195,15 @@ namespace LmbrCentral
                 ->Event("UpdateVertex", &SplineComponentRequestBus::Events::UpdateVertex)
                 ->Event("UpdateVertex", &SplineComponentRequestBus::Events::UpdateVertex)
                 ->Event("InsertVertex", &SplineComponentRequestBus::Events::InsertVertex)
                 ->Event("InsertVertex", &SplineComponentRequestBus::Events::InsertVertex)
                 ->Event("RemoveVertex", &SplineComponentRequestBus::Events::RemoveVertex)
                 ->Event("RemoveVertex", &SplineComponentRequestBus::Events::RemoveVertex)
-                ->Event("ClearVertices", &SplineComponentRequestBus::Events::ClearVertices);
+                ->Event("ClearVertices", &SplineComponentRequestBus::Events::ClearVertices)
+                ->Event("GetVertex",
+                    [](SplineComponentRequests* handler, size_t index) -> AZStd::tuple<AZ::Vector3, bool>
+                    {
+                        AZ::Vector3 vertex(0.0f);
+                        bool vertexFound = handler->GetVertex(index, vertex);
+                        return AZStd::make_tuple(vertex, vertexFound);
+                    })
+                ->Event("GetVertexCount", &SplineComponentRequestBus::Events::Size);
         }
         }
     }
     }
 
 

+ 58 - 0
Gems/ScriptCanvas/Assets/TranslationAssets/EBus/Senders/SplineComponentRequestBus.names

@@ -53,6 +53,42 @@
                         }
                         }
                     ]
                     ]
                 },
                 },
+                {
+                    "base": "GetVertex",
+                    "entry": {
+                        "name": "In",
+                        "tooltip": "When signaled, this will invoke Get Vertex"
+                    },
+                    "exit": {
+                        "name": "Out",
+                        "tooltip": "Signaled after Get Vertex is invoked"
+                    },
+                    "details": {
+                        "name": "Get Vertex"
+                    },
+                    "params": [
+                        {
+                            "typeid": "{D6597933-47CD-4FC8-B911-63F3E2B0993A}",
+                            "details": {
+                                "name": "Index"
+                            }
+                        }
+                    ],
+                    "results": [
+                        {
+                            "typeid": "{8379EB7D-01FA-4538-B64B-A6543B4BE73D}",
+                            "details": {
+                                "name": "Vertex"
+                            }
+                        },
+                        {
+                            "typeid": "{A0CA880C-AFE4-43CB-926C-59AC48496112}",
+                            "details": {
+                                "name": "Found"
+                            }
+                        }
+                    ]
+                },
                 {
                 {
                     "base": "UpdateVertex",
                     "base": "UpdateVertex",
                     "entry": {
                     "entry": {
@@ -89,6 +125,28 @@
                         }
                         }
                     ]
                     ]
                 },
                 },
+                {
+                    "base": "GetVertexCount",
+                    "entry": {
+                        "name": "In",
+                        "tooltip": "When signaled, this will invoke Get Vertex Count"
+                    },
+                    "exit": {
+                        "name": "Out",
+                        "tooltip": "Signaled after Get Vertex Count is invoked"
+                    },
+                    "details": {
+                        "name": "Get Vertex Count"
+                    },
+                    "results": [
+                        {
+                            "typeid": "{D6597933-47CD-4FC8-B911-63F3E2B0993A}",
+                            "details": {
+                                "name": "Count"
+                            }
+                        }
+                    ]
+                },
                 {
                 {
                     "base": "AddVertex",
                     "base": "AddVertex",
                     "entry": {
                     "entry": {

+ 1 - 1
Gems/SurfaceData/Code/Source/SurfacePointList.cpp

@@ -159,7 +159,7 @@ namespace SurfaceData
         // If we've made it here, we're adding the point, not merging it.
         // If we've made it here, we're adding the point, not merging it.
 
 
         // Verify we aren't adding more points than expected.
         // Verify we aren't adding more points than expected.
-        AZ_Assert(m_numSurfacePointsPerInput[inPositionIndex] < m_maxSurfacePointsPerInput, "Adding too many surface points.");
+        AZ_Assert(m_numSurfacePointsPerInput[inPositionIndex] <= m_maxSurfacePointsPerInput, "Adding too many surface points.");
 
 
         // Expand our output AABB to include this point.
         // Expand our output AABB to include this point.
         m_surfacePointBounds.AddPoint(position);
         m_surfacePointBounds.AddPoint(position);

+ 4 - 0
Gems/Terrain/Code/Source/Components/TerrainWorldComponent.cpp

@@ -35,6 +35,10 @@ namespace Terrain
         result.Combine(ContinueLoadingFromJsonObjectField(
         result.Combine(ContinueLoadingFromJsonObjectField(
             &configInstance->m_worldMax, azrtti_typeid<decltype(configInstance->m_worldMax)>(), inputValue, "WorldMax", context));
             &configInstance->m_worldMax, azrtti_typeid<decltype(configInstance->m_worldMax)>(), inputValue, "WorldMax", context));
 
 
+        result.Combine(ContinueLoadingFromJsonObjectField(
+            &configInstance->m_surfaceDataQueryResolution, azrtti_typeid<decltype(configInstance->m_surfaceDataQueryResolution)>(),
+            inputValue, "SurfaceDataQueryResolution", context));
+
         rapidjson::Value::ConstMemberIterator itr = inputValue.FindMember("HeightQueryResolution");
         rapidjson::Value::ConstMemberIterator itr = inputValue.FindMember("HeightQueryResolution");
         if (itr != inputValue.MemberEnd())
         if (itr != inputValue.MemberEnd())
         {
         {