ModelPreset.cpp 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. #undef RC_INVOKED
  9. #include <Atom/Feature/Utils/ModelPreset.h>
  10. #include <AzCore/Asset/AssetSerializer.h>
  11. #include <AzCore/Serialization/SerializeContext.h>
  12. #include <AzCore/RTTI/BehaviorContext.h>
  13. #include <Atom/RPI.Reflect/Model/ModelAsset.h>
  14. #include <Atom/RPI.Reflect/Image/StreamingImageAsset.h>
  15. namespace AZ
  16. {
  17. namespace Render
  18. {
  19. void ModelPreset::Reflect(AZ::ReflectContext* context)
  20. {
  21. if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
  22. {
  23. serializeContext->Class<ModelPreset>()
  24. ->Version(5)
  25. ->Field("modelAsset", &ModelPreset::m_modelAsset)
  26. ;
  27. }
  28. if (auto behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context))
  29. {
  30. behaviorContext->Class<ModelPreset>("ModelPreset")
  31. ->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)
  32. ->Attribute(AZ::Script::Attributes::Category, "Editor")
  33. ->Attribute(AZ::Script::Attributes::Module, "render")
  34. ->Constructor()
  35. ->Constructor<const ModelPreset&>()
  36. ->Property("modelAsset", BehaviorValueProperty(&ModelPreset::m_modelAsset))
  37. ;
  38. }
  39. }
  40. }
  41. }