Exemplo n.º 1
0
        public virtual void ReadAdditionalData(ref string[] nodeParams)
        {
            string defaultTextureGUID = GetCurrentParam(ref nodeParams);

            //m_defaultValue = AssetDatabase.LoadAssetAtPath<Texture>( textureName );
            if (UIUtils.CurrentShaderVersion() > 14101)
            {
                m_defaultValue = AssetDatabase.LoadAssetAtPath <Texture>(AssetDatabase.GUIDToAssetPath(defaultTextureGUID));
                string materialTextureGUID = GetCurrentParam(ref nodeParams);
                m_materialValue = AssetDatabase.LoadAssetAtPath <Texture>(AssetDatabase.GUIDToAssetPath(materialTextureGUID));
            }
            else
            {
                m_defaultValue = AssetDatabase.LoadAssetAtPath <Texture>(defaultTextureGUID);
            }

            m_isNormalMap         = Convert.ToBoolean(GetCurrentParam(ref nodeParams));
            m_defaultTextureValue = (TexturePropertyValues)Enum.Parse(typeof(TexturePropertyValues), GetCurrentParam(ref nodeParams));
            m_autocastMode        = (AutoCastType)Enum.Parse(typeof(AutoCastType), GetCurrentParam(ref nodeParams));
            if (UIUtils.CurrentShaderVersion() > 15306)
            {
                m_currentType = (TextureType)Enum.Parse(typeof(TextureType), GetCurrentParam(ref nodeParams));
            }
            else
            {
                m_currentType = TextureType.Texture2D;
            }

            ConfigTextureData(m_currentType);

            //ConfigFromObject( m_defaultValue );
            if (m_materialValue == null)
            {
                ConfigFromObject(m_defaultValue);
            }
            else
            {
                CheckTextureImporter(true, true);
            }
            ConfigureInputPorts();
            ConfigureOutputPorts();
        }
        new void ShowDefaults()
        {
            m_defaultTextureValue = (TexturePropertyValues)EditorGUILayoutEnumPopup(DefaultTextureStr, m_defaultTextureValue);

            if (!m_drawAutocast)
            {
                return;
            }

            AutoCastType newAutoCast = (AutoCastType)EditorGUILayoutEnumPopup(AutoCastModeStr, m_autocastMode);

            if (newAutoCast != m_autocastMode)
            {
                m_autocastMode = newAutoCast;
                if (m_autocastMode != AutoCastType.Auto)
                {
                    ConfigTextureData(m_currentType);
                    ConfigureInputPorts();
                    ConfigureOutputPorts();
                }
            }
        }
Exemplo n.º 3
0
        //

        public override void DrawSubProperties()
        {
            m_textureCoordSet     = EditorGUILayout.IntPopup(Constants.AvailableUVSetsLabel, m_textureCoordSet, Constants.AvailableUVSetsStr, Constants.AvailableUVSets);
            m_defaultTextureValue = ( TexturePropertyValues )EditorGUILayout.EnumPopup(DefaultTextureStr, m_defaultTextureValue);
            AutoCastType newAutoCast = ( AutoCastType )EditorGUILayout.EnumPopup(AutoCastModeStr, m_autocastMode);

            if (newAutoCast != m_autocastMode)
            {
                m_autocastMode = newAutoCast;
                if (m_autocastMode != AutoCastType.Auto)
                {
                    ConfigTextureData(m_currentType);
                }
            }

            //if ( _isNormalMap )
            {
                bool autoUnpackNormals = EditorGUILayout.Toggle(AutoUnpackNormalsStr, m_autoUnpackNormals);
                if (m_autoUnpackNormals != autoUnpackNormals)
                {
                    AutoUnpackNormals = autoUnpackNormals;

                    ConfigurePorts();
                }
            }

            if (m_autoUnpackNormals && !m_inputPorts[1].IsConnected)
            {
                m_inputPorts[1].FloatInternalData = EditorGUILayout.FloatField(NormalScaleStr, m_inputPorts[1].FloatInternalData);
            }

            EditorGUI.BeginChangeCheck();
            m_defaultValue = ( Texture )EditorGUILayout.ObjectField(Constants.DefaultValueLabel, m_defaultValue, m_textureType, false);
            if (EditorGUI.EndChangeCheck())
            {
                CheckTextureImporter(true);
            }
        }