${Name}Component.cpp 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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 <Components/${Name}Component.h>
  9. #include <AzCore/RTTI/BehaviorContext.h>
  10. namespace ${Name}
  11. {
  12. ${Name}Component::${Name}Component(const ${Name}ComponentConfig& config)
  13. : BaseClass(config)
  14. {
  15. }
  16. void ${Name}Component::Reflect(AZ::ReflectContext* context)
  17. {
  18. BaseClass::Reflect(context);
  19. if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
  20. {
  21. serializeContext->Class<${Name}Component, BaseClass>()
  22. ->Version(0)
  23. ;
  24. }
  25. if (auto behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context))
  26. {
  27. behaviorContext->ConstantProperty("${Name}ComponentTypeId", BehaviorConstant(AZ::Uuid(${Name}ComponentTypeId)))
  28. ->Attribute(AZ::Script::Attributes::Module, "render")
  29. ->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common);
  30. }
  31. }
  32. }