/// <summary>
        /// Constructs a new set of GUI elements for inspecting the color grading 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>
        public ColorGradingSettingsGUI(ColorGradingSettings settings, GUILayout layout)
        {
            this.settings = settings;

            saturationField.OnChanged   += x => { this.settings.Saturation = x; MarkAsModified(); };
            saturationField.OnFocusLost += ConfirmModify;
            saturationField.OnConfirmed += ConfirmModify;

            contrastField.OnChanged   += x => { this.settings.Contrast = x; MarkAsModified(); };
            contrastField.OnFocusLost += ConfirmModify;
            contrastField.OnConfirmed += ConfirmModify;

            gainField.OnChanged   += x => { this.settings.Gain = x; MarkAsModified(); };
            gainField.OnFocusLost += ConfirmModify;
            gainField.OnConfirmed += ConfirmModify;

            offsetField.OnChanged   += x => { this.settings.Offset = x; MarkAsModified(); };
            offsetField.OnFocusLost += ConfirmModify;
            offsetField.OnConfirmed += ConfirmModify;

            layout.AddElement(saturationField);
            layout.AddElement(contrastField);
            layout.AddElement(gainField);
            layout.AddElement(offsetField);
        }
        /// <summary>
        /// Constructs a new set of GUI elements for inspecting the white balance 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>
        public WhiteBalanceSettingsGUI(WhiteBalanceSettings settings, GUILayout layout)
        {
            this.settings = settings;

            temperatureField.OnChanged += x => { this.settings.Temperature = x; MarkAsModified(); ConfirmModify(); };
            tintField.OnChanged        += x => { this.settings.Tint = x; MarkAsModified(); ConfirmModify(); };

            layout.AddElement(temperatureField);
            layout.AddElement(tintField);
        }
예제 #3
0
        private void OnInitialize()
        {
            GUILayout vertLayout   = GUI.AddLayoutY();
            GUILayout editorPanel  = vertLayout.AddPanel(GUIOption.FixedHeight(400));
            GUILayout buttonLayout = vertLayout.AddLayoutX(GUIOption.FixedHeight(40));

            guiOK     = new GUIButton(new LocEdString("OK"));
            guiCancel = new GUIButton(new LocEdString("Cancel"));

            guiOK.OnClick     += OnOK;
            guiCancel.OnClick += OnCancel;

            CurveDrawOptions drawOptions = CurveDrawOptions.DrawKeyframes | CurveDrawOptions.DrawMarkers;

            if (curveB != null)
            {
                drawOptions |= CurveDrawOptions.DrawRange;
            }

            curveEditor = new GUICurveEditor(editorPanel, 600, 400, false, drawOptions);
            curveEditor.Redraw();

            EdCurveDrawInfo[] drawinfo;

            if (curveB != null)
            {
                drawinfo = new []
                {
                    new EdCurveDrawInfo(curveA, Color.BansheeOrange),
                    new EdCurveDrawInfo(curveB, Color.Green),
                };
            }
            else
            {
                drawinfo = new [] { new EdCurveDrawInfo(curveA, Color.BansheeOrange), };
            }

            curveEditor.SetCurves(drawinfo);
            curveEditor.CenterAndResize(true);

            buttonLayout.AddFlexibleSpace();
            buttonLayout.AddElement(guiOK);
            buttonLayout.AddSpace(10);
            buttonLayout.AddElement(guiCancel);
            buttonLayout.AddFlexibleSpace();

            EditorInput.OnPointerPressed     += OnPointerPressed;
            EditorInput.OnPointerDoubleClick += OnPointerDoubleClicked;
            EditorInput.OnPointerMoved       += OnPointerMoved;
            EditorInput.OnPointerReleased    += OnPointerReleased;
            EditorInput.OnButtonUp           += OnButtonUp;
        }
