Exemple #1
0
        /// <summary>
        /// Constructor for Path
        /// </summary>
        public ColumnContext(AssetListConfiguration configuration, AssetListWindow window)
        {
            configColumnIndex = -1;
            propertyPath      = null;
            propertyOverride  = PropertyOverride.Path;
            Texture persistent = EditorGUIUtility.IconContent("Project").image;
            Texture inScene    = EditorGUIUtility.ObjectContent(null, typeof(SceneAsset)).image;

            Texture GetIcon(Object o) => EditorUtility.IsPersistent(o) ? persistent : inScene;

            onGUI = (rect, sO, property) => PathLabelWithIcon(rect, sO, window, GetIcon);
        }
Exemple #2
0
        static bool OpenAsset(int instanceID, int line)
        {
            Object @object = EditorUtility.InstanceIDToObject(instanceID);

            if (!(@object is AssetListConfiguration configAsset))
            {
                return(false);
            }

            AssetListWindow assetListWindow = AssetListWindow.GetUnopenedWindow();

            assetListWindow.InitialiseWithConfiguration(configAsset);
            assetListWindow.Show();
            return(true);
        }
Exemple #3
0
        public ColumnContext(AssetListConfiguration c, NamePropertyDisplay nameDisplay, AssetListWindow window)
        {
            configColumnIndex = -1;
            propertyPath      = null;
            propertyOverride  = PropertyOverride.Name;
            Func <SerializedObject, SerializedProperty> getIconProperty = null;

            if (!string.IsNullOrEmpty(c.IconPropertyPath))
            {
                if (c.IconIsArray)
                {
                    AssetListConfiguration.ArrayData propInfo = c.IconArrayPropertyInformation;
                    Func <SerializedProperty, SerializedProperty> arrayLookup = GetArrayPropertyLookup(propInfo);
                    if (arrayLookup != null)
                    {
                        getIconProperty = context =>
                        {
                            SerializedProperty iconPath = context.FindProperty(c.IconPropertyPath);
                            return(arrayLookup?.Invoke(iconPath));
                        };
                    }
                }
                else
                {
                    getIconProperty = context => context.FindProperty(c.IconPropertyPath);
                }
            }

            switch (nameDisplay)
            {
            case NamePropertyDisplay.Label:
                onGUI = (rect, sO, property) => LargeObjectLabelWithPing(rect, sO, getIconProperty, window, GUI.Label);
                break;

            case NamePropertyDisplay.NicifiedLabel:
                onGUI = (rect, sO, property) => LargeObjectLabelWithPing(rect, sO, getIconProperty, window, ReadonlyNicifiedLabelProperty);
                break;

            case NamePropertyDisplay.CenteredLabel:
                onGUI = (rect, sO, property) => LargeObjectLabelWithPing(rect, sO, getIconProperty, window, ReadonlyCenteredLabelProperty);
                break;

            case NamePropertyDisplay.NicifiedCenteredLabel:
                onGUI = (rect, sO, property) => LargeObjectLabelWithPing(rect, sO, getIconProperty, window, ReadonlyNicifiedCenteredLabelProperty);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(nameDisplay), nameDisplay, null);
            }
        }