예제 #1
0
        public static PropertyDrawerDrawer Create(object value, UnityEditor.PropertyDrawer drawerInstance, Type drawerType, LinkedMemberInfo memberInfo, IParentDrawer parent, GUIContent label, bool setReadOnly)
        {
            if (memberInfo == null)
            {
                                #if DEV_MODE
                Debug.LogError("PropertyDrawerDrawer.Create(drawerType=" + drawerType.Name + ", parent=" + StringUtils.ToString(parent) + ", label=" + (label == null ? "null" : label.text) + "), returning null because fieldInfo was null");
                                #endif
                return(null);
            }

            if (memberInfo.SerializedProperty == null)
            {
                                #if DEV_MODE
                Debug.LogError("PropertyDrawerDrawer.Create(drawerType=" + drawerType.Name + ", parent=" + StringUtils.ToString(parent) + ", label=" + (label == null ? "null" : label.text) + "), returning null because fieldInfo.SerializedProperty was null");
                                #endif
                return(null);
            }

            PropertyDrawerDrawer result;
            if (!DrawerPool.TryGet(out result))
            {
                result = new PropertyDrawerDrawer();
            }
            result.Setup(value, drawerInstance, drawerType, memberInfo, parent, label, setReadOnly);
            result.LateSetup();
            return(result);
        }
예제 #2
0
		/// <summary> Creates a new instance of the drawer or returns a reusable instance from the pool. </summary>
		/// <param name="attribute"> The PropertyAttribute that these drawer represent and whose DectoratorDrawer is used when drawing the control. </param>
		/// <param name="parent"> The parent drawer of the created drawer. Can be null. </param>
		/// <param name="drawerType"> Type of the DecoratorDrawer that is used for drawing the control. </param>
		/// <returns> The instance, ready to be used. </returns>
		public static DecoratorDrawerDrawer Create([NotNull]PropertyAttribute attribute, [NotNull]Type drawerType, [CanBeNull]IParentDrawer parent)
		{
			DecoratorDrawerDrawer result;
			if(!DrawerPool.TryGet(out result))
			{
				result = new DecoratorDrawerDrawer();
			}
			result.Setup(attribute, drawerType, null, parent);
			result.LateSetup();
			return result;
		}
예제 #3
0
		/// <summary> Creates a new instance of the drawer or returns a reusable instance from the pool. </summary>
		/// <param name="value"> The starting cached value of the drawer. </param>
		/// <param name="memberInfo"> LinkedMemberInfo for the field, property or parameter that the drawer represents. Can be null. </param>
		/// <param name="parent"> The parent drawer of the created drawer. Can be null. </param>
		/// <param name="label"> The prefix label. </param>
		/// <param name="readOnly"> True if control should be read only. </param>
		/// <returns> The instance, ready to be used. </returns>
		public static FloatDrawer Create(float value, LinkedMemberInfo memberInfo, IParentDrawer parent, GUIContent label, bool readOnly)
		{
			FloatDrawer result;
			if(!DrawerPool.TryGet(out result))
			{
				result = new FloatDrawer();
			}
			result.Setup(value, typeof(float), memberInfo, parent, label, readOnly);
			result.LateSetup();
			return result;
		}
예제 #4
0
        /// <summary> Creates a new instance of the drawer or returns a reusable instance from the pool. </summary>
        /// <param name="list"> The starting cached value of the drawer. </param>
        /// <param name="memberInfo"> LinkedMemberInfo for the field, property or parameter that the drawer represents. Can be null. </param>
        /// <param name="parent"> The parent drawer of the created drawer. Can be null. </param>
        /// <param name="label"> The prefix label. </param>
        /// <param name="readOnly"> True if control should be read only. </param>
        /// <returns> The instance, ready to be used. </returns>
        public static ListDrawer <T> Create(IList <T> list, LinkedMemberInfo memberInfo, IParentDrawer parent, GUIContent label, bool readOnly)
        {
            ListDrawer <T> result;

            if (!DrawerPool.TryGet(out result))
            {
                result = new ListDrawer <T>();
            }
            result.Setup(list, DrawerUtility.GetType(memberInfo, list), memberInfo, parent, label, readOnly);
            result.LateSetup();
            return(result);
        }
