Fix for LYN-3726 : Actor Draw Character Doesn't Work (#1336)
-Re-purposed an unused boolean in RPI::Cullable for previous frame's visiblity to instead represent objects that are hidden in the simulation. -Updated MeshFeatureProcessor::SetVisible to set this value on the cullable. -Updated the MeshComponent to handle visiblity changes by not rendering the mesh instead of deactivating and/or reactivating the component. -Updated the AtomActorInstance to handle changes to the visibility from the ActorComponent. Tested by creating two entities with static mesh components, on entity hidden and the other visible. Plus three entities with actor components, one where the actor is visible, one where the entity is visible but the 'render character' setting on the actor component is disabled, and one where the 'render character' setting is enabled, but the entity is not visible. For each of these 5 entities, I added them as 5 loose entities, 5 entities that were children to a parent entity, and a slice with all 5 as children to a parent entity, and tested toggling visibility of the parent entities. For each of these 3 sets of 5 entities, I added them directly to the level, added them all to a layer where the layer was visible, and added them all to a layer where the layer was not visible, and tested toggling the visibility of the layers.
This commit is contained in:
@@ -204,6 +204,7 @@ namespace AZ
|
||||
&AzToolsFramework::ToolsApplicationEvents::InvalidatePropertyDisplay,
|
||||
AzToolsFramework::Refresh_EntireTree);
|
||||
}
|
||||
|
||||
AZ::u32 EditorMeshComponent::OnConfigurationChanged()
|
||||
{
|
||||
// temp variable is needed to hold reference to m_modelAsset while it's being loaded.
|
||||
@@ -213,5 +214,18 @@ namespace AZ
|
||||
auto temp = m_controller.m_configuration.m_modelAsset;
|
||||
return BaseClass::OnConfigurationChanged();
|
||||
}
|
||||
|
||||
void EditorMeshComponent::OnEntityVisibilityChanged(bool visibility)
|
||||
{
|
||||
m_controller.SetVisibility(visibility);
|
||||
}
|
||||
|
||||
bool EditorMeshComponent::ShouldActivateController() const
|
||||
{
|
||||
// By default, components using the EditorRenderComponentAdapter will only activate if the component is visible
|
||||
// Since the mesh component handles visibility changes by not rendering the mesh, rather than deactivating the component entirely,
|
||||
// it can be activated even if it is not visible
|
||||
return true;
|
||||
}
|
||||
} // namespace Render
|
||||
} // namespace AZ
|
||||
|
||||
Reference in New Issue
Block a user