Example #1
0
        public void FillDataCollector(TemplateMultiPassMasterNode owner, ref MasterNodeDataCollector dataCollector)
        {
            InputPort port = null;

            if (m_portId > -1)
            {
                port = owner.GetInputPortByUniqueId(m_portId);
            }
            else
            {
                port = owner.InputPorts.Find(x => x.Name.Equals(m_options.Name));
            }

            if (port != null)
            {
                int optionId = port.HasOwnOrLinkConnection ? 0 : 1;
                for (int i = 0; i < m_options.ActionsPerOption[optionId].Length; i++)
                {
                    switch (m_options.ActionsPerOption[optionId][i].ActionType)
                    {
                    case AseOptionsActionType.SetDefine:
                    {
                        List <TemplateMultiPassMasterNode> nodes = owner.ContainerGraph.GetMultiPassMasterNodes(owner.LODIndex);
                        int count = nodes.Count;
                        for (int nodeIdx = 0; nodeIdx < count; nodeIdx++)
                        {
                            nodes[nodeIdx].OptionsDefineContainer.AddDefine("#define " + m_options.ActionsPerOption[optionId][i].ActionData, false);
                        }
                        //dataCollector.AddToDefines( -1, m_options.ActionsPerOption[ optionId ][ i ].ActionData );
                    }
                    break;

                    case AseOptionsActionType.SetUndefine:
                    {
                        List <TemplateMultiPassMasterNode> nodes = owner.ContainerGraph.GetMultiPassMasterNodes(owner.LODIndex);
                        int count = nodes.Count;
                        for (int nodeIdx = 0; nodeIdx < count; nodeIdx++)
                        {
                            nodes[nodeIdx].OptionsDefineContainer.AddDefine("#undef " + m_options.ActionsPerOption[optionId][i].ActionData, false);
                        }
                        //dataCollector.AddToDefines( -1, m_options.ActionsPerOption[ optionId ][ i ].ActionData, false );
                    }
                    break;

                    case AseOptionsActionType.SetShaderProperty:
                    {
                        TemplateShaderPropertyData data = owner.CurrentTemplate.GetShaderPropertyData(m_options.ActionsPerOption[optionId][i].ActionData);
                        if (data != null)
                        {
                            string newPropertyValue = data.CreatePropertyForValue(m_options.ActionsPerOption[optionId][i].ActionBuffer);
                            owner.CurrentTemplate.IdManager.SetReplacementText(data.FullValue, newPropertyValue);
                        }
                    }
                    break;
                    }
                }
            }
        }
Example #2
0
        public override void DeactivateInputPortNode(int deactivatedPort, bool forceComplete)
        {
            InputPort port = GetInputPortByUniqueId(deactivatedPort);

            if (deactivatedPort == m_currentSelectedInput)
            {
                port.GetOutputNode().DeactivateNode(deactivatedPort, false);
            }
        }
Example #3
0
 public override void Destroy()
 {
     base.Destroy();
     m_uvPort         = null;
     m_texPort        = null;
     m_scalePort      = null;
     m_viewdirTanPort = null;
     m_pomUVPort      = null;
 }
        void DrawInstancedProperties()
        {
            string[] arr = UIUtils.GlobalArrayNodeArr();
            bool     guiEnabledBuffer = GUI.enabled;

            if (arr != null && arr.Length > 0)
            {
                GUI.enabled = true;
            }
            else
            {
                m_referenceArrayId = -1;
                m_referenceNodeId  = -1;
                m_referenceNode    = null;
                GUI.enabled        = false;
            }
            EditorGUI.BeginChangeCheck();
            m_referenceArrayId = EditorGUILayoutPopup(Constants.AvailableReferenceStr, m_referenceArrayId, arr);
            if (EditorGUI.EndChangeCheck())
            {
                m_referenceNode = UIUtils.GetGlobalArrayNode(m_referenceArrayId);
                if (m_referenceNode != null)
                {
                    m_referenceNodeId = m_referenceNode.UniqueId;
                }
                UpdatePorts();
            }

            GUI.enabled = guiEnabledBuffer;

            InputPort indexXPort = GetInputPortByUniqueId(0);

            if (!indexXPort.IsConnected)
            {
                EditorGUI.BeginChangeCheck();
                m_indexX = EditorGUILayoutIntField(indexXPort.Name, m_indexX);
                if (EditorGUI.EndChangeCheck())
                {
                    m_indexX = Mathf.Clamp(m_indexX, 0, (m_arrayLengthX - 1));
                }
            }

            if (m_isJagged)
            {
                InputPort indexYPort = GetInputPortByUniqueId(2);
                if (!indexYPort.IsConnected)
                {
                    EditorGUI.BeginChangeCheck();
                    m_indexY = EditorGUILayoutIntField(indexYPort.Name, m_indexY);
                    if (EditorGUI.EndChangeCheck())
                    {
                        m_indexY = Mathf.Clamp(m_indexY, 0, (m_arrayLengthY - 1));
                    }
                }
            }
        }
        public override string GenerateShaderForOutput(int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar)
        {
            if (m_outputPorts[0].IsLocalValue(dataCollector.PortCategory))
            {
                return(m_outputPorts[0].LocalValue(dataCollector.PortCategory));
            }

            if (m_referenceType == TexReferenceType.Instance)
            {
                return(GenerateInstancedShaderForOutput(outputId, ref dataCollector, ignoreLocalvar));
            }

            string dataType = UIUtils.FinalPrecisionWirePortToCgType(m_currentPrecisionType, AvailableTypesValues[m_type]);

            InputPort indexXPort       = GetInputPortByUniqueId(0);
            InputPort arrayLengthXPort = GetInputPortByUniqueId(1);
            string    result           = string.Empty;

            if (m_isJagged)
            {
                InputPort indexYPort       = GetInputPortByUniqueId(2);
                InputPort arrayLengthYPort = GetInputPortByUniqueId(3);

                string arrayIndexX  = indexXPort.IsConnected ? indexXPort.GeneratePortInstructions(ref dataCollector) : m_indexX.ToString();
                string arrayLengthX = arrayLengthXPort.IsConnected ? arrayLengthXPort.GeneratePortInstructions(ref dataCollector) : m_arrayLengthX.ToString();

                string arrayIndexY  = indexYPort.IsConnected ? indexYPort.GeneratePortInstructions(ref dataCollector) : m_indexY.ToString();
                string arrayLengthY = arrayLengthYPort.IsConnected ? arrayLengthYPort.GeneratePortInstructions(ref dataCollector) : m_arrayLengthY.ToString();

                dataCollector.AddToUniforms(UniqueId, dataType, string.Format(JaggedArrayFormatStr, m_name, arrayLengthX, arrayLengthY));
                if (m_autoRangeCheck)
                {
                    arrayIndexX = string.Format("clamp({0},0,({1} - 1))", arrayIndexX, arrayLengthX);
                    arrayIndexY = string.Format("clamp({0},0,({1} - 1))", arrayIndexY, arrayLengthY);
                }
                result = string.Format(JaggedArrayFormatStr, m_name, arrayIndexX, arrayIndexY);
            }
            else
            {
                string arrayIndex  = indexXPort.IsConnected ? indexXPort.GeneratePortInstructions(ref dataCollector) : m_indexX.ToString();
                string arrayLength = arrayLengthXPort.IsConnected ? arrayLengthXPort.GeneratePortInstructions(ref dataCollector) : m_arrayLengthX.ToString();


                dataCollector.AddToUniforms(UniqueId, dataType, string.Format(ArrayFormatStr, m_name, arrayLength));

                if (m_autoRangeCheck)
                {
                    arrayIndex = string.Format("clamp({0},0,({1} - 1))", arrayIndex, arrayLength);
                }

                result = string.Format(ArrayFormatStr, m_name, arrayIndex);
            }

            m_outputPorts[0].SetLocalValue(result, dataCollector.PortCategory);
            return(m_outputPorts[0].LocalValue(dataCollector.PortCategory));
        }
        public TemplateOptionPortItem(TemplateMultiPassMasterNode owner, TemplateOptionsItem options)
        {
            m_options = options;
            InputPort port = owner.InputPorts.Find(x => x.Name.Equals(options.Name));

            if (port != null)
            {
                m_portId = port.PortId;
            }
        }
