Esempio n. 1
0
    private void AddProperty(string propName, PropType type, SerializedProperty prop)
    {
        string prefix = GetTypeName(type) + "_";

        if (MaterialPropNames.ContainsKey(propName) &&
            (MaterialPropNames[propName].type == type ||
             (MaterialPropNames[propName].type == PropType.Vector && type == PropType.Color)))
        {
            m_properties.Add(prefix + propName, prop);
        }
    }
Esempio n. 2
0
    //base API functions
    public SerializedProperty GetProperty(PropType type, string varName)
    {
        string prop = GetPropertyName(type, varName);


        if (!m_properties.ContainsKey(prop))
        {
            if (MaterialPropNames.ContainsKey(varName))
            {
                IsValid = false;
            }

            return(null);
        }
        return(m_properties[prop]);
    }
Esempio n. 3
0
    void ClearMaterialArray(PropType type, SerializedProperty props)
    {
        for (int i = 0; i < props.arraySize; ++i)
        {
            var    prop     = props.GetArrayElementAtIndex(i);
            var    nameProp = prop.FindPropertyRelative("first.name");
            string propName = nameProp.stringValue;

            if (!MaterialPropNames.ContainsKey(propName) || MaterialPropNames[propName].type != type)
            {
                props.DeleteArrayElementAtIndex(i);
                --i;
            }
        }

        MatEditor.OnEnable();
    }