| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Runtime.CompilerServices;
- using System.Text;
- using System.Threading.Tasks;
- using BansheeEngine;
- namespace BansheeEditor
- {
- /// <summary>
- /// Contains utility methods relating to inspector window.
- /// </summary>
- public class InspectorUtility
- {
- /// <summary>
- /// Creates an inspector capable of displaying GUI elements for an object of the provided type.
- /// </summary>
- /// <param name="type">Type of the object that will be displayed in the inspector.</param>
- /// <returns>Custom user defined inspector if it exists for the provided type, or the generic inspector.</returns>
- public static Inspector GetInspector(Type type)
- {
- Inspector customInspector = Internal_GetCustomInspector(type);
- if (customInspector != null)
- return customInspector;
- return new GenericInspector();
- }
- /// <summary>
- /// Gets an <see cref="InspectableField"/> implementation for the specified type. This only searches custom user
- /// defined implementations, not the built-in ones.
- /// </summary>
- /// <param name="type">Type of the object to find an <see cref="InspectableField"/> for.</param>
- /// <returns>Implementation of <see cref="InspectableField"/> capable of display contents of the provided type,
- /// or null if one wasn't found.</returns>
- public static Type GetCustomInspectable(Type type)
- {
- Type customInspectable = Internal_GetCustomInspectable(type);
- if (customInspectable != null)
- return customInspectable;
- return null;
- }
- [MethodImpl(MethodImplOptions.InternalCall)]
- private static extern Inspector Internal_GetCustomInspector(Type type);
- [MethodImpl(MethodImplOptions.InternalCall)]
- private static extern Type Internal_GetCustomInspectable(Type type);
- }
- }
|