예제 #4
0
        /// <summary>
        /// Creates a new material parameter GUI.
        /// </summary>
        /// <param name="shaderParam">Shader parameter to create the GUI for. Must be of color type.</param>
        /// <param name="material">Material the parameter is a part of.</param>
        /// <param name="layout">Layout to append the GUI elements to.</param>
        internal MaterialParamColorGUI(ShaderParameter shaderParam, Material material, GUILayout layout)
            : base(shaderParam)
        {
            LocString title = new LocEdString(shaderParam.name);

            var guiToggle = new GUIToggle(new GUIContent(
                                              EditorBuiltin.GetEditorToggleIcon(EditorToggleIcon.AnimateProperty), new LocString("Animate")));

            guiColor         = new GUIColorField(title);
            guiColorGradient = new GUIColorGradientField(title);

            bool isAnimated = material.IsAnimated(shaderParam.name);

            guiColor.Active         = !isAnimated;
            guiColorGradient.Active = isAnimated;

            fieldLayout = layout.AddLayoutX();
            fieldLayout.AddElement(guiColor);
            fieldLayout.AddElement(guiColorGradient);
            fieldLayout.AddSpace(10);
            fieldLayout.AddElement(guiToggle);

            guiColor.OnChanged += (x) =>
            {
                material.SetColor(shaderParam.name, x);
                EditorApplication.SetDirty(material);
            };

            guiColorGradient.OnChanged += x =>
            {
                material.SetColorGradient(shaderParam.name, x);
                EditorApplication.SetDirty(material);
            };

            guiToggle.OnToggled += x =>
            {
                guiColor.Active         = !x;
                guiColorGradient.Active = x;

                if (x)
                {
                    ColorGradient gradient = material.GetColorGradient(shaderParam.name);
                    if (gradient.NumKeys == 0)
                    {
                        material.SetColorGradient(shaderParam.name, new ColorGradient(material.GetColor(shaderParam.name)));
                    }
                }
            };
        }
예제 #5
0
        /// <summary>
        /// Constructs a new set of GUI elements for inspecting the spring object.
        /// </summary>
        /// <param name="spring">Initial values to assign to the GUI elements.</param>
        /// <param name="layout">Layout to append the GUI elements to.</param>
        public SpringGUI(Spring spring, GUILayout layout)
        {
            this.spring = spring;

            stiffnessField.OnChanged   += x => { spring.stiffness = x; MarkAsModified(); };
            stiffnessField.OnFocusLost += ConfirmModify;
            stiffnessField.OnConfirmed += ConfirmModify;

            dampingField.OnChanged   += x => { spring.damping = x; MarkAsModified(); };
            dampingField.OnFocusLost += ConfirmModify;
            dampingField.OnConfirmed += ConfirmModify;

            layout.AddElement(stiffnessField);
            layout.AddElement(dampingField);
        }
예제 #6
0
        /// <summary>
        /// Initializes the drop down window by creating the necessary GUI. Must be called after construction and before
        /// use.
        /// </summary>
        /// <param name="keyFrame">Keyframe whose properties to edit.</param>
        /// <param name="updateCallback">Callback triggered when event values change.</param>
        internal void Initialize(KeyFrame keyFrame, Action <KeyFrame> updateCallback)
        {
            GUIFloatField timeField = new GUIFloatField(new LocEdString("Time"), 40, "");

            timeField.Value      = keyFrame.time;
            timeField.OnChanged += x => { keyFrame.time = x; updateCallback(keyFrame); };

            GUIFloatField valueField = new GUIFloatField(new LocEdString("Value"), 40, "");

            valueField.Value      = keyFrame.value;
            valueField.OnChanged += x => { keyFrame.value = x; updateCallback(keyFrame); };

            GUILayoutY vertLayout = GUI.AddLayoutY();

            vertLayout.AddFlexibleSpace();
            GUILayoutX horzLayout = vertLayout.AddLayoutX();

            horzLayout.AddFlexibleSpace();
            GUILayout contentLayout = horzLayout.AddLayoutY();
            GUILayout timeLayout    = contentLayout.AddLayoutX();

            timeLayout.AddSpace(5);
            timeLayout.AddElement(timeField);
            timeLayout.AddFlexibleSpace();
            GUILayout componentLayout = contentLayout.AddLayoutX();

            componentLayout.AddSpace(5);
            componentLayout.AddElement(valueField);
            componentLayout.AddFlexibleSpace();
            horzLayout.AddFlexibleSpace();
            vertLayout.AddFlexibleSpace();
        }
