/// <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(); Renderable renderable = InspectedObject as Renderable; if (renderable == null) return; meshField = new GUIResourceField(typeof(Mesh), new LocEdString("Mesh")); layersField = new GUIListBoxField(Layers.Names, false, new LocEdString("Layer")); Layout.AddElement(meshField); Layout.AddElement(layersField); layersValue = 0; materials = renderable.Materials; materialsField = GUIArrayField<Material, MaterialArrayRow>.Create(new LocEdString("Materials"), materials, Layout); materialsField.OnChanged += x => { materials = x; }; materialsField.IsExpanded = Persistent.GetBool("materialsField_Expanded"); materialsField.OnExpand += x => Persistent.SetBool("materialsField_Expanded", x); meshField.OnChanged += x => { Mesh mesh = Resources.Load<Mesh>(x); renderable.Mesh = mesh; MarkAsModified(); ConfirmModify(); }; layersField.OnSelectionChanged += x => { ulong layers = 0; bool[] states = layersField.States; for (int i = 0; i < states.Length; i++) layers |= states[i] ? Layers.Values[i] : 0; layersValue = layers; renderable.Layers = layers; MarkAsModified(); ConfirmModify(); }; materialsLayout = Layout.AddLayoutY(); BuildMaterialsGUI(); }