Example #7
0
        public void SubShaderFillDataCollector(TemplateMultiPassMasterNode owner, ref MasterNodeDataCollector dataCollector)
        {
            //TemplateMultiPassMasterNode targetNode = string.IsNullOrEmpty(m_options.Id) ? owner:owner.ContainerGraph.GetMasterNodeOfPass( m_options.Id , owner.LODIndex );
            TemplateMultiPassMasterNode targetNode = string.IsNullOrEmpty(m_options.Id) ?
                                                     owner.ContainerGraph.GetMainMasterNodeOfLOD(owner.LODIndex) :
                                                     owner.ContainerGraph.GetMasterNodeOfPass(m_options.Id, owner.LODIndex);

            InputPort port = null;

            if (m_portId > -1)
            {
                port = targetNode.GetInputPortByUniqueId(m_portId);
            }
            else
            {
                port = targetNode.InputPorts.Find(x => x.Name.Equals(m_options.Name));
            }

            if (port != null)
            {
                int optionId = port.HasOwnOrLinkConnection ? 0 : 1;
                for (int i = 0; i < m_options.ActionsPerOption[optionId].Length; i++)
                {
                    if (string.IsNullOrEmpty(m_options.ActionsPerOption[optionId][i].PassName) ||
                        m_options.ActionsPerOption[optionId][i].PassName.Equals(owner.PassName))
                    {
                        switch (m_options.ActionsPerOption[optionId][i].ActionType)
                        {
                        case AseOptionsActionType.SetDefine:
                        {
                            owner.OptionsDefineContainer.AddDefine("#define " + m_options.ActionsPerOption[optionId][i].ActionData, true);
                        }
                        break;

                        case AseOptionsActionType.SetUndefine:
                        {
                            owner.OptionsDefineContainer.AddDefine("#undef " + m_options.ActionsPerOption[optionId][i].ActionData, true);
                        }
                        break;

                        case AseOptionsActionType.SetShaderProperty:
                        {
                            TemplateShaderPropertyData data = owner.CurrentTemplate.GetShaderPropertyData(m_options.ActionsPerOption[optionId][i].ActionData);
                            if (data != null)
                            {
                                string newPropertyValue = data.CreatePropertyForValue(m_options.ActionsPerOption[optionId][i].ActionBuffer);
                                owner.CurrentTemplate.IdManager.SetReplacementText(data.FullValue, newPropertyValue);
                            }
                        }
                        break;
                        }
                    }
                }
            }
        }
        void UpdatePorts()
        {
            InputPort indexXPort       = GetInputPortByUniqueId(0);
            InputPort arrayLengthPortX = GetInputPortByUniqueId(1);
            InputPort indexYPort       = GetInputPortByUniqueId(2);
            InputPort arrayLengthPortY = GetInputPortByUniqueId(3);

            if (m_referenceType == TexReferenceType.Object)
            {
                m_headerColorModifier = Color.white;
                SetAdditonalTitleText(string.Format(Constants.SubTitleValueFormatStr, m_name));
                arrayLengthPortX.Visible = true;
                if (m_isJagged)
                {
                    indexXPort.Name          = "Index X";
                    arrayLengthPortX.Name    = "Array Length X";
                    indexYPort.Visible       = true;
                    arrayLengthPortY.Visible = true;
                }
                else
                {
                    indexXPort.Name          = "Index";
                    arrayLengthPortX.Name    = "Array Length";
                    indexYPort.Visible       = false;
                    arrayLengthPortY.Visible = false;
                }
            }
            else if (m_referenceNodeId > -1)
            {
                m_headerColorModifier = ReferenceHeaderColor;
                if (m_referenceNode == null)
                {
                    m_referenceNode = UIUtils.GetNode(m_referenceNodeId) as GlobalArrayNode;
                }

                if (m_referenceNode != null)
                {
                    SetAdditonalTitleText(string.Format(Constants.SubTitleValueFormatStr, m_referenceNode.DataToArray));
                    arrayLengthPortX.Visible = false;
                    arrayLengthPortY.Visible = false;
                    if (m_referenceNode.IsJagged)
                    {
                        indexXPort.Name    = "Index X";
                        indexYPort.Visible = true;
                    }
                    else
                    {
                        indexXPort.Name    = "Index";
                        indexYPort.Visible = false;
                    }
                }
            }
            m_sizeIsDirty = true;
        }
Example #9
0
 public override void RefreshExternalReferences()
 {
     base.RefreshExternalReferences();
     if (UIUtils.CurrentShaderVersion() < 16303)
     {
         InputPort standardPort = GetInputPortByUniqueId(0);
         if (standardPort.IsConnected)
         {
             UIUtils.SetConnection(UniqueId, 3, standardPort.GetConnection().NodeId, standardPort.GetConnection().PortId);
         }
     }
 }