예제 #7
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;
        }
        /// <inheritdoc/>
        protected internal override void Initialize()
        {
            LoadResource();

            PlainText plainText = InspectedObject as PlainText;

            if (plainText == null)
            {
                return;
            }

            GUIPanel  textPanel   = Layout.AddPanel();
            GUILayout textLayoutY = textPanel.AddLayoutY();

            textLayoutY.AddSpace(5);
            GUILayout textLayoutX = textLayoutY.AddLayoutX();

            textLayoutX.AddSpace(5);
            textLayoutX.AddElement(textLabel);
            textLayoutX.AddSpace(5);
            textLayoutY.AddSpace(5);

            GUIPanel textBgPanel = textPanel.AddPanel(1);

            textBgPanel.AddElement(textBg);
        }
        /// <summary>
        /// Constructs a new set of GUI elements for inspecting the screen space reflections 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>
        public ScreenSpaceReflectionsSettingsGUI(ScreenSpaceReflectionsSettings settings, GUILayout layout)
        {
            this.settings = settings;

            enabledField.OnChanged      += x => { this.settings.Enabled = x; MarkAsModified(); ConfirmModify(); };
            qualityField.OnChanged      += x => { this.settings.Quality = (uint)x; MarkAsModified(); ConfirmModify(); };
            intensityField.OnChanged    += x => { this.settings.Intensity = x; MarkAsModified(); ConfirmModify(); };
            maxRoughnessField.OnChanged += x => { this.settings.MaxRoughness = x; MarkAsModified(); ConfirmModify(); };

            qualityField.Step = 1.0f;

            layout.AddElement(enabledField);
            layout.AddElement(qualityField);
            layout.AddElement(intensityField);
            layout.AddElement(maxRoughnessField);
        }
예제 #10
0
        /// <summary>
        /// Constructs a new timeline and adds it to the specified layout.
        /// </summary>
        /// <param name="layout">Layout to add the timeline GUI to.</param>
        /// <param name="width">Width of the timeline in pixels.</param>
        /// <param name="height">Height of the timeline in pixels.</param>
        public GUITimelineBase(GUILayout layout, int width, int height)
        {
            canvas = new GUICanvas();
            layout.AddElement(canvas);

            SetSize(width, height);
        }
예제 #11
0
        /// <inheritdoc/>
        protected internal override void Initialize()
        {
            if (InspectedObject != null)
            {
                importOptions = GetImportOptions();

                normalsField.OnChanged     += x => importOptions.ImportNormals = x;
                tangentsField.OnChanged    += x => importOptions.ImportTangents = x;
                skinField.OnChanged        += x => importOptions.ImportSkin = x;
                blendShapesField.OnChanged += x => importOptions.ImportBlendShapes = x;
                animationField.OnChanged   += x => importOptions.ImportAnimation = x;
                scaleField.OnChanged       += x => importOptions.Scale = x;
                cpuReadableField.OnChanged += x => importOptions.CPUReadable = x;
                collisionMeshTypeField.OnSelectionChanged += x => importOptions.CollisionMeshType = (CollisionMeshType)x;

                reimportButton.OnClick += TriggerReimport;

                Layout.AddElement(normalsField);
                Layout.AddElement(tangentsField);
                Layout.AddElement(skinField);
                Layout.AddElement(blendShapesField);
                Layout.AddElement(animationField);
                Layout.AddElement(scaleField);
                Layout.AddElement(cpuReadableField);
                Layout.AddElement(collisionMeshTypeField);
                Layout.AddSpace(10);

                GUILayout reimportButtonLayout = Layout.AddLayoutX();
                reimportButtonLayout.AddFlexibleSpace();
                reimportButtonLayout.AddElement(reimportButton);
            }
        }
예제 #12
0
        private void OnInitialize()
        {
            treeScrollArea = new GUIScrollArea();
            GUI.AddElement(treeScrollArea);

            treeView = new GUISceneTreeView(GUIOption.FlexibleHeight(20), GUIOption.FlexibleWidth(20));
            treeScrollArea.Layout.AddElement(treeView);

            // Loading progress
            loadLabel       = new GUILabel(new LocEdString("Loading scene..."));
            loadProgressBar = new GUIProgressBar();

            progressLayout = GUI.AddLayoutY();
            progressLayout.AddFlexibleSpace();
            GUILayout loadLabelLayout = progressLayout.AddLayoutX();

            loadLabelLayout.AddFlexibleSpace();
            loadLabelLayout.AddElement(loadLabel);
            loadLabelLayout.AddFlexibleSpace();

            GUILayout progressBarLayout = progressLayout.AddLayoutX();

            progressBarLayout.AddFlexibleSpace();
            progressBarLayout.AddElement(loadProgressBar);
            progressBarLayout.AddFlexibleSpace();
            progressLayout.AddFlexibleSpace();

            progressLayout.Active = false;

            EditorVirtualInput.OnButtonUp += OnButtonUp;
        }
