/* * 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 namespace Vegetation { void InstanceData::Reflect(AZ::ReflectContext* context) { AZ::SerializeContext* serialize = azrtti_cast(context); if (serialize) { serialize->RegisterGenericType>(); serialize->Class() ->Version(1) ->Field("Id", &InstanceData::m_id) ->Field("InstanceId", &InstanceData::m_instanceId) ->Field("Position", &InstanceData::m_position) ->Field("Normal", &InstanceData::m_normal) ->Field("Rotation", &InstanceData::m_rotation) ->Field("Alignment", &InstanceData::m_alignment) ->Field("Scale", &InstanceData::m_scale) ->Field("Descriptor", &InstanceData::m_descriptorPtr) ; } if (auto behaviorContext = azrtti_cast(context)) { behaviorContext->Class() ->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common) ->Attribute(AZ::Script::Attributes::Category, "Vegetation") ->Attribute(AZ::Script::Attributes::Module, "vegetation") ->Constructor() ->Property("id", BehaviorValueProperty(&InstanceData::m_id)) ->Property("instanceId", BehaviorValueProperty(&InstanceData::m_instanceId)) ->Property("position", BehaviorValueProperty(&InstanceData::m_position)) ->Property("normal", BehaviorValueProperty(&InstanceData::m_normal)) ->Property("rotation", BehaviorValueProperty(&InstanceData::m_rotation)) ->Property("alignment", BehaviorValueProperty(&InstanceData::m_alignment)) ->Property("scale", BehaviorValueProperty(&InstanceData::m_scale)) // Return a bare pointer instead of a smart pointer for easier use from scripting languages. ->Property("descriptor", [](InstanceData* thisPtr) { return thisPtr->m_descriptorPtr.get(); }, nullptr) ; } } } // namespace Vegetation