new void ShowDefaults()
        {
            EditorGUI.BeginChangeCheck();
            m_virtualPreset = ( VirtualPreset )EditorGUILayoutEnumPopup(VirtualPresetStr, m_virtualPreset);
            if (EditorGUI.EndChangeCheck())
            {
                ChangeChannels();
            }

            EditorGUI.BeginChangeCheck();
            m_selectedChannelInt = EditorGUILayoutPopup(VirtualChannelStr, m_selectedChannelInt, m_channelTypeStr);
            if (EditorGUI.EndChangeCheck())
            {
                m_virtualChannel = GetChannel(m_selectedChannelInt);
            }
        }
        public override void ReadFromString(ref string[] nodeParams)
        {
            base.ReadFromString(ref nodeParams);
            string textureName = GetCurrentParam(ref nodeParams);

            m_defaultValue        = AssetDatabase.LoadAssetAtPath <Texture>(textureName);
            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));
            m_virtualPreset       = ( VirtualPreset )Enum.Parse(typeof(VirtualPreset), GetCurrentParam(ref nodeParams));
            m_selectedChannelInt  = Convert.ToInt32(GetCurrentParam(ref nodeParams));
            ChangeChannels();
            m_virtualChannel = GetChannel(m_selectedChannelInt);

            m_forceNodeUpdate = true;

            ConfigFromObject(m_defaultValue);
            ConfigureInputPorts();
            ConfigureOutputPorts();
        }
示例#3
0
        public override void ReadFromString(ref string[] nodeParams)
        {
            base.ReadFromString(ref 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));
            m_virtualPreset       = ( VirtualPreset )Enum.Parse(typeof(VirtualPreset), GetCurrentParam(ref nodeParams));
            m_selectedChannelInt  = Convert.ToInt32(GetCurrentParam(ref nodeParams));
            ChangeChannels();
            m_virtualChannel = GetChannel(m_selectedChannelInt);

            //m_forceNodeUpdate = true;

            //ConfigFromObject( m_defaultValue );
            if (m_materialValue == null)
            {
                ConfigFromObject(m_defaultValue);
            }
            else
            {
                CheckTextureImporter(true, true);
            }
            ConfigureInputPorts();
            ConfigureOutputPorts();
        }