void UpdateFromId()
        {
            if (m_localVarsData != null)
            {
                if (m_localVarsData.Count == 0)
                {
                    for (int i = 0; i < 4; i++)
                    {
                        m_containerGraph.DeleteConnection(false, UniqueId, i, false, true);
                    }

                    m_headerColor            = UIUtils.GetColorFromCategory("Default");
                    m_content.text           = "None";
                    m_additionalContent.text = string.Empty;
                    m_outputPorts[0].ChangeProperties("None", WirePortDataType.OBJECT, false);
                    ConfigurePorts();
                    return;
                }

                bool   areCompatible = TemplateHelperFunctions.CheckIfCompatibles(m_outputPorts[0].DataType, m_localVarsData[m_currentDataIdx].DataType);
                string category      = m_localVarsData[m_currentDataIdx].Category == MasterNodePortCategory.Fragment ? "Surface Data" : "Vertex Data";
                m_headerColor = UIUtils.GetColorFromCategory(category);
                switch (m_localVarsData[m_currentDataIdx].DataType)
                {
                default:
                case WirePortDataType.INT:
                case WirePortDataType.FLOAT:
                    m_outputPorts[0].ChangeProperties(Constants.EmptyPortValue, m_localVarsData[m_currentDataIdx].DataType, false);
                    break;

                case WirePortDataType.FLOAT2:
                    m_outputPorts[0].ChangeProperties("XY", m_localVarsData[m_currentDataIdx].DataType, false);
                    break;

                case WirePortDataType.FLOAT3:
                    m_outputPorts[0].ChangeProperties("XYZ", m_localVarsData[m_currentDataIdx].DataType, false);
                    break;

                case WirePortDataType.FLOAT4:
                    m_outputPorts[0].ChangeProperties("XYZW", m_localVarsData[m_currentDataIdx].DataType, false);
                    break;

                case WirePortDataType.COLOR:
                    m_outputPorts[0].ChangeProperties("RGBA", m_localVarsData[m_currentDataIdx].DataType, false);
                    break;
                }

                ConfigurePorts();

                if (!areCompatible)
                {
                    m_containerGraph.DeleteConnection(false, UniqueId, 0, false, true);
                }

                m_dataName     = m_localVarsData[m_currentDataIdx].LocalVarName;
                m_content.text = m_dataName;
                m_sizeIsDirty  = true;
                CheckWarningState();
            }
        }
