/// <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); }
/// <inheritoc/> protected internal override void Initialize(int layoutIndex) { if (property != null) { guiField = new GUIEnumField(property.InternalType, new GUIContent(title)); guiField.OnSelectionChanged += OnFieldValueChanged; layout.AddElement(layoutIndex, guiField); } }
/// <summary> /// Initializes the drop down window by creating the necessary GUI. Must be called after construction and before /// use. /// </summary> /// <param name="parent">Scene window that this drop down window is a part of.</param> /// <param name="cameraOptions">Reference to the current scene camera options.</param> internal void Initialize(SceneWindow parent) { this.Parent = parent; GUIEnumField cameraProjectionTypeField = new GUIEnumField(typeof(ProjectionType), new LocEdString("Projection type")); cameraProjectionTypeField.Value = (ulong)Parent.ProjectionType; cameraProjectionTypeField.OnSelectionChanged += SetCameraProjectionType; nearClipPlaneInput = new GUIFloatField(new LocEdString("Near plane")); nearClipPlaneInput.Value = Parent.NearClipPlane; nearClipPlaneInput.OnChanged += OnNearClipPlaneChanged; nearClipPlaneInput.SetRange(SceneCameraOptions.MinNearClipPlane, SceneCameraOptions.MaxNearClipPlane); farClipPlaneInput = new GUIFloatField(new LocEdString("Far plane")); farClipPlaneInput.Value = Parent.FarClipPlane; farClipPlaneInput.OnChanged += OnFarClipPlaneChanged; farClipPlaneInput.SetRange(SceneCameraOptions.MinFarClipPlane, SceneCameraOptions.MaxFarClipPlane); cameraFieldOfView = new GUISliderField(1, 360, new LocEdString("Field of view")); cameraFieldOfView.Value = Parent.FieldOfView.Degrees; cameraFieldOfView.OnChanged += SetFieldOfView; cameraOrthographicSize = new GUIFloatField(new LocEdString("Orthographic size")); cameraOrthographicSize.Value = Parent.OrthographicSize; cameraOrthographicSize.OnChanged += SetOrthographicSize; GUISliderField cameraScrollSpeed = new GUISliderField(SceneCameraOptions.MinScrollSpeed, SceneCameraOptions.MaxScrollSpeed, new LocEdString("Scroll speed")); cameraScrollSpeed.Value = Parent.ScrollSpeed; cameraScrollSpeed.OnChanged += SetScrollSpeed; GUILayoutY vertLayout = GUI.AddLayoutY(); vertLayout.AddSpace(10); GUILayoutX cameraOptionsLayoutX = vertLayout.AddLayoutX(); cameraOptionsLayoutX.AddSpace(10); GUILayoutY cameraOptionsLayoutY = cameraOptionsLayoutX.AddLayoutY(); cameraOptionsLayoutY.AddElement(cameraProjectionTypeField); cameraOptionsLayoutY.AddElement(nearClipPlaneInput); cameraOptionsLayoutY.AddElement(farClipPlaneInput); cameraOptionsLayoutY.AddElement(cameraFieldOfView); cameraOptionsLayoutY.AddElement(cameraOrthographicSize); cameraOptionsLayoutY.AddElement(cameraScrollSpeed); cameraOptionsLayoutX.AddSpace(10); vertLayout.AddSpace(10); ToggleTypeSpecificFields((ProjectionType)cameraProjectionTypeField.Value); }
/// <summary> /// Destroys all inspector GUI elements. /// </summary> internal void Clear() { for (int i = 0; i < inspectorComponents.Count; i++) { inspectorComponents[i].foldout.Destroy(); inspectorComponents[i].removeBtn.Destroy(); inspectorComponents[i].inspector.Destroy(); } inspectorComponents.Clear(); if (inspectorResource != null) { inspectorResource.inspector.Destroy(); inspectorResource = null; } if (inspectorScrollArea != null) { inspectorScrollArea.Destroy(); inspectorScrollArea = null; } if (scrollAreaHighlight != null) { scrollAreaHighlight.Destroy(); scrollAreaHighlight = null; } if (highlightPanel != null) { highlightPanel.Destroy(); highlightPanel = null; } activeSO = null; soNameInput = null; soActiveToggle = null; soMobility = null; soPrefabLayout = null; soHasPrefab = false; soPosX = null; soPosY = null; soPosZ = null; soRotX = null; soRotY = null; soRotZ = null; soScaleX = null; soScaleY = null; soScaleZ = null; dropAreas = new Rect2I[0]; activeResourcePath = null; currentType = InspectorType.None; }
/// <inheritdoc/> protected internal override void Initialize() { Material material = InspectedObject as Material; if (material == null) { return; } Shader activeShader = material.Shader; BuiltinShader builtinType = ShaderToBuiltin(activeShader); builtinShaderField = new GUIEnumField(typeof(BuiltinShader), new LocEdString("Shader")); builtinShaderField.Value = (ulong)builtinType; builtinShaderField.OnSelectionChanged += x => { BuiltinShader newBuiltinType = (BuiltinShader)x; material.Shader = Builtin.GetShader(newBuiltinType); EditorApplication.SetDirty(material); RebuildParamGUI(material); bool newIsCustom = newBuiltinType == BuiltinShader.Custom; shaderField.Active = newIsCustom; }; shaderField = new GUIResourceField(typeof(Shader), new LocEdString("Shader file")); shaderField.Value = material.Shader; shaderField.OnChanged += (x) => { Shader shader = Resources.Load <Shader>(x); material.Shader = shader; EditorApplication.SetDirty(material); RebuildParamGUI(material); }; bool isCustom = builtinType == BuiltinShader.Custom; shaderField.Active = isCustom; Layout.AddElement(builtinShaderField); Layout.AddElement(shaderField); RebuildParamGUI(material); }
/// <summary> /// Recreates all the GUI elements used by this inspector. /// </summary> private void BuildGUI() { Layout.Clear(); fontSizes = GUIArrayField <int, FontSizeArrayRow> .Create( new LocEdString("Font sizes"), importOptions.FontSizes, Layout); fontSizes.OnChanged += x => importOptions.FontSizes = x; fontSizes.IsExpanded = Persistent.GetBool("fontSizes_Expanded"); fontSizes.OnExpand += x => Persistent.SetBool("fontSizes_Expanded", x); charRanges = GUIArrayField <CharRange, CharRangeArrayRow> .Create( new LocEdString("Character ranges"), importOptions.CharRanges, Layout); charRanges.OnChanged += x => importOptions.CharRanges = x; charRanges.IsExpanded = Persistent.GetBool("charRanges_Expanded"); charRanges.OnExpand += x => Persistent.SetBool("charRanges_Expanded", x); renderModeField = new GUIEnumField(typeof(FontRenderMode), new LocEdString("Render mode")); renderModeField.OnSelectionChanged += x => importOptions.RenderMode = (FontRenderMode)x; boldField = new GUIToggleField(new LocEdString("Bold")); boldField.OnChanged += x => importOptions.Bold = x; italicField = new GUIToggleField(new LocEdString("Italic")); italicField.OnChanged += x => importOptions.Italic = x; dpiField = new GUIIntField(new LocEdString("DPI")); dpiField.OnChanged += x => importOptions.DPI = x; reimportButton = new GUIButton(new LocEdString("Reimport")); reimportButton.OnClick += TriggerReimport; Layout.AddElement(renderModeField); Layout.AddElement(boldField); Layout.AddElement(italicField); Layout.AddElement(dpiField); Layout.AddSpace(10); GUILayout reimportButtonLayout = Layout.AddLayoutX(); reimportButtonLayout.AddFlexibleSpace(); reimportButtonLayout.AddElement(reimportButton); }
/// <summary> /// Creates GUI elements required for displaying <see cref="SceneObject"/> fields like name, prefab data and /// transform (position, rotation, scale). Assumes that necessary inspector scroll area layout has already been /// created. /// </summary> private void CreateSceneObjectFields() { GUIPanel sceneObjectPanel = inspectorLayout.AddPanel(); sceneObjectPanel.SetHeight(GetTitleBounds().height); GUILayoutY sceneObjectLayout = sceneObjectPanel.AddLayoutY(); sceneObjectLayout.SetPosition(PADDING, PADDING); GUIPanel sceneObjectBgPanel = sceneObjectPanel.AddPanel(1); GUILayoutX nameLayout = sceneObjectLayout.AddLayoutX(); soActiveToggle = new GUIToggle(""); soActiveToggle.OnToggled += OnSceneObjectActiveStateToggled; GUILabel nameLbl = new GUILabel(new LocEdString("Name"), GUIOption.FixedWidth(50)); soNameInput = new GUITextBox(false, GUIOption.FlexibleWidth(180)); soNameInput.Text = activeSO.Name; soNameInput.OnChanged += OnSceneObjectRename; soNameInput.OnConfirmed += OnModifyConfirm; soNameInput.OnFocusLost += OnModifyConfirm; nameLayout.AddElement(soActiveToggle); nameLayout.AddSpace(3); nameLayout.AddElement(nameLbl); nameLayout.AddElement(soNameInput); nameLayout.AddFlexibleSpace(); GUILayoutX mobilityLayout = sceneObjectLayout.AddLayoutX(); GUILabel mobilityLbl = new GUILabel(new LocEdString("Mobility"), GUIOption.FixedWidth(50)); soMobility = new GUIEnumField(typeof(ObjectMobility), "", 0, GUIOption.FixedWidth(85)); soMobility.Value = (ulong)activeSO.Mobility; soMobility.OnSelectionChanged += value => activeSO.Mobility = (ObjectMobility)value; mobilityLayout.AddElement(mobilityLbl); mobilityLayout.AddElement(soMobility); soPrefabLayout = sceneObjectLayout.AddLayoutX(); GUILayoutX positionLayout = sceneObjectLayout.AddLayoutX(); GUILabel positionLbl = new GUILabel(new LocEdString("Position"), GUIOption.FixedWidth(50)); soPosX = new GUIFloatField(new LocEdString("X"), 10, "", GUIOption.FixedWidth(60)); soPosY = new GUIFloatField(new LocEdString("Y"), 10, "", GUIOption.FixedWidth(60)); soPosZ = new GUIFloatField(new LocEdString("Z"), 10, "", GUIOption.FixedWidth(60)); soPosX.OnChanged += (x) => OnPositionChanged(0, x); soPosY.OnChanged += (y) => OnPositionChanged(1, y); soPosZ.OnChanged += (z) => OnPositionChanged(2, z); soPosX.OnConfirmed += OnModifyConfirm; soPosY.OnConfirmed += OnModifyConfirm; soPosZ.OnConfirmed += OnModifyConfirm; soPosX.OnFocusLost += OnModifyConfirm; soPosY.OnFocusLost += OnModifyConfirm; soPosZ.OnFocusLost += OnModifyConfirm; positionLayout.AddElement(positionLbl); positionLayout.AddElement(soPosX); positionLayout.AddSpace(10); positionLayout.AddFlexibleSpace(); positionLayout.AddElement(soPosY); positionLayout.AddSpace(10); positionLayout.AddFlexibleSpace(); positionLayout.AddElement(soPosZ); positionLayout.AddFlexibleSpace(); GUILayoutX rotationLayout = sceneObjectLayout.AddLayoutX(); GUILabel rotationLbl = new GUILabel(new LocEdString("Rotation"), GUIOption.FixedWidth(50)); soRotX = new GUIFloatField(new LocEdString("X"), 10, "", GUIOption.FixedWidth(60)); soRotY = new GUIFloatField(new LocEdString("Y"), 10, "", GUIOption.FixedWidth(60)); soRotZ = new GUIFloatField(new LocEdString("Z"), 10, "", GUIOption.FixedWidth(60)); soRotX.OnChanged += (x) => OnRotationChanged(0, x); soRotY.OnChanged += (y) => OnRotationChanged(1, y); soRotZ.OnChanged += (z) => OnRotationChanged(2, z); soRotX.OnConfirmed += OnModifyConfirm; soRotY.OnConfirmed += OnModifyConfirm; soRotZ.OnConfirmed += OnModifyConfirm; soRotX.OnFocusLost += OnModifyConfirm; soRotY.OnFocusLost += OnModifyConfirm; soRotZ.OnFocusLost += OnModifyConfirm; rotationLayout.AddElement(rotationLbl); rotationLayout.AddElement(soRotX); rotationLayout.AddSpace(10); rotationLayout.AddFlexibleSpace(); rotationLayout.AddElement(soRotY); rotationLayout.AddSpace(10); rotationLayout.AddFlexibleSpace(); rotationLayout.AddElement(soRotZ); rotationLayout.AddFlexibleSpace(); GUILayoutX scaleLayout = sceneObjectLayout.AddLayoutX(); GUILabel scaleLbl = new GUILabel(new LocEdString("Scale"), GUIOption.FixedWidth(50)); soScaleX = new GUIFloatField(new LocEdString("X"), 10, "", GUIOption.FixedWidth(60)); soScaleY = new GUIFloatField(new LocEdString("Y"), 10, "", GUIOption.FixedWidth(60)); soScaleZ = new GUIFloatField(new LocEdString("Z"), 10, "", GUIOption.FixedWidth(60)); soScaleX.OnChanged += (x) => OnScaleChanged(0, x); soScaleY.OnChanged += (y) => OnScaleChanged(1, y); soScaleZ.OnChanged += (z) => OnScaleChanged(2, z); soScaleX.OnConfirmed += OnModifyConfirm; soScaleY.OnConfirmed += OnModifyConfirm; soScaleZ.OnConfirmed += OnModifyConfirm; soScaleX.OnFocusLost += OnModifyConfirm; soScaleY.OnFocusLost += OnModifyConfirm; soScaleZ.OnFocusLost += OnModifyConfirm; scaleLayout.AddElement(scaleLbl); scaleLayout.AddElement(soScaleX); scaleLayout.AddSpace(10); scaleLayout.AddFlexibleSpace(); scaleLayout.AddElement(soScaleY); scaleLayout.AddSpace(10); scaleLayout.AddFlexibleSpace(); scaleLayout.AddElement(soScaleZ); scaleLayout.AddFlexibleSpace(); sceneObjectLayout.AddFlexibleSpace(); GUITexture titleBg = new GUITexture(null, EditorStylesInternal.InspectorTitleBg); sceneObjectBgPanel.AddElement(titleBg); }
private static extern void Internal_CreateInstance(GUIEnumField instance, string[] names, Array values, bool multiselect, GUIContent title, int titleWidth, string style, GUIOption[] options, bool withTitle);
/// <summary> /// Recreates all the GUI elements used by this inspector. /// </summary> private void BuildGUI() { Layout.Clear(); fontSizes = GUIArrayField<int, FontSizeArrayRow>.Create( new LocEdString("Font sizes"), importOptions.FontSizes, Layout); fontSizes.OnChanged += x => importOptions.FontSizes = x; fontSizes.IsExpanded = Persistent.GetBool("fontSizes_Expanded"); fontSizes.OnExpand += x => Persistent.SetBool("fontSizes_Expanded", x); charRanges = GUIArrayField<CharRange, CharRangeArrayRow>.Create( new LocEdString("Character ranges"), importOptions.CharRanges, Layout); charRanges.OnChanged += x => importOptions.CharRanges = x; charRanges.IsExpanded = Persistent.GetBool("charRanges_Expanded"); charRanges.OnExpand += x => Persistent.SetBool("charRanges_Expanded", x); renderModeField = new GUIEnumField(typeof(FontRenderMode), new LocEdString("Render mode")); renderModeField.OnSelectionChanged += x => importOptions.RenderMode = (FontRenderMode)x; boldField = new GUIToggleField(new LocEdString("Bold")); boldField.OnChanged += x => importOptions.Bold = x; italicField = new GUIToggleField(new LocEdString("Italic")); italicField.OnChanged += x => importOptions.Italic = x; dpiField = new GUIIntField(new LocEdString("DPI")); dpiField.OnChanged += x => importOptions.DPI = x; reimportButton = new GUIButton(new LocEdString("Reimport")); reimportButton.OnClick += TriggerReimport; Layout.AddElement(renderModeField); Layout.AddElement(boldField); Layout.AddElement(italicField); Layout.AddElement(dpiField); Layout.AddSpace(10); GUILayout reimportButtonLayout = Layout.AddLayoutX(); reimportButtonLayout.AddFlexibleSpace(); reimportButtonLayout.AddElement(reimportButton); }
/// <summary> /// Recreates all the GUI elements used by this inspector. /// </summary> private void BuildGUI() { Layout.Clear(); strings.Clear(); StringTable stringTable = InspectedObject as StringTable; if (stringTable == null) { return; } string[] identifiers = stringTable.Identifiers; foreach (var identifier in identifiers) { strings[identifier] = stringTable.GetString(identifier); } languageField = new GUIEnumField(typeof(Language)); languageField.OnSelectionChanged += x => { StringTables.ActiveLanguage = (Language)x; BuildGUI(); Refresh(); }; Layout.AddElement(languageField); valuesField = GUIDictionaryField <string, string, StringTableEntry> .Create( new LocEdString("Strings"), strings, Layout); valuesField.IsExpanded = Persistent.GetBool("valuesField_Expanded"); valuesField.OnExpand += x => Persistent.SetBool("valuesField_Expanded", x); valuesField.OnChanged += x => { if (x != null) { foreach (var KVP in x) { if (stringTable.Contains(KVP.Key)) { string oldValue = stringTable.GetString(KVP.Key); if (oldValue != KVP.Value) { stringTable.SetString(KVP.Key, KVP.Value); } } else { stringTable.SetString(KVP.Key, KVP.Value); } } string[] oldIdentifiers = stringTable.Identifiers; foreach (var identifier in oldIdentifiers) { if (!x.ContainsKey(identifier)) { stringTable.RemoveString(identifier); } } strings = x; } else { foreach (var KVP in strings) { stringTable.RemoveString(KVP.Key); } strings.Clear(); } EditorApplication.SetDirty(stringTable); }; valuesField.OnValueChanged += x => { stringTable.SetString(x, strings[x]); EditorApplication.SetDirty(stringTable); }; valuesField.OnValueRemoved += x => { stringTable.RemoveString(x); EditorApplication.SetDirty(stringTable); }; Layout.AddSpace(10); }
/// <summary> /// Creates GUI elements for fields specific to the spherical joint. /// </summary> protected void BuildGUI(D6Joint joint) { for (int i = 0; i < (int) D6JointAxis.Count; i++) { D6JointAxis axis = (D6JointAxis) i; string entryName = Enum.GetName(typeof (D6JointAxis), axis); motionFields[i] = new GUIEnumField(typeof (D6JointMotion), new LocEdString(entryName)); motionFields[i].OnSelectionChanged += x => { joint.SetMotion(axis, (D6JointMotion)x); MarkAsModified(); ConfirmModify(); }; } linearLimitFoldout.OnToggled += x => { linearLimitLayout.Active = x; Persistent.SetBool("linearLimit_Expanded", x); }; twistLimitFoldout.OnToggled += x => { twistLimitLayout.Active = x; Persistent.SetBool("twistLimit_Expanded", x); }; swingLimitFoldout.OnToggled += x => { swingLimitLayout.Active = x; Persistent.SetBool("swingLimit_Expanded", x); }; driveFoldout.OnToggled += x => { driveLayout.Active = x; Persistent.SetBool("drive_Expanded", x); }; drivePositionField.OnChanged += x => { joint.DrivePosition = x; MarkAsModified(); }; drivePositionField.OnFocusLost += ConfirmModify; drivePositionField.OnConfirmed += ConfirmModify; driveRotationField.OnChanged += x => { joint.DriveRotation = Quaternion.FromEuler(x); MarkAsModified(); }; driveRotationField.OnFocusLost += ConfirmModify; driveRotationField.OnConfirmed += ConfirmModify; driveLinVelocityField.OnChanged += x => { joint.DriveLinearVelocity = x; MarkAsModified(); }; driveLinVelocityField.OnFocusLost += ConfirmModify; driveLinVelocityField.OnConfirmed += ConfirmModify; driveAngVelocityField.OnChanged += x => { joint.DriveAngularVelocity = x; MarkAsModified(); }; driveAngVelocityField.OnFocusLost += ConfirmModify; driveAngVelocityField.OnConfirmed += ConfirmModify; for (int i = 0; i < (int) D6JointAxis.Count; i++) Layout.AddElement(motionFields[i]); Layout.AddElement(linearLimitFoldout); linearLimitLayout = Layout.AddLayoutX(); { linearLimitLayout.AddSpace(10); GUILayoutY linearLimitContentsLayout = linearLimitLayout.AddLayoutY(); limitLinearGUI = new LimitLinearGUI(joint.LimitLinear, linearLimitContentsLayout, Persistent); limitLinearGUI.OnChanged += (x, y) => { joint.LimitLinear = new LimitLinear(x, y); MarkAsModified(); }; limitLinearGUI.OnConfirmed += ConfirmModify; } Layout.AddElement(twistLimitFoldout); twistLimitLayout = Layout.AddLayoutX(); { twistLimitLayout.AddSpace(10); GUILayoutY twistLimitContentsLayout = twistLimitLayout.AddLayoutY(); limitTwistGUI = new LimitAngularRangeGUI(joint.LimitTwist, twistLimitContentsLayout, Persistent); limitTwistGUI.OnChanged += (x, y) => { joint.LimitTwist = new LimitAngularRange(x, y); MarkAsModified(); }; limitTwistGUI.OnConfirmed += ConfirmModify; } Layout.AddElement(swingLimitFoldout); swingLimitLayout = Layout.AddLayoutX(); { swingLimitLayout.AddSpace(10); GUILayoutY swingLimitContentsLayout = swingLimitLayout.AddLayoutY(); limitSwingGUI = new LimitConeRangeGUI(joint.LimitSwing, swingLimitContentsLayout, Persistent); limitSwingGUI.OnChanged += (x, y) => { joint.LimitSwing = new LimitConeRange(x, y); MarkAsModified(); }; limitSwingGUI.OnConfirmed += ConfirmModify; } Layout.AddElement(driveFoldout); driveLayout = Layout.AddLayoutX(); { driveLayout.AddSpace(10); GUILayoutY driveContentsLayout = driveLayout.AddLayoutY(); for (int i = 0; i < (int) D6JointDriveType.Count; i++) { D6JointDriveType type = (D6JointDriveType)i; drivesGUI[i] = new D6JointDriveGUI(joint.GetDrive(type), driveContentsLayout); drivesGUI[i].OnChanged += x => { joint.SetDrive(type, new D6JointDrive(x)); MarkAsModified(); }; drivesGUI[i].OnConfirmed += ConfirmModify; } driveContentsLayout.AddElement(drivePositionField); driveContentsLayout.AddElement(driveRotationField); driveContentsLayout.AddElement(driveLinVelocityField); driveContentsLayout.AddElement(driveAngVelocityField); } linearLimitLayout.Active = Persistent.GetBool("linearLimit_Expanded"); twistLimitLayout.Active = Persistent.GetBool("twistLimit_Expanded"); swingLimitLayout.Active = Persistent.GetBool("swingLimit_Expanded"); driveLayout.Active = Persistent.GetBool("drive_Expanded"); base.BuildGUI(joint, true); }
/// <summary> /// Builds GUI for the specified GUI element style. /// </summary> /// <param name="layout">Layout to append the GUI elements to.</param> /// <param name="depth">Determines the depth at which the element is rendered.</param> public void BuildGUI(GUILayout layout, int depth) { short backgroundDepth = (short)(Inspector.START_BACKGROUND_DEPTH - depth - 1); string bgPanelStyle = depth % 2 == 0 ? EditorStyles.InspectorContentBgAlternate : EditorStyles.InspectorContentBg; GUIToggle foldout = new GUIToggle(new LocEdString("Style"), EditorStyles.Foldout); GUITexture inspectorContentBg = new GUITexture(null, bgPanelStyle); layout.AddElement(foldout); GUIPanel panel = layout.AddPanel(); GUIPanel backgroundPanel = panel.AddPanel(backgroundDepth); backgroundPanel.AddElement(inspectorContentBg); GUILayoutX guiIndentLayoutX = panel.AddLayoutX(); guiIndentLayoutX.AddSpace(IndentAmount); GUILayoutY guiIndentLayoutY = guiIndentLayoutX.AddLayoutY(); guiIndentLayoutY.AddSpace(IndentAmount); GUILayoutY contentLayout = guiIndentLayoutY.AddLayoutY(); guiIndentLayoutY.AddSpace(IndentAmount); guiIndentLayoutX.AddSpace(IndentAmount); fontField = new GUIResourceField(typeof (Font), new LocEdString("Font")); fontSizeField = new GUIIntField(new LocEdString("Font size")); horzAlignField = new GUIEnumField(typeof (TextHorzAlign), new LocEdString("Horizontal alignment")); vertAlignField = new GUIEnumField(typeof(TextVertAlign), new LocEdString("Vertical alignment")); imagePositionField = new GUIEnumField(typeof(GUIImagePosition), new LocEdString("Image position")); wordWrapField = new GUIToggleField(new LocEdString("Word wrap")); contentLayout.AddElement(fontField); contentLayout.AddElement(fontSizeField); contentLayout.AddElement(horzAlignField); contentLayout.AddElement(vertAlignField); contentLayout.AddElement(imagePositionField); contentLayout.AddElement(wordWrapField); normalGUI.BuildGUI(new LocEdString("Normal"), contentLayout); hoverGUI.BuildGUI(new LocEdString("Hover"), contentLayout); activeGUI.BuildGUI(new LocEdString("Active"), contentLayout); focusedGUI.BuildGUI(new LocEdString("Focused"), contentLayout); normalOnGUI.BuildGUI(new LocEdString("NormalOn"), contentLayout); hoverOnGUI.BuildGUI(new LocEdString("HoverOn"), contentLayout); activeOnGUI.BuildGUI(new LocEdString("ActiveOn"), contentLayout); focusedOnGUI.BuildGUI(new LocEdString("FocusedOn"), contentLayout); borderGUI = new RectOffsetGUI(new LocEdString("Border"), contentLayout); marginsGUI = new RectOffsetGUI(new LocEdString("Margins"), contentLayout); contentOffsetGUI = new RectOffsetGUI(new LocEdString("Content offset"), contentLayout); fixedWidthField = new GUIToggleField(new LocEdString("Fixed width")); widthField = new GUIIntField(new LocEdString("Width")); minWidthField = new GUIIntField(new LocEdString("Min. width")); maxWidthField = new GUIIntField(new LocEdString("Max. width")); fixedHeightField = new GUIToggleField(new LocEdString("Fixed height")); heightField = new GUIIntField(new LocEdString("Height")); minHeightField = new GUIIntField(new LocEdString("Min. height")); maxHeightField = new GUIIntField(new LocEdString("Max. height")); contentLayout.AddElement(fixedWidthField); contentLayout.AddElement(widthField); contentLayout.AddElement(minWidthField); contentLayout.AddElement(maxWidthField); contentLayout.AddElement(fixedHeightField); contentLayout.AddElement(heightField); contentLayout.AddElement(minHeightField); contentLayout.AddElement(maxHeightField); foldout.OnToggled += x => { panel.Active = x; isExpanded = x; }; fontField.OnChanged += x => { Font font = Resources.Load<Font>(x); GetStyle().Font = font; MarkAsModified(); ConfirmModify(); }; fontSizeField.OnChanged += x => { GetStyle().FontSize = x; MarkAsModified(); }; fontSizeField.OnFocusLost += ConfirmModify; fontSizeField.OnConfirmed += ConfirmModify; horzAlignField.OnSelectionChanged += x => { GetStyle().TextHorzAlign = (TextHorzAlign)x; MarkAsModified(); ConfirmModify(); }; vertAlignField.OnSelectionChanged += x => { GetStyle().TextVertAlign = (TextVertAlign)x; MarkAsModified(); ConfirmModify(); }; imagePositionField.OnSelectionChanged += x => { GetStyle().ImagePosition = (GUIImagePosition)x; MarkAsModified(); ConfirmModify(); }; wordWrapField.OnChanged += x => { GetStyle().WordWrap = x; MarkAsModified(); ConfirmModify(); }; normalGUI.OnChanged += x => { GetStyle().Normal = x; MarkAsModified(); ConfirmModify(); }; hoverGUI.OnChanged += x => { GetStyle().Hover = x; MarkAsModified(); ConfirmModify(); }; activeGUI.OnChanged += x => { GetStyle().Active = x; MarkAsModified(); ConfirmModify(); }; focusedGUI.OnChanged += x => { GetStyle().Focused = x; MarkAsModified(); ConfirmModify(); }; normalOnGUI.OnChanged += x => { GetStyle().NormalOn = x; MarkAsModified(); ConfirmModify(); }; hoverOnGUI.OnChanged += x => { GetStyle().HoverOn = x; MarkAsModified(); ConfirmModify(); }; activeOnGUI.OnChanged += x => { GetStyle().ActiveOn = x; MarkAsModified(); ConfirmModify(); }; focusedOnGUI.OnChanged += x => { GetStyle().FocusedOn = x; MarkAsModified(); ConfirmModify(); }; borderGUI.OnChanged += x => { GetStyle().Border = x; MarkAsModified(); }; marginsGUI.OnChanged += x => { GetStyle().Margins = x; MarkAsModified(); }; contentOffsetGUI.OnChanged += x => { GetStyle().ContentOffset = x; MarkAsModified(); }; borderGUI.OnConfirmed += ConfirmModify; marginsGUI.OnConfirmed += ConfirmModify; contentOffsetGUI.OnConfirmed += ConfirmModify; fixedWidthField.OnChanged += x => { GetStyle().FixedWidth = x; MarkAsModified(); ConfirmModify(); }; widthField.OnChanged += x => GetStyle().Width = x; widthField.OnFocusLost += ConfirmModify; widthField.OnConfirmed += ConfirmModify; minWidthField.OnChanged += x => GetStyle().MinWidth = x; minWidthField.OnFocusLost += ConfirmModify; minWidthField.OnConfirmed += ConfirmModify; maxWidthField.OnChanged += x => GetStyle().MaxWidth = x; maxWidthField.OnFocusLost += ConfirmModify; maxWidthField.OnConfirmed += ConfirmModify; fixedHeightField.OnChanged += x => { GetStyle().FixedHeight = x; MarkAsModified(); ConfirmModify(); }; heightField.OnChanged += x => GetStyle().Height = x; heightField.OnFocusLost += ConfirmModify; heightField.OnConfirmed += ConfirmModify; minHeightField.OnChanged += x => GetStyle().MinHeight = x; minHeightField.OnFocusLost += ConfirmModify; minHeightField.OnConfirmed += ConfirmModify; maxHeightField.OnChanged += x => GetStyle().MaxHeight = x; maxHeightField.OnFocusLost += ConfirmModify; maxHeightField.OnConfirmed += ConfirmModify; foldout.Value = isExpanded; panel.Active = isExpanded; }
/// <summary> /// Builds GUI for the specified GUI element style. /// </summary> /// <param name="layout">Layout to append the GUI elements to.</param> /// <param name="depth">Determines the depth at which the element is rendered.</param> public void BuildGUI(GUILayout layout, int depth) { short backgroundDepth = (short)(Inspector.START_BACKGROUND_DEPTH - depth - 1); string bgPanelStyle = depth % 2 == 0 ? EditorStylesInternal.InspectorContentBgAlternate : EditorStylesInternal.InspectorContentBg; GUIToggle foldout = new GUIToggle(new LocEdString("Style"), EditorStyles.Foldout); foldout.AcceptsKeyFocus = false; GUITexture inspectorContentBg = new GUITexture(null, bgPanelStyle); layout.AddElement(foldout); GUIPanel panel = layout.AddPanel(); GUIPanel backgroundPanel = panel.AddPanel(backgroundDepth); backgroundPanel.AddElement(inspectorContentBg); GUILayoutX guiIndentLayoutX = panel.AddLayoutX(); guiIndentLayoutX.AddSpace(IndentAmount); GUILayoutY guiIndentLayoutY = guiIndentLayoutX.AddLayoutY(); guiIndentLayoutY.AddSpace(IndentAmount); GUILayoutY contentLayout = guiIndentLayoutY.AddLayoutY(); guiIndentLayoutY.AddSpace(IndentAmount); guiIndentLayoutX.AddSpace(IndentAmount); fontField = new GUIResourceField(typeof(Font), new LocEdString("Font")); fontSizeField = new GUIIntField(new LocEdString("Font size")); horzAlignField = new GUIEnumField(typeof(TextHorzAlign), new LocEdString("Horizontal alignment")); vertAlignField = new GUIEnumField(typeof(TextVertAlign), new LocEdString("Vertical alignment")); imagePositionField = new GUIEnumField(typeof(GUIImagePosition), new LocEdString("Image position")); wordWrapField = new GUIToggleField(new LocEdString("Word wrap")); contentLayout.AddElement(fontField); contentLayout.AddElement(fontSizeField); contentLayout.AddElement(horzAlignField); contentLayout.AddElement(vertAlignField); contentLayout.AddElement(imagePositionField); contentLayout.AddElement(wordWrapField); normalGUI.BuildGUI(new LocEdString("Normal"), contentLayout); hoverGUI.BuildGUI(new LocEdString("Hover"), contentLayout); activeGUI.BuildGUI(new LocEdString("Active"), contentLayout); focusedGUI.BuildGUI(new LocEdString("Focused"), contentLayout); normalOnGUI.BuildGUI(new LocEdString("NormalOn"), contentLayout); hoverOnGUI.BuildGUI(new LocEdString("HoverOn"), contentLayout); activeOnGUI.BuildGUI(new LocEdString("ActiveOn"), contentLayout); focusedOnGUI.BuildGUI(new LocEdString("FocusedOn"), contentLayout); borderGUI = new RectOffsetGUI(new LocEdString("Border"), contentLayout); marginsGUI = new RectOffsetGUI(new LocEdString("Margins"), contentLayout); contentOffsetGUI = new RectOffsetGUI(new LocEdString("Content offset"), contentLayout); fixedWidthField = new GUIToggleField(new LocEdString("Fixed width")); widthField = new GUIIntField(new LocEdString("Width")); minWidthField = new GUIIntField(new LocEdString("Min. width")); maxWidthField = new GUIIntField(new LocEdString("Max. width")); fixedHeightField = new GUIToggleField(new LocEdString("Fixed height")); heightField = new GUIIntField(new LocEdString("Height")); minHeightField = new GUIIntField(new LocEdString("Min. height")); maxHeightField = new GUIIntField(new LocEdString("Max. height")); contentLayout.AddElement(fixedWidthField); contentLayout.AddElement(widthField); contentLayout.AddElement(minWidthField); contentLayout.AddElement(maxWidthField); contentLayout.AddElement(fixedHeightField); contentLayout.AddElement(heightField); contentLayout.AddElement(minHeightField); contentLayout.AddElement(maxHeightField); foldout.OnToggled += x => { panel.Active = x; isExpanded = x; }; fontField.OnChanged += x => { Font font = Resources.Load <Font>(x.UUID); GetStyle().Font = font; MarkAsModified(); ConfirmModify(); }; fontSizeField.OnChanged += x => { GetStyle().FontSize = x; MarkAsModified(); }; fontSizeField.OnFocusLost += ConfirmModify; fontSizeField.OnConfirmed += ConfirmModify; horzAlignField.OnSelectionChanged += x => { GetStyle().TextHorzAlign = (TextHorzAlign)x; MarkAsModified(); ConfirmModify(); }; vertAlignField.OnSelectionChanged += x => { GetStyle().TextVertAlign = (TextVertAlign)x; MarkAsModified(); ConfirmModify(); }; imagePositionField.OnSelectionChanged += x => { GetStyle().ImagePosition = (GUIImagePosition)x; MarkAsModified(); ConfirmModify(); }; wordWrapField.OnChanged += x => { GetStyle().WordWrap = x; MarkAsModified(); ConfirmModify(); }; normalGUI.OnChanged += x => { GetStyle().Normal = x; MarkAsModified(); ConfirmModify(); }; hoverGUI.OnChanged += x => { GetStyle().Hover = x; MarkAsModified(); ConfirmModify(); }; activeGUI.OnChanged += x => { GetStyle().Active = x; MarkAsModified(); ConfirmModify(); }; focusedGUI.OnChanged += x => { GetStyle().Focused = x; MarkAsModified(); ConfirmModify(); }; normalOnGUI.OnChanged += x => { GetStyle().NormalOn = x; MarkAsModified(); ConfirmModify(); }; hoverOnGUI.OnChanged += x => { GetStyle().HoverOn = x; MarkAsModified(); ConfirmModify(); }; activeOnGUI.OnChanged += x => { GetStyle().ActiveOn = x; MarkAsModified(); ConfirmModify(); }; focusedOnGUI.OnChanged += x => { GetStyle().FocusedOn = x; MarkAsModified(); ConfirmModify(); }; borderGUI.OnChanged += x => { GetStyle().Border = x; MarkAsModified(); }; marginsGUI.OnChanged += x => { GetStyle().Margins = x; MarkAsModified(); }; contentOffsetGUI.OnChanged += x => { GetStyle().ContentOffset = x; MarkAsModified(); }; borderGUI.OnConfirmed += ConfirmModify; marginsGUI.OnConfirmed += ConfirmModify; contentOffsetGUI.OnConfirmed += ConfirmModify; fixedWidthField.OnChanged += x => { GetStyle().FixedWidth = x; MarkAsModified(); ConfirmModify(); }; widthField.OnChanged += x => GetStyle().Width = x; widthField.OnFocusLost += ConfirmModify; widthField.OnConfirmed += ConfirmModify; minWidthField.OnChanged += x => GetStyle().MinWidth = x; minWidthField.OnFocusLost += ConfirmModify; minWidthField.OnConfirmed += ConfirmModify; maxWidthField.OnChanged += x => GetStyle().MaxWidth = x; maxWidthField.OnFocusLost += ConfirmModify; maxWidthField.OnConfirmed += ConfirmModify; fixedHeightField.OnChanged += x => { GetStyle().FixedHeight = x; MarkAsModified(); ConfirmModify(); }; heightField.OnChanged += x => GetStyle().Height = x; heightField.OnFocusLost += ConfirmModify; heightField.OnConfirmed += ConfirmModify; minHeightField.OnChanged += x => GetStyle().MinHeight = x; minHeightField.OnFocusLost += ConfirmModify; minHeightField.OnConfirmed += ConfirmModify; maxHeightField.OnChanged += x => GetStyle().MaxHeight = x; maxHeightField.OnFocusLost += ConfirmModify; maxHeightField.OnConfirmed += ConfirmModify; foldout.Value = isExpanded; panel.Active = isExpanded; }
/// <summary> /// Recreates all the GUI elements used by this inspector. /// </summary> private void BuildGUI() { Layout.Clear(); strings.Clear(); StringTable stringTable = InspectedObject as StringTable; if(stringTable == null) return; string[] identifiers = stringTable.Identifiers; foreach (var identifier in identifiers) strings[identifier] = stringTable.GetString(identifier); languageField = new GUIEnumField(typeof (Language)); languageField.OnSelectionChanged += x => { StringTables.ActiveLanguage = (Language)x; BuildGUI(); Refresh(); }; Layout.AddElement(languageField); valuesField = GUIDictionaryField<string, string, StringTableEntry>.Create( new LocEdString("Strings"), strings, Layout); valuesField.IsExpanded = Persistent.GetBool("valuesField_Expanded"); valuesField.OnExpand += x => Persistent.SetBool("valuesField_Expanded", x); valuesField.OnChanged += x => { if (x != null) { foreach (var KVP in x) { if (stringTable.Contains(KVP.Key)) { string oldValue = stringTable.GetString(KVP.Key); if (oldValue != KVP.Value) stringTable.SetString(KVP.Key, KVP.Value); } else stringTable.SetString(KVP.Key, KVP.Value); } string[] oldIdentifiers = stringTable.Identifiers; foreach (var identifier in oldIdentifiers) { if (!x.ContainsKey(identifier)) stringTable.RemoveString(identifier); } strings = x; } else { foreach (var KVP in strings) stringTable.RemoveString(KVP.Key); strings.Clear(); } EditorApplication.SetDirty(stringTable); }; valuesField.OnValueChanged += x => { stringTable.SetString(x, strings[x]); EditorApplication.SetDirty(stringTable); }; valuesField.OnValueRemoved += x => { stringTable.RemoveString(x); EditorApplication.SetDirty(stringTable); }; Layout.AddSpace(10); }
/// <summary> /// Creates GUI elements for fields specific to the spherical joint. /// </summary> protected void BuildGUI(D6Joint joint) { for (int i = 0; i < (int)D6JointAxis.Count; i++) { D6JointAxis axis = (D6JointAxis)i; string entryName = Enum.GetName(typeof(D6JointAxis), axis); motionFields[i] = new GUIEnumField(typeof(D6JointMotion), new LocEdString(entryName)); motionFields[i].OnSelectionChanged += x => { joint.SetMotion(axis, (D6JointMotion)x); MarkAsModified(); ConfirmModify(); }; } linearLimitFoldout.OnToggled += x => { linearLimitLayout.Active = x; Persistent.SetBool("linearLimit_Expanded", x); }; twistLimitFoldout.OnToggled += x => { twistLimitLayout.Active = x; Persistent.SetBool("twistLimit_Expanded", x); }; swingLimitFoldout.OnToggled += x => { swingLimitLayout.Active = x; Persistent.SetBool("swingLimit_Expanded", x); }; driveFoldout.OnToggled += x => { driveLayout.Active = x; Persistent.SetBool("drive_Expanded", x); }; drivePositionField.OnChanged += x => { joint.DrivePosition = x; MarkAsModified(); }; drivePositionField.OnFocusLost += ConfirmModify; drivePositionField.OnConfirmed += ConfirmModify; driveRotationField.OnChanged += x => { joint.DriveRotation = Quaternion.FromEuler(x); MarkAsModified(); }; driveRotationField.OnFocusLost += ConfirmModify; driveRotationField.OnConfirmed += ConfirmModify; driveLinVelocityField.OnChanged += x => { joint.DriveLinearVelocity = x; MarkAsModified(); }; driveLinVelocityField.OnFocusLost += ConfirmModify; driveLinVelocityField.OnConfirmed += ConfirmModify; driveAngVelocityField.OnChanged += x => { joint.DriveAngularVelocity = x; MarkAsModified(); }; driveAngVelocityField.OnFocusLost += ConfirmModify; driveAngVelocityField.OnConfirmed += ConfirmModify; for (int i = 0; i < (int)D6JointAxis.Count; i++) { Layout.AddElement(motionFields[i]); } Layout.AddElement(linearLimitFoldout); linearLimitLayout = Layout.AddLayoutX(); { linearLimitLayout.AddSpace(10); GUILayoutY linearLimitContentsLayout = linearLimitLayout.AddLayoutY(); limitLinearGUI = new LimitLinearGUI(joint.LimitLinear, linearLimitContentsLayout, Persistent); limitLinearGUI.OnChanged += (x, y) => { joint.LimitLinear = new LimitLinear(x, y); MarkAsModified(); }; limitLinearGUI.OnConfirmed += ConfirmModify; } Layout.AddElement(twistLimitFoldout); twistLimitLayout = Layout.AddLayoutX(); { twistLimitLayout.AddSpace(10); GUILayoutY twistLimitContentsLayout = twistLimitLayout.AddLayoutY(); limitTwistGUI = new LimitAngularRangeGUI(joint.LimitTwist, twistLimitContentsLayout, Persistent); limitTwistGUI.OnChanged += (x, y) => { joint.LimitTwist = new LimitAngularRange(x, y); MarkAsModified(); }; limitTwistGUI.OnConfirmed += ConfirmModify; } Layout.AddElement(swingLimitFoldout); swingLimitLayout = Layout.AddLayoutX(); { swingLimitLayout.AddSpace(10); GUILayoutY swingLimitContentsLayout = swingLimitLayout.AddLayoutY(); limitSwingGUI = new LimitConeRangeGUI(joint.LimitSwing, swingLimitContentsLayout, Persistent); limitSwingGUI.OnChanged += (x, y) => { joint.LimitSwing = new LimitConeRange(x, y); MarkAsModified(); }; limitSwingGUI.OnConfirmed += ConfirmModify; } Layout.AddElement(driveFoldout); driveLayout = Layout.AddLayoutX(); { driveLayout.AddSpace(10); GUILayoutY driveContentsLayout = driveLayout.AddLayoutY(); for (int i = 0; i < (int)D6JointDriveType.Count; i++) { D6JointDriveType type = (D6JointDriveType)i; drivesGUI[i] = new D6JointDriveGUI(joint.GetDrive(type), driveContentsLayout); drivesGUI[i].OnChanged += x => { joint.SetDrive(type, new D6JointDrive(x)); MarkAsModified(); }; drivesGUI[i].OnConfirmed += ConfirmModify; } driveContentsLayout.AddElement(drivePositionField); driveContentsLayout.AddElement(driveRotationField); driveContentsLayout.AddElement(driveLinVelocityField); driveContentsLayout.AddElement(driveAngVelocityField); } linearLimitLayout.Active = Persistent.GetBool("linearLimit_Expanded"); twistLimitLayout.Active = Persistent.GetBool("twistLimit_Expanded"); swingLimitLayout.Active = Persistent.GetBool("swingLimit_Expanded"); driveLayout.Active = Persistent.GetBool("drive_Expanded"); base.BuildGUI(joint, true); }
/// <summary> /// Creates GUI elements required for displaying <see cref="SceneObject"/> fields like name, prefab data and /// transform (position, rotation, scale). Assumes that necessary inspector scroll area layout has already been /// created. /// </summary> private void CreateSceneObjectFields() { GUIPanel sceneObjectPanel = inspectorLayout.AddPanel(); sceneObjectPanel.SetHeight(GetTitleBounds().height); GUILayoutY sceneObjectLayout = sceneObjectPanel.AddLayoutY(); sceneObjectLayout.SetPosition(PADDING, PADDING); GUIPanel sceneObjectBgPanel = sceneObjectPanel.AddPanel(1); GUILayoutX nameLayout = sceneObjectLayout.AddLayoutX(); soActiveToggle = new GUIToggle(""); soActiveToggle.OnToggled += OnSceneObjectActiveStateToggled; GUILabel nameLbl = new GUILabel(new LocEdString("Name"), GUIOption.FixedWidth(50)); soNameInput = new GUITextBox(false, GUIOption.FlexibleWidth(180)); soNameInput.Text = activeSO.Name; soNameInput.OnChanged += OnSceneObjectRename; soNameInput.OnConfirmed += OnModifyConfirm; soNameInput.OnFocusLost += OnModifyConfirm; nameLayout.AddElement(soActiveToggle); nameLayout.AddSpace(3); nameLayout.AddElement(nameLbl); nameLayout.AddElement(soNameInput); nameLayout.AddFlexibleSpace(); GUILayoutX mobilityLayout = sceneObjectLayout.AddLayoutX(); GUILabel mobilityLbl = new GUILabel(new LocEdString("Mobility"), GUIOption.FixedWidth(50)); soMobility = new GUIEnumField(typeof(ObjectMobility), "", 0, GUIOption.FixedWidth(85)); soMobility.Value = (ulong)activeSO.Mobility; soMobility.OnSelectionChanged += value => activeSO.Mobility = (ObjectMobility)value; mobilityLayout.AddElement(mobilityLbl); mobilityLayout.AddElement(soMobility); soPrefabLayout = sceneObjectLayout.AddLayoutX(); soPos = new GUIVector3Field(new LocEdString("Position"), 50); sceneObjectLayout.AddElement(soPos); soPos.OnChanged += OnPositionChanged; soPos.OnConfirmed += OnModifyConfirm; soPos.OnFocusLost += OnModifyConfirm; soRot = new GUIVector3Field(new LocEdString("Rotation"), 50); sceneObjectLayout.AddElement(soRot); soRot.OnChanged += OnRotationChanged; soRot.OnConfirmed += OnModifyConfirm; soRot.OnFocusLost += OnModifyConfirm; soScale = new GUIVector3Field(new LocEdString("Scale"), 50); sceneObjectLayout.AddElement(soScale); soScale.OnChanged += OnScaleChanged; soScale.OnConfirmed += OnModifyConfirm; soScale.OnFocusLost += OnModifyConfirm; sceneObjectLayout.AddFlexibleSpace(); GUITexture titleBg = new GUITexture(null, EditorStylesInternal.InspectorTitleBg); sceneObjectBgPanel.AddElement(titleBg); }