diff options
author | chai <chaifix@163.com> | 2022-03-10 14:07:40 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2022-03-10 14:07:40 +0800 |
commit | 22891bf59032ba88262824255a706d652031384b (patch) | |
tree | 7595439ba9966c9402d37e37cee5e8cf098757d5 /Assets/ThirdParty/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateCullModeModule.cs | |
parent | 8b04ea73e540067f83870b61d89db4868fea5e8a (diff) |
* move folder
Diffstat (limited to 'Assets/ThirdParty/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateCullModeModule.cs')
-rw-r--r-- | Assets/ThirdParty/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateCullModeModule.cs | 125 |
1 files changed, 0 insertions, 125 deletions
diff --git a/Assets/ThirdParty/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateCullModeModule.cs b/Assets/ThirdParty/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateCullModeModule.cs deleted file mode 100644 index fed77dc0..00000000 --- a/Assets/ThirdParty/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateCullModeModule.cs +++ /dev/null @@ -1,125 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using UnityEngine; -using UnityEditor; -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - public sealed class TemplateCullModeModule : TemplateModuleParent - { - private const string CullModeFormatStr = "Cull "; - - public TemplateCullModeModule() : base("Cull Mode"){ } - - private static readonly string CullModeStr = "Cull Mode"; - - [SerializeField] - private CullMode m_cullMode = CullMode.Back; - - [SerializeField] - private InlineProperty m_inlineCullMode = new InlineProperty(); - - public void CopyFrom( TemplateCullModeModule other , bool allData ) - { - if( allData ) - m_independentModule = other.IndependentModule; - - m_cullMode = other.CurrentCullMode; - m_inlineCullMode.CopyFrom( other.CullInlineProperty ); - } - - public void ConfigureFromTemplateData( TemplateCullModeData data ) - { - bool newValidData = ( data.DataCheck == TemplateDataCheck.Valid ); - - if( newValidData && m_validData != newValidData ) - { - m_independentModule = data.IndependentModule; - if( string.IsNullOrEmpty( data.InlineData ) ) - { - m_cullMode = data.CullModeData; - m_inlineCullMode.IntValue = (int)m_cullMode; - m_inlineCullMode.ResetProperty(); - } - else - { - m_inlineCullMode.SetInlineByName( data.InlineData ); - } - } - - m_validData = newValidData; - } - - public override void Draw( UndoParentNode owner, bool style = true ) - { - EditorGUI.BeginChangeCheck(); - //m_cullMode = (CullMode)owner.EditorGUILayoutEnumPopup( CullModeStr, m_cullMode ); - m_inlineCullMode.CustomDrawer( ref owner, ( x ) => { m_cullMode = (CullMode)owner.EditorGUILayoutEnumPopup( CullModeStr, m_cullMode ); }, CullModeStr ); - if( EditorGUI.EndChangeCheck() ) - { - m_inlineCullMode.IntValue = (int)m_cullMode; - m_isDirty = true; - } - } - - public override void ReadFromString( ref uint index, ref string[] nodeParams ) - { - bool validDataOnMeta = m_validData; - if( UIUtils.CurrentShaderVersion() > TemplatesManager.MPShaderVersion ) - { - validDataOnMeta = Convert.ToBoolean( nodeParams[ index++ ] ); - } - - if( validDataOnMeta ) - { - if( UIUtils.CurrentShaderVersion() < 15304 ) - { - m_cullMode = (CullMode)Enum.Parse( typeof( CullMode ), nodeParams[ index++ ] ); - m_inlineCullMode.IntValue = (int)m_cullMode; - } - else - { - m_inlineCullMode.ReadFromString( ref index, ref nodeParams ); - m_cullMode = (CullMode)m_inlineCullMode.IntValue; - } - } - } - - public override void WriteToString( ref string nodeInfo ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_validData ); - if( m_validData ) - { - //IOUtils.AddFieldValueToString( ref nodeInfo, m_cullMode ); - m_inlineCullMode.WriteToString( ref nodeInfo ); - } - } - - public override string GenerateShaderData( bool isSubShader ) - { - //return CullModeFormatStr + m_cullMode.ToString(); - return CullModeFormatStr + m_inlineCullMode.GetValueOrProperty( m_cullMode.ToString()); - } - - public override void Destroy() - { - base.Destroy(); - m_inlineCullMode = null; - } - - public CullMode CurrentCullMode - { - get { return m_cullMode; } - set - { - m_cullMode = value; - m_inlineCullMode.IntValue = (int)value; - m_inlineCullMode.Active = false; - } - } - public InlineProperty CullInlineProperty { get { return m_inlineCullMode; } } - } -} |