コード例 #1
0
ファイル: Inspector.cs プロジェクト: guozanhua/BansheeEngine
        /// <summary>
        /// Initializes the inspector. Must be called after construction.
        /// </summary>
        /// <param name="gui">GUI panel to add the GUI elements to.</param>
        /// <param name="instance">Instance of the object whose fields to display GUI for.</param>
        /// <param name="persistent">A set of properties that the inspector can read/write. They will be persisted even
        ///                          after the inspector is closed and restored when it is re-opened.</param>
        internal virtual void Initialize(GUIPanel gui, object instance, SerializableProperties persistent)
        {
            rootGUI         = gui;
            this.persistent = persistent;

            GUILayout contentLayoutX = gui.AddLayoutX();

            contentLayoutX.AddSpace(5);
            GUILayout contentLayoutY = contentLayoutX.AddLayoutY();

            contentLayoutY.AddSpace(5);
            GUIPanel contentPanel = contentLayoutY.AddPanel();

            contentLayoutY.AddSpace(5);
            contentLayoutX.AddSpace(5);

            GUIPanel   backgroundPanel    = gui.AddPanel(START_BACKGROUND_DEPTH);
            GUITexture inspectorContentBg = new GUITexture(null, EditorStyles.InspectorContentBg);

            backgroundPanel.AddElement(inspectorContentBg);

            mainPanel       = contentPanel;
            layout          = GUI.AddLayoutY();
            inspectedObject = instance;

            Initialize();
            Refresh();
        }
コード例 #2
0
        /// <summary>
        /// Constructs a new set of GUI elements for inspecting the limit object.
        /// </summary>
        /// <param name="prefix">Prefix that identifies the exact type of the limit type.</param>
        /// <param name="limitData">Initial values to assign to the GUI elements.</param>
        /// <param name="layout">Layout to append the GUI elements to.</param>
        /// <param name="properties">A set of properties that are persisted by the parent inspector. Used for saving state.
        ///                          </param>
        public LimitCommonGUI(string prefix, LimitCommon limitData, GUILayout layout, SerializableProperties properties)
        {
            this.limitData  = limitData;
            this.properties = properties;
            this.prefix     = prefix;

            hardFoldout.OnToggled += x =>
            {
                properties.SetBool(prefix + "_hardLimit_Expanded", x);
                ToggleLimitFields();
            };

            contactDistanceField.OnChanged   += x => { this.limitData.contactDist = x; MarkAsModified(); };
            contactDistanceField.OnFocusLost += ConfirmModify;
            contactDistanceField.OnConfirmed += ConfirmModify;

            softFoldout.OnToggled += x =>
            {
                properties.SetBool(prefix + "_softLimit_Expanded", x);
                ToggleLimitFields();
            };

            restitutionField.OnChanged   += x => { this.limitData.restitution = x; MarkAsModified(); };
            restitutionField.OnFocusLost += ConfirmModify;

            springFoldout.OnToggled += x =>
            {
                properties.SetBool(prefix + "_spring_Expanded", x);
                ToggleLimitFields();
            };

            hardLimitLayout = layout.AddLayoutX();
            {
                hardLimitLayout.AddSpace(10);

                GUILayoutY hardLimitContentsLayout = hardLimitLayout.AddLayoutY();
                hardLimitContentsLayout.AddElement(contactDistanceField);
            }

            softLimitLayout = layout.AddLayoutX();
            layout.AddElement(softFoldout);
            {
                softLimitLayout.AddSpace(10);

                GUILayoutY softLimitContentsLayout = softLimitLayout.AddLayoutY();
                softLimitContentsLayout.AddElement(restitutionField);
                softLimitContentsLayout.AddElement(springFoldout);
                springLayout = softLimitContentsLayout.AddLayoutX();
                {
                    springLayout.AddSpace(10);

                    GUILayoutY springContentsLayout = springLayout.AddLayoutY();
                    springGUI              = new SpringGUI(limitData.spring, springContentsLayout);
                    springGUI.OnChanged   += x => { this.limitData.spring = x; MarkAsModified(); };
                    springGUI.OnConfirmed += ConfirmModify;
                }
            }
        }
コード例 #3
0
ファイル: Inspector.cs プロジェクト: xuebai5/BansheeEngine
        /// <summary>
        /// Initializes the inspector using a resource path. Must be called after construction.
        /// </summary>
        /// <param name="gui">GUI panel to add the GUI elements to.</param>
        /// <param name="path">Path to the resource for which to display GUI for.</param>
        /// <param name="persistent">A set of properties that the inspector can read/write. They will be persisted even
        ///                          after the inspector is closed and restored when it is re-opened.</param>
        internal virtual void Initialize(GUIPanel gui, string path, SerializableProperties persistent)
        {
            InitializeBase(gui, persistent);

            inspectedResourcePath = path;

            Initialize();
            Refresh();
        }
