Esempio n. 1
0
        protected override void OnMaterialChanged(Material material)
        {
            var keyword = String.Empty;

            if (m_args.GetField(out keyword, "keyword", String.Empty))
            {
                while (m_prop != null)
                {
                    if (!ShaderGUIHelper.IsModeMatched(this, m_args))
                    {
                        break;
                    }
                    var cmp = ShaderGUIHelper.ExcuteLogicOp(this, m_prop, m_args);
                    if (cmp != -1)
                    {
                        SetKeyword(material, keyword, cmp == 1);
                        return;
                    }
                    break;
                }
                // disable keyword for default
                if (material.IsKeywordEnabled(keyword))
                {
                    SetKeyword(material, keyword, false);
                }
            }
        }
Esempio n. 2
0
 public override bool GetLogicOpResult(out String returnValue)
 {
     returnValue = "false";
     if (ShaderGUIHelper.IsModeMatched(this, m_args) &&
         ShaderGUIHelper.ExcuteLogicOp(this, null, m_args) == 1)
     {
         returnValue = "true";
         return(true);
     }
     return(false);
 }
Esempio n. 3
0
 public override bool GetLogicOpResult(out String returnValue, MaterialProperty[] props)
 {
     returnValue = String.Empty;
     if (m_prop != null)
     {
         return(ShaderGUIHelper.IsModeMatched(this, m_args) &&
                ShaderGUIHelper.ExcuteLogicOp(this, m_prop, props, m_args) == 1);
     }
     else
     {
         return(ShaderGUIHelper.IsModeMatched(this, m_args) &&
                GetBoolTestResult(m_MaterialEditor.target as Material, props));
     }
 }
        protected override void OnMaterialChanged(Material material, MaterialProperty[] props)
        {
            var keyword = String.Empty;

            if (m_args != null && m_args.GetField(out keyword, "keyword", String.Empty))
            {
                if (keyword.Equals("none", StringComparison.OrdinalIgnoreCase))
                {
                    return;
                }
                var enable_if = TryGetBoolTestResult(material, props, Cfg.Key_EnableIfValue);
                if (enable_if != null && enable_if.Value == false)
                {
                    return;
                }
                if (ShaderGUIHelper.IsModeMatched(this, m_args) && GetBoolTestResult(material, props))
                {
                    if (m_prop != null)
                    {
                        var cmp = ShaderGUIHelper.ExcuteLogicOp(this, m_prop, props, m_args);
                        if (cmp != -1)
                        {
                            if (!keyword.Equals("none", StringComparison.OrdinalIgnoreCase))
                            {
                                SetKeyword(material, keyword, cmp == 1);
                            }
                            return;
                        }
                    }
                    else
                    {
                        SetKeyword(material, keyword, true);
                        return;
                    }
                }
                if (!keyword.Equals("none", StringComparison.OrdinalIgnoreCase))
                {
                    // disable keyword for default
                    if (material.IsKeywordEnabled(keyword))
                    {
                        SetKeyword(material, keyword, false);
                    }
                }
            }
        }
Esempio n. 5
0
 public override bool GetLogicOpResult(out String returnValue)
 {
     returnValue = String.Empty;
     return(m_prop != null && ShaderGUIHelper.IsModeMatched(this, m_args) &&
            ShaderGUIHelper.ExcuteLogicOp(this, m_prop, m_args) == 1);
 }