Beispiel #1
0
        internal static MaterialProperty GetMaterialProperty(SearchItem item, SearchColumn column)
        {
            var mat = item.ToObject <Material>();

            if (!mat)
            {
                return(null);
            }

            foreach (var m in SelectorManager.Match(column.selector, item.provider?.type))
            {
                var selectorArgs = new SearchSelectorArgs(m, item);
                if (selectorArgs.name == null)
                {
                    continue;
                }

                if (!mat.HasProperty(selectorArgs.name))
                {
                    continue;
                }

                return(MaterialEditor.GetMaterialProperty(new Object[] { mat }, selectorArgs.name));
            }

            return(null);
        }
Beispiel #2
0
        internal static SerializedProperty GetSerializedProperty(SearchItem item, SearchColumn column, out SerializedObject so)
        {
            foreach (var m in SelectorManager.Match(column.selector, item.provider?.type))
            {
                var selectorArgs = new SearchSelectorArgs(m, item);
                if (selectorArgs.name == null)
                {
                    continue;
                }
                var property = GetSerializedProperty(item, selectorArgs.name, out so);
                if (property == null)
                {
                    so?.Dispose();
                    continue;
                }

                so.UpdateIfRequiredOrScript();
                return(property);
            }

            so = null;
            return(null);
        }