コード例 #4
0
ファイル: Inspector.cs プロジェクト: xuebai5/BansheeEngine
        /// <summary>
        /// Initializes the inspector using an object instance. Must be called after construction.
        /// </summary>
        /// <param name="gui">GUI panel to add the GUI elements to.</param>
        /// <param name="instance">Instance of the object whose fields to display GUI for.</param>
        /// <param name="persistent">A set of properties that the inspector can read/write. They will be persisted even
        ///                          after the inspector is closed and restored when it is re-opened.</param>
        internal virtual void Initialize(GUIPanel gui, object instance, SerializableProperties persistent)
        {
            InitializeBase(gui, persistent);

            inspectedObject = instance;

            Initialize();
            Refresh();
        }
コード例 #5
0
        /// <summary>
        /// Returns existing, or creates new properties for a resource with the specified UUID.
        /// </summary>
        /// <param name="uuid">Unique identifier of the resource to retrieve properties for.</param>
        /// <returns>A set of key value pairs representing persistent properties of an inspectable resource.</returns>
        public SerializableProperties GetProperties(string uuid)
        {
            SerializableProperties output;

            if (!resourceProperties.TryGetValue(uuid, out output))
            {
                output = new SerializableProperties();
                resourceProperties[uuid] = output;
            }

            return(output);
        }
コード例 #6
0
        /// <summary>
        /// Constructs a new set of GUI elements for inspecting the limit object.
        /// </summary>
        /// <param name="limit">Initial values to assign to the GUI elements.</param>
        /// <param name="layout">Layout to append the GUI elements to.</param>
        /// <param name="properties">A set of properties that are persisted by the parent inspector. Used for saving state.
        ///                          </param>
        public LimitLinearGUI(LimitLinear limit, GUILayout layout, SerializableProperties properties)
        {
            limitData = limit;

            limitExtentField.OnChanged   += x => { limitData.extent = x; MarkAsModified(); };
            limitExtentField.OnFocusLost += ConfirmModify;

            layout.AddElement(limitExtentField);
            limitCommonGUI              = new LimitCommonGUI("linear", limit.GetBase(), layout, properties);
            limitCommonGUI.OnChanged   += x => MarkAsModified();
            limitCommonGUI.OnConfirmed += ConfirmModify;
        }
コード例 #7
0
        /// <summary>
        /// Returns existing, or creates new properties for a component with the specified id.
        /// </summary>
        /// <param name="componentId">Internal ID of the component to retrieve properties for.</param>
        /// <returns>A set of key value pairs representing persistent properties of an inspectable component.</returns>
        public SerializableProperties GetProperties(ulong componentId)
        {
            SerializableProperties output;

            if (!componentProperties.TryGetValue(componentId, out output))
            {
                output = new SerializableProperties();
                componentProperties[componentId] = output;
            }

            return(output);
        }
コード例 #8
0
ファイル: LimitInspectors.cs プロジェクト: Ruu/BansheeEngine
        /// <summary>
        /// Constructs a new set of GUI elements for inspecting the limit object.
        /// </summary>
        /// <param name="limit">Initial values to assign to the GUI elements.</param>
        /// <param name="layout">Layout to append the GUI elements to.</param>
        /// <param name="properties">A set of properties that are persisted by the parent inspector. Used for saving state.
        ///                          </param>
        public LimitAngularRangeGUI(LimitAngularRange limit, GUILayout layout, SerializableProperties properties)
        {
            this.limitData = limit.Data;

            limitLowerField.OnChanged += x => { limitData.lower = new Degree(x); MarkAsModified(); };
            limitLowerField.OnFocusLost += ConfirmModify;

            limitUpperField.OnChanged += x => { limitData.upper = new Degree(x); MarkAsModified(); };
            limitUpperField.OnFocusLost += ConfirmModify;

            layout.AddElement(limitLowerField);
            layout.AddElement(limitUpperField);
            limitCommonGUI = new LimitCommonGUI("angularRange", limit.CommonData, layout, properties);
            limitCommonGUI.OnChanged += x => MarkAsModified();
            limitCommonGUI.OnConfirmed += ConfirmModify;
        }
コード例 #9
0
        /// <summary>
        /// Constructs a new set of GUI elements for inspecting the limit object.
        /// </summary>
        /// <param name="limit">Initial values to assign to the GUI elements.</param>
        /// <param name="layout">Layout to append the GUI elements to.</param>
        /// <param name="properties">A set of properties that are persisted by the parent inspector. Used for saving state.
        ///                          </param>
        public LimitConeRangeGUI(LimitConeRange limit, GUILayout layout, SerializableProperties properties)
        {
            this.limitData = limit;

            yLimitAngleField.OnChanged   += x => { limitData.yLimitAngle = new Degree(x); MarkAsModified(); };
            yLimitAngleField.OnFocusLost += ConfirmModify;

            zLimitAngleField.OnChanged   += x => { limitData.zLimitAngle = new Degree(x); MarkAsModified(); };
            zLimitAngleField.OnFocusLost += ConfirmModify;

            layout.AddElement(yLimitAngleField);
            layout.AddElement(zLimitAngleField);
            limitCommonGUI              = new LimitCommonGUI("coneRange", limit.GetBase(), layout, properties);
            limitCommonGUI.OnChanged   += x => MarkAsModified();
            limitCommonGUI.OnConfirmed += ConfirmModify;
        }
