/* * Copyright (c) Contributors to the Open 3D Engine Project. * For complete copyright and license terms please see the LICENSE at the root of this distribution. * * SPDX-License-Identifier: Apache-2.0 OR MIT * */ #include "EditorDebugComponent.h" #include #include #include #include #include #include #include #include #include namespace Vegetation { namespace EditorDebugComponentVersionUtility { bool VersionConverter(AZ::SerializeContext& context, AZ::SerializeContext::DataElementNode& classElement) { EditorVegetationComponentBaseVersionConverter(context, classElement); if (classElement.GetVersion() < 2) { classElement.RemoveElementByName(AZ_CRC("FilerTypeLevel", 0x246c4e16)); classElement.RemoveElementByName(AZ_CRC("SortType", 0xdd2117e6)); } return true; } } void EditorDebugComponent::Reflect(AZ::ReflectContext* context) { BaseClassType::Reflect(context); AZ::SerializeContext* serialize = azrtti_cast(context); if (serialize) { serialize->Class() ->Version(2, &EditorDebugComponentVersionUtility::VersionConverter) ; AZ::EditContext* edit = serialize->GetEditContext(); if (edit) { edit->Class( s_componentName, s_componentDescription) ->ClassElement(AZ::Edit::ClassElements::EditorData, "") ->Attribute(AZ::Edit::Attributes::Icon, s_icon) ->Attribute(AZ::Edit::Attributes::ViewportIcon, s_viewportIcon) ->Attribute(AZ::Edit::Attributes::HelpPageURL, s_helpUrl) ->Attribute(AZ::Edit::Attributes::Category, s_categoryName) ->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("Level", 0x9aeacc13)) ->Attribute(AZ::Edit::Attributes::AutoExpand, true) ->UIElement(AZ::Edit::UIHandlers::Button, "") ->Attribute(AZ::Edit::Attributes::ChangeNotify, &EditorDebugComponent::OnDumpDataToFile) ->Attribute(AZ::Edit::Attributes::NameLabelOverride, "") ->Attribute(AZ::Edit::Attributes::ButtonText, "Dump Performance Log") ->UIElement(AZ::Edit::UIHandlers::Button, "") ->Attribute(AZ::Edit::Attributes::ChangeNotify, &EditorDebugComponent::OnClearReport) ->Attribute(AZ::Edit::Attributes::NameLabelOverride, "") ->Attribute(AZ::Edit::Attributes::ButtonText, "Clear Performance Log") ->UIElement(AZ::Edit::UIHandlers::Button, "") ->Attribute(AZ::Edit::Attributes::ChangeNotify, &EditorDebugComponent::OnRefreshAllAreas) ->Attribute(AZ::Edit::Attributes::NameLabelOverride, "") ->Attribute(AZ::Edit::Attributes::ButtonText, "Refresh All Areas") ->UIElement(AZ::Edit::UIHandlers::Button, "") ->Attribute(AZ::Edit::Attributes::ChangeNotify, &EditorDebugComponent::OnClearAllAreas) ->Attribute(AZ::Edit::Attributes::NameLabelOverride, "") ->Attribute(AZ::Edit::Attributes::ButtonText, "Clear All Areas") ; } } } void EditorDebugComponent::Activate() { BaseClassType::Activate(); } void EditorDebugComponent::OnDumpDataToFile() { m_component.ExportCurrentReport(); } void EditorDebugComponent::OnClearReport() { m_component.ClearPerformanceReport(); } void EditorDebugComponent::OnRefreshAllAreas() { AreaSystemRequestBus::Broadcast(&AreaSystemRequestBus::Events::RefreshAllAreas); } void EditorDebugComponent::OnClearAllAreas() { AreaSystemRequestBus::Broadcast(&AreaSystemRequestBus::Events::ClearAllAreas); AreaSystemRequestBus::Broadcast(&AreaSystemRequestBus::Events::RefreshAllAreas); } }