Revert #3117 and do it different way as some types can be valid even if different thus use internal parameter setter for type validation

This commit is contained in:
Wojtek Figat
2025-01-13 16:07:47 +01:00
parent bc18ddc04b
commit 3796b0ccae
3 changed files with 11 additions and 14 deletions

View File

@@ -25,24 +25,17 @@ Variant MaterialBase::GetParameterValue(const StringView& name)
return Variant::Null;
}
void MaterialBase::SetParameterValue(const StringView& name, const Variant& value, bool warnIfMissing, bool warnIfWrongType)
void MaterialBase::SetParameterValue(const StringView& name, const Variant& value, bool warnIfMissing)
{
const auto param = Params.Get(name);
if (param)
{
if (Variant::CanCast(value, param->GetValue().Type))
{
param->SetValue(value);
param->SetIsOverride(true);
}
else if (warnIfWrongType)
{
LOG(Warning, "Material parameter '{0}' in material {1} is type '{2}' and not type '{3}'.", String(name), ToString(), param->GetValue().Type, value.Type);
}
param->SetValue(value);
param->SetIsOverride(true);
}
else if (warnIfMissing)
{
LOG(Warning, "Missing material parameter '{0}' in material {1}", String(name), ToString());
LOG(Warning, "Missing material parameter '{0}' in material {1}", name, ToString());
}
}