コード例 #10
0
        /// <summary>
        /// Constructs a new set of GUI elements for inspecting the limit object.
        /// </summary>
        /// <param name="limit">Initial values to assign to the GUI elements.</param>
        /// <param name="layout">Layout to append the GUI elements to.</param>
        /// <param name="properties">A set of properties that are persisted by the parent inspector. Used for saving state.
        ///                          </param>
        public LimitLinearRangeGUI(LimitLinearRange limit, GUILayout layout, SerializableProperties properties)
        {
            this.limitData = limit.Data;

            limitLowerField.OnChanged   += x => { limitData.lower = x; MarkAsModified(); };
            limitLowerField.OnFocusLost += ConfirmModify;

            limitUpperField.OnChanged   += x => { limitData.upper = x; MarkAsModified(); };
            limitUpperField.OnFocusLost += ConfirmModify;

            layout.AddElement(limitLowerField);
            layout.AddElement(limitUpperField);
            limitCommonGUI              = new LimitCommonGUI("linearRange", limit.CommonData, layout, properties);
            limitCommonGUI.OnChanged   += x => MarkAsModified();
            limitCommonGUI.OnConfirmed += ConfirmModify;
        }
コード例 #11
0
        /// <summary>
        /// Constructs a new set of GUI elements for inspecting the limit object.
        /// </summary>
        /// <param name="limit">Initial values to assign to the GUI elements.</param>
        /// <param name="layout">Layout to append the GUI elements to.</param>
        /// <param name="properties">A set of properties that are persisted by the parent inspector. Used for saving state.
        ///                          </param>
        public LimitAngularRangeGUI(LimitAngularRange limit, GUILayout layout, SerializableProperties properties)
        {
            this.limitData = limit;

            limitLowerField.OnChanged   += x => { limitData.lower = new Degree(x); MarkAsModified(); };
            limitLowerField.OnFocusLost += ConfirmModify;

            limitUpperField.OnChanged   += x => { limitData.upper = new Degree(x); MarkAsModified(); };
            limitUpperField.OnFocusLost += ConfirmModify;

            layout.AddElement(limitLowerField);
            layout.AddElement(limitUpperField);
            limitCommonGUI              = new LimitCommonGUI("angularRange", limit.GetBase(), layout, properties);
            limitCommonGUI.OnChanged   += x => MarkAsModified();
            limitCommonGUI.OnConfirmed += ConfirmModify;
        }
コード例 #12
0
ファイル: Inspector.cs プロジェクト: xuebai5/BansheeEngine
        /// <summary>
        /// Common code called by both Initialize() overloads.
        /// </summary>
        /// <param name="gui">GUI panel to add the GUI elements to.</param>
        /// <param name="persistent">A set of properties that the inspector can read/write. They will be persisted even
        ///                          after the inspector is closed and restored when it is re-opened.</param>
        private void InitializeBase(GUIPanel gui, SerializableProperties persistent)
        {
            rootGUI         = gui;
            this.persistent = persistent;

            GUILayout contentLayoutX = gui.AddLayoutX();

            contentLayoutX.AddSpace(5);
            GUILayout contentLayoutY = contentLayoutX.AddLayoutY();

            contentLayoutY.AddSpace(5);
            GUIPanel contentPanel = contentLayoutY.AddPanel();

            contentLayoutY.AddSpace(5);
            contentLayoutX.AddSpace(5);

            GUIPanel   backgroundPanel    = gui.AddPanel(START_BACKGROUND_DEPTH);
            GUITexture inspectorContentBg = new GUITexture(null, EditorStylesInternal.InspectorContentBg);

            backgroundPanel.AddElement(inspectorContentBg);

            mainPanel = contentPanel;
            layout    = GUI.AddLayoutY();
        }
コード例 #13
0
        /// <summary>
        /// Returns existing, or creates new properties for a component with the specified id.
        /// </summary>
        /// <param name="componentId">Internal ID of the component to retrieve properties for.</param>
        /// <returns>A set of key value pairs representing persistent properties of an inspectable component.</returns>
        public SerializableProperties GetProperties(ulong componentId)
        {
            SerializableProperties output;
            if (!componentProperties.TryGetValue(componentId, out output))
            {
                output = new SerializableProperties();
                componentProperties[componentId] = output;
            }

            return output;
        }