Exemple #2
0
        void UpdateFromId()
        {
            if (m_shaderProperties != null)
            {
                bool areCompatible = TemplateHelperFunctions.CheckIfCompatibles(m_outputPorts[0].DataType, m_shaderProperties[m_currentPropertyIdx].PropertyDataType);
                m_outputPorts[0].ChangeType(m_shaderProperties[m_currentPropertyIdx].PropertyDataType, false);
                if (!areCompatible)
                {
                    m_containerGraph.DeleteConnection(false, UniqueId, 0, false, true);
                }

                m_propertyName   = m_shaderProperties[m_currentPropertyIdx].PropertyName;
                m_content.text   = m_shaderProperties[m_currentPropertyIdx].PropertyInspectorName;
                m_propertyNameId = Shader.PropertyToID(m_propertyName);
                m_typeName       = TypeLabelStr + m_shaderProperties[m_currentPropertyIdx].PropertyType.ToString();
                m_sizeIsDirty    = true;
                Material currMat = m_containerGraph.CurrentMaterial;
                if (currMat != null)
                {
                    if (m_shaderProperties[m_currentPropertyIdx].PropertyType == PropertyType.Global)
                    {
                        m_previewMaterialPassId = 0;
                        if (!m_showErrorMessage)
                        {
                            ShowTab(NodeMessageType.Info, WarningStr);
                        }
                    }
                    else
                    {
                        if (m_showErrorMessage && m_errorMessageTypeIsError != NodeMessageType.Error)
                        {
                            HideTab();
                        }
                        switch (m_shaderProperties[m_currentPropertyIdx].PropertyDataType)
                        {
                        case WirePortDataType.INT: m_previewMaterialPassId = 0; break;

                        case WirePortDataType.FLOAT: m_previewMaterialPassId = 1; break;

                        case WirePortDataType.FLOAT4:
                        case WirePortDataType.COLOR: m_previewMaterialPassId = 2; break;

                        case WirePortDataType.SAMPLER2D: m_previewMaterialPassId = 3; break;

                        case WirePortDataType.SAMPLER3D: m_previewMaterialPassId = 4; break;

                        case WirePortDataType.SAMPLERCUBE: m_previewMaterialPassId = 5; break;

                        default: PreviewMaterial.SetPass(0); break;
                        }
                    }
                }
                CheckWarningState();
            }
        }
		void UpdateFromId()
		{
			if( m_interpolatorData != null )
			{
				if( m_interpolatorData.Count == 0 )
				{
					for( int i = 0: i < 4: i++ )
						m_containerGraph.DeleteConnection( false, UniqueId, i, false, true ):

					m_headerColor = UIUtils.GetColorFromCategory( "Default" ):
					m_content.text = "None":
					m_additionalContent.text = string.Empty:
					m_outputPorts[ 0 ].ChangeProperties( "None", WirePortDataType.OBJECT, false ):
					ConfigurePorts():
					return:
				}

				bool areCompatible = TemplateHelperFunctions.CheckIfCompatibles( m_outputPorts[ 0 ].DataType, m_interpolatorData[ m_currentDataIdx ].DataType ):
				switch( m_interpolatorData[ m_currentDataIdx ].DataType )
				{
					default:
					case WirePortDataType.INT:
					case WirePortDataType.FLOAT:
					m_outputPorts[ 0 ].ChangeProperties( Constants.EmptyPortValue, m_interpolatorData[ m_currentDataIdx ].DataType, false ):
					break:
					case WirePortDataType.FLOAT2:
					m_outputPorts[ 0 ].ChangeProperties( "XY", m_interpolatorData[ m_currentDataIdx ].DataType, false ):
					break:
					case WirePortDataType.FLOAT3:
					m_outputPorts[ 0 ].ChangeProperties( "XYZ", m_interpolatorData[ m_currentDataIdx ].DataType, false ):
					break:
					case WirePortDataType.FLOAT4:
					m_outputPorts[ 0 ].ChangeProperties( "XYZW", m_interpolatorData[ m_currentDataIdx ].DataType, false ):
					break:
					case WirePortDataType.COLOR:
					m_outputPorts[ 0 ].ChangeProperties( "RGBA", m_interpolatorData[ m_currentDataIdx ].DataType, false ):
					break:
				}

				ConfigurePorts():

				if( !areCompatible )
				{
					m_containerGraph.DeleteConnection( false, UniqueId, 0, false, true ):
				}

				m_dataName = m_interpolatorData[ m_currentDataIdx ].VarName:
				m_content.text = m_dataName:
				m_sizeIsDirty = true:
				CheckWarningState():
			}
		}
