Exemplo n.º 1
0
 /// <summary>
 /// Creates a new inspectable quaternion GUI for the specified property.
 /// </summary>
 /// <param name="context">Context shared by all inspectable fields created by the same parent.</param>
 /// <param name="title">Name of the property, or some other value to set as the title.</param>
 /// <param name="path">Full path to this property (includes name of this property and all parent properties).</param>
 /// <param name="depth">Determines how deep within the inspector nesting hierarchy is this field. Some fields may
 ///                     contain other fields, in which case you should increase this value by one.</param>
 /// <param name="layout">Parent layout that all the field elements will be added to.</param>
 /// <param name="property">Serializable property referencing the field whose contents to display.</param>
 public InspectableQuaternion(InspectableContext context, string title, string path, int depth, InspectableFieldLayout layout,
                              SerializableProperty property)
     : base(context, title, path, SerializableProperty.FieldType.Quaternion, depth, layout, property)
 {
 }
Exemplo n.º 2
0
 /// <summary>
 /// Creates a new inspectable AABox GUI for the specified property.
 /// </summary>
 /// <param name="context">Context shared by all inspectable fields created by the same parent.</param>
 /// <param name="title">Name of the property, or some other value to set as the title.</param>
 /// <param name="path">Full path to this property (includes name of this property and all parent properties).</param>
 /// <param name="depth">Determines how deep within the inspector nesting hierarchy is this field. Some fields may
 ///                     contain other fields, in which case you should increase this value by one.</param>
 /// <param name="layout">Parent layout that all the field elements will be added to.</param>
 /// <param name="property">Serializable property referencing the field whose contents to display.</param>
 /// <param name="style">Information that can be used for customizing field rendering and behaviour.</param>
 public InspectableAABox(InspectableContext context, string title, string path, int depth, InspectableFieldLayout layout,
                         SerializableProperty property, InspectableFieldStyleInfo style)
     : base(context, title, path, SerializableProperty.FieldType.Object, depth, layout, property)
 {
 }
Exemplo n.º 3
0
 /// <summary>
 /// Creates a new inspectable resource reference GUI for the specified property.
 /// </summary>
 /// <param name="context">Context shared by all inspectable fields created by the same parent.</param>
 /// <param name="title">Name of the property, or some other value to set as the title.</param>
 /// <param name="path">Full path to this property (includes name of this property and all parent properties).</param>
 /// <param name="depth">Determines how deep within the inspector nesting hierarchy is this field. Some fields may
 ///                     contain other fields, in which case you should increase this value by one.</param>
 /// <param name="layout">Parent layout that all the field elements will be added to.</param>
 /// <param name="property">Serializable property referencing the field whose contents to display.</param>
 /// <param name="style">Contains information about the field style.</param>
 public InspectableRRef(InspectableContext context, string title, string path, int depth, InspectableFieldLayout layout,
                        SerializableProperty property, InspectableFieldStyleInfo style)
     : base(context, title, path, SerializableProperty.FieldType.RRef, depth, layout, property)
 {
     this.style = style;
 }
Exemplo n.º 4
0
 /// <summary>
 /// Creates a new inspectable color gradient GUI for the specified property.
 /// </summary>
 /// <param name="context">Context shared by all inspectable fields created by the same parent.</param>
 /// <param name="title">Name of the property, or some other value to set as the title.</param>
 /// <param name="path">Full path to this property (includes name of this property and all parent properties).</param>
 /// <param name="depth">Determines how deep within the inspector nesting hierarchy is this field. Some fields may
 ///                     contain other fields, in which case you should increase this value by one.</param>
 /// <param name="layout">Parent layout that all the field elements will be added to.</param>
 /// <param name="property">Serializable property referencing the field whose contents to display.</param>
 public InspectableColorGradient(InspectableContext context, string title, string path, int depth,
                                 InspectableFieldLayout layout, SerializableProperty property)
     : base(context, title, path, SerializableProperty.FieldType.ColorGradient, depth, layout, property)
 {
 }