예제 #5
0
        /// <summary> Creates a new instance of the drawer or returns a reusable instance from the pool. </summary>
        /// <param name="value"> The initial cached value of the drawer. </param>
        /// <param name="memberInfo"> LinkedMemberInfo for the class member that the created drawer represents. Can be null. </param>
        /// <param name="parent"> The parent drawer of the created drawer. Can be null. </param>
        /// <param name="label"> The prefix label. </param>
        /// <param name="readOnly"> True if drawer should be read only. </param>
        /// <returns> The drawer instance, ready to be used. </returns>
        public static AnyEnumDrawer Create(object value, LinkedMemberInfo memberInfo, IParentDrawer parent, GUIContent label, bool readOnly)
        {
            AnyEnumDrawer result;

            if (!DrawerPool.TryGet(out result))
            {
                result = new AnyEnumDrawer();
            }
            result.Setup(value, DrawerUtility.GetType(memberInfo, value), memberInfo, parent, label, readOnly);
            result.LateSetup();
            return(result);
        }
예제 #6
0
        /// <summary> Creates a new instance of ClampedFloatDrawer or returns a reusable instance from the pool. </summary>
        /// <param name="value"> The starting cached value of the drawer. </param>
        /// <param name="min">smallest possible value for drawer</param>
        /// <param name="max">largest possible value for drawer</param>
        /// <param name="memberInfo"> LinkedMemberInfo for the field, property or parameter that the created drawer represents. Can be null. </param>
        /// <param name="parent"> The parent drawer of the created drawer. Can be null. </param>
        /// <param name="label"> The prefix label. </param>
        /// <param name="readOnly"> True if control should be read only. </param>
        /// <returns> Ready-to-use instance of RectDrawer. </returns>
        public static ClampedFloatDrawer Create(float value, float min, float max, LinkedMemberInfo memberInfo, IParentDrawer parent, GUIContent label, bool readOnly)
        {
            ClampedFloatDrawer result;

            if (!DrawerPool.TryGet(out result))
            {
                result = new ClampedFloatDrawer();
            }
            result.Setup(value, min, max, memberInfo, parent, label, readOnly);
            result.LateSetup();
            return(result);
        }
예제 #7
0
        public static GUIContentDrawer Create(GUIContent value, [CanBeNull] LinkedMemberInfo memberInfo, [CanBeNull] IParentDrawer parent, GUIContent label, bool readOnly)
        {
            GUIContentDrawer result;

            if (!DrawerPool.TryGet(out result))
            {
                result = new GUIContentDrawer();
            }
            result.Setup(value, typeof(GUIContent), memberInfo, parent, label, readOnly);
            result.LateSetup();
            return(result);
        }
예제 #8
0
        /// <summary> Creates a new instance of the drawer or returns a reusable instance from the pool. </summary>
        /// <param name="targets"> The targets that the drawer represent. </param>
        /// <param name="parent"> The parent drawer of the created drawer. Can be null. </param>
        /// <param name="inspector"> The inspector in which the IDrawer are contained. Can not be null. </param>
        /// <returns> The instance, ready to be used. </returns>
        public static TerrainDrawer Create(Component[] targets, [CanBeNull] IParentDrawer parent, [NotNull] IInspector inspector)
        {
            TerrainDrawer result;

            if (!DrawerPool.TryGet(out result))
            {
                result = new TerrainDrawer();
            }
            result.Setup(targets, parent, inspector, null);
            result.LateSetup();
            return(result);
        }
예제 #9
0
        /// <summary> Creates a new instance of the drawer or returns a reusable instance from the pool. </summary>
        /// <param name="parent"> The parent drawer of the created drawer. Can be null. </param>
        /// <param name="label"> The prefix label. </param>
        /// <param name="setReadOnly"> True if control should be read only. </param>
        /// <returns> The instance, ready to be used. </returns>
        public static CategorizedComponentsDrawer Create(IParentDrawer parent, GUIContent label)
        {
            CategorizedComponentsDrawer result;

            if (!DrawerPool.TryGet(out result))
            {
                result = new CategorizedComponentsDrawer();
            }
            result.Setup(parent, label);
            result.LateSetup();
            return(result);
        }
