GetMiniTypeThumbnail() static private method

static private GetMiniTypeThumbnail ( Object obj ) : Texture2D
obj Object
return UnityEngine.Texture2D
Ejemplo n.º 1
0
 GUIContent GetContentForOutput(PlayableBinding binding, UnityEngine.Object source)
 {
     m_BindingContent.text    = binding.streamName;
     m_BindingContent.tooltip = (source == null) ? Styles.NoBindingsContent.text : string.Empty;
     m_BindingContent.image   = AssetPreview.GetMiniTypeThumbnail(binding.outputTargetType) ?? m_DefaultScriptContentTexture;
     return(m_BindingContent);
 }
Ejemplo n.º 2
0
 public TypeSelection(string typeName, Object[] objects)
 {
     this.objects = objects;
     object[] objArray1 = new object[] { objects.Length, " ", ObjectNames.NicifyVariableName(typeName), (objects.Length <= 1) ? string.Empty : "s" };
     this.label       = new GUIContent(string.Concat(objArray1));
     this.label.image = AssetPreview.GetMiniTypeThumbnail(objects[0]);
 }
Ejemplo n.º 3
0
 public TypeSelection(string typeName, Object[] objects)
 {
     System.Diagnostics.Debug.Assert(objects != null || objects.Length >= 1);
     this.objects = objects;
     label        = new GUIContent(objects.Length + " " + ObjectNames.NicifyVariableName(typeName) + (objects.Length > 1 ? "s" : ""));
     label.image  = AssetPreview.GetMiniTypeThumbnail(objects[0]);
 }
Ejemplo n.º 4
0
 private void BindingInspector(SerializedProperty bindingProperty, PlayableBinding binding)
 {
     if (!(binding.sourceObject == null))
     {
         UnityEngine.Object objectReferenceValue = bindingProperty.objectReferenceValue;
         if (binding.streamType == DataStreamType.Audio)
         {
             this.m_AudioContent.text    = binding.streamName;
             this.m_AudioContent.tooltip = ((!(objectReferenceValue == null)) ? string.Empty : DirectorEditor.Styles.NoBindingsContent.text);
             DirectorEditor.PropertyFieldAsObject(bindingProperty, this.m_AudioContent, typeof(AudioSource), false, false);
         }
         else if (binding.streamType == DataStreamType.Animation)
         {
             this.m_AnimatorContent.text    = binding.streamName;
             this.m_AnimatorContent.tooltip = ((!(objectReferenceValue is GameObject)) ? string.Empty : DirectorEditor.Styles.NoBindingsContent.text);
             DirectorEditor.PropertyFieldAsObject(bindingProperty, this.m_AnimatorContent, typeof(Animator), true, true);
         }
         else if (binding.streamType == DataStreamType.None)
         {
             this.m_ScriptContent.text    = binding.streamName;
             this.m_ScriptContent.tooltip = ((!(objectReferenceValue == null)) ? string.Empty : DirectorEditor.Styles.NoBindingsContent.text);
             this.m_ScriptContent.image   = (AssetPreview.GetMiniTypeThumbnail(binding.sourceBindingType) ?? this.m_DefaultScriptContentTexture);
             if (binding.sourceBindingType != null && typeof(UnityEngine.Object).IsAssignableFrom(binding.sourceBindingType))
             {
                 DirectorEditor.PropertyFieldAsObject(bindingProperty, this.m_ScriptContent, binding.sourceBindingType, true, false);
             }
         }
     }
 }
        public static Type SearchBar(params Type[] types)
        {
            if (s_NoneButtonContent == null)
            {
                s_NoneButtonContent      = EditorGUIUtility.IconContent("sv_icon_none");
                s_NoneButtonContent.text = "None";
            }

            if (s_FocusType != null && (s_HierarchyWindow == null || s_HierarchyWindow.m_SearchFilter != "t:" + s_FocusType.Name))
            {
                s_FocusType = null;
            }

            GUILayout.Label("Scene Filter:");

            EditorGUILayout.BeginHorizontal();

            {
                GUIContent label = EditorGUIUtility.TempContent(
                    "All",
                    AssetPreview.GetMiniTypeThumbnail(typeof(GameObject)));
                if (TypeButton(label, s_FocusType == null, styles.typeButton))
                {
                    SceneModeUtility.SearchForType(null);
                }
            }

            for (int i = 0; i < types.Length; i++)
            {
                Type      type = types[i];
                Texture2D icon = null;
                if (type == typeof(Renderer))
                {
                    icon = EditorGUIUtility.IconContent("MeshRenderer Icon").image as Texture2D;
                }
                else if (type == typeof(Terrain))
                {
                    icon = EditorGUIUtility.IconContent("Terrain Icon").image as Texture2D;
                }
                else
                {
                    icon = AssetPreview.GetMiniTypeThumbnail(type);
                }
                string     name  = ObjectNames.NicifyVariableName(type.Name) + "s";
                GUIContent label = EditorGUIUtility.TempContent(name, icon);
                if (TypeButton(label, type == s_FocusType, styles.typeButton))
                {
                    SceneModeUtility.SearchForType(type);
                }
            }
            GUILayout.FlexibleSpace();
            EditorGUILayout.EndHorizontal();

            return(s_FocusType);
        }