コード例 #14
0
ファイル: LimitInspectors.cs プロジェクト: Ruu/BansheeEngine
        /// <summary>
        /// Constructs a new set of GUI elements for inspecting the limit object.
        /// </summary>
        /// <param name="limit">Initial values to assign to the GUI elements.</param>
        /// <param name="layout">Layout to append the GUI elements to.</param>
        /// <param name="properties">A set of properties that are persisted by the parent inspector. Used for saving state.
        ///                          </param>
        public LimitLinearGUI(LimitLinear limit, GUILayout layout, SerializableProperties properties)
        {
            limitData = limit.Data;

            limitExtentField.OnChanged += x => { limitData.extent = x; MarkAsModified(); };
            limitExtentField.OnFocusLost += ConfirmModify;

            layout.AddElement(limitExtentField);
            limitCommonGUI = new LimitCommonGUI("linear", limit.CommonData, layout, properties);
            limitCommonGUI.OnChanged += x => MarkAsModified();
            limitCommonGUI.OnConfirmed += ConfirmModify;
        }
コード例 #15
0
ファイル: Inspector.cs プロジェクト: Ruu/BansheeEngine
        /// <summary>
        /// Initializes the inspector. Must be called after construction.
        /// </summary>
        /// <param name="gui">GUI panel to add the GUI elements to.</param>
        /// <param name="instance">Instance of the object whose fields to display GUI for.</param>
        /// <param name="persistent">A set of properties that the inspector can read/write. They will be persisted even 
        ///                          after the inspector is closed and restored when it is re-opened.</param>
        internal virtual void Initialize(GUIPanel gui, object instance, SerializableProperties persistent)
        {
            rootGUI = gui;
            this.persistent = persistent;

            GUILayout contentLayoutX = gui.AddLayoutX();
            contentLayoutX.AddSpace(5);
            GUILayout contentLayoutY = contentLayoutX.AddLayoutY();
            contentLayoutY.AddSpace(5);
            GUIPanel contentPanel = contentLayoutY.AddPanel();
            contentLayoutY.AddSpace(5);
            contentLayoutX.AddSpace(5);

            GUIPanel backgroundPanel = gui.AddPanel(START_BACKGROUND_DEPTH);
            GUITexture inspectorContentBg = new GUITexture(null, EditorStyles.InspectorContentBg);
            backgroundPanel.AddElement(inspectorContentBg);

            mainPanel = contentPanel;
            layout = GUI.AddLayoutY();
            inspectedObject = instance;

            Initialize();
            Refresh();
        }
コード例 #16
0
ファイル: LimitInspectors.cs プロジェクト: Ruu/BansheeEngine
        /// <summary>
        /// Constructs a new set of GUI elements for inspecting the limit object.
        /// </summary>
        /// <param name="limit">Initial values to assign to the GUI elements.</param>
        /// <param name="layout">Layout to append the GUI elements to.</param>
        /// <param name="properties">A set of properties that are persisted by the parent inspector. Used for saving state.
        ///                          </param>
        public LimitConeRangeGUI(LimitConeRange limit, GUILayout layout, SerializableProperties properties)
        {
            this.limitData = limit.Data;

            yLimitAngleField.OnChanged += x => { limitData.yLimitAngle = new Degree(x); MarkAsModified(); };
            yLimitAngleField.OnFocusLost += ConfirmModify;

            zLimitAngleField.OnChanged += x => { limitData.zLimitAngle = new Degree(x); MarkAsModified(); };
            zLimitAngleField.OnFocusLost += ConfirmModify;

            layout.AddElement(yLimitAngleField);
            layout.AddElement(zLimitAngleField);
            limitCommonGUI = new LimitCommonGUI("coneRange", limit.CommonData, layout, properties);
            limitCommonGUI.OnChanged += x => MarkAsModified();
            limitCommonGUI.OnConfirmed += ConfirmModify;
        }
