public static float CalculateHeight(IParentDrawer target)
        {
            float unfoldedness = target.Unfoldedness;

            if (unfoldedness > 0f)
            {
                var visibleMembers = target.VisibleMembers;
                int count          = visibleMembers.Length;
                if (count > 0)
                {
                    float membersHeight = 0f;
                    for (int n = count - 1; n >= 0; n--)
                    {
                        membersHeight += visibleMembers[n].Height;
                    }

                                        #if DEV_MODE && DEBUG_WHEN_UNFOLDED
                    UnityEngine.Debug.Log("CalculateHeight(" + target + ") from " + count + " visible members: " + (target.HeaderHeight + membersHeight * unfoldedness + DrawGUI.RightPadding) + " with Unfolded=" + target.Unfolded + " , Unfoldedness=" + target.Unfoldedness + ", HeaderHeight=" + target.HeaderHeight);
                                        #elif DEV_MODE && DEBUG_WHEN_CHANGING
                    if (unfoldedness < 1f)
                    {
                        UnityEngine.Debug.Log("CalculateHeight(" + target + ") from " + count + " visible members: " + (target.HeaderHeight + membersHeight * unfoldedness + DrawGUI.RightPadding) + " with Unfolded=" + target.Unfolded + " , Unfoldedness=" + target.Unfoldedness + ", HeaderHeight=" + target.HeaderHeight + ", DrawGUI.RightPadding=" + DrawGUI.RightPadding);
                    }
                                        #endif

                    return(target.HeaderHeight + membersHeight * unfoldedness + DrawGUI.RightPadding);
                }
            }

                        #if DEV_MODE && DEBUG_WHEN_FOLDED
            UnityEngine.Debug.Log("CalculateHeight(" + target + ") returning HeaderHeight: " + target.HeaderHeight);
                        #endif

            return(target.HeaderHeight);
        }
Ejemplo n.º 2
0
        public void RestoreFoldedStateWhenDisposingDuringFiltering(IParentDrawer subject)
        {
            if (!hasFilter)
            {
                                #if DEV_MODE && PI_ASSERTATIONS
                Debug.Assert(!inspector.State.filter.HasFilter);
                                #endif
                return;
            }

            if (foldedBeforeFiltering.Remove(subject) && subject.Unfolded)
            {
                var membs = subject.Members;
                for (int n = membs.Length - 1; n >= 0; n--)
                {
                    var memb = membs[n] as IParentDrawer;
                    if (memb != null)
                    {
                        RestoreFoldedStateWhenDisposingDuringFiltering(memb);
                    }
                }

                subject.SetUnfolded(false, false);
            }
        }