Ejemplo n.º 6
0
 public TypeSelection(string typeName, UnityEngine.Object[] objects)
 {
     this.objects = objects;
     this.label   = new GUIContent(string.Concat(new object[]
     {
         objects.Length,
         " ",
         ObjectNames.NicifyVariableName(typeName),
         (objects.Length <= 1) ? "" : "s"
     }));
     this.label.image = AssetPreview.GetMiniTypeThumbnail(objects[0]);
 }
        protected override void OnHeaderGUI()
        {
            EditorGUILayout.BeginHorizontal(EditorStyles.inspectorBig);
            Texture2D icon = AssetPreview.GetMiniTypeThumbnail(typeof(Grid));

            GUILayout.Label(icon, GUILayout.Width(iconSize), GUILayout.Height(iconSize));
            EditorGUILayout.BeginVertical();
            GUILayout.Label(Styles.gridSelectionLabel);
            GridSelection.position = EditorGUILayout.BoundsIntField(GUIContent.none, GridSelection.position);
            EditorGUILayout.EndVertical();
            EditorGUILayout.EndHorizontal();
            DrawHeaderHelpAndSettingsGUI(GUILayoutUtility.GetLastRect());
        }
Ejemplo n.º 8
0
 public void OnEnable()
 {
     this.m_PlayableAsset               = base.serializedObject.FindProperty("m_PlayableAsset");
     this.m_InitialState                = base.serializedObject.FindProperty("m_InitialState");
     this.m_WrapMode                    = base.serializedObject.FindProperty("m_WrapMode");
     this.m_UpdateMethod                = base.serializedObject.FindProperty("m_DirectorUpdateMode");
     this.m_InitialTime                 = base.serializedObject.FindProperty("m_InitialTime");
     this.m_SceneBindings               = base.serializedObject.FindProperty("m_SceneBindings");
     this.m_AnimatorContent             = new GUIContent(AssetPreview.GetMiniTypeThumbnail(typeof(Animator)));
     this.m_AudioContent                = new GUIContent(AssetPreview.GetMiniTypeThumbnail(typeof(AudioSource)));
     this.m_ScriptContent               = new GUIContent(EditorGUIUtility.LoadIcon("ScriptableObject Icon"));
     this.m_DefaultScriptContentTexture = this.m_ScriptContent.image;
 }
Ejemplo n.º 9
0
 public TypeSelection(string typeName, Object[] objects)
 {
     System.Diagnostics.Debug.Assert(objects != null && objects.Length >= 1);
     this.objects = objects;
     label        = new GUIContent(objects.Length + " " + ObjectNames.NicifyVariableName(typeName) + (objects.Length > 1 ? "s" : ""));
     if (objects[0] is GameObject)
     {
         label.image = EditorUtility.IsPersistent(objects[0]) ? PrefabUtility.GameObjectStyles.prefabIcon : PrefabUtility.GameObjectStyles.gameObjectIcon;
     }
     else
     {
         label.image = AssetPreview.GetMiniTypeThumbnail(objects[0]);
     }
 }
