/* * 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 * */ #pragma once #include #include #include #include namespace ScriptCanvasEditor { class ScriptCanvasAsset; } namespace ScriptCanvasBuilder { class BuildVariableOverrides { public: AZ_TYPE_INFO(BuildVariableOverrides, "{8336D44C-8EDC-4C28-AEB4-3420D5FD5AE2}"); AZ_CLASS_ALLOCATOR(BuildVariableOverrides, AZ::SystemAllocator, 0); static void Reflect(AZ::ReflectContext* reflectContext); void Clear(); // use this to preserve old values that may have been overridden on the instance, and are still valid in the parsed graph void CopyPreviousOverriddenValues(const BuildVariableOverrides& source); bool IsEmpty() const; // use this to initialize the new data, and make sure they have a editor graph variable for proper editor display void PopulateFromParsedResults(ScriptCanvas::Grammar::AbstractCodeModelConstPtr abstractCodeModel, const ScriptCanvas::VariableData& variables); // #functions2 provide an identifier for the node/variable in the source that caused the dependency. the root will not have one. AZ::Data::Asset m_source; // all of the variables here are overrides AZStd::vector m_variables; // the values here may or may not be overrides AZStd::vector> m_entityIds; // these two variable lists are all that gets exposed to the edit context AZStd::vector m_overrides; AZStd::vector m_overridesUnused; // AZStd::vector m_entityIdRuntimeInputIndices; since all of the entity ids need to go in, they may not need indices AZStd::vector m_dependencies; }; class EditorAssetTree { public: AZ_CLASS_ALLOCATOR(EditorAssetTree, AZ::SystemAllocator, 0); EditorAssetTree* m_parent = nullptr; AZStd::vector m_dependencies; AZ::Data::Asset m_asset; EditorAssetTree* ModRoot(); void SetParent(EditorAssetTree& parent); AZStd::string ToString(size_t depth = 0) const; }; // copy the variables overridden during editor / prefab build time back to runtime data ScriptCanvas::RuntimeDataOverrides ConvertToRuntime(const BuildVariableOverrides& overrides); AZ::Outcome LoadEditorAssetTree(AZ::Data::AssetId editorAssetId, AZStd::string_view assetHint, EditorAssetTree* parent = nullptr); AZ::Outcome ParseEditorAssetTree(const EditorAssetTree& editorAssetTree); }