예제 #10
0
        public static AbstractDrawer Create(object value, LinkedMemberInfo memberInfo, IParentDrawer parent, GUIContent label, bool setReadOnly)
        {
            AbstractDrawer result;

            if (!DrawerPool.TryGet(out result))
            {
                result = new AbstractDrawer();
            }
            result.Setup(value, memberInfo != null ? memberInfo.Type : value != null ? value.GetType() : Types.SystemObject, memberInfo, parent, label, setReadOnly);
            result.LateSetup();
            return(result);
        }
        /// <summary> Creates a new instance of the drawer or returns a reusable instance from the pool. </summary>
        /// <param name="value"> The initial cached value of the drawer. </param>
        /// <param name="memberInfo"> LinkedMemberInfo for the class member that the created drawer represents. Can be null. </param>
        /// <param name="parent"> The parent drawer of the created drawer. Can be null. </param>
        /// <param name="label"> The prefix label. </param>
        /// <param name="readOnly"> True if drawer should be read only. </param>
        /// <returns> The drawer instance, ready to be used. </returns>
        public static ConstraintedTypeDrawer Create([CanBeNull] Type value, [NotNull] Type[] baseTypeConstraints, TypeConstraint typeCategoryConstraint, LinkedMemberInfo memberInfo, IParentDrawer parent, GUIContent label, bool readOnly)
        {
            ConstraintedTypeDrawer result;

            if (!DrawerPool.TryGet(out result))
            {
                result = new ConstraintedTypeDrawer();
            }
            result.Setup(value, baseTypeConstraints, typeCategoryConstraint, memberInfo, parent, label, readOnly);
            result.LateSetup();
            return(result);
        }
예제 #12
0
        public static IntRangeDrawer Create(int value, float min, float max, LinkedMemberInfo memberInfo, IParentDrawer parent, GUIContent label, bool setReadOnly)
        {
            IntRangeDrawer result;

            if (!DrawerPool.TryGet(out result))
            {
                result = new IntRangeDrawer();
            }
            result.Setup(value, min, max, memberInfo, parent, label, setReadOnly);
            result.LateSetup();
            return(result);
        }
예제 #13
0
        /// <summary> Creates a new instance of the drawer or returns a reusable instance from the pool. </summary>
        /// <param name="value"> The starting cached value of the drawer. </param>
        /// <param name="memberInfo"> LinkedMemberInfo for the field, property or parameter that the drawer represents. Can be null. </param>
        /// <param name="parent"> The parent drawer of the created drawer. Can be null. </param>
        /// <param name="label"> The prefix label. </param>
        /// <param name="setReadOnly"> True if control should be read only. </param>
        /// <returns> The instance, ready to be used. </returns>
        public static AnimationCurveDrawer Create(AnimationCurve value, LinkedMemberInfo memberInfo, IParentDrawer parent, GUIContent label, bool setReadOnly)
        {
            AnimationCurveDrawer result;

            if (!DrawerPool.TryGet(out result))
            {
                result = new AnimationCurveDrawer();
            }
            result.Setup(value, typeof(AnimationCurve), memberInfo, parent, label, setReadOnly);
            result.LateSetup();
            return(result);
        }
예제 #14
0
        /// <summary> Creates a new instance of the drawer or returns a reusable instance from the pool. </summary>
        /// <param name="parent"> The parent drawer of the created drawer. Can not be null. </param>
        /// <returns> The instance, ready to be used. </returns>
        public static DebugModeDisplaySettingsDrawer Create <TParent>([NotNull] TParent parent, DebugModeDisplaySettings settings) where TParent : IDebuggable, IUnityObjectDrawer
        {
            DebugModeDisplaySettingsDrawer result;

            if (!DrawerPool.TryGet(out result))
            {
                result = new DebugModeDisplaySettingsDrawer();
            }
            result.Setup(settings, typeof(DebugModeDisplaySettings), null, parent, new GUIContent("Display Settings"), false);
            result.LateSetup();
            return(result);
        }