Ejemplo n.º 10
0
        public void OnEnable()
        {
            m_PlayableAsset = serializedObject.FindProperty("m_PlayableAsset");
            m_InitialState  = serializedObject.FindProperty("m_InitialState");
            m_WrapMode      = serializedObject.FindProperty("m_WrapMode");
            m_UpdateMethod  = serializedObject.FindProperty("m_DirectorUpdateMode");
            m_InitialTime   = serializedObject.FindProperty("m_InitialTime");
            m_SceneBindings = serializedObject.FindProperty("m_SceneBindings");

            m_AnimatorContent             = new GUIContent(AssetPreview.GetMiniTypeThumbnail(typeof(Animator)));
            m_AudioContent                = new GUIContent(AssetPreview.GetMiniTypeThumbnail(typeof(AudioSource)));
            m_VideoContent                = new GUIContent(AssetPreview.GetMiniTypeThumbnail(typeof(RenderTexture)));
            m_ScriptContent               = new GUIContent(EditorGUIUtility.FindTexture(typeof(ScriptableObject)));
            m_DefaultScriptContentTexture = m_ScriptContent.image;
        }
Ejemplo n.º 11
0
        protected override void OnHeaderGUI()
        {
            EditorGUILayout.BeginHorizontal(GridSelectionEditor.Styles.header, new GUILayoutOption[0]);
            Texture2D miniTypeThumbnail = AssetPreview.GetMiniTypeThumbnail(typeof(Grid));

            GUILayout.Label(miniTypeThumbnail, new GUILayoutOption[]
            {
                GUILayout.Width(32f),
                GUILayout.Height(32f)
            });
            EditorGUILayout.BeginVertical(new GUILayoutOption[0]);
            GUILayout.Label(GridSelectionEditor.Styles.gridSelectionLabel, new GUILayoutOption[0]);
            GridSelection.position = EditorGUILayout.BoundsIntField(GUIContent.none, GridSelection.position, new GUILayoutOption[0]);
            EditorGUILayout.EndVertical();
            EditorGUILayout.EndHorizontal();
            this.DrawHeaderHelpAndSettingsGUI(GUILayoutUtility.GetLastRect());
        }
Ejemplo n.º 12
0
 public static GUIContent ObjectContent(UnityEngine.Object obj, Type type)
 {
     if (obj)
     {
         if (obj is AudioMixerGroup)
         {
             EditorGUIUtility.s_ObjectContent.text = obj.name + " (" + ((AudioMixerGroup)obj).audioMixer.name + ")";
         }
         else
         {
             if (obj is AudioMixerSnapshot)
             {
                 EditorGUIUtility.s_ObjectContent.text = obj.name + " (" + ((AudioMixerSnapshot)obj).audioMixer.name + ")";
             }
             else
             {
                 EditorGUIUtility.s_ObjectContent.text = obj.name;
             }
         }
         EditorGUIUtility.s_ObjectContent.image = AssetPreview.GetMiniThumbnail(obj);
     }
     else
     {
         string arg;
         if (type == null)
         {
             arg = "<no type>";
         }
         else
         {
             if (type.Namespace != null)
             {
                 arg = type.ToString().Substring(type.Namespace.ToString().Length + 1);
             }
             else
             {
                 arg = type.ToString();
             }
         }
         EditorGUIUtility.s_ObjectContent.text  = string.Format("None ({0})", arg);
         EditorGUIUtility.s_ObjectContent.image = AssetPreview.GetMiniTypeThumbnail(type);
     }
     return(EditorGUIUtility.s_ObjectContent);
 }
Ejemplo n.º 13
0
 public static GUIContent ObjectContent(UnityEngine.Object obj, Type type)
 {
     if (obj)
     {
         EditorGUIUtility.s_ObjectContent.text  = EditorGUIUtility.GetObjectNameWithInfo(obj);
         EditorGUIUtility.s_ObjectContent.image = AssetPreview.GetMiniThumbnail(obj);
     }
     else if (type != null)
     {
         EditorGUIUtility.s_ObjectContent.text  = EditorGUIUtility.GetTypeNameWithInfo(type.Name);
         EditorGUIUtility.s_ObjectContent.image = AssetPreview.GetMiniTypeThumbnail(type);
     }
     else
     {
         EditorGUIUtility.s_ObjectContent.text  = "<no type>";
         EditorGUIUtility.s_ObjectContent.image = null;
     }
     return(EditorGUIUtility.s_ObjectContent);
 }