예제 #13
0
        /// <summary>
        /// Updates GUI for the recent projects list.
        /// </summary>
        private void RefreshRecentProjects()
        {
            GUILayout scrollLayout = recentProjectsArea.Layout;

            while (scrollLayout.ChildCount > 0)
            {
                scrollLayout.GetChild(0).Destroy();
            }

            RecentProject[] recentProjects = EditorSettings.RecentProjects;
            Array.Sort(recentProjects, (a, b) => a.accessTimestamp.CompareTo(b.accessTimestamp));

            GUIToggleGroup grp = new GUIToggleGroup();

            for (int i = 0; i < recentProjects.Length; i++)
            {
                string projectPath = recentProjects[i].path;

                GUIToggle entryBtn = new GUIToggle(projectPath, grp, EditorStylesInternal.SelectableLabel);
                entryBtn.OnClick       += () => OnEntryClicked(projectPath);
                entryBtn.OnDoubleClick += () => OnEntryDoubleClicked(projectPath);

                if (PathEx.Compare(projectPath, projectInputBox.Value))
                {
                    entryBtn.Value = true;
                }

                scrollLayout.AddElement(entryBtn);
            }
        }
예제 #14
0
        /// <summary>
        /// Creates a new material parameter GUI.
        /// </summary>
        /// <param name="shaderParam">Shader parameter to create the GUI for. Must be of texture type.</param>
        /// <param name="material">Material the parameter is a part of.</param>
        /// <param name="layout">Layout to append the GUI elements to.</param>
        internal MaterialParamTextureGUI(ShaderParameter shaderParam, Material material, GUILayout layout)
            : base(shaderParam)
        {
            LocString title = new LocEdString(shaderParam.name);

            guiElem = new GUITextureField(title);

            switch (shaderParam.type)
            {
            case ShaderParameterType.Texture2D:
            case ShaderParameterType.Texture3D:
            case ShaderParameterType.TextureCube:
                guiElem.OnChanged += (x) =>
                {
                    Resource resource = x.Value;

                    if (resource is Texture tex)
                    {
                        material.SetTexture(shaderParam.name, tex);
                    }
                    else if (resource is SpriteTexture spriteTex)
                    {
                        material.SetSpriteTexture(shaderParam.name, spriteTex);
                    }

                    EditorApplication.SetDirty(material);
                };
                break;
            }

            layout.AddElement(guiElem);
        }
예제 #15
0
        /// <inheritdoc/>
        protected internal override void Initialize()
        {
            importOptions = GetImportOptions();

            formatField.OnSelectionChanged            += x => importOptions.Format = (PixelFormat)x;
            generateMipsField.OnChanged               += x => importOptions.GenerateMips = x;
            maximumMipsField.OnChanged                += x => importOptions.MaxMip = x;
            srgbField.OnChanged                       += x => importOptions.SRGB = x;
            cpuCachedField.OnChanged                  += x => importOptions.CpuCached = x;
            isCubemapField.OnChanged                  += x => importOptions.Cubemap = x;
            cubemapSourceTypeField.OnSelectionChanged += x => importOptions.CubemapSourceType = (CubemapSourceType)x;
            reimportButton.OnClick                    += TriggerReimport;

            Layout.AddElement(formatField);
            Layout.AddElement(generateMipsField);
            Layout.AddElement(maximumMipsField);
            Layout.AddElement(srgbField);
            Layout.AddElement(cpuCachedField);
            Layout.AddElement(isCubemapField);
            Layout.AddElement(cubemapSourceTypeField);
            Layout.AddSpace(10);

            GUILayout reimportButtonLayout = Layout.AddLayoutX();

            reimportButtonLayout.AddFlexibleSpace();
            reimportButtonLayout.AddElement(reimportButton);
        }
