using System; using System.Collections.Generic; using UnityEditor.Graphing; using UnityEngine; namespace UnityEditor.ShaderGraph { [Serializable] class SubGraphData : ISerializationCallbackReceiver { public bool isValid; public bool isRecursive; public long processedAt; public string functionName; public string inputStructName; public string hlslName; public string assetGuid; public ShaderGraphRequirements requirements; public string path; public List functionNames = new List(); [NonSerialized] public List inputs = new List(); [SerializeField] List m_SerializedInputs = new List(); [NonSerialized] public List nodeProperties = new List(); [SerializeField] List m_SerializedProperties = new List(); [NonSerialized] public List outputs = new List(); [SerializeField] List m_SerializedOutputs = new List(); public List children = new List(); public List descendents = new List(); public List ancestors = new List(); public ShaderStageCapability effectiveShaderStage; public void Reset() { isValid = true; isRecursive = false; processedAt = 0; functionName = null; inputStructName = null; hlslName = null; assetGuid = null; requirements = ShaderGraphRequirements.none; path = null; functionNames.Clear(); inputs.Clear(); m_SerializedInputs.Clear(); nodeProperties.Clear(); m_SerializedProperties.Clear(); outputs.Clear(); m_SerializedOutputs.Clear(); children.Clear(); descendents.Clear(); ancestors.Clear(); effectiveShaderStage = ShaderStageCapability.All; } public void OnBeforeSerialize() { m_SerializedInputs = SerializationHelper.Serialize(inputs); m_SerializedProperties = SerializationHelper.Serialize(nodeProperties); m_SerializedOutputs = SerializationHelper.Serialize(outputs); } public void OnAfterDeserialize() { var typeSerializationInfos = GraphUtil.GetLegacyTypeRemapping(); inputs = SerializationHelper.Deserialize(m_SerializedInputs, typeSerializationInfos); nodeProperties = SerializationHelper.Deserialize(m_SerializedProperties, typeSerializationInfos); outputs = SerializationHelper.Deserialize(m_SerializedOutputs, typeSerializationInfos); } } }