Example #10
0
 protected override void CommonInit(int uniqueId)
 {
     base.CommonInit(uniqueId);
     AddInputPort(WirePortDataType.SAMPLER2D, false, "Tex");
     m_inputPorts[0].CreatePortRestrictions(WirePortDataType.SAMPLER1D, WirePortDataType.SAMPLER2D, WirePortDataType.SAMPLER3D, WirePortDataType.SAMPLERCUBE, WirePortDataType.SAMPLER2DARRAY);
     AddOutputPort(WirePortDataType.SAMPLERSTATE, "Out");
     m_texPort                 = m_inputPorts[0];
     m_hasLeftDropdown         = true;
     m_autoWrapProperties      = true;
     m_errorMessageTypeIsError = NodeMessageType.Warning;
     m_errorMessageTooltip     = MessageMacrosOFF;
 }
Example #11
0
 public override void NotifyExternalRefencesOnChange()
 {
     for (int i = 0; i < m_externalReferences.Count; i++)
     {
         ParentNode node = UIUtils.GetNode(m_externalReferences[i].NodeId);
         if (node)
         {
             InputPort port = node.GetInputPortById(m_externalReferences[i].PortId);
             port.UpdateInfoOnExternalConn(m_nodeId, m_portId, m_dataType);
             node.OnConnectedOutputNodeChanges(m_externalReferences[i].PortId, m_nodeId, m_portId, m_name, m_dataType);
         }
     }
 }
        public override void ReadInputDataFromString(ref string[] nodeParams)
        {
            if (UIUtils.CurrentShaderVersion() > 7003)
            {
                base.ReadInputDataFromString(ref nodeParams);
            }
            else
            {
                for (int i = 0; i < 2 && i < nodeParams.Length && m_currentReadParamIdx < nodeParams.Length; i++)
                {
                    if (UIUtils.CurrentShaderVersion() < 5003)
                    {
                        int newId = VersionConvertInputPortId(i) + 1;
                        if (UIUtils.CurrentShaderVersion() > 23)
                        {
                            m_inputPorts[newId].DataType = (WirePortDataType)Enum.Parse(typeof(WirePortDataType), nodeParams[m_currentReadParamIdx++]);
                        }

                        m_inputPorts[newId].InternalData = nodeParams[m_currentReadParamIdx++];
                        if (m_inputPorts[newId].IsEditable && UIUtils.CurrentShaderVersion() >= 3100 && m_currentReadParamIdx < nodeParams.Length)
                        {
                            m_inputPorts[newId].Name = nodeParams[m_currentReadParamIdx++];
                        }
                    }
                    else
                    {
                        int portId = Convert.ToInt32(nodeParams[m_currentReadParamIdx++]);
                        WirePortDataType DataType     = (WirePortDataType)Enum.Parse(typeof(WirePortDataType), nodeParams[m_currentReadParamIdx++]);
                        string           InternalData = nodeParams[m_currentReadParamIdx++];
                        bool             isEditable   = Convert.ToBoolean(nodeParams[m_currentReadParamIdx++]);
                        string           Name         = string.Empty;
                        if (isEditable && m_currentReadParamIdx < nodeParams.Length)
                        {
                            Name = nodeParams[m_currentReadParamIdx++];
                        }

                        InputPort inputPort = GetInputPortByUniqueId(portId);
                        if (inputPort != null)
                        {
                            inputPort.DataType     = DataType;
                            inputPort.InternalData = InternalData;
                            if (!string.IsNullOrEmpty(Name))
                            {
                                inputPort.Name = Name;
                            }
                        }
                    }
                }
            }
        }
Example #13
0
        void NewUpdateBehaviorConn(int portId, bool onLoading)
        {
            InputPort inputPort         = GetInputPortByUniqueId(portId);
            int       channelsRequired  = UIUtils.GetChannelsAmount(onLoading ? inputPort.DataType : inputPort.ConnectionType(0));
            int       availableChannels = UIUtils.GetChannelsAmount(m_selectedOutputType);

            // Invalidate previously used channels
            for (int i = 0; i < availableChannels; i++)
            {
                if (m_occupiedChannels[i] == portId)
                {
                    m_occupiedChannels[i]   = -1;
                    m_inputPorts[i].Visible = true;
                }
            }
            // Lock available channels to port
            int len = Mathf.Min(portId + channelsRequired, availableChannels);

            int channelsUsed = 0;

            for (int i = portId; i < len; i++)
            {
                if (m_occupiedChannels[i] == -1)
                {
                    m_occupiedChannels[i] = portId;
                    channelsUsed         += 1;
                }
                else
                {
                    break;
                }
            }

            if (!onLoading)
            {
                inputPort.ChangeType(UIUtils.GetWireTypeForChannelAmount(channelsUsed), false);
            }

            if (channelsUsed > 1 && portId < availableChannels - 1)
            {
                channelsUsed -= 1;
                int i = portId + 1;
                for ( ; channelsUsed > 0; i++, --channelsUsed)
                {
                    m_inputPorts[i].Visible = false;
                }
            }
            m_sizeIsDirty = true;
        }
 protected override void CommonInit(int uniqueId)
 {
     base.CommonInit(uniqueId);
     AddInputPort(WirePortDataType.OBJECT, true, Constants.EmptyPortValue);
     AddInputPort(WirePortDataType.FLOAT, false, "Time");
     AddOutputColorPorts("RGBA", true);
     m_gradPort                 = m_inputPorts[0];
     m_useInternalPortData      = true;
     m_autoDrawInternalPortData = true;
     m_drawPreviewExpander      = false;
     m_drawPreview              = true;
     m_showPreview              = true;
     m_selectedLocation         = PreviewLocation.TopCenter;
     m_previewShaderGUID        = "8a09124cd6e4aa54a996e7487ec16b90";
 }