コード例 #17
0
        /// <summary>
        /// Constructs a new set of GUI elements for inspecting the post process settings object.
        /// </summary>
        /// <param name="settings">Initial values to assign to the GUI elements.</param>
        /// <param name="layout">Layout to append the GUI elements to.</param>
        /// <param name="properties">A set of properties that are persisted by the parent inspector. Used for saving state.
        ///                          </param>
        public PostProcessSettingsGUI(PostProcessSettings settings, GUILayout layout, SerializableProperties properties)
        {
            this.settings   = settings;
            this.properties = properties;

            // Auto exposure
            enableAutoExposureField.OnChanged += x => { this.settings.EnableAutoExposure = x; MarkAsModified(); ConfirmModify(); };
            layout.AddElement(enableAutoExposureField);

            autoExposureFoldout.OnToggled += x =>
            {
                properties.SetBool("autoExposure_Expanded", x);
                ToggleFoldoutFields();
            };
            layout.AddElement(autoExposureFoldout);

            autoExposureLayout = layout.AddLayoutX();
            {
                autoExposureLayout.AddSpace(10);

                GUILayoutY contentsLayout = autoExposureLayout.AddLayoutY();
                autoExposureGUI              = new AutoExposureSettingsGUI(settings.AutoExposure, contentsLayout);
                autoExposureGUI.OnChanged   += x => { this.settings.AutoExposure = x; MarkAsModified(); };
                autoExposureGUI.OnConfirmed += ConfirmModify;
            }

            // Tonemapping
            enableToneMappingField.OnChanged += x => { this.settings.EnableTonemapping = x; MarkAsModified(); ConfirmModify(); };
            layout.AddElement(enableToneMappingField);

            //// Tonemapping settings
            toneMappingFoldout.OnToggled += x =>
            {
                properties.SetBool("toneMapping_Expanded", x);
                ToggleFoldoutFields();
            };
            layout.AddElement(toneMappingFoldout);

            toneMappingLayout = layout.AddLayoutX();
            {
                toneMappingLayout.AddSpace(10);

                GUILayoutY contentsLayout = toneMappingLayout.AddLayoutY();
                toneMappingGUI              = new TonemappingSettingsGUI(settings.Tonemapping, contentsLayout);
                toneMappingGUI.OnChanged   += x => { this.settings.Tonemapping = x; MarkAsModified(); };
                toneMappingGUI.OnConfirmed += ConfirmModify;
            }

            //// White balance settings
            whiteBalanceFoldout.OnToggled += x =>
            {
                properties.SetBool("whiteBalance_Expanded", x);
                ToggleFoldoutFields();
            };
            layout.AddElement(whiteBalanceFoldout);

            whiteBalanceLayout = layout.AddLayoutX();
            {
                whiteBalanceLayout.AddSpace(10);

                GUILayoutY contentsLayout = whiteBalanceLayout.AddLayoutY();
                whiteBalanceGUI              = new WhiteBalanceSettingsGUI(settings.WhiteBalance, contentsLayout);
                whiteBalanceGUI.OnChanged   += x => { this.settings.WhiteBalance = x; MarkAsModified(); };
                whiteBalanceGUI.OnConfirmed += ConfirmModify;
            }

            //// Color grading settings
            colorGradingFoldout.OnToggled += x =>
            {
                properties.SetBool("colorGrading_Expanded", x);
                ToggleFoldoutFields();
            };
            layout.AddElement(colorGradingFoldout);

            colorGradingLayout = layout.AddLayoutX();
            {
                colorGradingLayout.AddSpace(10);

                GUILayoutY contentsLayout = colorGradingLayout.AddLayoutY();
                colorGradingGUI              = new ColorGradingSettingsGUI(settings.ColorGrading, contentsLayout);
                colorGradingGUI.OnChanged   += x => { this.settings.ColorGrading = x; MarkAsModified(); };
                colorGradingGUI.OnConfirmed += ConfirmModify;
            }

            // Gamma
            gammaField.OnChanged += x => { this.settings.Gamma = x; MarkAsModified(); ConfirmModify(); };
            layout.AddElement(gammaField);

            // Exposure scale
            exposureScaleField.OnChanged += x => { this.settings.ExposureScale = x; MarkAsModified(); ConfirmModify(); };
            layout.AddElement(exposureScaleField);

            ToggleFoldoutFields();
        }