Ejemplo n.º 3
0
        /// <inheritdoc/>
        public override void OnParentAssigned(IParentDrawer newParent)
        {
            memberIndex = Array.IndexOf(newParent.Members, this);

            switch (memberIndex)
            {
            default:
                axisColor = DrawGUI.IsProSkin ? XAxisColorDark : XAxisColorLight;
                break;

            case 1:
                axisColor = DrawGUI.IsProSkin ? YAxisColorDark : YAxisColorLight;
                break;

            case 2:
                axisColor = DrawGUI.IsProSkin ? ZAxisColorDark : ZAxisColorLight;
                break;
            }

            var component = parent.Parent as IUnityObjectDrawer;

            if (component != null)
            {
                component.OnWidthsChanged += OnWidthChanged;
            }

                        #if DEV_MODE && PI_ASSERTATIONS
            Debug.Assert(memberIndex != -1, ToString() + ".OnParentAssigned: index in members " + StringUtils.ToString(newParent.Members) + " of parent " + newParent + " was -1");
            Debug.Assert(newParent is ISnappable, ToString() + ".OnParentAssigned: parent " + newParent + " was not snappable");
            Debug.Assert(newParent is TransformMemberBaseDrawer, ToString() + ".OnParentAssigned: parent " + newParent + " did not inherit from TransformMemberBaseDrawer");
                        #endif

            SnapIfSnappingEnabled();
        }
        /// <inheritdoc />
        protected override void Setup(Component[] setTargets, IParentDrawer setParent, IInspector setInspector, Type setEditorType)
        {
            inspector             = setInspector;
            hasExecuteMethodItems = base.HasExecuteMethodIcon && HasExecuteMethodMenuItems();
            var firstTarget = setTargets[0];

            if (!HeadlessMode && firstTarget != null && firstTarget.HasEnabledProperty())
            {
                hasEnabledFlag = true;
                var monoBehaviour = firstTarget as MonoBehaviour;
                if (monoBehaviour != null)
                {
                    //Unity doesn't show the enabled flag in the inspector unless
                    //the Behaviour contains certain methods. However, it can be
                    //useful to have it be there anyways for various reasons.
                    createCustomEnabledFlag = !monoBehaviour.HasEnabledFlagInEditor();
                                        #if DEV_MODE && DEBUG_CUSTOM_ENABLED_FLAG
                    if (createCustomEnabledFlag)
                    {
                        Debug.Log(ToString() + " - Creating custom enabled flag for " + firstTarget.GetType());
                    }
                                        #endif
                }
            }

            base.Setup(setTargets, setParent, setInspector, setEditorType);

                        #if DEV_MODE && DEBUG_ENABLED_FLAG
            Debug.Log(ToString() + " hasEnabledFlag: " + hasEnabledFlag);
                        #endif
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Sets up the drawer so that it is ready to be used.
        /// LateSetup should be called right after this.
        /// </summary>
        /// <param name="setStyle"> GUIStyle inside which to draw members. </param>
        /// <param name="indentLevel"> How many levels of indentation to add when drawing members. </param>
        /// <param name="setDrawHeader"> Should the prefix label header be drawn for the dataset. </param>
        /// <param name="setValue"> The initial cached value of the drawers. </param>
        /// <param name="setValueType"> Type constraint for the value. </param>
        /// <param name="setMemberInfo"> LinkedMemberInfo for the field or property that these drawers represent. </param>
        /// <param name="setParent"> Drawer whose member these Drawer are. Can be null. </param>
        /// <param name="setLabel"> The label (name) of the field. Can be null. </param>
        /// <param name="setReadOnly"> True if Drawer should be read only. </param>
        private void Setup(GUIStyle setStyle, int indentLevel, bool setDrawHeader, object setValue, Type setValueType, LinkedMemberInfo setMemberInfo, IParentDrawer setParent, GUIContent setLabel, bool setReadOnly)
        {
            style               = new GUIStyle(setStyle);
            style.fixedHeight   = 0f;
            style.fixedWidth    = 0f;
            style.stretchHeight = true;
            style.stretchWidth  = true;

            appendIndentLevel = indentLevel;
            drawHeader        = setDrawHeader;

            if (setValueType == null)
            {
                                #if DEV_MODE
                Debug.LogWarning(GetType().Name + ".Setup called with null setValueType");
                                #endif
                setValueType = DrawerUtility.GetType(setMemberInfo, setValue);
            }

            // This is an important step, because parent is referenced by DebugMode
            parent          = setParent;
            drawInSingleRow = DrawerUtility.CanDrawInSingleRow(setValueType, DebugMode);

            base.Setup(setValue, setValueType, setMemberInfo, setParent, setLabel, setReadOnly);

                        #if DEV_MODE && DEBUG_DRAW_IN_SINGLE_ROW
            if (drawInSingleRow)
            {
                Debug.Log(Msg(ToString(setLabel, setMemberInfo) + ".Setup with drawInSingleRow=", drawInSingleRow, ", type=", setValueType, ", DebugMode=", DebugMode));
            }
                        #endif
        }
Ejemplo n.º 6
0
        /// <inheritdoc/>
        public override void OnParentAssigned(IParentDrawer newParent)
        {
                        #if DEV_MODE && DEBUG_ON_PARENT_ASSIGNED
            Debug.Assert(Array.IndexOf(newParent.Members, this) != -1, ToString() + ".OnParentAssigned: index in members " + StringUtils.ToString(newParent.Members) + " of parent " + newParent + " was -1");
                        #endif

                        #if UNITY_EDITOR
            if (EditorSettings.serializationMode != SerializationMode.ForceBinary)
            {
                var scene = gameObject.scene;

                if (!scene.IsValid())
                {
                                        #if DEV_MODE
                    Debug.Log("MissingScript OnParentAssigned: GameObject \"" + gameObject.name + "\" had no scene.");
                                        #endif
                }
                else
                {
                    var path = scene.path;
                    if (string.IsNullOrEmpty(path))
                    {
                                                #if DEV_MODE
                        Debug.Log("MissingScript OnParentAssigned: Path of scene \"" + scene.name + "\" was empty.");
                                                #endif
                    }
                    else
                    {
                        var scenePath = FileUtility.LocalAssetsPathToFullPath(path);
                        try
                        {
                            string sceneData = System.IO.File.ReadAllText(scenePath);
                            int    index     = Array.IndexOf(newParent.Members, this);
                            guid = TryGetGuidForMissingComponent(gameObject, index, sceneData);
                        }
                        catch (Exception e)
                        {
                            Debug.LogError("MissingScript.OnParentAssigned - File.ReadAllText " + e);
                            guid = "";
                        }

                        if (guid.Length > 0)
                        {
                            assetPath  = guid.Length == 0 ? "" : AssetDatabase.GUIDToAssetPath(guid);
                            monoScript = AssetDatabase.LoadAssetAtPath <MonoScript>(assetPath);
                        }
                    }
                }
            }
                        #endif

            base.OnParentAssigned(newParent);

            if (memberBuildState != MemberBuildState.MembersBuilt && MembersAreVisible)
            {
                memberBuildState = MemberBuildState.BuildListGenerated;
                BuildMembers();
            }
        }
Ejemplo n.º 7
0
 private void Setup([NotNull] IInspector setInspector, IParentDrawer setParent, GUIContent setLabel)
 {
     nowEditingMembers = true;
     inspector         = setInspector;
     hasFilter         = setInspector.State.filter.HasFilter;
     base.Setup(setParent, setLabel);
     inspector.OnFilterChanging += OnFilterChanging;
 }
Ejemplo n.º 8
0
        private void Setup(int setValue, int setMin, LinkedMemberInfo setMemberInfo, IParentDrawer setParent, GUIContent setLabel, bool setReadOnly)
        {
            min = setMin;
            base.Setup(setValue < min ? min : setValue, typeof(int), setMemberInfo, setParent, setLabel, setReadOnly);

            if (string.IsNullOrEmpty(label.tooltip))
            {
                label.tooltip = string.Concat("Value greater than or equal to ", StringUtils.ToString(min));
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Sets up the drawer so that it is ready to be used.
        /// LateSetup should be called right after this.
        /// </summary>
        /// <param name="setMemberInfo"> LinkedMemberInfo for the field or property that these drawers represent. </param>
        /// <param name="setParent"> Drawer whose member these Drawer are. Can be null. </param>
        /// <param name="setPrefixLabel"> The prefix label to precede the button. Can be null. </param>
        /// <param name="setButtonLabel"> Label to show on the button. </param>
        /// <param name="setGUIStyle"> GUIStyle to use when drawing the button. Can be null. </param>
        /// <param name="setReadOnly"> True if Drawer should be read only. </param>
        protected virtual void Setup(LinkedMemberInfo setMemberInfo, IParentDrawer setParent, GUIContent setPrefixLabel, GUIContent setButtonLabel, GUIStyle setGUIStyle, bool setReadOnly)
        {
                        #if DEV_MODE && DEBUG_SETUP
            Debug.Log("MethodButton with setPrefixLabel=" + StringUtils.ToString(setPrefixLabel) + ", setButtonLabel=" + StringUtils.ToString(setButtonLabel));
                        #endif

            guiStyle = setGUIStyle;

            base.Setup(setMemberInfo, setParent, setPrefixLabel, setButtonLabel, setReadOnly);
        }
Ejemplo n.º 10
0
        private void Setup(int value, int setMax, LinkedMemberInfo setMemberInfo, IParentDrawer setParent, GUIContent setLabel, bool setReadOnly)
        {
            max = setMax;
            base.Setup(value > max ? max : value, typeof(int), setMemberInfo, setParent, setLabel, setReadOnly);

            if (string.IsNullOrEmpty(label.tooltip))
            {
                label.tooltip = string.Concat("Value smaller than or equal to ", StringUtils.ToString(max));
            }
        }
Ejemplo n.º 11
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;
		}
Ejemplo n.º 12
0
        private void Setup(int value, int min, int max, LinkedMemberInfo memberInfo, IParentDrawer parent, GUIContent label, bool setReadOnly)
        {
            this.min = Mathf.Min(min, max);
            this.max = Mathf.Max(min, max);

            base.Setup(Mathf.Clamp(value, this.min, this.max), typeof(int), memberInfo, parent, label, setReadOnly);
            if (string.IsNullOrEmpty(label.tooltip))
            {
                label.tooltip = string.Concat("Value between ", StringUtils.ToString(min), " and ", StringUtils.ToString(max));
            }
        }
Ejemplo n.º 13
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);
        }