Example #15
0
		public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true )
		{
			InputPort port = GetInputPortByUniqueId( portId ):
			int arrayPos = m_inputPorts.IndexOf( port ):
			if( activateNode && m_connStatus == NodeConnectionStatus.Connected && arrayPos == m_currentSelectedInput )
			{
				port.GetOutputNode().ActivateNode( m_activeNode, m_activePort, m_activeType ):
			}

			OnNodeChange():
			SetSaveIsDirty():

			m_inputPorts[ portId ].MatchPortToConnection():
			if( arrayPos == m_currentSelectedInput )
				m_outputPorts[ 0 ].ChangeType( m_inputPorts[ portId ].DataType, false ):
		}
        public void FillDataCollector(TemplateMultiPassMasterNode owner, ref MasterNodeDataCollector dataCollector)
        {
            InputPort port = null;

            if (m_portId > -1)
            {
                port = owner.GetInputPortByUniqueId(m_portId);
            }
            else
            {
                port = owner.InputPorts.Find(x => x.Name.Equals(m_options.Name));
            }

            if (port != null)
            {
                int optionId = port.HasOwnOrLinkConnection ? 0 : 1;
                for (int i = 0; i < m_options.ActionsPerOption[optionId].Length; i++)
                {
                    switch (m_options.ActionsPerOption[optionId][i].ActionType)
                    {
                    case AseOptionsActionType.SetDefine:
                    {
                        List <TemplateMultiPassMasterNode> nodes = owner.ContainerGraph.MultiPassMasterNodes.NodesList;
                        int count = nodes.Count;
                        for (int nodeIdx = 0; nodeIdx < count; nodeIdx++)
                        {
                            nodes[nodeIdx].OptionsDefineContainer.AddDefine("#define " + m_options.ActionsPerOption[optionId][i].ActionData, false);
                        }
                        //dataCollector.AddToDefines( -1, m_options.ActionsPerOption[ optionId ][ i ].ActionData );
                    }
                    break;

                    case AseOptionsActionType.SetUndefine:
                    {
                        List <TemplateMultiPassMasterNode> nodes = owner.ContainerGraph.MultiPassMasterNodes.NodesList;
                        int count = nodes.Count;
                        for (int nodeIdx = 0; nodeIdx < count; nodeIdx++)
                        {
                            nodes[nodeIdx].OptionsDefineContainer.AddDefine("#undef " + m_options.ActionsPerOption[optionId][i].ActionData, false);
                        }
                        //dataCollector.AddToDefines( -1, m_options.ActionsPerOption[ optionId ][ i ].ActionData, false );
                    }
                    break;
                    }
                }
            }
        }
        public override void Destroy()
        {
            base.Destroy();
            //Not calling m_texCoordsHelper.Destroy() on purpose so UIUtils does not incorrectly unregister stuff
            if (m_texCoordsHelper != null)
            {
                DestroyImmediate(m_texCoordsHelper);
                m_texCoordsHelper = null;
            }


            m_uvPort         = null;
            m_texPort        = null;
            m_scalePort      = null;
            m_viewdirTanPort = null;
            m_pomUVPort      = null;
        }
Example #18
0
        protected override void CommonInit(int uniqueId)
        {
            base.CommonInit(uniqueId);
            AddOutputColorPorts("RGBA");
            m_colorPort = m_outputPorts[0];
            AddInputPort(WirePortDataType.SAMPLER2D, false, "Tex", -1, MasterNodePortCategory.Fragment, 6);
            AddInputPort(WirePortDataType.FLOAT2, false, "UV", -1, MasterNodePortCategory.Fragment, 0);
            AddInputPort(WirePortDataType.FLOAT, false, "Index", -1, MasterNodePortCategory.Fragment, 1);
            AddInputPort(WirePortDataType.FLOAT, false, "Level", -1, MasterNodePortCategory.Fragment, 2);
            AddInputPort(WirePortDataType.FLOAT, false, NormalScaleStr, -1, MasterNodePortCategory.Fragment, 3);
            AddInputPort(WirePortDataType.FLOAT2, false, "DDX", -1, MasterNodePortCategory.Fragment, 4);
            AddInputPort(WirePortDataType.FLOAT2, false, "DDY", -1, MasterNodePortCategory.Fragment, 5);
            m_inputPorts[2].AutoDrawInternalData = true;

            m_texPort   = m_inputPorts[0];
            m_uvPort    = m_inputPorts[1];
            m_indexPort = m_inputPorts[2];
            m_lodPort   = m_inputPorts[3];

            m_lodPort.Visible              = false;
            m_normalPort                   = m_inputPorts[4];
            m_normalPort.Visible           = m_autoUnpackNormals;
            m_normalPort.FloatInternalData = 1.0f;
            m_ddxPort         = m_inputPorts[5];
            m_ddxPort.Visible = false;
            m_ddyPort         = m_inputPorts[6];
            m_ddyPort.Visible = false;
            m_insideSize.Set(128, 128 + 5);
            m_drawPrecisionUI      = false;
            m_currentParameterType = PropertyType.Property;

            m_availableAttribs.Add(new PropertyAttributes("No Scale Offset", "[NoScaleOffset]"));

            m_freeType            = false;
            m_showPreview         = true;
            m_drawPreviewExpander = false;
            m_drawPreview         = false;
            m_drawPicker          = true;
            m_customPrefix        = "Texture Array ";
            m_selectedLocation    = PreviewLocation.TopCenter;
            m_precisionString     = UIUtils.FinalPrecisionWirePortToCgType(m_currentPrecisionType, m_outputPorts[0].DataType);
            m_previewShaderGUID   = "2e6d093df2d289f47b827b36efb31a81";
            m_showAutoRegisterUI  = false;
        }
Example #19
0
        public override void Destroy()
        {
            base.Destroy();
            m_defaultTextureArray  = null;
            m_materialTextureArray = null;

            m_texPort    = null;
            m_uvPort     = null;
            m_indexPort  = null;
            m_lodPort    = null;
            m_normalPort = null;
            m_ddxPort    = null;
            m_ddyPort    = null;

            if (m_referenceType == TexReferenceType.Object)
            {
                UIUtils.UnregisterTextureArrayNode(this);
                UIUtils.UnregisterPropertyNode(this);
            }
        }
Example #20
0
		public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true )
		{
			base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ):
			FunctionInput functionInput = m_refreshIdsRequired ? m_allFunctionInputs[ portId ] : GetFunctionInputByUniqueId( portId ):
			if( functionInput.AutoCast )
			{
				InputPort inputPort = m_refreshIdsRequired ? m_inputPorts[ portId ] : GetInputPortByUniqueId( portId ):
				inputPort.MatchPortToConnection():

				ParentGraph cachedGraph = ContainerGraph.ParentWindow.CustomGraph:
				ContainerGraph.ParentWindow.CustomGraph = m_functionGraph:
				functionInput.ChangeOutputType( inputPort.DataType, false ):
				ContainerGraph.ParentWindow.CustomGraph = cachedGraph:
			}

			for( int i = 0: i < m_allFunctionOutputs.Count: i++ )
			{
				m_outputPorts[ i ].ChangeType( m_allFunctionOutputs[ i ].InputPorts[ 0 ].DataType, false ):
			}
		}
        protected override void CommonInit(int uniqueId)
        {
            base.CommonInit(uniqueId);
            AddInputPort(WirePortDataType.FLOAT, false, Constants.EmptyPortValue);
            AddInputPort(WirePortDataType.SAMPLER2D, false, "Pattern");
            m_inputPorts[1].CreatePortRestrictions(WirePortDataType.SAMPLER2D);
            m_texPort = m_inputPorts[1];
            AddInputPort(WirePortDataType.FLOAT4, false, "Screen Position");

            AddInputPort(WirePortDataType.SAMPLERSTATE, false, "SS");
            m_inputPorts[3].CreatePortRestrictions(WirePortDataType.SAMPLERSTATE);
            m_ssPort = m_inputPorts[3];

            AddOutputPort(WirePortDataType.FLOAT, Constants.EmptyPortValue);
            m_textLabelWidth     = 110;
            m_autoWrapProperties = true;
            m_hasLeftDropdown    = true;
            SetAdditonalTitleText(string.Format(Constants.SubTitleTypeFormatStr, PatternsStr[m_selectedPatternInt]));
            UpdatePorts();
        }