コード例 #18
0
        /// <summary>
        /// Constructs a new set of GUI elements for inspecting the post process settings object.
        /// </summary>
        /// <param name="settings">Initial values to assign to the GUI elements.</param>
        /// <param name="layout">Layout to append the GUI elements to.</param>
        /// <param name="properties">A set of properties that are persisted by the parent inspector. Used for saving state.
        ///                          </param>
        public PostProcessSettingsGUI(PostProcessSettings settings, GUILayout layout, SerializableProperties properties)
        {
            this.settings = settings;
            this.properties = properties;

            // Auto exposure
            enableAutoExposureField.OnChanged += x => { this.settings.EnableAutoExposure = x; MarkAsModified(); ConfirmModify(); };
            layout.AddElement(enableAutoExposureField);

            autoExposureFoldout.OnToggled += x =>
            {
                properties.SetBool("autoExposure_Expanded", x);
                ToggleFoldoutFields();
            };
            layout.AddElement(autoExposureFoldout);

            autoExposureLayout = layout.AddLayoutX();
            {
                autoExposureLayout.AddSpace(10);

                GUILayoutY contentsLayout = autoExposureLayout.AddLayoutY();
                autoExposureGUI = new AutoExposureSettingsGUI(settings.AutoExposure, contentsLayout);
                autoExposureGUI.OnChanged += x => { this.settings.AutoExposure = x; MarkAsModified(); };
                autoExposureGUI.OnConfirmed += ConfirmModify;
            }

            // Tonemapping
            enableToneMappingField.OnChanged += x => { this.settings.EnableTonemapping = x; MarkAsModified(); ConfirmModify(); };
            layout.AddElement(enableToneMappingField);

            //// Tonemapping settings
            toneMappingFoldout.OnToggled += x =>
            {
                properties.SetBool("toneMapping_Expanded", x);
                ToggleFoldoutFields();
            };
            layout.AddElement(toneMappingFoldout);

            toneMappingLayout = layout.AddLayoutX();
            {
                toneMappingLayout.AddSpace(10);

                GUILayoutY contentsLayout = toneMappingLayout.AddLayoutY();
                toneMappingGUI = new TonemappingSettingsGUI(settings.Tonemapping, contentsLayout);
                toneMappingGUI.OnChanged += x => { this.settings.Tonemapping = x; MarkAsModified(); };
                toneMappingGUI.OnConfirmed += ConfirmModify;
            }

            //// White balance settings
            whiteBalanceFoldout.OnToggled += x =>
            {
                properties.SetBool("whiteBalance_Expanded", x);
                ToggleFoldoutFields();
            };
            layout.AddElement(whiteBalanceFoldout);

            whiteBalanceLayout = layout.AddLayoutX();
            {
                whiteBalanceLayout.AddSpace(10);

                GUILayoutY contentsLayout = whiteBalanceLayout.AddLayoutY();
                whiteBalanceGUI = new WhiteBalanceSettingsGUI(settings.WhiteBalance, contentsLayout);
                whiteBalanceGUI.OnChanged += x => { this.settings.WhiteBalance = x; MarkAsModified(); };
                whiteBalanceGUI.OnConfirmed += ConfirmModify;
            }

            //// Color grading settings
            colorGradingFoldout.OnToggled += x =>
            {
                properties.SetBool("colorGrading_Expanded", x);
                ToggleFoldoutFields();
            };
            layout.AddElement(colorGradingFoldout);

            colorGradingLayout = layout.AddLayoutX();
            {
                colorGradingLayout.AddSpace(10);

                GUILayoutY contentsLayout = colorGradingLayout.AddLayoutY();
                colorGradingGUI = new ColorGradingSettingsGUI(settings.ColorGrading, contentsLayout);
                colorGradingGUI.OnChanged += x => { this.settings.ColorGrading = x; MarkAsModified(); };
                colorGradingGUI.OnConfirmed += ConfirmModify;
            }

            // Gamma
            gammaField.OnChanged += x => { this.settings.Gamma = x; MarkAsModified(); ConfirmModify(); };
            layout.AddElement(gammaField);

            // Exposure scale
            exposureScaleField.OnChanged += x => { this.settings.ExposureScale = x; MarkAsModified(); ConfirmModify(); };
            layout.AddElement(exposureScaleField);

            ToggleFoldoutFields();
        }
コード例 #19
0
        /// <summary>
        /// Returns existing, or creates new properties for a resource with the specified UUID.
        /// </summary>
        /// <param name="uuid">Unique identifier of the resource to retrieve properties for.</param>
        /// <returns>A set of key value pairs representing persistent properties of an inspectable resource.</returns>
        public SerializableProperties GetProperties(string uuid)
        {
            SerializableProperties output;
            if (!resourceProperties.TryGetValue(uuid, out output))
            {
                output = new SerializableProperties();
                resourceProperties[uuid] = output;
            }

            return output;
        }