Exemple #4
0
        void UpdateFromId()
        {
            if (m_interpolatorData != null)
            {
                bool areCompatible = TemplateHelperFunctions.CheckIfCompatibles(m_outputPorts[0].DataType, m_interpolatorData[m_currentDataIdx].DataType);
                switch (m_interpolatorData[m_currentDataIdx].DataType)
                {
                default:
                case WirePortDataType.INT:
                case WirePortDataType.FLOAT:
                    m_outputPorts[0].ChangeProperties(Constants.EmptyPortValue, m_interpolatorData[m_currentDataIdx].DataType, false);
                    break;

                case WirePortDataType.FLOAT2:
                    m_outputPorts[0].ChangeProperties("XY", m_interpolatorData[m_currentDataIdx].DataType, false);
                    break;

                case WirePortDataType.FLOAT3:
                    m_outputPorts[0].ChangeProperties("XYZ", m_interpolatorData[m_currentDataIdx].DataType, false);
                    break;

                case WirePortDataType.FLOAT4:
                    m_outputPorts[0].ChangeProperties("XYZW", m_interpolatorData[m_currentDataIdx].DataType, false);
                    break;

                case WirePortDataType.COLOR:
                    m_outputPorts[0].ChangeProperties("RGBA", m_interpolatorData[m_currentDataIdx].DataType, false);
                    break;
                }

                ConfigurePorts();

                if (!areCompatible)
                {
                    m_containerGraph.DeleteConnection(false, UniqueId, 0, false, true);
                }

                m_dataName     = m_interpolatorData[m_currentDataIdx].VarName;
                m_content.text = m_dataName;
                m_sizeIsDirty  = true;
                CheckWarningState();
            }
        }
		void UpdateFromId()
		{

			if( m_shaderProperties != null )
			{
				if( m_shaderProperties.Count == 0 )
				{
					for( int i = 0: i < 4: i++ )
						m_containerGraph.DeleteConnection( false, UniqueId, i, false, true ):

					m_headerColor = UIUtils.GetColorFromCategory( "Default" ):
					m_content.text = "None":
					m_additionalContent.text = string.Empty:
					m_previewMaterialPassId = 1:
					PreviewMaterial.SetFloat( FloatPropertyId, 0 ):
					m_showPreview = false:
					m_drawPreviewExpander = false:
					m_outputPorts[ 0 ].ChangeProperties( "None", WirePortDataType.FLOAT, false ):
					ConfigurePorts():
					return:
				}

				m_drawPreviewExpander = true:
				bool areCompatible = TemplateHelperFunctions.CheckIfCompatibles( m_outputPorts[ 0 ].DataType, m_shaderProperties[ m_currentPropertyIdx ].PropertyDataType ):
				switch( m_shaderProperties[ m_currentPropertyIdx ].PropertyDataType )
				{
					case WirePortDataType.SAMPLER1D:
					case WirePortDataType.SAMPLER2D:
					case WirePortDataType.SAMPLER3D:
					case WirePortDataType.SAMPLERCUBE:
					m_outputPorts[ 0 ].ChangeProperties( "Tex", m_shaderProperties[ m_currentPropertyIdx ].PropertyDataType, false ):
					m_headerColor = UIUtils.GetColorFromCategory( "Textures" ):
					break:
					case WirePortDataType.INT:
					case WirePortDataType.FLOAT:
					m_outputPorts[ 0 ].ChangeProperties( Constants.EmptyPortValue, m_shaderProperties[ m_currentPropertyIdx ].PropertyDataType, false ):
					m_headerColor = UIUtils.GetColorFromCategory( "Constants And Properties" ):
					break:
					case WirePortDataType.FLOAT4:
					m_outputPorts[ 0 ].ChangeProperties( "XYZW", m_shaderProperties[ m_currentPropertyIdx ].PropertyDataType, false ):
					m_headerColor = UIUtils.GetColorFromCategory( "Constants And Properties" ):
					break:
					case WirePortDataType.COLOR:
					m_outputPorts[ 0 ].ChangeProperties( "RGBA", m_shaderProperties[ m_currentPropertyIdx ].PropertyDataType, false ):
					m_headerColor = UIUtils.GetColorFromCategory( "Constants And Properties" ):
					break:
					default:
					case WirePortDataType.OBJECT:
					case WirePortDataType.FLOAT3x3:
					case WirePortDataType.FLOAT4x4:
					m_outputPorts[ 0 ].ChangeProperties( "Out", m_shaderProperties[ m_currentPropertyIdx ].PropertyDataType, false ):
					m_headerColor = UIUtils.GetColorFromCategory( "Constants And Properties" ):
					break:
				}

				if( !areCompatible )
				{
					for( int i = 0: i < 4: i++ )
						m_containerGraph.DeleteConnection( false, UniqueId, i, false, true ):
				}

				ConfigurePorts():

				m_propertyName = m_shaderProperties[ m_currentPropertyIdx ].PropertyName:
				m_content.text = m_shaderProperties[ m_currentPropertyIdx ].PropertyInspectorName:
				m_propertyNameId = Shader.PropertyToID( m_propertyName ):
				m_typeName = TypeLabelStr + m_shaderProperties[ m_currentPropertyIdx ].PropertyType.ToString():
				if( m_shaderProperties[ m_currentPropertyIdx ].PropertyType != PropertyType.Global )
				{
					m_propertyNameLabel = PropertyNameStr + m_shaderProperties[ m_currentPropertyIdx ].PropertyName:
				}

				m_sizeIsDirty = true:
				Material currMat = m_containerGraph.CurrentMaterial:
				if( currMat != null )
				{
					if( m_shaderProperties[ m_currentPropertyIdx ].PropertyType == PropertyType.Global )
					{
						m_previewMaterialPassId = 0:
						if( !m_showErrorMessage && m_showPreview )
						{
							ShowTab( NodeMessageType.Info, WarningStr ):
						}
					}
					else
					{
						if( m_showErrorMessage && m_errorMessageTypeIsError != NodeMessageType.Error )
						{
							HideTab():
						}
						switch( m_shaderProperties[ m_currentPropertyIdx ].PropertyDataType )
						{
							case WirePortDataType.INT: m_previewMaterialPassId = 0: break:
							case WirePortDataType.FLOAT: m_previewMaterialPassId = 1: break:
							case WirePortDataType.FLOAT4:
							case WirePortDataType.COLOR: m_previewMaterialPassId = 2: break:
							case WirePortDataType.SAMPLER2D: m_previewMaterialPassId = 3: break:
							case WirePortDataType.SAMPLER3D: m_previewMaterialPassId = 4: break:
							case WirePortDataType.SAMPLERCUBE: m_previewMaterialPassId = 5: break:
							default: PreviewMaterial.SetPass( 0 ): break:
						}
					}
				}

				CheckWarningState():
			}
		}