Example #22
0
		public override void OnConnectedOutputNodeChanges( int inputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type )
		{
			base.OnConnectedOutputNodeChanges( inputPortId, otherNodeId, otherPortId, name, type );
			FunctionInput functionInput = m_refreshIdsRequired ? m_allFunctionInputs[ inputPortId ] : GetFunctionInputByUniqueId( inputPortId );
			if( functionInput.AutoCast )
			{
				InputPort inputPort = m_refreshIdsRequired ? m_inputPorts[ inputPortId ] : GetInputPortByUniqueId( inputPortId );
				inputPort.MatchPortToConnection();

				ParentGraph cachedGraph = ContainerGraph.ParentWindow.CustomGraph;
				ContainerGraph.ParentWindow.CustomGraph = m_functionGraph;
				functionInput.ChangeOutputType( inputPort.DataType, false );
				ContainerGraph.ParentWindow.CustomGraph = cachedGraph;
			}

			for( int i = 0; i < m_allFunctionOutputs.Count; i++ )
			{
				m_outputPorts[ i ].ChangeType( m_allFunctionOutputs[ i ].InputPorts[ 0 ].DataType, false );
			}
		}
        public void SubShaderFillDataCollector(TemplateMultiPassMasterNode owner, ref MasterNodeDataCollector dataCollector)
        {
            TemplateMultiPassMasterNode targetNode = string.IsNullOrEmpty(m_options.Id) ? owner:owner.ContainerGraph.GetMasterNodeOfPass(m_options.Id);
            InputPort port = null;

            if (m_portId > -1)
            {
                port = targetNode.GetInputPortByUniqueId(m_portId);
            }
            else
            {
                port = targetNode.InputPorts.Find(x => x.Name.Equals(m_options.Name));
            }


            if (port != null)
            {
                int optionId = port.HasOwnOrLinkConnection ? 0 : 1;
                for (int i = 0; i < m_options.ActionsPerOption[optionId].Length; i++)
                {
                    if (string.IsNullOrEmpty(m_options.ActionsPerOption[optionId][i].PassName) ||
                        m_options.ActionsPerOption[optionId][i].PassName.Equals(owner.PassName))
                    {
                        switch (m_options.ActionsPerOption[optionId][i].ActionType)
                        {
                        case AseOptionsActionType.SetDefine:
                        {
                            owner.OptionsDefineContainer.AddDefine("#define " + m_options.ActionsPerOption[optionId][i].ActionData, true);
                        }
                        break;

                        case AseOptionsActionType.SetUndefine:
                        {
                            owner.OptionsDefineContainer.AddDefine("#undef " + m_options.ActionsPerOption[optionId][i].ActionData, true);
                        }
                        break;
                        }
                    }
                }
            }
        }
Example #24
0
        //public void AnaliseNode( ParentNode node, int outputTargetId, eWirePortDataType inputPortType, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar )
        //{
        //	dataCollector.AddInstructions( node.GetValueFromOutputStr( outputTargetId, inputPortType, ref dataCollector, ignoreLocalVar ) );
        //}

        public void CreateInstructionsForPort(InputPort port, string portName, bool addCustomDelimiters = false, string customDelimiterIn = null, string customDelimiterOut = null, bool ignoreLocalVar = false)
        {
            WireReference connection = port.GetConnection();
            ParentNode    node       = UIUtils.GetNode(connection.NodeId);

            string newInstruction = node.GetValueFromOutputStr(connection.PortId, port.DataType, ref UIUtils.CurrentDataCollector, ignoreLocalVar);

            if (UIUtils.CurrentDataCollector.DirtySpecialLocalVariables)
            {
                UIUtils.CurrentDataCollector.AddInstructions(UIUtils.CurrentDataCollector.SpecialLocalVariables);
                UIUtils.CurrentDataCollector.ClearSpecialLocalVariables();
            }
            if (UIUtils.CurrentDataCollector.ForceNormal)
            {
                UIUtils.CurrentDataCollector.AddToStartInstructions("\t\t\t" + Constants.OutputVarStr + ".Normal = float3(0,0,1);\n");
                UIUtils.CurrentDataCollector.ForceNormal = false;
            }

            UIUtils.CurrentDataCollector.AddInstructions(addCustomDelimiters ? customDelimiterIn : ("\t\t\t" + portName + " = "));
            UIUtils.CurrentDataCollector.AddInstructions(newInstruction);
            UIUtils.CurrentDataCollector.AddInstructions(addCustomDelimiters ? customDelimiterOut : ";\n");
        }
        public string GenerateInstancedShaderForOutput(int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar)
        {
            string result = string.Empty;

            if (m_referenceNode != null)
            {
                InputPort indexXPort = GetInputPortByUniqueId(0);
                if (m_referenceNode.IsJagged)
                {
                    InputPort indexYPort  = GetInputPortByUniqueId(2);
                    string    arrayIndexX = indexXPort.IsConnected ? indexXPort.GeneratePortInstructions(ref dataCollector) : m_indexX.ToString();
                    string    arrayIndexY = indexYPort.IsConnected ? indexYPort.GeneratePortInstructions(ref dataCollector) : m_indexY.ToString();
                    result = m_referenceNode.GetArrayValue(arrayIndexX, arrayIndexY);
                }
                else
                {
                    string arrayIndexX = indexXPort.IsConnected ? indexXPort.GeneratePortInstructions(ref dataCollector) : m_indexX.ToString();
                    result = m_referenceNode.GetArrayValue(arrayIndexX);
                }
            }
            m_outputPorts[0].SetLocalValue(result, dataCollector.PortCategory);
            return(result);
        }
Example #26
0
		public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar )
		{
			base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ):
			if ( outputId < m_outputData.Count )
			{
				Dictionary<string, InputPort> inputs = InputPortsDict:

				string value = m_outputData[ outputId ].expression:
				for ( int i = 0: i < m_outputData[ outputId ].inputData.Count: i++ )
				{
					if ( inputs.ContainsKey( m_outputData[ outputId ].inputData[ i ].name ) )
					{
						InputPort inputPort = inputs[ m_outputData[ outputId ].inputData[ i ].name ]:
						if ( inputPort != null )
						{
							string inputValue = inputPort.GenerateShaderForOutput( ref dataCollector, WirePortDataType.OBJECT, ignoreLocalvar ):
							value = value.Replace( m_outputData[ outputId ].inputData[ i ].name, inputValue ):
						}
						else
						{
							UIUtils.ShowMessage( m_outputData[ outputId ].inputData[ i ].name + " invalid on the inputs list", MessageSeverity.Error ):
							return string.Empty:
						}
					}
					else
					{
						UIUtils.ShowMessage( m_outputData[ outputId ].inputData[ i ].name + " Not found on the inputs list", MessageSeverity.Error ):
						return string.Empty:
					}
				}
				return value:

			}

			return string.Empty:
		}