コード例 #20
0
        /// <summary>
        /// Constructs a new set of GUI elements for inspecting the post process settings object.
        /// </summary>
        /// <param name="settings">Initial values to assign to the GUI elements.</param>
        /// <param name="layout">Layout to append the GUI elements to.</param>
        /// <param name="properties">A set of properties that are persisted by the parent inspector. Used for saving state.
        ///                          </param>
        public RenderSettingsGUI(RenderSettings settings, GUILayout layout, SerializableProperties properties)
        {
            this.settings   = settings;
            this.properties = properties;

            // Enable HDR
            enableHDRField.OnChanged += x => { this.settings.EnableHDR = x; MarkAsModified(); ConfirmModify(); };
            layout.AddElement(enableHDRField);

            // Enable lighting
            enableLightingField.OnChanged += x => { this.settings.EnableLighting = x; MarkAsModified(); ConfirmModify(); };
            layout.AddElement(enableLightingField);

            // Enable indirect lighting
            enableIndirectLightingField.OnChanged += x => { this.settings.EnableIndirectLighting = x; MarkAsModified(); ConfirmModify(); };
            layout.AddElement(enableIndirectLightingField);

            // Overlay only
            overlayOnlyField.OnChanged += x => { this.settings.OverlayOnly = x; MarkAsModified(); ConfirmModify(); };
            layout.AddElement(overlayOnlyField);

            // Shadows
            enableShadowsField.OnChanged += x => { this.settings.EnableShadows = x; MarkAsModified(); ConfirmModify(); };
            layout.AddElement(enableShadowsField);

            shadowsFoldout.AcceptsKeyFocus = false;
            shadowsFoldout.OnToggled      += x =>
            {
                properties.SetBool("shadows_Expanded", x);
                ToggleFoldoutFields();
            };
            layout.AddElement(shadowsFoldout);

            shadowsLayout = layout.AddLayoutX();
            {
                shadowsLayout.AddSpace(10);

                GUILayoutY contentsLayout = shadowsLayout.AddLayoutY();
                shadowsGUI              = new ShadowSettingsGUI(settings.ShadowSettings, contentsLayout);
                shadowsGUI.OnChanged   += x => { this.settings.ShadowSettings = x; MarkAsModified(); };
                shadowsGUI.OnConfirmed += ConfirmModify;
            }

            // Auto exposure
            enableAutoExposureField.OnChanged += x => { this.settings.EnableAutoExposure = x; MarkAsModified(); ConfirmModify(); };
            layout.AddElement(enableAutoExposureField);

            autoExposureFoldout.AcceptsKeyFocus = false;
            autoExposureFoldout.OnToggled      += x =>
            {
                properties.SetBool("autoExposure_Expanded", x);
                ToggleFoldoutFields();
            };
            layout.AddElement(autoExposureFoldout);

            autoExposureLayout = layout.AddLayoutX();
            {
                autoExposureLayout.AddSpace(10);

                GUILayoutY contentsLayout = autoExposureLayout.AddLayoutY();
                autoExposureGUI              = new AutoExposureSettingsGUI(settings.AutoExposure, contentsLayout);
                autoExposureGUI.OnChanged   += x => { this.settings.AutoExposure = x; MarkAsModified(); };
                autoExposureGUI.OnConfirmed += ConfirmModify;
            }

            // Tonemapping
            enableToneMappingField.OnChanged += x => { this.settings.EnableTonemapping = x; MarkAsModified(); ConfirmModify(); };
            layout.AddElement(enableToneMappingField);

            //// Tonemapping settings
            toneMappingFoldout.AcceptsKeyFocus = false;
            toneMappingFoldout.OnToggled      += x =>
            {
                properties.SetBool("toneMapping_Expanded", x);
                ToggleFoldoutFields();
            };
            layout.AddElement(toneMappingFoldout);

            toneMappingLayout = layout.AddLayoutX();
            {
                toneMappingLayout.AddSpace(10);

                GUILayoutY contentsLayout = toneMappingLayout.AddLayoutY();
                toneMappingGUI              = new TonemappingSettingsGUI(settings.Tonemapping, contentsLayout);
                toneMappingGUI.OnChanged   += x => { this.settings.Tonemapping = x; MarkAsModified(); };
                toneMappingGUI.OnConfirmed += ConfirmModify;
            }

            //// White balance settings
            whiteBalanceFoldout.AcceptsKeyFocus = false;
            whiteBalanceFoldout.OnToggled      += x =>
            {
                properties.SetBool("whiteBalance_Expanded", x);
                ToggleFoldoutFields();
            };
            layout.AddElement(whiteBalanceFoldout);

            whiteBalanceLayout = layout.AddLayoutX();
            {
                whiteBalanceLayout.AddSpace(10);

                GUILayoutY contentsLayout = whiteBalanceLayout.AddLayoutY();
                whiteBalanceGUI              = new WhiteBalanceSettingsGUI(settings.WhiteBalance, contentsLayout);
                whiteBalanceGUI.OnChanged   += x => { this.settings.WhiteBalance = x; MarkAsModified(); };
                whiteBalanceGUI.OnConfirmed += ConfirmModify;
            }

            //// Color grading settings
            colorGradingFoldout.AcceptsKeyFocus = false;
            colorGradingFoldout.OnToggled      += x =>
            {
                properties.SetBool("colorGrading_Expanded", x);
                ToggleFoldoutFields();
            };
            layout.AddElement(colorGradingFoldout);

            colorGradingLayout = layout.AddLayoutX();
            {
                colorGradingLayout.AddSpace(10);

                GUILayoutY contentsLayout = colorGradingLayout.AddLayoutY();
                colorGradingGUI              = new ColorGradingSettingsGUI(settings.ColorGrading, contentsLayout);
                colorGradingGUI.OnChanged   += x => { this.settings.ColorGrading = x; MarkAsModified(); };
                colorGradingGUI.OnConfirmed += ConfirmModify;
            }

            // Gamma
            gammaField.OnChanged += x => { this.settings.Gamma = x; MarkAsModified(); ConfirmModify(); };
            layout.AddElement(gammaField);

            // Exposure scale
            exposureScaleField.OnChanged += x => { this.settings.ExposureScale = x; MarkAsModified(); ConfirmModify(); };
            layout.AddElement(exposureScaleField);

            //// Depth of field settings
            depthOfFieldFoldout.AcceptsKeyFocus = false;
            depthOfFieldFoldout.OnToggled      += x =>
            {
                properties.SetBool("depthOfField_Expanded", x);
                ToggleFoldoutFields();
            };
            layout.AddElement(depthOfFieldFoldout);

            depthOfFieldLayout = layout.AddLayoutX();
            {
                depthOfFieldLayout.AddSpace(10);

                GUILayoutY contentsLayout = depthOfFieldLayout.AddLayoutY();
                depthOfFieldGUI              = new DepthOfFieldSettingsGUI(settings.DepthOfField, contentsLayout);
                depthOfFieldGUI.OnChanged   += x => { this.settings.DepthOfField = x; MarkAsModified(); };
                depthOfFieldGUI.OnConfirmed += ConfirmModify;
            }

            //// Ambient occlusion settings
            ambientOcclusionFoldout.AcceptsKeyFocus = false;
            ambientOcclusionFoldout.OnToggled      += x =>
            {
                properties.SetBool("ambientOcclusion_Expanded", x);
                ToggleFoldoutFields();
            };
            layout.AddElement(ambientOcclusionFoldout);

            ambientOcclusionLayout = layout.AddLayoutX();
            {
                ambientOcclusionLayout.AddSpace(10);

                GUILayoutY contentsLayout = ambientOcclusionLayout.AddLayoutY();
                ambientOcclusionGUI              = new AmbientOcclusionSettingsGUI(settings.AmbientOcclusion, contentsLayout);
                ambientOcclusionGUI.OnChanged   += x => { this.settings.AmbientOcclusion = x; MarkAsModified(); };
                ambientOcclusionGUI.OnConfirmed += ConfirmModify;
            }

            //// Screen space reflections settings
            screenSpaceReflectionsFoldout.AcceptsKeyFocus = false;
            screenSpaceReflectionsFoldout.OnToggled      += x =>
            {
                properties.SetBool("screenSpaceReflections_Expanded", x);
                ToggleFoldoutFields();
            };
            layout.AddElement(screenSpaceReflectionsFoldout);

            screenSpaceReflectionsLayout = layout.AddLayoutX();
            {
                screenSpaceReflectionsLayout.AddSpace(10);

                GUILayoutY contentsLayout = screenSpaceReflectionsLayout.AddLayoutY();
                screenSpaceReflectionsGUI              = new ScreenSpaceReflectionsSettingsGUI(settings.ScreenSpaceReflections, contentsLayout);
                screenSpaceReflectionsGUI.OnChanged   += x => { this.settings.ScreenSpaceReflections = x; MarkAsModified(); };
                screenSpaceReflectionsGUI.OnConfirmed += ConfirmModify;
            }

            // FXAA
            enableFXAAField.OnChanged += x => { this.settings.EnableFXAA = x; MarkAsModified(); ConfirmModify(); };
            layout.AddElement(enableFXAAField);

            ToggleFoldoutFields();
        }
