Exemple #1
0
        public override void Destroy()
        {
            m_mainPreviewNode = null;
            base.Destroy();
            if (ContainerGraph.ParentWindow.OutsideGraph.CurrentStandardSurface != null)
            {
                for (int i = 0; i < m_includes.Count; i++)
                {
                    if (ContainerGraph.ParentWindow.OutsideGraph.CurrentStandardSurface.AdditionalIncludes.OutsideList.Contains(m_includes[i]))
                    {
                        ContainerGraph.ParentWindow.OutsideGraph.CurrentStandardSurface.AdditionalIncludes.OutsideList.Remove(m_includes[i]);
                    }
                }

                for (int i = 0; i < m_pragmas.Count; i++)
                {
                    if (ContainerGraph.ParentWindow.OutsideGraph.CurrentStandardSurface.AdditionalPragmas.OutsideList.Contains(m_pragmas[i]))
                    {
                        ContainerGraph.ParentWindow.OutsideGraph.CurrentStandardSurface.AdditionalPragmas.OutsideList.Remove(m_pragmas[i]);
                    }
                }
            }

            if (m_reordenator != null)
            {
                ParentGraph cachedGraph = ContainerGraph.ParentWindow.CustomGraph;
                ContainerGraph.ParentWindow.CustomGraph = null;
                UIUtils.UnregisterPropertyNode(m_reordenator);
                ContainerGraph.ParentWindow.CustomGraph = cachedGraph;

                m_reordenator.Destroy();
                m_reordenator = null;
            }

            UIUtils.UnregisterFunctionNode(this);

            ParentGraph cachedGraph2 = ContainerGraph.ParentWindow.CustomGraph;

            ContainerGraph.ParentWindow.CustomGraph = m_functionGraph;

            if (m_allFunctionInputs != null)
            {
                m_allFunctionInputs.Clear();
            }
            m_allFunctionInputs = null;

            if (m_allFunctionOutputs != null)
            {
                m_allFunctionOutputs.Clear();
            }
            m_allFunctionOutputs = null;

            if (m_functionGraph != null)
            {
                m_functionGraph.SoftDestroy();
            }
            m_functionGraph = null;

            ContainerGraph.ParentWindow.CustomGraph = cachedGraph2;
            m_function = null;

            m_allFunctionOutputsDict.Clear();
            m_allFunctionOutputsDict = null;

            m_allFunctionSwitchesDict.Clear();
            m_allFunctionSwitchesDict = null;

            m_allFunctionSwitchesCopiesDict.Clear();
            m_allFunctionSwitchesCopiesDict = null;

            m_allFunctionInputsDict.Clear();
            m_allFunctionInputsDict = null;
        }
