EditorSurfaceAltitudeGradientComponent.cpp 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #include "EditorSurfaceAltitudeGradientComponent.h"
  9. namespace GradientSignal
  10. {
  11. void EditorSurfaceAltitudeGradientComponent::Reflect(AZ::ReflectContext* context)
  12. {
  13. EditorGradientComponentBase::ReflectSubClass<EditorSurfaceAltitudeGradientComponent, BaseClassType>(context);
  14. }
  15. void EditorSurfaceAltitudeGradientComponent::Activate()
  16. {
  17. BaseClassType::Activate();
  18. UpdateFromShape();
  19. }
  20. void EditorSurfaceAltitudeGradientComponent::Deactivate()
  21. {
  22. BaseClassType::Deactivate();
  23. }
  24. AZ::u32 EditorSurfaceAltitudeGradientComponent::ConfigurationChanged()
  25. {
  26. BaseClassType::ConfigurationChanged();
  27. UpdateFromShape();
  28. // Refresh attributes because changing shapes affects read-only status of bounds
  29. return AZ::Edit::PropertyRefreshLevels::AttributesAndValues;
  30. }
  31. void EditorSurfaceAltitudeGradientComponent::OnCompositionChanged()
  32. {
  33. UpdateFromShape();
  34. InvalidatePropertyDisplay(AzToolsFramework::Refresh_AttributesAndValues);
  35. }
  36. void EditorSurfaceAltitudeGradientComponent::UpdateFromShape()
  37. {
  38. // Update config from shape on game component, copy that back to our config
  39. m_component.UpdateFromShape();
  40. m_component.WriteOutConfig(&m_configuration);
  41. SetDirty();
  42. }
  43. }