Ejemplo n.º 14
0
 public static System.Type SearchBar(params System.Type[] types)
 {
     if (s_NoneButtonContent == null)
     {
         s_NoneButtonContent      = EditorGUIUtility.IconContent("sv_icon_none");
         s_NoneButtonContent.text = "None";
     }
     if ((s_FocusType != null) && ((s_HierarchyWindow == null) || (s_HierarchyWindow.m_SearchFilter != ("t:" + s_FocusType.Name))))
     {
         s_FocusType = null;
     }
     GUILayout.Label("Scene Filter:", new GUILayoutOption[0]);
     EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]);
     if (TypeButton(EditorGUIUtility.TempContent("All", AssetPreview.GetMiniTypeThumbnail(typeof(GameObject))), s_FocusType == null, styles.typeButton))
     {
         SearchForType(null);
     }
     for (int i = 0; i < types.Length; i++)
     {
         System.Type type  = types[i];
         Texture2D   image = null;
         if (type == typeof(Renderer))
         {
             image = EditorGUIUtility.IconContent("MeshRenderer Icon").image as Texture2D;
         }
         else if (type == typeof(Terrain))
         {
             image = EditorGUIUtility.IconContent("Terrain Icon").image as Texture2D;
         }
         else
         {
             image = AssetPreview.GetMiniTypeThumbnail(type);
         }
         if (TypeButton(EditorGUIUtility.TempContent(ObjectNames.NicifyVariableName(type.Name) + "s", image), type == s_FocusType, styles.typeButton))
         {
             SearchForType(type);
         }
     }
     GUILayout.FlexibleSpace();
     EditorGUILayout.EndHorizontal();
     return(s_FocusType);
 }
Ejemplo n.º 15
0
        private void BindingInspector(SerializedProperty bindingProperty, PlayableBinding binding)
        {
            if (binding.sourceObject == null)
            {
                return;
            }

            var source = bindingProperty.objectReferenceValue;

            if (binding.streamType == DataStreamType.Audio)
            {
                m_AudioContent.text    = binding.streamName;
                m_AudioContent.tooltip = source == null ? Styles.NoBindingsContent.text : string.Empty;
                PropertyFieldAsObject(bindingProperty, m_AudioContent, typeof(AudioSource), true);
            }
            else if (binding.streamType == DataStreamType.Animation)
            {
                m_AnimatorContent.text    = binding.streamName;
                m_AnimatorContent.tooltip = source is GameObject ? Styles.NoBindingsContent.text : string.Empty;
                PropertyFieldAsObject(bindingProperty, m_AnimatorContent, typeof(Animator), true, true);
            }
            if (binding.streamType == DataStreamType.Texture)
            {
                m_VideoContent.text    = binding.streamName;
                m_VideoContent.tooltip = source == null ? Styles.NoBindingsContent.text : string.Empty;
                PropertyFieldAsObject(bindingProperty, m_VideoContent, typeof(RenderTexture), false);
            }
            else if (binding.streamType == DataStreamType.None)
            {
                m_ScriptContent.text    = binding.streamName;
                m_ScriptContent.tooltip = source == null ? Styles.NoBindingsContent.text : string.Empty;
                m_ScriptContent.image   = AssetPreview.GetMiniTypeThumbnail(binding.sourceBindingType) ?? m_DefaultScriptContentTexture;

                if (binding.sourceBindingType != null && typeof(UnityEngine.Object).IsAssignableFrom(binding.sourceBindingType))
                {
                    PropertyFieldAsObject(bindingProperty, m_ScriptContent, binding.sourceBindingType, true);
                }
            }
        }