コード例 #21
0
ファイル: LimitInspectors.cs プロジェクト: Ruu/BansheeEngine
        /// <summary>
        /// Constructs a new set of GUI elements for inspecting the limit object.
        /// </summary>
        /// <param name="prefix">Prefix that identifies the exact type of the limit type.</param>
        /// <param name="limitData">Initial values to assign to the GUI elements.</param>
        /// <param name="layout">Layout to append the GUI elements to.</param>
        /// <param name="properties">A set of properties that are persisted by the parent inspector. Used for saving state.
        ///                          </param>
        public LimitCommonGUI(string prefix, LimitCommonData limitData, GUILayout layout, SerializableProperties properties)
        {
            this.limitData = limitData;
            this.properties = properties;
            this.prefix = prefix;

            hardFoldout.OnToggled += x =>
            {
                properties.SetBool(prefix + "_hardLimit_Expanded", x);
                ToggleLimitFields();
            };

            contactDistanceField.OnChanged += x => { this.limitData.contactDist = x; MarkAsModified(); };
            contactDistanceField.OnFocusLost += ConfirmModify;
            contactDistanceField.OnConfirmed += ConfirmModify;

            softFoldout.OnToggled += x =>
            {
                properties.SetBool(prefix + "_softLimit_Expanded", x);
                ToggleLimitFields();
            };

            restitutionField.OnChanged += x => { this.limitData.restitution = x; MarkAsModified(); };
            restitutionField.OnFocusLost += ConfirmModify;

            springFoldout.OnToggled += x =>
            {
                properties.SetBool(prefix + "_spring_Expanded", x);
                ToggleLimitFields();
            };

            hardLimitLayout = layout.AddLayoutX();
            {
                hardLimitLayout.AddSpace(10);

                GUILayoutY hardLimitContentsLayout = hardLimitLayout.AddLayoutY();
                hardLimitContentsLayout.AddElement(contactDistanceField);
            }

            softLimitLayout = layout.AddLayoutX();
            layout.AddElement(softFoldout);
            {
                softLimitLayout.AddSpace(10);

                GUILayoutY softLimitContentsLayout = softLimitLayout.AddLayoutY();
                softLimitContentsLayout.AddElement(restitutionField);
                softLimitContentsLayout.AddElement(springFoldout);
                springLayout = softLimitContentsLayout.AddLayoutX();
                {
                    springLayout.AddSpace(10);

                    GUILayoutY springContentsLayout = springLayout.AddLayoutY();
                    springGUI = new SpringGUI(limitData.spring, springContentsLayout);
                    springGUI.OnChanged += x => { this.limitData.spring = x; MarkAsModified(); };
                    springGUI.OnConfirmed += ConfirmModify;
                }
            }
        }