Merge pull request #1944 from aws-lumberyard-dev/pruiksma/LYN-3913

[LYN-3913] Fix conversion to unsupported photometric unit on light type change
main
Jon B 5 years ago committed by GitHub
commit e8cc6a86ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -263,7 +263,23 @@ namespace AZ
// Update the cached light type.
m_lightType = m_controller.m_configuration.m_lightType;
// Check to see if the current photometric type is supported by the light type. If not, convert to lumens before deactivating.
auto supportedPhotometricUnits = m_controller.m_configuration.GetValidPhotometricUnits();
auto foundIt = AZStd::find_if(
supportedPhotometricUnits.begin(),
supportedPhotometricUnits.end(),
[&](const Edit::EnumConstant<PhotometricUnit>& entry) -> bool
{
return AZStd::RemoveEnum<PhotometricUnit>::type(m_controller.m_configuration.m_intensityMode) == entry.m_value;
}
);
if (foundIt == supportedPhotometricUnits.end())
{
m_controller.ConvertToIntensityMode(PhotometricUnit::Lumen);
}
// componets may be removed or added here, so deactivate now and reactivate the entity when everything is done shifting around.
GetEntity()->Deactivate();
@ -320,7 +336,7 @@ namespace AZ
// Some light types don't require a shape, this is ok.
break;
}
GetEntity()->Activate();
// Set more reasonable default values for certain shapes.
@ -333,7 +349,7 @@ namespace AZ
LmbrCentral::DiskShapeComponentRequestBus::Event(GetEntityId(), &LmbrCentral::DiskShapeComponentRequests::SetRadius, 0.05f);
break;
}
return true;
}

Loading…
Cancel
Save