예제 #16
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;
        }
            /// <summary>
            /// Constructs a new gradient key editor control.
            /// </summary>
            /// <param name="parent">GUI layout to attach the child GUI controls to.</param>
            /// <param name="keys">Set of keys to initially display on the editor.</param>
            /// <param name="width">Width of the editor in pixels.</param>
            /// <param name="height">Height of the editor in pixels.</param>
            public GradientKeyEditor(GUILayout parent, ColorGradientKey[] keys, int width, int height)
            {
                canvas = new GUICanvas();
                parent.AddElement(canvas);

                Rebuild(new List <ColorGradientKey>(keys), width, height);
            }
예제 #18
0
        /// <inheritdoc/>
        protected internal override void Initialize()
        {
            if (InspectedObject != null)
            {
                importOptions = GetImportOptions();

                formatField.OnSelectionChanged += x => importOptions.Format = (PixelFormat)x;
                generateMipsField.OnChanged    += x => importOptions.GenerateMipmaps = x;
                maximumMipsField.OnChanged     += x => importOptions.MaxMipmapLevel = x;
                srgbField.OnChanged            += x => importOptions.IsSRGB = x;
                cpuReadableField.OnChanged     += x => importOptions.CPUReadable = x;

                reimportButton.OnClick += TriggerReimport;

                Layout.AddElement(formatField);
                Layout.AddElement(generateMipsField);
                Layout.AddElement(maximumMipsField);
                Layout.AddElement(srgbField);
                Layout.AddElement(cpuReadableField);
                Layout.AddSpace(10);

                GUILayout reimportButtonLayout = Layout.AddLayoutX();
                reimportButtonLayout.AddFlexibleSpace();
                reimportButtonLayout.AddElement(reimportButton);
            }
        }
예제 #19
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;
        }
예제 #20
0
        /// <summary>
        /// Recreates all the GUI elements used by this inspector.
        /// </summary>
        private void BuildGUI()
        {
            Layout.Clear();

            normalsField           = new GUIToggleField(new LocEdString("Import Normals"));
            tangentsField          = new GUIToggleField(new LocEdString("Import Tangents"));
            skinField              = new GUIToggleField(new LocEdString("Import Skin"));
            blendShapesField       = new GUIToggleField(new LocEdString("Import Blend Shapes"));
            animationField         = new GUIToggleField(new LocEdString("Import Animation"));
            scaleField             = new GUIFloatField(new LocEdString("Scale"));
            cpuCachedField         = new GUIToggleField(new LocEdString("CPU cached"));
            cpuReadableField       = new GUIToggleField(new LocEdString("CPU readable"));
            collisionMeshTypeField = new GUIEnumField(typeof(CollisionMeshType), new LocEdString("Collision mesh"));
            keyFrameReductionField = new GUIToggleField(new LocEdString("Keyframe Reduction"));
            rootMotionField        = new GUIToggleField(new LocEdString("Import root motion"));
            reimportButton         = new GUIButton(new LocEdString("Reimport"));

            normalsField.OnChanged     += x => importOptions.ImportNormals = x;
            tangentsField.OnChanged    += x => importOptions.ImportTangents = x;
            skinField.OnChanged        += x => importOptions.ImportSkin = x;
            blendShapesField.OnChanged += x => importOptions.ImportBlendShapes = x;
            animationField.OnChanged   += x => importOptions.ImportAnimation = x;
            scaleField.OnChanged       += x => importOptions.Scale = x;
            cpuCachedField.OnChanged   += x => importOptions.CPUCached = x;
            cpuReadableField.OnChanged += x => importOptions.CPUReadable = x;
            collisionMeshTypeField.OnSelectionChanged += x => importOptions.CollisionMeshType = (CollisionMeshType)x;
            keyFrameReductionField.OnChanged          += x => importOptions.KeyframeReduction = x;
            rootMotionField.OnChanged += x => importOptions.ImportRootMotion = x;

            reimportButton.OnClick += TriggerReimport;

            Layout.AddElement(normalsField);
            Layout.AddElement(tangentsField);
            Layout.AddElement(skinField);
            Layout.AddElement(blendShapesField);
            Layout.AddElement(animationField);
            Layout.AddElement(scaleField);
            Layout.AddElement(cpuCachedField);
            Layout.AddElement(cpuReadableField);
            Layout.AddElement(collisionMeshTypeField);
            Layout.AddElement(keyFrameReductionField);
            Layout.AddElement(rootMotionField);

            splitInfos = importOptions.AnimationClipSplits;

            animSplitInfoField = GUIArrayField <AnimationSplitInfo, AnimSplitArrayRow> .Create(
                new LocEdString("Animation splits"), splitInfos, Layout);

            animSplitInfoField.OnChanged += x => { splitInfos = x; };
            animSplitInfoField.IsExpanded = Persistent.GetBool("animSplitInfos_Expanded");
            animSplitInfoField.OnExpand  += x => Persistent.SetBool("animSplitInfos_Expanded", x);

            Layout.AddSpace(10);

            GUILayout reimportButtonLayout = Layout.AddLayoutX();

            reimportButtonLayout.AddFlexibleSpace();
            reimportButtonLayout.AddElement(reimportButton);
        }