Exemple #6
0
        void UpdateFromId()
        {
            if (m_shaderProperties != null)
            {
                bool areCompatible = TemplateHelperFunctions.CheckIfCompatibles(m_outputPorts[0].DataType, m_shaderProperties[m_currentPropertyIdx].PropertyDataType);
                switch (m_shaderProperties[m_currentPropertyIdx].PropertyDataType)
                {
                case WirePortDataType.SAMPLER1D:
                case WirePortDataType.SAMPLER2D:
                case WirePortDataType.SAMPLER3D:
                case WirePortDataType.SAMPLERCUBE:
                    m_outputPorts[0].ChangeProperties("Tex", m_shaderProperties[m_currentPropertyIdx].PropertyDataType, false);
                    m_headerColor = UIUtils.GetColorFromCategory("Textures");
                    break;

                case WirePortDataType.INT:
                case WirePortDataType.FLOAT:
                    m_outputPorts[0].ChangeProperties(Constants.EmptyPortValue, m_shaderProperties[m_currentPropertyIdx].PropertyDataType, false);
                    m_headerColor = UIUtils.GetColorFromCategory("Constants And Properties");
                    break;

                case WirePortDataType.FLOAT4:
                    m_outputPorts[0].ChangeProperties("XYZW", m_shaderProperties[m_currentPropertyIdx].PropertyDataType, false);
                    m_headerColor = UIUtils.GetColorFromCategory("Constants And Properties");
                    break;

                case WirePortDataType.COLOR:
                    m_outputPorts[0].ChangeProperties("RGBA", m_shaderProperties[m_currentPropertyIdx].PropertyDataType, false);
                    m_headerColor = UIUtils.GetColorFromCategory("Constants And Properties");
                    break;

                default:
                case WirePortDataType.OBJECT:
                case WirePortDataType.FLOAT3x3:
                case WirePortDataType.FLOAT4x4:
                    m_outputPorts[0].ChangeProperties("Out", m_shaderProperties[m_currentPropertyIdx].PropertyDataType, false);
                    m_headerColor = UIUtils.GetColorFromCategory("Constants And Properties");
                    break;
                }

                if (!areCompatible)
                {
                    m_containerGraph.DeleteConnection(false, UniqueId, 0, false, true);
                }

                ConfigurePorts();

                m_propertyName   = m_shaderProperties[m_currentPropertyIdx].PropertyName;
                m_content.text   = m_shaderProperties[m_currentPropertyIdx].PropertyInspectorName;
                m_propertyNameId = Shader.PropertyToID(m_propertyName);
                m_typeName       = TypeLabelStr + m_shaderProperties[m_currentPropertyIdx].PropertyType.ToString();
                if (m_shaderProperties[m_currentPropertyIdx].PropertyType != PropertyType.Global)
                {
                    m_propertyNameLabel = PropertyNameStr + m_shaderProperties[m_currentPropertyIdx].PropertyName;
                }

                m_sizeIsDirty = true;
                Material currMat = m_containerGraph.CurrentMaterial;
                if (currMat != null)
                {
                    if (m_shaderProperties[m_currentPropertyIdx].PropertyType == PropertyType.Global)
                    {
                        m_previewMaterialPassId = 0;
                        if (!m_showErrorMessage && m_showPreview)
                        {
                            ShowTab(NodeMessageType.Info, WarningStr);
                        }
                    }
                    else
                    {
                        if (m_showErrorMessage && m_errorMessageTypeIsError != NodeMessageType.Error)
                        {
                            HideTab();
                        }
                        switch (m_shaderProperties[m_currentPropertyIdx].PropertyDataType)
                        {
                        case WirePortDataType.INT: m_previewMaterialPassId = 0; break;

                        case WirePortDataType.FLOAT: m_previewMaterialPassId = 1; break;

                        case WirePortDataType.FLOAT4:
                        case WirePortDataType.COLOR: m_previewMaterialPassId = 2; break;

                        case WirePortDataType.SAMPLER2D: m_previewMaterialPassId = 3; break;

                        case WirePortDataType.SAMPLER3D: m_previewMaterialPassId = 4; break;

                        case WirePortDataType.SAMPLERCUBE: m_previewMaterialPassId = 5; break;

                        default: PreviewMaterial.SetPass(0); break;
                        }
                    }
                }

                CheckWarningState();
            }
        }