Example #27
0
        public void DuplicateMe()
        {
            bool previewOpen = m_showPreview;

            string allOptions = m_allFunctionSwitches.Count.ToString();

            for (int i = 0; i < m_allFunctionSwitches.Count; i++)
            {
                allOptions += "," + m_allFunctionSwitches[i].UniqueId + "," + m_allFunctionSwitches[i].GetCurrentSelectedInput();
            }

            ReadOptionsHelper = allOptions.Split(',');

            ParentGraph cachedGraph = ContainerGraph.ParentWindow.CustomGraph;

            ContainerGraph.ParentWindow.CustomGraph = null;
            MasterNode masterNode = ContainerGraph.ParentWindow.CurrentGraph.CurrentMasterNode;

            if (masterNode != null)
            {
                masterNode.InvalidateMaterialPropertyCount();
            }

            ContainerGraph.ParentWindow.CustomGraph = cachedGraph;

            ParentNode newNode = ContainerGraph.CreateNode(m_function, false, Vec2Position);

            newNode.ShowPreview = previewOpen;
            (newNode as FunctionNode).ReadOptionsHelper = ReadOptionsHelper;
            newNode.RefreshExternalReferences();
            if ((newNode as FunctionNode).m_reordenator && m_reordenator)
            {
                (newNode as FunctionNode).m_reordenator.OrderIndex = m_reordenator.OrderIndex;
            }

            for (int i = 0; i < m_outputPorts.Count; i++)
            {
                if (m_outputPorts[i].IsConnected)
                {
                    OutputPort newOutputPort = newNode.GetOutputPortByUniqueId(m_outputPorts[i].PortId);
                    if (newNode.OutputPorts != null && newOutputPort != null)
                    {
                        for (int j = m_outputPorts[i].ExternalReferences.Count - 1; j >= 0; j--)
                        {
                            ContainerGraph.CreateConnection(m_outputPorts[i].ExternalReferences[j].NodeId, m_outputPorts[i].ExternalReferences[j].PortId, newOutputPort.NodeId, newOutputPort.PortId);
                        }
                    }
                }
                //else
                //{
                //if( newNode.OutputPorts != null && newNode.OutputPorts[ i ] != null )
                //{
                //    ContainerGraph.DeleteConnection( false, newNode.UniqueId, newNode.OutputPorts[ i ].PortId, false, false, false );
                //}
                //}
            }

            for (int i = 0; i < m_inputPorts.Count; i++)
            {
                if (m_inputPorts[i].IsConnected)
                {
                    InputPort newInputPort = newNode.GetInputPortByUniqueId(m_inputPorts[i].PortId);
                    if (newNode.InputPorts != null && newInputPort != null)
                    {
                        ContainerGraph.CreateConnection(newInputPort.NodeId, newInputPort.PortId, m_inputPorts[i].ExternalReferences[0].NodeId, m_inputPorts[i].ExternalReferences[0].PortId);
                    }
                }
            }

            ContainerGraph.OnDuplicateEvent -= DuplicateMe;

            if (Selected)
            {
                ContainerGraph.DeselectNode(this);
                ContainerGraph.SelectNode(newNode, true, false);
            }

            ContainerGraph.DestroyNode(this, false);
        }