예제 #21
0
        /// <summary>
        /// Creates the reimport GUI elements in the provided layout.
        /// </summary>
        /// <param name="path">Path of the resource that can be reimported.</param>
        /// <param name="parent">Parent GUI layout to which to add the reimport GUI elements.</param>
        /// <param name="doReimport">User provided callback that triggers when the reimport button is clicked.</param>
        internal GUIReimportButton(string path, GUILayout parent, Action doReimport)
        {
            this.path = path;

            reimportButton.OnClick += () => doReimport();

            GUILayout reimportButtonLayout = parent.AddLayoutX();

            reimportButtonLayout.AddFlexibleSpace();
            reimportButtonLayout.AddElement(reimportButton);
            reimportButtonLayout.AddElement(guiSpinner);

            bool isImporting = ProjectLibrary.GetImportProgress(path) < 1.0f;

            guiSpinner.Active     = isImporting;
            reimportButton.Active = !isImporting;
        }
예제 #22
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;
                }
            }
        }
예제 #23
0
        public GUIAnimFieldDisplay(GUILayout layout, int width, int height, SceneObject root)
        {
            this.root = root;

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

            SetSize(width, height);
        }
예제 #24
0
        /// <summary>
        /// Constructs a new value display and adds it to the specified layout.
        /// </summary>
        /// <param name="layout">Layout to add the GUI element to.</param>
        /// <param name="width">Width of the timeline in pixels.</param>
        /// <param name="height">Height of the timeline in pixels.</param>
        public GUIGraphValues(GUILayout layout, int width, int height)
        {
            canvas = new GUICanvas();
            layout.AddElement(canvas);

            tickHandler = new GUIGraphTicks();

            SetSize(width, height);
        }
예제 #25
0
                /// <summary>
                /// Builds the GUI for the specified state style.
                /// </summary>
                /// <param name="title">Text to display on the title bar.</param>
                /// <param name="layout">Layout to append the GUI elements to.</param>
                public void BuildGUI(LocString title, GUILayout layout)
                {
                    foldout        = new GUIToggle(title, EditorStyles.Foldout);
                    textureField   = new GUIResourceField(typeof(SpriteTexture), new LocEdString("Texture"));
                    textColorField = new GUIColorField(new LocEdString("Text color"));

                    foldout.AcceptsKeyFocus = false;
                    foldout.OnToggled      += x =>
                    {
                        textureField.Active   = x;
                        textColorField.Active = x;
                        isExpanded            = x;
                    };

                    textureField.OnChanged += x =>
                    {
                        SpriteTexture texture = Resources.Load <SpriteTexture>(x.UUID);
                        state.texture = texture;

                        if (OnChanged != null)
                        {
                            OnChanged(state);
                        }
                    };

                    textColorField.OnChanged += x =>
                    {
                        state.textColor = x;

                        if (OnChanged != null)
                        {
                            OnChanged(state);
                        }
                    };

                    layout.AddElement(foldout);
                    layout.AddElement(textureField);
                    layout.AddElement(textColorField);

                    foldout.Value         = isExpanded;
                    textureField.Active   = isExpanded;
                    textColorField.Active = isExpanded;
                }
예제 #26
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;
        }
