Fixed trigger
All checks were successful
CI / React UI Build (push) Successful in 10s
CI / Native Windows Build And Tests (push) Successful in 2m57s
CI / Windows Release Package (push) Has been skipped

This commit is contained in:
Aiden
2026-05-12 18:11:43 +10:00
parent 5fb4607d8c
commit 6e32941675
5 changed files with 49 additions and 4 deletions

View File

@@ -3,6 +3,7 @@
#include "RuntimeParameterUtils.h"
#include <algorithm>
#include <chrono>
#include <utility>
namespace RenderCadenceCompositor
@@ -156,8 +157,18 @@ bool RuntimeLayerModel::UpdateParameter(const std::string& layerId, const std::s
}
ShaderParameterValue normalizedValue;
if (!NormalizeAndValidateParameterValue(*definition, value, normalizedValue, error))
if (definition->type == ShaderParameterType::Trigger)
{
const auto currentIt = layer->parameterValues.find(parameterId);
const double previousCount = currentIt == layer->parameterValues.end() || currentIt->second.numberValues.empty()
? 0.0
: currentIt->second.numberValues.front();
normalizedValue.numberValues = { previousCount + 1.0, RuntimeElapsedSeconds() };
}
else if (!NormalizeAndValidateParameterValue(*definition, value, normalizedValue, error))
{
return false;
}
layer->parameterValues[parameterId] = normalizedValue;
if (layer->renderReady)
@@ -360,4 +371,9 @@ RuntimeLayerReadModel RuntimeLayerModel::ToReadModel(const Layer& layer)
readModel.parameterValues = layer.parameterValues;
return readModel;
}
double RuntimeLayerModel::RuntimeElapsedSeconds() const
{
return std::chrono::duration_cast<std::chrono::duration<double>>(std::chrono::steady_clock::now() - mStartTime).count();
}
}