Example #28
0
        public override string GenerateShaderForOutput(int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar)
        {
            if (m_outputPorts[0].IsLocalValue)
            {
                return(m_outputPorts[0].LocalValue);
            }

            InputPort vertexPort = GetInputPortByUniqueId(2);
            InputPort lengthPort = GetInputPortByUniqueId(0);
            InputPort offsetPort = GetInputPortByUniqueId(1);

            string distance = lengthPort.GeneratePortInstructions(ref dataCollector);
            string offset   = offsetPort.GeneratePortInstructions(ref dataCollector);

            string value    = string.Empty;
            string eyeDepth = string.Empty;

            if (dataCollector.IsTemplate)
            {
                if (vertexPort.IsConnected)
                {
                    string varName = "customSurfaceDepth" + OutputId;
                    GenerateInputInVertex(ref dataCollector, 2, varName, false);

                    string formatStr = string.Empty;
                    if (dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.Lightweight)
                    {
                        formatStr = "-TransformWorldToView(TransformObjectToWorld({0})).z";
                    }
                    else
                    {
                        formatStr = "-UnityObjectToViewPos({0}).z";
                    }

                    string eyeInstruction = string.Format(formatStr, varName);
                    eyeDepth = "customEye" + OutputId;
                    dataCollector.TemplateDataCollectorInstance.RegisterCustomInterpolatedData(eyeDepth, WirePortDataType.FLOAT, m_currentPrecisionType, eyeInstruction);
                }
                else
                {
                    eyeDepth = dataCollector.TemplateDataCollectorInstance.GetEyeDepth(m_currentPrecisionType);
                }

                value = string.Format(CameraDepthFadeFormat, eyeDepth, offset, distance);
                RegisterLocalVariable(0, value, ref dataCollector, "cameraDepthFade" + OutputId);
                return(m_outputPorts[0].LocalValue);
            }

            if (dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation)
            {
                string vertexVarName = string.Empty;
                if (vertexPort.IsConnected)
                {
                    vertexVarName = vertexPort.GeneratePortInstructions(ref dataCollector);
                }
                else
                {
                    vertexVarName = Constants.VertexShaderInputStr + ".vertex.xyz";
                }

                //dataCollector.AddVertexInstruction( "float cameraDepthFade" + UniqueId + " = (( -UnityObjectToViewPos( " + Constants.VertexShaderInputStr + ".vertex.xyz ).z -_ProjectionParams.y - " + offset + " ) / " + distance + ");", UniqueId );
                value = string.Format(CameraDepthFadeFormat, "-UnityObjectToViewPos( " + vertexVarName + " ).z", offset, distance);
                RegisterLocalVariable(0, value, ref dataCollector, "cameraDepthFade" + OutputId);
                return(m_outputPorts[0].LocalValue);
            }

            dataCollector.AddToIncludes(UniqueId, Constants.UnityShaderVariables);

            if (dataCollector.TesselationActive)
            {
                if (vertexPort.IsConnected)
                {
                    string vertexValue = vertexPort.GeneratePortInstructions(ref dataCollector);
                    eyeDepth = "customSurfaceDepth" + OutputId;
                    RegisterLocalVariable(0, string.Format("-UnityObjectToViewPos( {0} ).z", vertexValue), ref dataCollector, eyeDepth);
                }
                else
                {
                    eyeDepth = GeneratorUtils.GenerateScreenDepthOnFrag(ref dataCollector, UniqueId, m_currentPrecisionType);
                }
            }
            else
            {
                if (vertexPort.IsConnected)
                {
                    string varName = "customSurfaceDepth" + OutputId;
                    GenerateInputInVertex(ref dataCollector, 2, varName, false);
                    dataCollector.AddToInput(UniqueId, varName, WirePortDataType.FLOAT);
                    string vertexInstruction = "-UnityObjectToViewPos( " + varName + " ).z";
                    dataCollector.AddVertexInstruction(Constants.VertexShaderOutputStr + "." + varName + " = " + vertexInstruction, UniqueId);
                    eyeDepth = Constants.InputVarStr + "." + varName;
                }
                else
                {
                    dataCollector.AddToInput(UniqueId, "eyeDepth", WirePortDataType.FLOAT);
                    string instruction = "-UnityObjectToViewPos( " + Constants.VertexShaderInputStr + ".vertex.xyz ).z";
                    dataCollector.AddVertexInstruction(Constants.VertexShaderOutputStr + ".eyeDepth = " + instruction, UniqueId);
                    eyeDepth = Constants.InputVarStr + ".eyeDepth";
                }
            }

            value = string.Format(CameraDepthFadeFormat, eyeDepth, offset, distance);
            RegisterLocalVariable(0, value, ref dataCollector, "cameraDepthFade" + OutputId);
            //dataCollector.AddToLocalVariables( UniqueId, "float cameraDepthFade" + UniqueId + " = (( " + Constants.InputVarStr + ".eyeDepth -_ProjectionParams.y - "+ offset + " ) / " + distance + ");" );

            return(m_outputPorts[0].LocalValue);
        }
        void DrawObjectProperties()
        {
            EditorGUI.BeginChangeCheck();
            m_name = EditorGUILayoutStringField("Name", m_name);
            if (EditorGUI.EndChangeCheck())
            {
                m_updated = true;
                m_name    = UIUtils.RemoveInvalidCharacters(m_name);
                if (string.IsNullOrEmpty(m_name))
                {
                    m_name = DefaultArrayName;
                }
                UIUtils.UpdateGlobalArrayDataNode(UniqueId, m_name);
                SetAdditonalTitleText(string.Format(Constants.SubTitleValueFormatStr, m_name));
            }


            m_autoRegister = EditorGUILayoutToggle(AutoRegisterStr, m_autoRegister);

            EditorGUI.BeginChangeCheck();
            m_isJagged = EditorGUILayoutToggle(IsJaggedStr, m_isJagged);
            if (EditorGUI.EndChangeCheck())
            {
                m_updated = true;
                UpdatePorts();
            }

            InputPort indexXPort = GetInputPortByUniqueId(0);

            if (!indexXPort.IsConnected)
            {
                EditorGUI.BeginChangeCheck();
                m_indexX = EditorGUILayoutIntField(indexXPort.Name, m_indexX);
                if (EditorGUI.EndChangeCheck())
                {
                    m_indexX = Mathf.Clamp(m_indexX, 0, (m_arrayLengthX - 1));
                }
            }

            if (m_isJagged)
            {
                InputPort indexYPort = GetInputPortByUniqueId(2);
                if (!indexYPort.IsConnected)
                {
                    EditorGUI.BeginChangeCheck();
                    m_indexY = EditorGUILayoutIntField(indexYPort.Name, m_indexY);
                    if (EditorGUI.EndChangeCheck())
                    {
                        m_indexY = Mathf.Clamp(m_indexY, 0, (m_arrayLengthY - 1));
                    }
                }
            }

            InputPort arrayLengthXPort = GetInputPortByUniqueId(1);

            if (!arrayLengthXPort.IsConnected)
            {
                EditorGUI.BeginChangeCheck();
                m_arrayLengthX = EditorGUILayoutIntField(arrayLengthXPort.Name, m_arrayLengthX);
                if (EditorGUI.EndChangeCheck())
                {
                    m_arrayLengthX = Mathf.Max(1, m_arrayLengthX);
                }
            }

            if (m_isJagged)
            {
                InputPort arrayLengthYPort = GetInputPortByUniqueId(3);
                if (!arrayLengthYPort.IsConnected)
                {
                    EditorGUI.BeginChangeCheck();
                    m_arrayLengthY = EditorGUILayoutIntField(arrayLengthYPort.Name, m_arrayLengthY);
                    if (EditorGUI.EndChangeCheck())
                    {
                        m_arrayLengthY = Mathf.Max(1, m_arrayLengthY);
                    }
                }
            }

            EditorGUI.BeginChangeCheck();
            m_type = EditorGUILayoutPopup(TypeStr, m_type, AvailableTypesLabel);
            if (EditorGUI.EndChangeCheck())
            {
                m_outputPorts[0].ChangeType((WirePortDataType)AvailableTypesValues[m_type], false);
            }

            m_autoRangeCheck = EditorGUILayoutToggle(AutoRangeCheckStr, m_autoRangeCheck);
        }