Exemplo n.º 5
0
        private void OnInitialize()
        {
            EditorApplication.OnProjectSave += SaveSettings;

            SceneWindow sceneWindow = SceneWindow.GetWindow <SceneWindow>();

            if (sceneWindow != null)
            {
                viewSettings   = sceneWindow.Camera.ViewSettings;
                moveSettings   = sceneWindow.Camera.MoveSettings;
                renderSettings = sceneWindow.Camera.RenderSettings;
            }
            else
            {
                viewSettings   = ProjectSettings.GetObject <SceneCameraViewSettings>(SceneCamera.ViewSettingsKey);
                moveSettings   = ProjectSettings.GetObject <SceneCameraMoveSettings>(SceneCamera.MoveSettingsKey);
                renderSettings = ProjectSettings.GetObject <RenderSettings>(SceneCamera.RenderSettingsKey);
            }

            expandStates = ProjectSettings.GetObject <SerializableProperties>(ExpandStatesKey);
            InspectableContext inspectableContext = new InspectableContext(expandStates);

            GUILayout mainLayout = GUI.AddLayoutY();

            GUIScrollArea scrollArea = new GUIScrollArea(ScrollBarType.ShowIfDoesntFit, ScrollBarType.NeverShow);

            mainLayout.AddElement(scrollArea);

            GUILayoutX horzPadLayout = scrollArea.Layout.AddLayoutX(GUIOption.FlexibleWidth(100, 400));

            horzPadLayout.AddSpace(5);

            GUILayout vertLayout = horzPadLayout.AddLayoutY();

            horzPadLayout.AddSpace(5);

            vertLayout.AddSpace(5);

            vertLayout.AddElement(new GUILabel(new LocEdString("View Settings"), EditorStyles.LabelBold));
            GUILayoutY viewSettingsLayout = vertLayout.AddLayoutY();

            vertLayout.AddSpace(10);

            vertLayout.AddElement(new GUILabel(new LocEdString("Move Settings"), EditorStyles.LabelBold));
            GUILayoutY moveSettingsLayout = vertLayout.AddLayoutY();

            vertLayout.AddSpace(10);

            vertLayout.AddElement(new GUILabel(new LocEdString("Render Settings"), EditorStyles.LabelBold));
            GUILayoutY renderSettingsLayout = vertLayout.AddLayoutY();

            guiViewSettings     = new InspectorFieldDrawer(inspectableContext, viewSettingsLayout);
            guiMovementSettings = new InspectorFieldDrawer(inspectableContext, moveSettingsLayout);
            guiRenderSettings   = new InspectorFieldDrawer(inspectableContext, renderSettingsLayout);

            guiViewSettings.AddDefault(viewSettings);
            guiMovementSettings.AddDefault(moveSettings);
            guiRenderSettings.AddDefault(renderSettings);

            mainLayout.AddSpace(5);
            GUILayout buttonCenterLayout = mainLayout.AddLayoutX();

            mainLayout.AddSpace(5);

            GUIButton resetToDefaultBtn = new GUIButton(new LocEdString("Reset to defaults"));

            resetToDefaultBtn.OnClick += () => ConfirmResetToDefault(ResetToDefault, null);

            buttonCenterLayout.AddFlexibleSpace();
            buttonCenterLayout.AddElement(resetToDefaultBtn);
            buttonCenterLayout.AddFlexibleSpace();
        }
Exemplo n.º 6
0
 /// <summary>
 /// Creates a new inspectable category. The category is initially empty and children must be added by calling
 /// <see cref="AddChild"/>.
 /// </summary>
 /// <param name="context">Context shared by all inspectable fields created by the same parent.</param>
 /// <param name="title">Name of the category.</param>
 /// <param name="path">Full path to the category (includes name of the category and all parent properties).</param>
 /// <param name="depth">Determines how deep within the inspector nesting hierarchy is this field. Some fields may
 ///                     contain other fields, in which case you should increase this value by one.</param>
 /// <param name="layout">Parent layout that all the field elements will be added to.</param>
 public InspectableCategory(InspectableContext context, string title, string path, int depth, InspectableFieldLayout layout)
     : base(context, title, "", SerializableProperty.FieldType.Object, depth, layout, null)
 {
     isExpanded = context.Persistent.GetBool(path + "_Expanded");
 }
 /// <summary>
 /// Creates a new inspectable game object reference GUI for the specified property.
 /// </summary>
 /// <param name="context">Context shared by all inspectable fields created by the same parent.</param>
 /// <param name="title">Name of the property, or some other value to set as the title.</param>
 /// <param name="path">Full path to this property (includes name of this property and all parent properties).</param>
 /// <param name="depth">Determines how deep within the inspector nesting hierarchy is this field. Some fields may
 ///                     contain other fields, in which case you should increase this value by one.</param>
 /// <param name="layout">Parent layout that all the field elements will be added to.</param>
 /// <param name="property">Serializable property referencing the field whose contents to display.</param>
 public InspectableGameObjectRef(InspectableContext context, string title, string path, int depth, InspectableFieldLayout layout,
                                 SerializableProperty property)
     : base(context, title, path, SerializableProperty.FieldType.GameObjectRef, depth, layout, property)
 {
 }