Exemple #2
0
        public override void Destroy()
        {
            m_mainPreviewNode = null;
            base.Destroy();

            if (m_functionGraph != null && ContainerGraph.ParentWindow.CurrentGraph != m_functionGraph)
            {
                ContainerGraph.ParentWindow.CurrentGraph.InstancePropertyCount -= m_functionGraph.InstancePropertyCount;
            }

            if (ContainerGraph.ParentWindow.OutsideGraph.CurrentStandardSurface != null)
            {
                //for( int i = 0; i < m_includes.Count; i++ )
                //{
                //	//if( ContainerGraph.ParentWindow.OutsideGraph.CurrentStandardSurface.AdditionalIncludes.OutsideList.Contains( m_includes[ i ] ) )
                //	//{
                //	//	ContainerGraph.ParentWindow.OutsideGraph.CurrentStandardSurface.AdditionalIncludes.OutsideList.Remove( m_includes[ i ] );
                //	//}
                //	ContainerGraph.ParentWindow.OutsideGraph.CurrentStandardSurface.AdditionalDirectives.RemoveShaderFunctionItem( AdditionalLineType.Include, m_includes[ i ] );
                //}

                //for( int i = 0; i < m_pragmas.Count; i++ )
                //{
                //	//if( ContainerGraph.ParentWindow.OutsideGraph.CurrentStandardSurface.AdditionalPragmas.OutsideList.Contains( m_pragmas[ i ] ) )
                //	//{
                //	//	ContainerGraph.ParentWindow.OutsideGraph.CurrentStandardSurface.AdditionalPragmas.OutsideList.Remove( m_pragmas[ i ] );
                //	//}
                //	ContainerGraph.ParentWindow.OutsideGraph.CurrentStandardSurface.AdditionalDirectives.RemoveShaderFunctionItem( AdditionalLineType.Pragma, m_pragmas[ i ] );
                //}
                ContainerGraph.ParentWindow.OutsideGraph.CurrentStandardSurface.AdditionalDirectives.RemoveShaderFunctionItems(m_directives);
            }
            else
            {
                if (ContainerGraph.ParentWindow.OutsideGraph.MultiPassMasterNodes.Count > 0)
                {
                    List <TemplateMultiPassMasterNode> nodes = ContainerGraph.ParentWindow.OutsideGraph.MultiPassMasterNodes.NodesList;
                    int count = nodes.Count;
                    for (int i = 0; i < count; i++)
                    {
                        nodes[i].PassModule.AdditionalDirectives.RemoveShaderFunctionItems(m_directives);
                    }
                }
            }

            // Cannot GameObject.Destroy(m_directives[i]) since we would be removing them from
            // the shader function asset itself

            m_directives.Clear();
            m_directives = null;

            if (m_reordenator != null)
            {
                ParentGraph cachedGraph = ContainerGraph.ParentWindow.CustomGraph;
                ContainerGraph.ParentWindow.CustomGraph = null;
                UIUtils.UnregisterPropertyNode(m_reordenator);
                ContainerGraph.ParentWindow.CustomGraph = cachedGraph;

                m_reordenator.Destroy();
                m_reordenator = null;
            }

            UIUtils.UnregisterFunctionNode(this);

            ParentGraph cachedGraph2 = ContainerGraph.ParentWindow.CustomGraph;

            ContainerGraph.ParentWindow.CustomGraph = m_functionGraph;

            if (m_allFunctionInputs != null)
            {
                m_allFunctionInputs.Clear();
            }
            m_allFunctionInputs = null;

            if (m_allFunctionOutputs != null)
            {
                m_allFunctionOutputs.Clear();
            }
            m_allFunctionOutputs = null;

            if (m_functionGraph != null)
            {
                m_functionGraph.SoftDestroy();
            }
            m_functionGraph = null;

            ContainerGraph.ParentWindow.CustomGraph = cachedGraph2;
            m_function = null;

            m_allFunctionOutputsDict.Clear();
            m_allFunctionOutputsDict = null;

            m_allFunctionSwitchesDict.Clear();
            m_allFunctionSwitchesDict = null;

            m_allFunctionInputsDict.Clear();
            m_allFunctionInputsDict = null;
        }
        public override void Destroy()
        {
            m_mainPreviewNode = null;
            base.Destroy();

            if (m_functionGraph != null && ContainerGraph.ParentWindow.CurrentGraph != m_functionGraph)
            {
                ContainerGraph.ParentWindow.CurrentGraph.InstancePropertyCount -= m_functionGraph.InstancePropertyCount;
            }

            if (ContainerGraph.ParentWindow.OutsideGraph.CurrentStandardSurface != null)
            {
                //for( int i = 0; i < m_includes.Count; i++ )
                //{
                //	//if( ContainerGraph.ParentWindow.OutsideGraph.CurrentStandardSurface.AdditionalIncludes.OutsideList.Contains( m_includes[ i ] ) )
                //	//{
                //	//	ContainerGraph.ParentWindow.OutsideGraph.CurrentStandardSurface.AdditionalIncludes.OutsideList.Remove( m_includes[ i ] );
                //	//}
                //	ContainerGraph.ParentWindow.OutsideGraph.CurrentStandardSurface.AdditionalDirectives.RemoveShaderFunctionItem( AdditionalLineType.Include, m_includes[ i ] );
                //}

                //for( int i = 0; i < m_pragmas.Count; i++ )
                //{
                //	//if( ContainerGraph.ParentWindow.OutsideGraph.CurrentStandardSurface.AdditionalPragmas.OutsideList.Contains( m_pragmas[ i ] ) )
                //	//{
                //	//	ContainerGraph.ParentWindow.OutsideGraph.CurrentStandardSurface.AdditionalPragmas.OutsideList.Remove( m_pragmas[ i ] );
                //	//}
                //	ContainerGraph.ParentWindow.OutsideGraph.CurrentStandardSurface.AdditionalDirectives.RemoveShaderFunctionItem( AdditionalLineType.Pragma, m_pragmas[ i ] );
                //}
                ContainerGraph.ParentWindow.OutsideGraph.CurrentStandardSurface.AdditionalDirectives.RemoveShaderFunctionItems(m_directives);
                m_directives.Clear();
                m_directives = null;
            }

            if (m_reordenator != null)
            {
                ParentGraph cachedGraph = ContainerGraph.ParentWindow.CustomGraph;
                ContainerGraph.ParentWindow.CustomGraph = null;
                UIUtils.UnregisterPropertyNode(m_reordenator);
                ContainerGraph.ParentWindow.CustomGraph = cachedGraph;

                m_reordenator.Destroy();
                m_reordenator = null;
            }

            UIUtils.UnregisterFunctionNode(this);

            ParentGraph cachedGraph2 = ContainerGraph.ParentWindow.CustomGraph;

            ContainerGraph.ParentWindow.CustomGraph = m_functionGraph;

            if (m_allFunctionInputs != null)
            {
                m_allFunctionInputs.Clear();
            }
            m_allFunctionInputs = null;

            if (m_allFunctionOutputs != null)
            {
                m_allFunctionOutputs.Clear();
            }
            m_allFunctionOutputs = null;

            if (m_functionGraph != null)
            {
                m_functionGraph.SoftDestroy();
            }
            m_functionGraph = null;

            ContainerGraph.ParentWindow.CustomGraph = cachedGraph2;
            m_function = null;

            m_allFunctionOutputsDict.Clear();
            m_allFunctionOutputsDict = null;

            m_allFunctionSwitchesDict.Clear();
            m_allFunctionSwitchesDict = null;

            m_allFunctionInputsDict.Clear();
            m_allFunctionInputsDict = null;
        }