예제 #15
0
        /// <summary> Creates a new instance of the drawer or returns a reusable instance from the pool. </summary>
        /// <param name="value"> The starting cached value of the drawer. </param>
        /// <param name="memberInfo"> LinkedMemberInfo for the field, property or parameter that the drawer represents. Can be null. </param>
        /// <param name="parent"> The parent drawer of the created drawer. Can be null. </param>
        /// <param name="label"> The prefix label. </param>
        /// <param name="setReadOnly"> True if control should be read only. </param>
        /// <returns> The instance, ready to be used. </returns>
        public static GradientDrawer Create(Gradient value, LinkedMemberInfo memberInfo, IParentDrawer parent, GUIContent label, bool setReadOnly)
        {
            GradientDrawer result;

            if (!DrawerPool.TryGet(out result))
            {
                result = new GradientDrawer();
            }
            result.Setup(value, DrawerUtility.GetType(memberInfo, value), memberInfo, parent, label, setReadOnly);
            result.LateSetup();
            return(result);
        }
예제 #16
0
        /// <summary> Creates a new instance of the drawer or returns a reusable instance from the pool. </summary>
        /// <param name="text"> The header text. </param>
        /// <param name="parent"> The parent drawer of the created drawer. Can be null. </param>
        /// <returns> The drawer instance, ready to be used. </returns>
        public static HeaderDrawer Create(string text, [CanBeNull] IParentDrawer parent)
        {
            HeaderDrawer result;

            if (!DrawerPool.TryGet(out result))
            {
                result = new HeaderDrawer();
            }
            result.Setup(text, parent);
            result.LateSetup();
            return(result);
        }
예제 #17
0
        /// <summary> Creates a new instance of the drawer or returns a reusable instance from the pool. </summary>
        /// <param name="value"> The starting cached value of the drawer. </param>
        /// <param name="memberInfo"> LinkedMemberInfo for the field, property or parameter that the drawer represents. Can be null. </param>
        /// <param name="parent"> The parent drawer of the created drawer. Can be null. </param>
        /// <param name="label"> The prefix label. </param>
        /// <param name="readOnly"> True if control should be read only. </param>
        /// <returns> The instance, ready to be used. </returns>
        public static DateTimeDrawer Create(DateTime value, LinkedMemberInfo memberInfo, IParentDrawer parent, GUIContent label, bool readOnly)
        {
            DateTimeDrawer result;

            if (!DrawerPool.TryGet(out result))
            {
                result = new DateTimeDrawer();
            }
            result.Setup(value, typeof(DateTime), memberInfo, parent, label, readOnly);
            result.LateSetup();
            return(result);
        }
예제 #18
0
        /// <summary> Creates a new instance of the drawer or returns a reusable instance from the pool. </summary>
        /// <param name="parent"> The parent drawers of the created drawers. Can be null. </param>
        /// <param name="inspector"> The inspector in which the IDrawer are contained. Can not be null. </param>
        /// <returns> The drawer instance, ready to be used. </returns>
        public static MissingScriptDrawer Create([NotNull] IParentDrawer parent, [NotNull] IInspector inspector)
        {
            MissingScriptDrawer result;

            if (!DrawerPool.TryGet(out result))
            {
                result = new MissingScriptDrawer();
            }
            result.Setup(ArrayPool <Component> .Create(1), parent, null, inspector);
            result.LateSetup();
            return(result);
        }
예제 #19
0
        /// <summary> Creates a new instance of the drawer or returns a reusable instance from the pool. </summary>
        /// <param name="item"> Information about the menu item. </param>
        /// <returns> The drawer instance, ready to be used. </returns>
        public static AddComponentMenuItemDrawer Create(AddComponentMenuItem item)
        {
            AddComponentMenuItemDrawer result;

            if (!DrawerPool.TryGet(out result))
            {
                result = new AddComponentMenuItemDrawer();
            }
            result.Setup(item);
            result.LateSetup();
            return(result);
        }