예제 #27
0
        /// <summary>
        /// Creates a new material parameter GUI.
        /// </summary>
        /// <param name="shaderParam">Shader parameter to create the GUI for. Must be of floating point type.</param>
        /// <param name="material">Material the parameter is a part of.</param>
        /// <param name="layout">Layout to append the GUI elements to.</param>
        internal MaterialParamFloatGUI(ShaderParameter shaderParam, Material material, GUILayout layout)
            : base(shaderParam)
        {
            LocString title = new LocEdString(shaderParam.name);

            var guiToggle = new GUIToggle(new GUIContent(
                                              EditorBuiltin.GetEditorToggleIcon(EditorToggleIcon.AnimateProperty), new LocString("Animate")));

            guiConstant = new GUIFloatField(title);
            guiCurves   = new GUICurvesField(title);

            bool isAnimated = material.IsAnimated(shaderParam.name);

            guiConstant.Active = !isAnimated;
            guiCurves.Active   = isAnimated;

            fieldLayout = layout.AddLayoutX();
            fieldLayout.AddElement(guiConstant);
            fieldLayout.AddElement(guiCurves);
            fieldLayout.AddSpace(10);
            fieldLayout.AddElement(guiToggle);

            guiConstant.OnChanged += (x) =>
            {
                material.SetFloat(shaderParam.name, x);
                EditorApplication.SetDirty(material);
            };

            guiCurves.OnChanged += x =>
            {
                material.SetFloatCurve(shaderParam.name, x);
                EditorApplication.SetDirty(material);
            };

            guiToggle.OnToggled += x =>
            {
                guiConstant.Active = !x;
                guiCurves.Active   = x;
            };
        }
        /// <summary>
        /// Constructs a new set of GUI elements for inspecting the shadow 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>
        public ShadowSettingsGUI(ShadowSettings settings, GUILayout layout)
        {
            this.settings = settings;

            directionalShadowDistanceField.OnChanged += x =>
            {
                this.settings.DirectionalShadowDistance = x;
                MarkAsModified();
                ConfirmModify();
            };

            numCascadesField.OnChanged += x =>
            {
                this.settings.NumCascades = (uint)x;
                MarkAsModified();
                ConfirmModify();
            };

            cascadeDistributionExponentField.OnChanged += x =>
            {
                this.settings.CascadeDistributionExponent = x;
                MarkAsModified();
                ConfirmModify();
            };

            filteringQualityField.OnChanged += x =>
            {
                this.settings.ShadowFilteringQuality = (uint)x;
                MarkAsModified();
                ConfirmModify();
            };

            filteringQualityField.Step = 1.0f;

            layout.AddElement(directionalShadowDistanceField);
            layout.AddElement(numCascadesField);
            layout.AddElement(cascadeDistributionExponentField);
            layout.AddElement(filteringQualityField);
        }
예제 #29
0
        /// <summary>
        /// Creates a new material parameter GUI.
        /// </summary>
        /// <param name="shaderParam">Shader parameter to create the GUI for. Must be of color type.</param>
        /// <param name="material">Material the parameter is a part of.</param>
        /// <param name="layout">Layout to append the GUI elements to.</param>
        internal MaterialParamColorGUI(ShaderParameter shaderParam, Material material, GUILayout layout)
            : base(shaderParam)
        {
            LocString title = new LocEdString(shaderParam.name);

            guiElem            = new GUIColorField(title);
            guiElem.OnChanged += (x) =>
            {
                material.SetColor(shaderParam.name, x);
                EditorApplication.SetDirty(material);
            };

            layout.AddElement(guiElem);
        }
예제 #30
0
        /// <summary>
        /// Constructs a new set of GUI elements for inspecting the drive object.
        /// </summary>
        /// <param name="drive">Initial values to assign to the GUI elements.</param>
        /// <param name="layout">Layout to append the GUI elements to.</param>
        public D6JointDriveGUI(D6JointDrive drive, GUILayout layout)
        {
            driveData = drive;

            stiffnessField.OnChanged   += x => { driveData.stiffness = x; MarkAsModified(); };
            stiffnessField.OnFocusLost += ConfirmModify;
            stiffnessField.OnConfirmed += ConfirmModify;

            dampingField.OnChanged   += x => { driveData.damping = x; MarkAsModified(); };
            dampingField.OnFocusLost += ConfirmModify;
            dampingField.OnConfirmed += ConfirmModify;

            forceLimitField.OnChanged   += x => { driveData.forceLimit = x; MarkAsModified(); };
            forceLimitField.OnFocusLost += ConfirmModify;
            forceLimitField.OnConfirmed += ConfirmModify;

            accelerationField.OnChanged += x => { driveData.acceleration = x; MarkAsModified(); ConfirmModify(); };

            layout.AddElement(stiffnessField);
            layout.AddElement(dampingField);
            layout.AddElement(forceLimitField);
            layout.AddElement(accelerationField);
        }