Fix const-correctness in dictionary iterator access

This commit is contained in:
Wojtek Figat
2025-01-23 21:40:52 +01:00
parent c1339765b7
commit 61a731704d
3 changed files with 11 additions and 11 deletions

View File

@@ -2142,7 +2142,7 @@ const Variant& VisualScript::GetScriptInstanceParameterValue(const StringView& n
return Variant::Null; return Variant::Null;
} }
void VisualScript::SetScriptInstanceParameterValue(const StringView& name, ScriptingObject* instance, const Variant& value) const void VisualScript::SetScriptInstanceParameterValue(const StringView& name, ScriptingObject* instance, const Variant& value)
{ {
CHECK(instance); CHECK(instance);
for (int32 paramIndex = 0; paramIndex < Graph.Parameters.Count(); paramIndex++) for (int32 paramIndex = 0; paramIndex < Graph.Parameters.Count(); paramIndex++)
@@ -2163,7 +2163,7 @@ void VisualScript::SetScriptInstanceParameterValue(const StringView& name, Scrip
LOG(Warning, "Failed to set {0} parameter '{1}'", ToString(), name); LOG(Warning, "Failed to set {0} parameter '{1}'", ToString(), name);
} }
void VisualScript::SetScriptInstanceParameterValue(const StringView& name, ScriptingObject* instance, Variant&& value) const void VisualScript::SetScriptInstanceParameterValue(const StringView& name, ScriptingObject* instance, Variant&& value)
{ {
CHECK(instance); CHECK(instance);
for (int32 paramIndex = 0; paramIndex < Graph.Parameters.Count(); paramIndex++) for (int32 paramIndex = 0; paramIndex < Graph.Parameters.Count(); paramIndex++)

View File

@@ -217,7 +217,7 @@ public:
/// <param name="name">The parameter name.</param> /// <param name="name">The parameter name.</param>
/// <param name="instance">The object instance.</param> /// <param name="instance">The object instance.</param>
/// <param name="value">The property value to set.</param> /// <param name="value">The property value to set.</param>
API_FUNCTION() void SetScriptInstanceParameterValue(const StringView& name, ScriptingObject* instance, const Variant& value) const; API_FUNCTION() void SetScriptInstanceParameterValue(const StringView& name, ScriptingObject* instance, const Variant& value);
/// <summary> /// <summary>
/// Sets the value of the Visual Script parameter of the given instance. /// Sets the value of the Visual Script parameter of the given instance.
@@ -225,7 +225,7 @@ public:
/// <param name="name">The parameter name.</param> /// <param name="name">The parameter name.</param>
/// <param name="instance">The object instance.</param> /// <param name="instance">The object instance.</param>
/// <param name="value">The property value to set.</param> /// <param name="value">The property value to set.</param>
void SetScriptInstanceParameterValue(const StringView& name, ScriptingObject* instance, Variant&& value) const; void SetScriptInstanceParameterValue(const StringView& name, ScriptingObject* instance, Variant&& value);
/// <summary> /// <summary>
/// Tries to find the method matching the given properties. Doesn't check base classes but just this script. /// Tries to find the method matching the given properties. Doesn't check base classes but just this script.

View File

@@ -72,7 +72,7 @@ struct ShadowAtlasLightTile
Matrix WorldToShadow; Matrix WorldToShadow;
float FramesToUpdate; // Amount of frames (with fraction) until the next shadow update can happen float FramesToUpdate; // Amount of frames (with fraction) until the next shadow update can happen
bool SkipUpdate; bool SkipUpdate;
bool HasStaticGeometry; mutable bool HasStaticGeometry;
Viewport CachedViewport; // The viewport used the last time to render shadow to the atlas Viewport CachedViewport; // The viewport used the last time to render shadow to the atlas
void FreeDynamic(ShadowsCustomBuffer* buffer); void FreeDynamic(ShadowsCustomBuffer* buffer);
@@ -190,7 +190,7 @@ struct ShadowAtlasLight
uint8 TilesNeeded; uint8 TilesNeeded;
uint8 TilesCount; uint8 TilesCount;
bool HasStaticShadowContext; bool HasStaticShadowContext;
StaticStates StaticState; mutable StaticStates StaticState;
BoundingSphere Bounds; BoundingSphere Bounds;
float Sharpness, Fade, NormalOffsetScale, Bias, FadeDistance, Distance, TileBorder; float Sharpness, Fade, NormalOffsetScale, Bias, FadeDistance, Distance, TileBorder;
Float4 CascadeSplits; Float4 CascadeSplits;
@@ -1393,7 +1393,7 @@ void ShadowsPass::RenderShadowMaps(RenderContextBatch& renderContextBatch)
bool renderedAny = false; bool renderedAny = false;
for (auto& e : shadows.Lights) for (auto& e : shadows.Lights)
{ {
ShadowAtlasLight& atlasLight = e.Value; const ShadowAtlasLight& atlasLight = e.Value;
if (!atlasLight.HasStaticShadowContext || atlasLight.ContextCount == 0) if (!atlasLight.HasStaticShadowContext || atlasLight.ContextCount == 0)
continue; continue;
int32 contextIndex = 0; int32 contextIndex = 0;
@@ -1403,7 +1403,7 @@ void ShadowsPass::RenderShadowMaps(RenderContextBatch& renderContextBatch)
// Check for any static geometry to use in static shadow map // Check for any static geometry to use in static shadow map
for (int32 tileIndex = 0; tileIndex < atlasLight.TilesCount; tileIndex++) for (int32 tileIndex = 0; tileIndex < atlasLight.TilesCount; tileIndex++)
{ {
ShadowAtlasLightTile& tile = atlasLight.Tiles[tileIndex]; const ShadowAtlasLightTile& tile = atlasLight.Tiles[tileIndex];
contextIndex++; // Skip dynamic context contextIndex++; // Skip dynamic context
auto& shadowContextStatic = renderContextBatch.Contexts[atlasLight.ContextIndex + contextIndex++]; auto& shadowContextStatic = renderContextBatch.Contexts[atlasLight.ContextIndex + contextIndex++];
if (!shadowContextStatic.List->DrawCallsLists[(int32)DrawCallsListType::Depth].IsEmpty() || !shadowContextStatic.List->ShadowDepthDrawCallsList.IsEmpty()) if (!shadowContextStatic.List->DrawCallsLists[(int32)DrawCallsListType::Depth].IsEmpty() || !shadowContextStatic.List->ShadowDepthDrawCallsList.IsEmpty())
@@ -1419,7 +1419,7 @@ void ShadowsPass::RenderShadowMaps(RenderContextBatch& renderContextBatch)
contextIndex = 0; contextIndex = 0;
for (int32 tileIndex = 0; tileIndex < atlasLight.TilesCount; tileIndex++) for (int32 tileIndex = 0; tileIndex < atlasLight.TilesCount; tileIndex++)
{ {
ShadowAtlasLightTile& tile = atlasLight.Tiles[tileIndex]; const ShadowAtlasLightTile& tile = atlasLight.Tiles[tileIndex];
if (!tile.RectTile) if (!tile.RectTile)
break; break;
if (!tile.StaticRectTile) if (!tile.StaticRectTile)
@@ -1472,13 +1472,13 @@ void ShadowsPass::RenderShadowMaps(RenderContextBatch& renderContextBatch)
context->SetRenderTarget(shadows.ShadowMapAtlas->View(), (GPUTextureView*)nullptr); context->SetRenderTarget(shadows.ShadowMapAtlas->View(), (GPUTextureView*)nullptr);
for (auto& e : shadows.Lights) for (auto& e : shadows.Lights)
{ {
ShadowAtlasLight& atlasLight = e.Value; const ShadowAtlasLight& atlasLight = e.Value;
if (atlasLight.ContextCount == 0) if (atlasLight.ContextCount == 0)
continue; continue;
int32 contextIndex = 0; int32 contextIndex = 0;
for (int32 tileIndex = 0; tileIndex < atlasLight.TilesCount; tileIndex++) for (int32 tileIndex = 0; tileIndex < atlasLight.TilesCount; tileIndex++)
{ {
ShadowAtlasLightTile& tile = atlasLight.Tiles[tileIndex]; const ShadowAtlasLightTile& tile = atlasLight.Tiles[tileIndex];
if (!tile.RectTile) if (!tile.RectTile)
break; break;
if (tile.SkipUpdate) if (tile.SkipUpdate)