예제 #20
0
        /// <summary> Creates a new instance of the drawer or returns a reusable instance from the pool. </summary>
        /// <param name="value"> The starting cached value of the drawer. </param>
        /// <param name="min"> The minimum value for the drawer. </param>
        /// <param name="memberInfo"> LinkedMemberInfo for the field, property or parameter that the drawer represents. Can be null. </param>
        /// <param name="parent"> The parent drawer of the created drawer. Can be null. </param>
        /// <param name="label"> The prefix label. </param>
        /// <param name="readOnly"> True if control should be read only. </param>
        /// <returns> The instance, ready to be used. </returns>
        public static MinIntDrawer Create(int value, int min, LinkedMemberInfo memberInfo, IParentDrawer parent, GUIContent label, bool readOnly)
        {
            MinIntDrawer result;

            if (!DrawerPool.TryGet(out result))
            {
                result = new MinIntDrawer();
            }
            result.Setup(value, min, memberInfo, parent, label, readOnly);
            result.LateSetup();
            return(result);
        }
예제 #21
0
        public static new MaterialDrawer Create(Object[] targets, [CanBeNull] IParentDrawer parent, [NotNull] IInspector inspector)
        {
            MaterialDrawer result;

            if (!DrawerPool.TryGet(out result))
            {
                result = new MaterialDrawer();
            }
            result.Setup(targets, targets, typeof(MaterialEditor), parent, inspector);
            result.LateSetup();
            return(result);
        }
        /// <summary> Creates a new instance of the drawer or returns a reusable instance from the pool. </summary>
        /// <param name="targets"> The targets that the drawers represent. </param>
        /// <param name="parent"> The parent drawers of the created drawers. Can be null. </param>
        /// <param name="inspector"> The inspector in which the IDrawer are contained. Can not be null. </param>
        /// <param name="editorType"> The type of for the custom editor. </param>
        /// <returns> The drawer instance, ready to be used. </returns>
        public static CustomEditorComponentDrawer Create(Component[] targets, IParentDrawer parent, [NotNull] IInspector inspector, Type editorType = null)
        {
            CustomEditorComponentDrawer result;

            if (!DrawerPool.TryGet(out result))
            {
                result = new CustomEditorComponentDrawer();
            }
            result.Setup(targets, parent, inspector, editorType);
            result.LateSetup();
            return(result);
        }
예제 #23
0
        /// <summary> Creates a new instance of the drawer or returns a reusable instance from the pool. </summary>
        /// <param name="parent"> The parent drawer of the created drawer. Can be null. </param>
        /// <param name="label"> Label with the text to shown in the box. </param>
        /// <param name="messageType"> Type of the message. </param>
        /// <param name="readOnly"> True if control should be read only. </param>
        /// <returns> The instance, ready to be used. </returns>
        public static BoxDrawer Create(IParentDrawer parent, GUIContent label, MessageType messageType, bool readOnly)
        {
            BoxDrawer result;

            if (!DrawerPool.TryGet(out result))
            {
                result = new BoxDrawer();
            }
            result.Setup(label.text, null, parent, label, messageType, readOnly);
            result.LateSetup();
            return(result);
        }
예제 #24
0
        public static ClassDrawer Create([NotNull] Type setClassType, [CanBeNull] IParentDrawer parent, [NotNull] IInspector inspector)
        {
            ClassDrawer result;

            if (!DrawerPool.TryGet(out result))
            {
                result = new ClassDrawer();
            }
            result.Setup(setClassType, parent, GUIContentPool.Create(StringUtils.SplitPascalCaseToWords(StringUtils.ToStringSansNamespace(setClassType))), inspector);
            result.LateSetup();
            return(result);
        }
예제 #25
0
        public static new AudioClipDrawer Create(Object[] targets, [CanBeNull] IParentDrawer parent, [NotNull] IInspector inspector)
        {
            AudioClipDrawer result;

            if (!DrawerPool.TryGet(out result))
            {
                result = new AudioClipDrawer();
            }
            result.Setup(targets, null, null, parent, inspector);
            result.LateSetup();
            return(result);
        }