Ejemplo n.º 16
0
 public static GUIContent ObjectContent(Object obj, Type type)
 {
     if (obj != null)
     {
         if (obj is AudioMixerGroup)
         {
             s_ObjectContent.text = obj.name + " (" + ((AudioMixerGroup)obj).audioMixer.name + ")";
         }
         else if (obj is AudioMixerSnapshot)
         {
             s_ObjectContent.text = obj.name + " (" + ((AudioMixerSnapshot)obj).audioMixer.name + ")";
         }
         else
         {
             s_ObjectContent.text = obj.name;
         }
         s_ObjectContent.image = AssetPreview.GetMiniThumbnail(obj);
     }
     else
     {
         string str;
         if (type == null)
         {
             str = "<no type>";
         }
         else if (type.Namespace != null)
         {
             str = type.ToString().Substring(type.Namespace.ToString().Length + 1);
         }
         else
         {
             str = type.ToString();
         }
         s_ObjectContent.text  = string.Format("None ({0})", str);
         s_ObjectContent.image = AssetPreview.GetMiniTypeThumbnail(type);
     }
     return(s_ObjectContent);
 }
Ejemplo n.º 17
0
        internal static Rect DrawHeaderGUI(Editor editor, string header, float leftMargin)
        {
            GUILayout.BeginHorizontal(BaseStyles.inspectorBig);
            GUILayout.Space(kImageSectionWidth - 6);
            GUILayout.BeginVertical();
            GUILayout.Space(k_HeaderHeight);
            GUILayout.BeginHorizontal();
            if (leftMargin > 0f)
            {
                GUILayout.Space(leftMargin);
            }
            if (editor)
            {
                editor.OnHeaderControlsGUI();
            }
            else
            {
                EditorGUILayout.GetControlRect();
            }
            GUILayout.EndHorizontal();
            GUILayout.EndVertical();
            GUILayout.EndHorizontal();
            Rect fullRect = GUILayoutUtility.GetLastRect();

            // Content rect
            Rect r = new Rect(fullRect.x + leftMargin, fullRect.y, fullRect.width - leftMargin, fullRect.height);

            // Icon
            Rect iconRect = new Rect(r.x + 6, r.y + 6, 32, 32);

            if (editor)
            {
                editor.OnHeaderIconGUI(iconRect);
            }
            else
            {
                GUI.Label(iconRect, AssetPreview.GetMiniTypeThumbnail(typeof(UnityObject)), BaseStyles.centerStyle);
            }

            if (editor)
            {
                editor.DrawPostIconContent(iconRect);
            }

            // Help and Settings
            Rect titleRect;

            if (editor)
            {
                Rect  helpAndSettingsRect = editor.DrawHeaderHelpAndSettingsGUI(r);
                float rectX = r.x + kImageSectionWidth;
                titleRect = new Rect(rectX, r.y + 6, (helpAndSettingsRect.x - rectX) - 4, 16);
            }
            else
            {
                titleRect = new Rect(r.x + kImageSectionWidth, r.y + 6, r.width - kImageSectionWidth, 16);
            }

            // Title
            if (editor)
            {
                editor.OnHeaderTitleGUI(titleRect, header);
            }
            else
            {
                GUI.Label(titleRect, header, EditorStyles.largeLabel);
            }

            // Context Menu
            Event evt = Event.current;

            if (editor != null && evt.type == EventType.MouseDown && evt.button == 1 && r.Contains(evt.mousePosition))
            {
                EditorUtility.DisplayObjectContextMenu(new Rect(evt.mousePosition.x, evt.mousePosition.y, 0, 0), editor.targets, 0);
                evt.Use();
            }

            return(fullRect);
        }