Ejemplo n.º 14
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);
        }
Ejemplo n.º 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="readOnly"> True if control should be read only. </param>
        /// <returns> The instance, ready to be used. </returns>
        public static ScaleDrawer Create(Vector3 value, LinkedMemberInfo memberInfo, IParentDrawer parent, GUIContent label, bool readOnly)
        {
            ScaleDrawer result;

            if (!DrawerPool.TryGet(out result))
            {
                result = new ScaleDrawer();
            }
            result.Setup(value, typeof(Vector3), memberInfo, parent, label, readOnly);
            result.LateSetup();
            return(result);
        }
Ejemplo n.º 16
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);
        }
Ejemplo n.º 17
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);
        }
Ejemplo n.º 18
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);
        }
Ejemplo n.º 19
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);
        }
Ejemplo n.º 20
0
        public static GameObjectBoxDrawer Create(IParentDrawer parent, GUIContent label)
        {
            GameObjectBoxDrawer result;

            if (!DrawerPool.TryGet(out result))
            {
                result = new GameObjectBoxDrawer();
            }
            result.Setup(parent, label);
            result.LateSetup();
            return(result);
        }
Ejemplo n.º 21
0
        /// <inheritdoc/>
        protected override void Setup(Component[] setTargets, IParentDrawer setParent, GUIContent setLabel, IInspector setInspector)
        {
            if (arrow == null)
            {
                var demoGraphics = FileUtility.LoadAssetByName <DemoGraphics>("Demo Graphics");
                arrow = demoGraphics.arrow;
            }

            PowerInspectorDocumentation.ShowUrlIfWindowOpen(DocumentationPageUrl);

            base.Setup(setTargets, setParent, setLabel, setInspector);
        }