Example #30
0
        public override string GenerateShaderForOutput(int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar)
        {
            if (dataCollector.IsTemplate)
            {
                return("0");
            }

            if (dataCollector.IsFragmentCategory)
            {
                UIUtils.ShowMessage(ErrorMessage);
                return("0");
            }
            if (m_outputPorts[0].IsLocalValue(dataCollector.PortCategory))
            {
                return("0");
            }

            m_outputPorts[0].SetLocalValue("0", dataCollector.PortCategory);

            StandardSurfaceOutputNode masterNode = m_containerGraph.CurrentMasterNode as StandardSurfaceOutputNode;

            MasterNodeDataCollector outlineDataCollector = new MasterNodeDataCollector();

            outlineDataCollector.IsOutlineDataCollector = true;
            outlineDataCollector.DirtyNormal            = true;
            InputPort colorPort  = GetInputPortByUniqueId(0);
            InputPort alphaPort  = GetInputPortByUniqueId(2);
            InputPort vertexPort = GetInputPortByUniqueId(1);

            if (vertexPort.IsConnected)
            {
                outlineDataCollector.PortCategory = MasterNodePortCategory.Vertex;
                string outlineWidth = vertexPort.GenerateShaderForOutput(ref outlineDataCollector, vertexPort.DataType, true, true);
                outlineDataCollector.AddToVertexLocalVariables(UniqueId, PrecisionType.Float, vertexPort.DataType, "outlineVar", outlineWidth);

                outlineDataCollector.AddVertexInstruction(outlineDataCollector.SpecialLocalVariables, UniqueId, false);
                outlineDataCollector.ClearSpecialLocalVariables();

                outlineDataCollector.AddVertexInstruction(outlineDataCollector.VertexLocalVariables, UniqueId, false);
                outlineDataCollector.ClearVertexLocalVariables();

                // need to check whether this breaks other outputs or not
                ContainerGraph.ResetNodesLocalVariables();
            }

            outlineDataCollector.PortCategory = MasterNodePortCategory.Fragment;
            string outlineColor = colorPort.GeneratePortInstructions(ref outlineDataCollector);              // "\to.Emission = " + colorPort.GeneratePortInstructions( ref outlineDataCollector ) + ";";
            string alphaValue   = alphaPort.Visible ? alphaPort.GeneratePortInstructions(ref outlineDataCollector) : string.Empty;

            bool addTabs = outlineDataCollector.DirtySpecialLocalVariables || alphaPort.Available;

            outlineDataCollector.AddInstructions("\t" + outlineDataCollector.SpecialLocalVariables.TrimStart('\t'));
            outlineDataCollector.ClearSpecialLocalVariables();
            outlineDataCollector.AddInstructions((addTabs ? "\t\t\t" : "") + "o.Emission = " + outlineColor + ";");
            if (alphaPort.Visible)
            {
                if (m_currentAlphaMode == OutlineAlphaModes.Masked)
                {
                    float maskClipValue = 0.5f;

                    if (masterNode != null)
                    {
                        maskClipValue = masterNode.OpacityMaskClipValue;
                    }

                    if (masterNode.InlineOpacityMaskClipValue.IsValid)
                    {
                        RangedFloatNode fnode = UIUtils.GetNode(masterNode.InlineOpacityMaskClipValue.NodeId) as RangedFloatNode;
                        if (fnode != null)
                        {
                            outlineDataCollector.AddToProperties(fnode.UniqueId, fnode.GetPropertyValue(), fnode.OrderIndex);
                            outlineDataCollector.AddToUniforms(fnode.UniqueId, fnode.GetUniformValue());
                        }
                        else
                        {
                            IntNode inode = UIUtils.GetNode(masterNode.InlineOpacityMaskClipValue.NodeId) as IntNode;
                            outlineDataCollector.AddToProperties(inode.UniqueId, inode.GetPropertyValue(), inode.OrderIndex);
                            outlineDataCollector.AddToUniforms(inode.UniqueId, inode.GetUniformValue());
                        }
                    }
                    else
                    {
                        outlineDataCollector.AddToProperties(-1, string.Format(IOUtils.MaskClipValueProperty, OpacityMaskClipValueStr, maskClipValue), -1);
                        outlineDataCollector.AddToUniforms(-1, string.Format(IOUtils.MaskClipValueUniform, maskClipValue));
                    }

                    outlineDataCollector.AddInstructions((addTabs ? "\n\t\t\t" : "") + "clip( " + alphaValue + " - " + masterNode.InlineOpacityMaskClipValue.GetValueOrProperty(IOUtils.MaskClipValueName, false) + " );");
                }
                else
                {
                    outlineDataCollector.AddInstructions((addTabs ? "\n\t\t\t" : "") + "o.Alpha = " + alphaValue + ";");
                }
            }

            if (outlineDataCollector.UsingWorldNormal)
            {
                outlineDataCollector.AddInstructions((addTabs ? "\n\t\t\t" : "") + "o.Normal = float3(0,0,-1);");
            }

            if (masterNode != null)
            {
                //masterNode.AdditionalIncludes.AddToDataCollector( ref outlineDataCollector );
                //masterNode.AdditionalPragmas.AddToDataCollector( ref outlineDataCollector );
                //masterNode.AdditionalDefines.AddToDataCollector( ref outlineDataCollector );
                masterNode.AdditionalDirectives.AddAllToDataCollector(ref outlineDataCollector);
            }

            ContainerGraph.CurrentStandardSurface.OutlineHelper.InputList       = outlineDataCollector.InputList;
            ContainerGraph.CurrentStandardSurface.OutlineHelper.Inputs          = outlineDataCollector.Inputs;
            ContainerGraph.CurrentStandardSurface.OutlineHelper.DirtyInput      = outlineDataCollector.DirtyInputs;
            ContainerGraph.CurrentStandardSurface.OutlineHelper.Includes        = outlineDataCollector.Includes;
            ContainerGraph.CurrentStandardSurface.OutlineHelper.Pragmas         = outlineDataCollector.Pragmas;
            ContainerGraph.CurrentStandardSurface.OutlineHelper.Defines         = outlineDataCollector.Defines;
            ContainerGraph.CurrentStandardSurface.OutlineHelper.Uniforms        = outlineDataCollector.Uniforms;
            ContainerGraph.CurrentStandardSurface.OutlineHelper.UniformList     = outlineDataCollector.UniformsList;
            ContainerGraph.CurrentStandardSurface.OutlineHelper.VertexData      = outlineDataCollector.VertexData;
            ContainerGraph.CurrentStandardSurface.OutlineHelper.Instructions    = outlineDataCollector.Instructions;
            ContainerGraph.CurrentStandardSurface.OutlineHelper.Functions       = outlineDataCollector.Functions;
            ContainerGraph.CurrentStandardSurface.OutlineHelper.LocalFunctions  = outlineDataCollector.LocalFunctions;
            ContainerGraph.CurrentStandardSurface.OutlineHelper.OutlineCullMode = m_cullMode;
            ContainerGraph.CurrentStandardSurface.OutlineHelper.ZTestMode       = m_zTestMode;
            ContainerGraph.CurrentStandardSurface.OutlineHelper.ZWriteMode      = m_zWriteMode;
            ContainerGraph.CurrentStandardSurface.OutlineHelper.OffsetMode      = m_currentSelectedMode;
            ContainerGraph.CurrentStandardSurface.OutlineHelper.CustomNoFog     = m_noFog;
            dataCollector.CustomOutlineSelectedAlpha = (int)m_currentAlphaMode;

            for (int i = 0; i < outlineDataCollector.PropertiesList.Count; i++)
            {
                dataCollector.AddToProperties(UniqueId, outlineDataCollector.PropertiesList[i].PropertyName, outlineDataCollector.PropertiesList[i].OrderIndex);
            }

            ContainerGraph.ResetNodesLocalVariablesIfNot(MasterNodePortCategory.Vertex);
            return("0");
        }