Ejemplo n.º 18
0
 public static System.Type SearchBar(params System.Type[] types)
 {
     if (SceneModeUtility.s_NoneButtonContent == null)
     {
         SceneModeUtility.s_NoneButtonContent      = EditorGUIUtility.IconContent("sv_icon_none");
         SceneModeUtility.s_NoneButtonContent.text = "None";
     }
     if (SceneModeUtility.s_FocusType != null && ((UnityEngine.Object)SceneModeUtility.s_HierarchyWindow == (UnityEngine.Object)null || SceneModeUtility.s_HierarchyWindow.m_SearchFilter != "t:" + SceneModeUtility.s_FocusType.Name))
     {
         SceneModeUtility.s_FocusType = (System.Type)null;
     }
     GUILayout.Label("Scene Filter:");
     EditorGUILayout.BeginHorizontal();
     if (SceneModeUtility.TypeButton(EditorGUIUtility.TempContent("All", (Texture)AssetPreview.GetMiniTypeThumbnail(typeof(GameObject))), SceneModeUtility.s_FocusType == null, SceneModeUtility.styles.typeButton))
     {
         SceneModeUtility.SearchForType((System.Type)null);
     }
     for (int index = 0; index < types.Length; ++index)
     {
         System.Type type      = types[index];
         Texture2D   texture2D = type != typeof(Renderer) ? (type != typeof(Terrain) ? AssetPreview.GetMiniTypeThumbnail(type) : EditorGUIUtility.IconContent("Terrain Icon").image as Texture2D) : EditorGUIUtility.IconContent("MeshRenderer Icon").image as Texture2D;
         if (SceneModeUtility.TypeButton(EditorGUIUtility.TempContent(ObjectNames.NicifyVariableName(type.Name) + "s", (Texture)texture2D), type == SceneModeUtility.s_FocusType, SceneModeUtility.styles.typeButton))
         {
             SceneModeUtility.SearchForType(type);
         }
     }
     GUILayout.FlexibleSpace();
     EditorGUILayout.EndHorizontal();
     return(SceneModeUtility.s_FocusType);
 }
Ejemplo n.º 19
0
        internal static Rect DrawHeaderGUI(Editor editor, string header, float leftMargin)
        {
            if (Editor.s_Styles == null)
            {
                Editor.s_Styles = new Editor.Styles();
            }
            GUILayout.BeginHorizontal(Editor.s_Styles.inspectorBig, new GUILayoutOption[0]);
            GUILayout.Space(38f);
            GUILayout.BeginVertical(new GUILayoutOption[0]);
            GUILayout.Space(19f);
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            if (leftMargin > 0f)
            {
                GUILayout.Space(leftMargin);
            }
            if (editor)
            {
                editor.OnHeaderControlsGUI();
            }
            else
            {
                EditorGUILayout.GetControlRect(new GUILayoutOption[0]);
            }
            GUILayout.EndHorizontal();
            GUILayout.EndVertical();
            GUILayout.EndHorizontal();
            Rect lastRect = GUILayoutUtility.GetLastRect();
            Rect r        = new Rect(lastRect.x + leftMargin, lastRect.y, lastRect.width - leftMargin, lastRect.height);
            Rect rect     = new Rect(r.x + 6f, r.y + 6f, 32f, 32f);

            if (editor)
            {
                editor.OnHeaderIconGUI(rect);
            }
            else
            {
                GUI.Label(rect, AssetPreview.GetMiniTypeThumbnail(typeof(UnityEngine.Object)), Editor.s_Styles.centerStyle);
            }
            if (editor)
            {
                editor.DrawPostIconContent(rect);
            }
            Rect rect2 = new Rect(r.x + 44f, r.y + 6f, r.width - 44f - 38f - 4f, 16f);

            if (editor)
            {
                editor.OnHeaderTitleGUI(rect2, header);
            }
            else
            {
                GUI.Label(rect2, header, EditorStyles.largeLabel);
            }
            if (editor)
            {
                editor.DrawHeaderHelpAndSettingsGUI(r);
            }
            Event current = Event.current;

            if (editor != null && current.type == EventType.MouseDown && current.button == 1 && r.Contains(current.mousePosition))
            {
                EditorUtility.DisplayObjectContextMenu(new Rect(current.mousePosition.x, current.mousePosition.y, 0f, 0f), editor.targets, 0);
                current.Use();
            }
            return(lastRect);
        }
Ejemplo n.º 20
0
 public TypeSelection(string typeName, UnityEngine.Object[] objects)
 {
     this.objects     = objects;
     this.label       = new GUIContent(objects.Length.ToString() + " " + ObjectNames.NicifyVariableName(typeName) + (objects.Length <= 1 ? string.Empty : "s"));
     this.label.image = (Texture)AssetPreview.GetMiniTypeThumbnail(objects[0]);
 }