// Copyright (c) 2012-2022 Wojciech Figat. All rights reserved. #pragma once #include "../BinaryAsset.h" #include "Engine/Tools/MaterialGenerator/Types.h" /// /// Material function graph asset that contains reusable part of the material graph. /// API_CLASS(NoSpawn) class FLAXENGINE_API MaterialFunction : public BinaryAsset { DECLARE_BINARY_ASSET_HEADER(MaterialFunction, 1); public: #if COMPILE_WITH_MATERIAL_GRAPH /// /// The loaded material function graph. /// MaterialGraph Graph; /// /// The input nodes (indices). /// Array> Inputs; /// /// The output nodes (indices). /// Array> Outputs; /// /// Tries to load surface graph from the asset. /// /// The output surface data, or empty if failed to load. API_FUNCTION() BytesContainer LoadSurface(); /// /// Tries to load surface graph from the asset. /// /// The graph to load. /// True if failed, otherwise false. bool LoadSurface(MaterialGraph& graph); // Gets the function signature for Visject Surface editor. API_FUNCTION() void GetSignature(API_PARAM(Out) Array>& types, API_PARAM(Out) Array>& names); #endif #if USE_EDITOR /// /// Updates the material graph surface (save new one, discards cached data, reloads asset). /// /// The surface graph data. /// True if cannot save it, otherwise false. API_FUNCTION() bool SaveSurface(BytesContainer& data); #endif protected: // [BinaryAsset] LoadResult load() override; void unload(bool isReloading) override; AssetChunksFlag getChunksToPreload() const override; };