/* * All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or * its licensors. * * For complete copyright and license terms please see the LICENSE at the root of this * distribution (the "License"). All use of this software is governed by the License, * or, if provided, by the license below or the license accompanying this file. Do not * remove or modify any license notices. This file is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * */ #include "Vegetation_precompiled.h" #include "EditorLevelSettingsComponent.h" #include #include namespace Vegetation { void EditorLevelSettingsComponent::Reflect(AZ::ReflectContext* context) { BaseClassType::Reflect(context); AZ::SerializeContext* serializeContext = azrtti_cast(context); if (serializeContext) { serializeContext->Class() ->Version(1, &LmbrCentral::EditorWrappedComponentBaseVersionConverter) ->Field("UseEditorMaxInstanceProcessTimeMicroseconds", &EditorLevelSettingsComponent::m_useEditorMaxInstanceProcessTimeMicroseconds) ->Field("EditorMaxInstanceProcessTimeMicroseconds", &EditorLevelSettingsComponent::m_editorMaxInstanceProcessTimeMicroseconds) ; AZ::EditContext* editContext = serializeContext->GetEditContext(); if (editContext) { editContext->Class(s_componentName, s_componentDescription) ->ClassElement(AZ::Edit::ClassElements::EditorData, "") ->Attribute(AZ::Edit::Attributes::Category, s_categoryName) ->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::AutoExpand, true) ->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("Level", 0x9aeacc13)) ->DataElement(AZ::Edit::UIHandlers::CheckBox, &EditorLevelSettingsComponent::m_useEditorMaxInstanceProcessTimeMicroseconds, "Override Instance Time Slicing", "Use a max instance process time (in microseconds) for the Editor") ->Attribute(AZ::Edit::Attributes::ChangeNotify, &EditorLevelSettingsComponent::ConfigurationChanged) ->DataElement(0, &EditorLevelSettingsComponent::m_editorMaxInstanceProcessTimeMicroseconds, "Editor Instance Time Slicing", "The timeout maximum number of microseconds to process the vegetation instance construction & removal operations while in the Editor.") ->Attribute(AZ::Edit::Attributes::ChangeNotify, &EditorLevelSettingsComponent::ConfigurationChanged) ->Attribute(AZ::Edit::Attributes::Min, 0) ->Attribute(AZ::Edit::Attributes::Max, 33000) ; } } } AZ::u32 EditorLevelSettingsComponent::ConfigurationChanged() { m_component.Deactivate(); if (m_useEditorMaxInstanceProcessTimeMicroseconds) { LevelSettingsConfig editorConfig = m_configuration; editorConfig.m_instanceSystemConfig.m_maxInstanceProcessTimeMicroseconds = m_editorMaxInstanceProcessTimeMicroseconds; m_component.ReadInConfig(&editorConfig); } else { m_component.ReadInConfig(&m_configuration); } if (m_visible && m_component.GetEntity()) { m_component.Activate(); } return AZ::Edit::PropertyRefreshLevels::None; } } // namespace Vegetation