public override void OnInspectorGUI() { if (EditorApplication.isPlaying) { EditorGUILayout.HelpBox("BuildR editor disabled in play mode", MessageType.Warning); return; } bool repaint = false; CheckDragDrop(); EditorGUILayout.BeginHorizontal(); int currentMode = (int)building.settings.editMode; GUIContent[] guiContent = new GUIContent[toolbarOptionCount]; for (int i = 0; i < toolbarOptionCount; i++) { guiContent[i] = new GUIContent(STAGE_TOOLBAR_TEXTURES[i], TOOLBAR_TEXT[i]); } int newStage = GUILayout.Toolbar(currentMode, guiContent, GUILayout.Width(MAIN_GUI_WIDTH), GUILayout.Height(50)); if (directionalLightIssueDetected) { Rect toolbarRect = GUILayoutUtility.GetLastRect(); Rect warningRect = new Rect(); float warningIconSize = 20; warningRect.x = toolbarRect.x + toolbarRect.width - warningIconSize - 4; warningRect.y = toolbarRect.y + 4; warningRect.width = warningIconSize; warningRect.height = warningIconSize; GUI.Label(warningRect, warning); } if (newStage != currentMode) { building.settings.editMode = (BuildREditmodes.Values)newStage; repaint = true; } GUILayout.EndHorizontal(); if (GUILayout.Button("Regenerate Building", GUILayout.Width(MAIN_GUI_WIDTH))) { Undo.RegisterCompleteObjectUndo(BUILDING, "Rebuild Building Meshes"); BUILDING.MarkModified(); UpdateGui(); } switch (building.settings.editMode) { case BuildREditmodes.Values.Volume: if (BuildingVolumeEditor.mode == BuildingVolumeEditor.EditModes.SwitchToInterior) { BuildingVolumeEditor.mode = BuildingVolumeEditor.EditModes.FloorplanSelection; BuildingFloorplanEditor.mode = BuildingFloorplanEditor.EditModes.BuildFloorplanInterior; building.settings.editMode = BuildREditmodes.Values.Floorplan; BuildingFloorplanEditor.ToggleEdit(false); } BuildRHeader("Volumes"); BuildingVolumeEditor.OnInspectorGUI(BUILDING); if (BuildingVolumeEditor.repaint) { repaint = true; } BuildingVolumeEditor.repaint = false; break; case BuildREditmodes.Values.Floorplan: BuildRHeader("Floorplans"); BuildingFloorplanEditor.OnInspectorGUI(BUILDING); if (BuildingFloorplanEditor.repaint) { repaint = true; } BuildingFloorplanEditor.repaint = false; break; case BuildREditmodes.Values.TextureLibrary: BuildRHeader("Surface Library"); BuildingSurfaceEditor.OnInspectoGUI(); break; case BuildREditmodes.Values.Facades: BuildingFacadeEditor.OnInspectorGUI(BUILDING); if (BuildingFacadeEditor.repaint) { repaint = true; } break; case BuildREditmodes.Values.Roofs: BuildRHeader("Roof Designs"); BuildingRoofEditor.OnInspectorGUI(BUILDING); if (BuildingRoofEditor.REPAINT) { repaint = true; } break; case BuildREditmodes.Values.Export: BuildRHeader("Export"); BuildingExportEditor.OnInspectorGUI(BUILDING); break; // case EditModes.Detailing: // BuildRHeader("Details"); // EditorGUILayout.LabelField("To Be Implemented"); // break; case BuildREditmodes.Values.Options: BuildRHeader("Options"); BuildingOptionsEditor.OnInspectorGUI(BUILDING); break; } if (repaint) { UpdateGui(); } }
private void OnSceneGUI() { bool repaint = false; CheckDragDrop(); if (Event.current.type == EventType.ValidateCommand) { switch (Event.current.commandName) { case "UndoRedoPerformed": if (BUILDING == null) { BUILDING = (Building)target; } UpdateGui(); return; } } if (BUILDING == null) { BUILDING = (Building)target; } switch (building.settings.editMode) { case BuildREditmodes.Values.Volume: BuildingVolumeEditor.OnSceneGUI(BUILDING); if (BuildingVolumeEditor.repaint) { repaint = true; } BuildingVolumeEditor.repaint = false; break; case BuildREditmodes.Values.Floorplan: BuildingFloorplanEditor.OnSceneGUI(BUILDING); if (BuildingFloorplanEditor.repaint) { repaint = true; } BuildingFloorplanEditor.repaint = false; break; case BuildREditmodes.Values.Facades: BuildingFacadeEditor.OnSceneGUI(BUILDING); if (BuildingFacadeEditor.repaint) { repaint = true; } BuildingFacadeEditor.repaint = false; break; case BuildREditmodes.Values.Roofs: BuildingRoofEditor.OnSceneGUI(BUILDING); if (BuildingFacadeEditor.repaint) { repaint = true; } BuildingFacadeEditor.repaint = false; break; } if (repaint || building.regenerate) { UpdateGui(); } }