예제 #26
0
        /// <summary> Creates a new instance of the drawer or returns a reusable instance from the pool. </summary>
        /// <param name="value"> The initial cached value of the drawer. </param>
        /// <param name="memberInfo"> LinkedMemberInfo for the class member that the created drawer represents. Can be null. </param>
        /// <param name="nullableType"> The underlying type of the Nullable type. </param>
        /// <param name="parent"> The parent drawer of the created drawer. Can be null. </param>
        /// <param name="label"> The prefix label. </param>
        /// <param name="readOnly"> True if drawer should be read only. </param>
        /// <returns> The drawer instance, ready to be used. </returns>
        public static NullableDrawer Create(object value, LinkedMemberInfo memberInfo, Type nullableType, IParentDrawer parent, GUIContent label, bool readOnly)
        {
            NullableDrawer result;

            if (!DrawerPool.TryGet(out result))
            {
                result = new NullableDrawer();
            }
            result.Setup(value, memberInfo, nullableType, parent, label, readOnly);
            result.LateSetup();
            return(result);
        }
예제 #27
0
        /// <summary> Creates a new instance of the drawer or returns a reusable instance from the pool. </summary>
        /// <param name="value"> The starting cached value of the drawer. </param>
        /// <param name="keyType"> The type of the keys in the dictionary. </param>
        /// <param name="valueType"> The type of the values in the dictionary. </param>
        /// <param name="memberInfo"> LinkedMemberInfo for the field, property or parameter that the drawer represents. Can be null. </param>
        /// <param name="parent"> The parent drawer of the created drawer. Can be null. </param>
        /// <param name="label"> The prefix label. </param>
        /// <param name="readOnly"> True if control should be read only. </param>
        /// <returns> The instance, ready to be used. </returns>
        public static DictionaryEntryDrawer Create(DictionaryEntry value, Type keyType, Type valueType, LinkedMemberInfo memberInfo, IParentDrawer parent, GUIContent label, bool readOnly, Func <int, object[], bool> validateKey)
        {
            DictionaryEntryDrawer result;

            if (!DrawerPool.TryGet(out result))
            {
                result = new DictionaryEntryDrawer();
            }
            result.Setup(value, DrawerUtility.GetType(memberInfo, value), keyType, valueType, memberInfo, parent, label, readOnly, validateKey);
            result.LateSetup();
            return(result);
        }
예제 #28
0
        /// <summary> Creates a new instance of the drawer or returns a reusable instance from the pool. </summary>
        /// <param name="targets"> The targets that the drawer represent. </param>
        /// <param name="parent"> The parent drawer of the created drawer. Can be null. </param>
        /// <param name="inspector"> The inspector in which the IDrawer are contained. Can not be null. </param>
        /// <returns> The instance, ready to be used. </returns>
        public static RectTransformDrawer Create(Component[] targets, [CanBeNull] IParentDrawer parent, [NotNull] IInspector inspector)
        {
            RectTransformDrawer result;

            if (!DrawerPool.TryGet(out result))
            {
                result = new RectTransformDrawer();
            }
            result.Setup(targets, parent, inspector, Types.GetInternalEditorType("UnityEditor.RectTransformEditor"));
            result.LateSetup();
            return(result);
        }
예제 #29
0
        public static new ShaderDrawer Create(Object[] targets, [CanBeNull] IParentDrawer parent, [NotNull] IInspector inspector)
        {
            ShaderDrawer result;

            if (!DrawerPool.TryGet(out result))
            {
                result = new ShaderDrawer();
            }
            result.Setup(targets, targets, Types.GetInternalEditorType("UnityEditor.ShaderImporterInspector"), parent, inspector);
            result.LateSetup();
            return(result);
        }
예제 #30
0
        /// <summary> Creates a new instance of the drawer or returns a reusable instance from the pool. </summary>
        /// <param name="value"> The starting cached value of the drawer. </param>
        /// <param name="memberInfo"> LinkedMemberInfo for the field, property or parameter that the drawer represents. Can be null. </param>
        /// <param name="parent"> The parent drawer of the created drawer. Can be null. </param>
        /// <param name="label"> The prefix label. </param>
        /// <param name="readOnly"> True if control should be read only. </param>
        /// <returns> The instance, ready to be used. </returns>
        public static RotationDrawer Create(Vector3 value, LinkedMemberInfo memberInfo, IParentDrawer parent, GUIContent label, bool readOnly)
        {
            RotationDrawer result;

            if (!DrawerPool.TryGet(out result))
            {
                result = new RotationDrawer();
            }
            result.Setup(value, typeof(Vector3), memberInfo, parent, label, readOnly);
            result.LateSetup();
            return(result);
        }