Ejemplo n.º 22
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>
        /// <param name="setLabel"> The label to be shown in the header of the asset. If left null, label will be generated from class name. </param>
        /// <returns> The instance, ready to be used. </returns>
        public static CustomAssetDrawer Create(Object[] targets, IParentDrawer parent, [NotNull] IInspector inspector, GUIContent setLabel = null)
        {
            CustomAssetDrawer result;

            if (!DrawerPool.TryGet(out result))
            {
                result = new CustomAssetDrawer();
            }
            result.Setup(targets, parent, setLabel, inspector);
            result.LateSetup();
            return(result);
        }
Ejemplo n.º 23
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);
        }
Ejemplo n.º 24
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);
        }
Ejemplo n.º 25
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);
        }
Ejemplo n.º 26
0
        /// <inheritdoc/>
        public override void Setup([NotNullOrEmpty] GameObject[] setTargets, [CanBeNull] IParentDrawer setParent, [NotNull] IInspector setInspector)
        {
            if (arrow == null)
            {
                var demoGraphics = FileUtility.LoadAssetByName <DemoGraphics>("Demo Graphics");
                arrow = demoGraphics.arrow;
            }

            base.Setup(setTargets, setParent, setInspector);

            PowerInspectorDocumentation.ShowUrlIfWindowOpen(DocumentationPageUrl);
        }
Ejemplo n.º 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="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 ObjectDrawer Create(object value, LinkedMemberInfo memberInfo, IParentDrawer parent, GUIContent label, bool setReadOnly)
        {
            ObjectDrawer result;

            if (!DrawerPool.TryGet(out result))
            {
                result = new ObjectDrawer();
            }
            result.Setup(value, DrawerUtility.GetType(memberInfo, value), 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="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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 30
0
        /// <summary> Creates a new instance of the drawer or returns a reusable instance from the pool. </summary>
        /// <param name="height"> The height in pixels to occupy in the inspector. </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 SpaceDrawer Create(float height, [CanBeNull] IParentDrawer parent)
        {
            SpaceDrawer result;

            if (!DrawerPool.TryGet(out result))
            {
                result = new SpaceDrawer();
            }
            result.Setup(height, parent);
            result.LateSetup();
            return(result);
        }