示例#1
0
        public static void OnInspectorGUI_S(RoomStyle roomStyle)
        {
            BuildingEditor.BuildRHeader("Room Style");


            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Name", GUILayout.Width(120));
            string newName = EditorGUILayout.DelayedTextField(roomStyle.name);

            if (newName != roomStyle.name)
            {
                nameError = BuildingEditorUtils.RenameAsset(roomStyle, newName);
            }
            EditorGUILayout.EndHorizontal();

            if (nameError.Length > 0)
            {
                EditorGUILayout.HelpBox(nameError, MessageType.Error);
            }

            EditorGUILayout.BeginVertical("Box");
            EditorGUILayout.LabelField("Surfaces");
            roomStyle.floorSurface   = (Surface)EditorGUILayout.ObjectField("Floor", roomStyle.floorSurface, typeof(Surface), false);
            roomStyle.wallSurface    = (Surface)EditorGUILayout.ObjectField("Wall", roomStyle.wallSurface, typeof(Surface), false);
            roomStyle.ceilingSurface = (Surface)EditorGUILayout.ObjectField("Ceiling", roomStyle.ceilingSurface, typeof(Surface), false);
            EditorGUILayout.EndVertical();
        }
示例#2
0
        public static void OnInspectorGUI(Building building)
        {
            EditorGUILayout.Space();
            EditorGUILayout.LabelField(string.Format("BuildR Version {0}", BuildrVersion.NUMBER));

            BuildingEditor.GUIDivider();

            if (settings == null)
            {
                settings = building.settings;
            }

            Undo.RecordObject(settings, "Settings Modified");

            GUIContent[] guiContent = { new GUIContent("Building Settings"), new GUIContent("BuildR Settings") };
            mode = GUILayout.Toolbar(mode, guiContent, GUILayout.Width(BuildingEditor.MAIN_GUI_WIDTH));

            EditorGUILayout.Space();

            EditorGUILayout.BeginVertical(GUILayout.Width(BuildingEditor.MAIN_GUI_WIDTH));
            switch (mode)
            {
            case 0:
                BuildingSettings(building);
                break;

            case 1:
                Editor editor = Editor.CreateEditor(settings);
                editor.DrawDefaultInspector();
                break;
            }

            if (BuildingEditor.directionalLightIssueDetected)
            {
                EditorGUILayout.BeginVertical("box");
                EditorGUILayout.HelpBox("Directional camera bias values may cause real-time shadows to render gaps", MessageType.Warning);
                if (GUILayout.Button("Fix"))
                {
                    Light[] lights     = GameObject.FindObjectsOfType <Light>();
                    int     lightCount = lights.Length;
                    for (int l = 0; l < lightCount; l++)
                    {
                        Light light = lights[l];
                        if (light.type != LightType.Directional)
                        {
                            continue;
                        }

                        light.shadowBias       = building.settings.recommendedBias;
                        light.shadowNormalBias = building.settings.recommendedNormalBias;
                    }
                    BuildingEditor.directionalLightIssueDetected = false;
                }
                EditorGUILayout.EndVertical();
            }

            EditorGUILayout.EndVertical();
        }
示例#3
0
        private void OnEnable()
        {
            _wallSection = (WallSection)target;
            _plane       = Primitives.Plane(10);
            _settings    = BuildingEditor.GetSettings();

            UpdatePreview();
//            InteractivePreview.Reset();
        }
示例#4
0
        private static string SurfacePath(string filename)
        {
            BuildRSettings settings       = BuildingEditor.GetSettings();
            string         pluginLocation = settings.pluginLocation;
            string         dirPath        = Path.Combine(pluginLocation, "Surfaces/");

            if (!Directory.Exists(dirPath))
            {
                Directory.CreateDirectory(dirPath);
            }
            return(AssetDatabase.GenerateUniqueAssetPath(Path.Combine(dirPath, filename)));
        }
示例#5
0
        public static void OnInspectorGUI_S(Surface surface, string title = "Surface")
        {
            BuildingEditor.BuildRHeader(title);

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Name", GUILayout.Width(120));
            string newName = EditorGUILayout.DelayedTextField(surface.name);

            if (newName != surface.name)
            {
                nameError = BuildingEditorUtils.RenameAsset(surface, newName);
            }
            EditorGUILayout.EndHorizontal();

            if (nameError.Length > 0)
            {
                EditorGUILayout.HelpBox(nameError, MessageType.Error);
            }

            if (!surface.readable)
            {
                string warningContent = "Texture used is not set to readable";
                EditorGUILayout.HelpBox(warningContent, MessageType.Error);

                if (GUILayout.Button("Make surface readable"))
                {
                    string          texturePath     = AssetDatabase.GetAssetPath(surface.previewTexture);
                    TextureImporter textureImporter = (TextureImporter)AssetImporter.GetAtPath(texturePath);
                    if (textureImporter != null)
                    {
                        textureImporter.isReadable = true;
                        AssetDatabase.ImportAsset(texturePath);
                        surface.MarkModified();
                    }
                }
            }

            EditorGUILayout.Space();
        }
        private static void OnInspectorGUI_VolumeFacade(Building building) {
            BuildingEditor.BuildRHeader("Building Facades");

            BuildingEditor.VolumeSelectorInspectorGUI();
            Volume volume = BuildingEditor.volume;
            if (volume == null) return;
            int facadeCount = volume.numberOfFacades;
            for (int f = 0; f < facadeCount; f++) {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField(string.Format("Facade {0}", f + 1), GUILayout.Width(75));
                if (GUILayout.Button("Look At")) {
                    Vector3 p0 = volume.WorldPoint(f);
                    Vector3 p1 = volume.WorldPoint((f + 1) % facadeCount);
                    Vector3 facadeBaseCenter = Vector3.Lerp(p0, p1, 0.5f);
                    float volumeHeight = volume.planHeight;
                    Vector3 facadeCenter = facadeBaseCenter + Vector3.up * volumeHeight * 0.5f;
                    Vector3 facadeVector = p1 - p0;
                    Vector3 facadeDirection = facadeVector.normalized;
                    float facadeLength = facadeVector.magnitude;
                    Vector3 facadeNormal = Vector3.Cross(Vector3.up, facadeDirection);

                    var view = SceneView.lastActiveSceneView;
                    if (view != null) {
                        Quaternion lookRotation = Quaternion.LookRotation(-facadeNormal) * Quaternion.Euler(15, 0, 0);
                        float useSize = Mathf.Max(facadeLength, volumeHeight) * 1.2f;
                        view.LookAt(facadeCenter, lookRotation, useSize);
                    }
                }
                Facade currentFacade = volume.GetFacade(f);
                Facade facadeDesign = EditorGUILayout.ObjectField(currentFacade, typeof(Facade), false) as Facade;
                if (facadeDesign != currentFacade) {
                    volume.SetFacade(f, facadeDesign);
                    building.MarkModified();
                }
                EditorGUILayout.EndHorizontal();
            }
        }
示例#7
0
        public static void OnInspectorGUI_S(Facade facade)
        {
            BuildingEditor.BuildRHeader("Facade Design");


            EditorGUILayout.BeginHorizontal(GUILayout.Width(BuildingEditor.MAIN_GUI_WIDTH));
            EditorGUILayout.LabelField("Name", GUILayout.Width(120));
            string newName = EditorGUILayout.DelayedTextField(facade.name);

            if (newName != facade.name)
            {
                NAME_ERROR = BuildingEditorUtils.RenameAsset(facade, newName);
            }
            EditorGUILayout.EndHorizontal();

            if (NAME_ERROR.Length > 0)
            {
                EditorGUILayout.HelpBox(NAME_ERROR, MessageType.Error);
            }

            BuildingEditor.GUIDivider();
            SHOW_BASE_PATTERN = EditorGUILayout.Foldout(SHOW_BASE_PATTERN, "Base Facade Pattern");
            if (SHOW_BASE_PATTERN)
            {
                EditorGUILayout.BeginHorizontal("Box", GUILayout.Width(BuildingEditor.MAIN_GUI_WIDTH));
                float bottomWidth = Mathf.Min((SECTION_PREVIEW_SIZE + 17) * facade.baseWidth, BuildingEditor.MAIN_GUI_WIDTH - SECTION_PREVIEW_SIZE);
                EditorGUILayout.BeginVertical(GUILayout.Width(bottomWidth));

                BasePatternEditor(facade);

                EditorGUILayout.BeginHorizontal(GUILayout.Width(bottomWidth), GUILayout.Height(SECTION_PREVIEW_SIZE));
                if (GUILayout.Button("-", GUILayout.Width(SECTION_PREVIEW_SIZE), GUILayout.Height(SECTION_PREVIEW_SIZE)))
                {
                    facade.baseWidth--;
                }
                EditorGUILayout.LabelField(String.Format("Pattern\nWidth:\n{0}", facade.baseWidth), GUILayout.Width(SECTION_PREVIEW_SIZE), GUILayout.Height(SECTION_PREVIEW_SIZE));
                GUILayout.Space(bottomWidth - SECTION_PREVIEW_SIZE * 3);
                if (GUILayout.Button("+", GUILayout.Width(SECTION_PREVIEW_SIZE), GUILayout.Height(SECTION_PREVIEW_SIZE)))
                {
                    facade.baseWidth++;
                }
                EditorGUILayout.EndHorizontal();

                EditorGUILayout.EndVertical();

                float rightHeight = facade.baseHeight * SECTION_PREVIEW_SIZE + SECTION_PREVIEW_SIZE;
                EditorGUILayout.BeginVertical(GUILayout.Width(SECTION_PREVIEW_SIZE), GUILayout.Height(rightHeight));

                if (GUILayout.Button("+", GUILayout.Width(SECTION_PREVIEW_SIZE), GUILayout.Height(SECTION_PREVIEW_SIZE)))
                {
                    facade.baseHeight++;
                }
                EditorGUILayout.LabelField(String.Format("Pattern\nHeight:\n{0}", facade.baseHeight), GUILayout.Width(SECTION_PREVIEW_SIZE), GUILayout.Height(SECTION_PREVIEW_SIZE));
                GUILayout.Space(rightHeight - SECTION_PREVIEW_SIZE * 3);
                if (GUILayout.Button("-", GUILayout.Width(SECTION_PREVIEW_SIZE), GUILayout.Height(SECTION_PREVIEW_SIZE)))
                {
                    facade.baseHeight--;
                }
                GUILayout.Space(40);

                EditorGUILayout.EndVertical();
                EditorGUILayout.EndHorizontal();

                //TODO add back in
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Ground Floor Pattern");
                facade.hasGroundFloorPattern = EditorGUILayout.Toggle(facade.hasGroundFloorPattern);
                EditorGUILayout.EndHorizontal();

                EditorGUI.BeginDisabledGroup(!facade.hasGroundFloorPattern);
                GroundPatternEditor(facade);
                EditorGUI.EndDisabledGroup();

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Pattern Anchor");
                facade.patternAnchors = (Facade.PatternAnchors)EditorGUILayout.EnumPopup(facade.patternAnchors);
                EditorGUILayout.EndHorizontal();

                //                EditorGUILayout.BeginHorizontal();
                //                EditorGUILayout.LabelField("Tiled Pattern");
                //                facade.tiled = EditorGUILayout.Toggle(facade.tiled);
                //                EditorGUILayout.EndHorizontal();

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Stretch Mode");
                facade.stretchMode = (Facade.StretchModes)EditorGUILayout.EnumPopup(facade.stretchMode);
                EditorGUILayout.EndHorizontal();


                EditorGUILayout.BeginVertical("box");

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("String Course");
                facade.stringCourse = EditorGUILayout.Toggle(facade.stringCourse);
//                if(GUILayout.Button("?", GUILayout.Width(20)))
//                    EditorUtility.DisplayDialog("Help", "Me", "No");
                EditorGUILayout.EndHorizontal();

                EditorGUI.BeginDisabledGroup(!facade.stringCourse);


                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Height");
                facade.stringCourseHeight = EditorGUILayout.Slider(facade.stringCourseHeight, 0.01f, 0.5f);
                EditorGUILayout.EndHorizontal();

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Depth");
                facade.stringCourseDepth = EditorGUILayout.Slider(facade.stringCourseDepth, 0.01f, 0.5f);
                EditorGUILayout.EndHorizontal();

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Vertical Position");
                facade.stringCoursePosition = EditorGUILayout.Slider(facade.stringCoursePosition, 0, 1);
                EditorGUILayout.EndHorizontal();

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Surface");
                facade.stringCourseSurface = EditorGUILayout.ObjectField(facade.stringCourseSurface, typeof(Surface), false) as Surface;
                EditorGUILayout.EndHorizontal();

                EditorGUI.EndDisabledGroup();
                EditorGUILayout.EndVertical();

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Random Mode");
                facade.randomisationMode = (Facade.RandomisationModes)EditorGUILayout.EnumPopup(facade.randomisationMode);
                EditorGUILayout.EndHorizontal();
            }
        }
        public static void FacadeLibraryInspectorGUI() {
            BuildingEditor.BuildRHeader("Facade Design Library");

//            string[] guids = AssetDatabase.FindAssets("t:BuildR2.Facade");//t: type Facade
//            int libraryCount = guids.Length;

            EditorGUILayout.LabelField("Facade Library");
            //            EditorGUILayout.BeginHorizontal("Box");
            //            scrollPos = EditorGUILayout.BeginScrollView(scrollPos, GUILayout.Width(BuildingEditor.MAIN_GUI_WIDTH - 10), GUILayout.Height(200));
            FacadePicker();

            //            List<GUIContent> toolbar = new List<GUIContent>();
            //            for (int s = 0; s < libraryCount; s++)
            //            {
            //                string assetPath = AssetDatabase.GUIDToAssetPath(guids[s]);
            //                Facade facade = AssetDatabase.LoadAssetAtPath(assetPath, typeof(Facade)) as Facade;
            //                if (facade != null)
            //                {
            //                    Texture texture = facade.previewTexture;
            //                    GUIContent content = new GUIContent();
            //                    content.text = facade.name;
            //                    content.tooltip = "tooltip here";
            //                    if (texture != null) 
            //                        content.image = texture;
            //                    toolbar.Add(content);
            //
            //                    if (selectedFacadeIndex == s)
            //                    {
            //                        selectedFacade = facade;
            //
            //                        DragAndDrop.PrepareStartDrag();// reset data
            //                        DragAndDrop.SetGenericData("BuildR2.Facade", selectedFacade);
            //
            //                        Object[] objectReferences = { selectedFacade };// Careful, null values cause exceptions in existing editor code.
            //                        DragAndDrop.objectReferences = objectReferences;// Note: this object won't be 'get'-able until the next GUI event.
            //                    }
            //                }
            //            }
            //            
            //            float calWidth = BuildingEditor.MAIN_GUI_WIDTH - 35;
            //            float calHeight = (libraryCount / 4f) * (calWidth / 4f);
            //            selectedFacadeIndex = GUILayout.SelectionGrid(selectedFacadeIndex, toolbar.ToArray(), 4, GUILayout.Width(calWidth), GUILayout.Height(calHeight));

            //            EditorGUILayout.EndScrollView();
            //            EditorGUILayout.EndHorizontal();

            //            if (selectedFacade != null)
            //            {
            //                Event currentEvent = Event.current;
            //                EventType currentEventType = currentEvent.type;
            //
            //                // The DragExited event does not have the same mouse position data as the other events,
            //                // so it must be checked now:
            //                if (currentEventType == EventType.DragExited) DragAndDrop.PrepareStartDrag();// Clear generic data when user pressed escape. (Unfortunately, DragExited is also called when the mouse leaves the drag area)
            //
            //                switch (currentEventType)
            //                {
            //                    case EventType.MouseDown:
            //                        DragAndDrop.PrepareStartDrag();// reset data
            //                        DragAndDrop.SetGenericData("BuildR2.Facade", selectedFacade);
            //
            //                        Object[] objectReferences = { selectedFacade };// Careful, null values cause exceptions in existing editor code.
            //                        DragAndDrop.objectReferences = objectReferences;// Note: this object won't be 'get'-able until the next GUI event.
            //
            //                        currentEvent.Use();
            //
            //                        break;
            //
            //                    case EventType.MouseDrag:
            //                        // If drag was started here:
            //                        Facade existingDragData = DragAndDrop.GetGenericData("BuildR2.Facade") as Facade;
            //
            //                        if (existingDragData != null)
            //                        {
            //                            DragAndDrop.StartDrag("Dragging List ELement");
            //                            currentEvent.Use();
            //                        }
            //
            //                        break;
            //                }
            //            }

        }
示例#9
0
        public override void OnInspectorGUI()
        {
            BuildingEditor.BuildRHeader("Wall Section");

            Undo.RecordObject(_wallSection, "Wall Section Modification");

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Name", GUILayout.Width(80));
            string newName = EditorGUILayout.DelayedTextField(_wallSection.name);

            if (newName != _wallSection.name)
            {
                BuildingEditorUtils.RenameAsset(_wallSection, newName);
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Has Opening");
            _wallSection.hasOpening = EditorGUILayout.Toggle(_wallSection.hasOpening);
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Is Door");
            _wallSection.isDoor = EditorGUILayout.Toggle(_wallSection.isDoor);
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Vertical Restriction");
            _wallSection.verticalRestriction = (WallSection.VerticalRestrictions)EditorGUILayout.EnumPopup(_wallSection.verticalRestriction);
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginVertical("Box");
            EditorGUILayout.LabelField("Custom Models");

            //TODO SOON!
//            EditorGUILayout.BeginHorizontal();
//            EditorGUILayout.LabelField("Wall Section Model");
//            _wallSection.model = EditorGUILayout.ObjectField(_wallSection.model, typeof(Model), false) as Model;
//            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Opening Model");
            EditorGUILayout.BeginVertical();
            _wallSection.portal       = EditorGUILayout.ObjectField(_wallSection.portal, typeof(Portal), false) as Portal;
            _wallSection.openingModel = EditorGUILayout.ObjectField(_wallSection.openingModel, typeof(Model), false) as Model;
            EditorGUILayout.EndVertical();
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Balcony Model");
            _wallSection.balconyModel = EditorGUILayout.ObjectField(_wallSection.balconyModel, typeof(BuildR2.Model), false) as Model;
            EditorGUILayout.EndHorizontal();

            EditorGUI.BeginDisabledGroup(_wallSection.balconyModel == null);
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Balcony Height");
            _wallSection.balconyHeight = EditorGUILayout.Slider(_wallSection.balconyHeight, 0.01f, 1);
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Balcony Side Overhang");
            _wallSection.balconySideOverhang = EditorGUILayout.Slider(_wallSection.balconySideOverhang, 0, 0.56f);
            EditorGUILayout.EndHorizontal();
            EditorGUI.EndDisabledGroup();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Shutter Model");
            _wallSection.shutterModel = EditorGUILayout.ObjectField(_wallSection.shutterModel, typeof(Model), false) as Model;
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.EndVertical();


            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Dimentions Type");
            _wallSection.dimensionType = (WallSection.DimensionTypes)EditorGUILayout.EnumPopup(_wallSection.dimensionType);
            EditorGUILayout.EndHorizontal();

            if (_wallSection.dimensionType == WallSection.DimensionTypes.Absolute)
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Opening Width");
                _wallSection.openingWidth = EditorGUILayout.Slider(_wallSection.openingWidth, _settings.minimumWindowWidth, _settings.maximumWindowWidth);
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Opening Height");
                _wallSection.openingHeight = EditorGUILayout.Slider(_wallSection.openingHeight, _settings.minimumWindowHeight, _settings.maximumWindowHeight);
                EditorGUILayout.EndHorizontal();
            }
            else
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Opening Width");
                _wallSection.openingWidth = EditorGUILayout.Slider(_wallSection.openingWidth, 0, 1);
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Opening Height");
                _wallSection.openingHeight = EditorGUILayout.Slider(_wallSection.openingHeight, 0, 1);
                EditorGUILayout.EndHorizontal();
            }
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Opening Depth");
            _wallSection.openingDepth = EditorGUILayout.Slider(_wallSection.openingDepth, _settings.minimumWindowDepth, _settings.maximumWindowDepth);
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Opening Width Ratio");
            _wallSection.openingWidthRatio = EditorGUILayout.Slider(_wallSection.openingWidthRatio, 0, 1);
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Opening Height Ratio");
            _wallSection.openingHeightRatio = EditorGUILayout.Slider(_wallSection.openingHeightRatio, 0, 1);
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Opening is Arched");
            _wallSection.isArched = EditorGUILayout.Toggle(_wallSection.isArched);
            EditorGUILayout.EndHorizontal();

            EditorGUI.BeginDisabledGroup(!_wallSection.isArched);

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Arch Height");
            _wallSection.archHeight = EditorGUILayout.Slider(_wallSection.archHeight, 0.1f, _wallSection.openingHeight);
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Arch Curve");
            _wallSection.archCurve = EditorGUILayout.Slider(_wallSection.archCurve, 0, 1);
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Arch Segments");
            _wallSection.archSegments = EditorGUILayout.IntSlider(_wallSection.archSegments, 1, 20);
            EditorGUILayout.EndHorizontal();

            EditorGUI.EndDisabledGroup();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Bay Extruded");
            _wallSection.bayExtruded = EditorGUILayout.Toggle(_wallSection.bayExtruded);
            EditorGUILayout.EndHorizontal();

            EditorGUI.BeginDisabledGroup(!_wallSection.bayExtruded);
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Bay Extrusion");
            _wallSection.bayExtrusion = EditorGUILayout.Slider(_wallSection.bayExtrusion, 0.1f, 1);
            EditorGUILayout.EndHorizontal();
            EditorGUI.EndDisabledGroup();

            EditorGUI.BeginDisabledGroup(!_wallSection.bayExtruded);
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Bay Bevel");
            _wallSection.bayBevel = EditorGUILayout.Slider(_wallSection.bayBevel, 0.1f, 1);
            EditorGUILayout.EndHorizontal();
            EditorGUI.EndDisabledGroup();


            EditorGUILayout.BeginVertical("Box");
            EditorGUILayout.LabelField("Sill");

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Enabled");
            _wallSection.extrudedSill = EditorGUILayout.Toggle(_wallSection.extrudedSill);
            EditorGUILayout.EndHorizontal();

            EditorGUI.BeginDisabledGroup(!_wallSection.extrudedSill);

            Vector3 sillDimentions = _wallSection.extrudedSillDimentions;

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Overshoot");
            sillDimentions.x = EditorGUILayout.FloatField(sillDimentions.x);
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Height");
            sillDimentions.y = EditorGUILayout.FloatField(sillDimentions.y);
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Depth");
            sillDimentions.z = EditorGUILayout.FloatField(sillDimentions.z);
            EditorGUILayout.EndHorizontal();

            _wallSection.extrudedSillDimentions = sillDimentions;

            EditorGUI.EndDisabledGroup();
            EditorGUILayout.EndVertical();


            EditorGUILayout.BeginVertical("Box");
            EditorGUILayout.LabelField("Lintel");

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Enabled");
            _wallSection.extrudedLintel = EditorGUILayout.Toggle(_wallSection.extrudedLintel);
            EditorGUILayout.EndHorizontal();

            EditorGUI.BeginDisabledGroup(!_wallSection.extrudedLintel);

            Vector3 lintelDimenstions = _wallSection.extrudedLintelDimentions;

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Overshoot");
            lintelDimenstions.x = EditorGUILayout.FloatField(lintelDimenstions.x);
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Height");
            lintelDimenstions.y = EditorGUILayout.FloatField(lintelDimenstions.y);
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Depth");
            lintelDimenstions.z = EditorGUILayout.FloatField(lintelDimenstions.z);
            EditorGUILayout.EndHorizontal();

            _wallSection.extrudedLintelDimentions = lintelDimenstions;

            EditorGUI.EndDisabledGroup();
            EditorGUILayout.EndVertical();

            EditorGUILayout.BeginVertical("Box");
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Opening Frame");
            _wallSection.openingFrame = EditorGUILayout.Toggle(_wallSection.openingFrame);
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Size");
            _wallSection.openingFrameSize = EditorGUILayout.Slider(_wallSection.openingFrameSize, 0.02f, 0.25f);
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Extrusion");
            _wallSection.openingFrameExtrusion = EditorGUILayout.Slider(_wallSection.openingFrameExtrusion, 0.0f, 0.1f);
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.EndVertical();


            EditorGUILayout.BeginVertical("Box");
            EditorGUILayout.LabelField("Surfaces");

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Wall");
            _wallSection.wallSurface = EditorGUILayout.ObjectField(_wallSection.wallSurface, typeof(Surface), false) as Surface;
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Opening");
            _wallSection.openingSurface = EditorGUILayout.ObjectField(_wallSection.openingSurface, typeof(Surface), false) as Surface;
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Sill");
            _wallSection.sillSurface = EditorGUILayout.ObjectField(_wallSection.sillSurface, typeof(Surface), false) as Surface;
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Ceiling");
            _wallSection.ceilingSurface = EditorGUILayout.ObjectField(_wallSection.ceilingSurface, typeof(Surface), false) as Surface;
            EditorGUILayout.EndHorizontal();


            EditorGUILayout.EndVertical();

            if (GUI.changed)
            {
                Repaint();
                _wallSection.GenereateData();
                UpdatePreview();
                _wallSection.SaveData();

                UpdatePreview();

                EditorUtility.SetDirty(_wallSection);
            }
        }
示例#10
0
        public override void OnInspectorGUI()
        {
            //            BuildRSettings settings = BuildRSettings.GetSettings();

            Undo.RecordObject(_gable, "Gable Modification");

            BuildingEditor.BuildRHeader("Gable");

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Name", GUILayout.Width(80));
            string newName = EditorGUILayout.DelayedTextField(_gable.name);

            if (newName != _gable.name)
            {
                BuildingEditorUtils.RenameAsset(_gable, newName);
            }
            EditorGUILayout.EndHorizontal();

            //            EditorGUILayout.BeginHorizontal();
            //            EditorGUILayout.LabelField("Thickness");
            //            _gable.thickness = EditorGUILayout.Slider(_gable.thickness, 0.1f, 5);
            //            EditorGUILayout.EndHorizontal();

            //            EditorGUILayout.BeginHorizontal();
            //            EditorGUILayout.LabelField("Additional Height");
            //            _gable.additionalHeight = EditorGUILayout.Slider(_gable.additionalHeight, 0.0f, 10f);
            //            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Surface");
            _gable.surface = EditorGUILayout.ObjectField(_gable.surface, typeof(Surface), false) as Surface;
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Gable Segments");
            _gable.segments = EditorGUILayout.IntSlider(_gable.segments, 1, 24);
            EditorGUILayout.EndHorizontal();

            int partCount = _gable.count;

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(string.Format("Gable Parts: {0}", partCount));
            if (GUILayout.Button("Add Part", GUILayout.Width(90)))
            {
                _gable.AddNewPart();
                partCount = _gable.count;
            }
            EditorGUILayout.EndHorizontal();

            for (int p = 0; p < partCount; p++)
            {
                GablePart part = _gable[p];

                EditorGUILayout.BeginVertical("Box");
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField(string.Format("Part {0}", p + 1));

                if (GUILayout.Button("Insert", GUILayout.Width(70)))
                {
                    _gable.InsertNewPart(p);
                    break;
                }

                if (GUILayout.Button("Remove", GUILayout.Width(70)))
                {
                    _gable.RemovePartAt(p);
                    break;//just kill the loop for now
                }
                EditorGUILayout.EndHorizontal();

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Type", GUILayout.Width(50));
                part.type = (GablePart.Types)EditorGUILayout.EnumPopup(part.type, GUILayout.Width(90));
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Size", GUILayout.Width(50));

                Vector2 size = part.size;
                switch (part.type)
                {
                case GablePart.Types.Horizonal:
                    //                        size.x = EditorGUILayout.DelayedFloatField(size.x);
                    size.x = EditorGUILayout.FloatField("\t", size.x);
                    break;

                case GablePart.Types.Vertical:
                    size.y = EditorGUILayout.FloatField("\t", size.y);
                    break;

                default:
                    size = EditorGUILayout.Vector2Field("", size);
                    break;
                }
                part.size = size;
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.EndVertical();

                _gable[p] = part;//reassign to check for modification
            }

            EditorGUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Add Part", GUILayout.Width(90)))
            {
                _gable.AddNewPart();
            }
            EditorGUILayout.EndHorizontal();

            if (GUI.changed)
            {
                Repaint();
                EditorUtility.SetDirty(_gable);
            }

            //            DrawDefaultInspector();
        }
示例#11
0
        public override void OnInspectorGUI()
        {
            BuildingEditor.BuildRHeader("Chimney");

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Seed");
            _chimney.seed = (uint)EditorGUILayout.IntSlider((int)_chimney.seed, 1, 999999);
            EditorGUILayout.EndHorizontal();

            _chimney.noise = EditorGUILayout.Vector3Field("Noise", _chimney.noise);

            EditorGUILayout.BeginVertical("box");
            EditorGUILayout.LabelField("Case");

            _chimney.caseSize = EditorGUILayout.Vector3Field("Case Size", _chimney.caseSize);

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Case Surface");
            _chimney.caseSurface = EditorGUILayout.ObjectField(_chimney.caseSurface, typeof(Surface), false) as Surface;
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.EndVertical();


            EditorGUILayout.BeginVertical("box");
            EditorGUILayout.LabelField("Crown");

            _chimney.crownSize = EditorGUILayout.Vector3Field("Crown Size", _chimney.crownSize);

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Crown Surface");
            _chimney.crownSurface = EditorGUILayout.ObjectField(_chimney.crownSurface, typeof(Surface), false) as Surface;
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.EndVertical();


            EditorGUILayout.BeginVertical("box");

            EditorGUILayout.LabelField("Flue");

            _chimney.flueSize = EditorGUILayout.Vector3Field("Flue Size", _chimney.flueSize);

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Flue Shape");
            if (GUILayout.Button(_chimney.square ? "Square" : "Circle"))
            {
                _chimney.square = !_chimney.square;
            }
            EditorGUILayout.EndHorizontal();

            if (!_chimney.square)
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Flue Segments");
                _chimney.segments = EditorGUILayout.IntSlider(_chimney.segments, 3, 20);
                EditorGUILayout.EndHorizontal();

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Flue Angle Offset");
                _chimney.angleOffset = EditorGUILayout.Slider(_chimney.angleOffset, 0, 360);
                EditorGUILayout.EndHorizontal();
            }

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Allow Multiple Flues");
            _chimney.allowMultiple = EditorGUILayout.Toggle(_chimney.allowMultiple);
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Allow Multiple Flues Rows");
            _chimney.allowMultipleRows = EditorGUILayout.Toggle(_chimney.allowMultipleRows);
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Flue Spacing");
            _chimney.flueSpacing = EditorGUILayout.Slider(_chimney.flueSpacing, 0.01f, 1);
            EditorGUILayout.EndHorizontal();

            SurfaceArrayEditor.Inspector(_chimney.flueSurfaces);
//            EditorGUILayout.BeginHorizontal();
//            EditorGUILayout.LabelField("Flue Surface");
//            _chimney.flueSurface = EditorGUILayout.ObjectField(_chimney.flueSurface, typeof(Surface), false) as Surface;
//            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Inner Surface");
            _chimney.innerSurface = EditorGUILayout.ObjectField(_chimney.innerSurface, typeof(Surface), false) as Surface;
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Cap Model");
            _chimney.cap = EditorGUILayout.ObjectField(_chimney.cap, typeof(Model), false) as Model;
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.EndVertical();

            if (GUI.changed)
            {
                EditorUtility.SetDirty(_chimney);
                UpdatePreview();
                Repaint();
            }
        }
示例#12
0
        public override void OnInspectorGUI()
        {
            if (_portal.type == Portal.Types.Window)
            {
                Undo.RecordObject(_portal, "Window Modification");
                BuildingEditor.BuildRHeader("Window");
            }
            else
            {
                Undo.RecordObject(_portal, "Door Modification");
                BuildingEditor.BuildRHeader("Door");
            }

            GUILayout.Space(5);


            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Name", GUILayout.Width(120));
            string newName = EditorGUILayout.DelayedTextField(_portal.name);

            if (newName != _portal.name)
            {
                nameError = BuildingEditorUtils.RenameAsset(_portal, newName);
            }
            EditorGUILayout.EndHorizontal();

            if (nameError.Length > 0)
            {
                EditorGUILayout.HelpBox(nameError, MessageType.Error);
            }

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Type", GUILayout.Width(120));
            _portal.type = (Portal.Types)EditorGUILayout.EnumPopup(_portal.type);
            EditorGUILayout.EndHorizontal();


            EditorGUILayout.TextArea("", GUI.skin.horizontalSlider);

            EditorGUILayout.BeginHorizontal();
            if (_portal.defaultFrameTexture != null)
            {
                GUILayout.Label(_portal.defaultFrameTexture.previewTexture, GUILayout.Width(75), GUILayout.Height(75));
            }
            EditorGUILayout.BeginVertical();
            EditorGUILayout.LabelField("Default Frame Texture");
            EditorGUILayout.BeginHorizontal();
            _portal.defaultFrameTexture = EditorGUILayout.ObjectField(_portal.defaultFrameTexture, typeof(Surface), false) as Surface;
            if (GUILayout.Button("?", GUILayout.Width(20)))
            {
                EditorUtility.DisplayDialog("Help Text", "TODO", "ok");
            }
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.EndVertical();
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.LabelField("Default Panel Texture");
            EditorGUILayout.BeginHorizontal();
            _portal.defaultPanelTexture = EditorGUILayout.ObjectField(_portal.defaultPanelTexture, typeof(Surface), false, GUILayout.Width(75), GUILayout.Height(75)) as Surface;
            if (GUILayout.Button("?", GUILayout.Width(20)))
            {
                EditorUtility.DisplayDialog("Help Text", "TODO", "ok");
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.TextArea("", GUI.skin.horizontalSlider);

            treeScroll = EditorGUILayout.BeginScrollView(treeScroll);
            DivisionInspector(_portal.root, 0);
            EditorGUILayout.EndScrollView();

            _portal.CheckModification();

//            GUILayout.Space(100);
//            base.OnInspectorGUI();
        }
示例#13
0
        public override void OnInspectorGUI()
        {
            Undo.RecordObject(_model, "Model Modification");

            BuildingEditor.BuildRHeader("Model");

            EditorGUILayout.BeginVertical(GUILayout.Width(BuildingEditor.MAIN_GUI_WIDTH));

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Name", GUILayout.Width(80));
            string newName = EditorGUILayout.DelayedTextField(_model.name);

            if (newName != _model.name)
            {
                BuildingEditorUtils.RenameAsset(_model, newName);
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Type", GUILayout.Width(80));
            _model.type = (Model.Types)EditorGUILayout.EnumPopup(_model.type);
            EditorGUILayout.EndHorizontal();

            if (_model.type == Model.Types.Mesh && _model.GetMeshes().Length > 1)
            {
                EditorGUILayout.HelpBox("Mesh mode only available for subjects with a single mesh", MessageType.Warning);
            }

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Subject", GUILayout.Width(80));
            _model.subject = EditorGUILayout.ObjectField(_model.subject, typeof(GameObject), false) as GameObject;
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Model Anchor", GUILayout.Width(150));
            _model.anchor = EditorGUILayout.Vector3Field("", _model.anchor);
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.Space();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Bounds", GUILayout.Width(150));
            _model.userBounds = EditorGUILayout.BoundsField(_model.userBounds);
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.Space();

            if (GUILayout.Button("Reset Bounds"))
            {
                _model.userBounds = _model.modelBounds;
            }

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Model Normal", GUILayout.Width(150));
            _model.normal = EditorGUILayout.Vector3Field("", _model.normal);
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Rotation Offset", GUILayout.Width(150));
            _model.userRotation = EditorGUILayout.Vector3Field("", _model.userRotation);
            EditorGUILayout.EndHorizontal();

            if (GUILayout.Button("Refresh Data"))
            {
                _model.UpdateInternalData();
            }

            EditorGUILayout.EndVertical();
        }
示例#14
0
        private void OnEnable()
        {
            BuildRSettings.AUTO_UPDATE = true;
            EditorUtility.ClearProgressBar();
            EDITOR = this;

            if (target != null)
            {
                if (BUILDING != (Building)target)
                {
                    Cleanup();
                    BUILDING = (Building)target;//directly set to avoid gui calls
                }

                if (building.settings == null)
                {
                    building.settings = GetSettings();
                }

                if (building.numberOfVolumes > 0)
                {
                    if (volume == null)
                    {
                        VOLUME = (Volume)BUILDING[0];//directly set to avoid gui calls
                    }
                    if (volume != null)
                    {
                        if (floorplan == null && volume.floors > 0 && building.settings.editMode == BuildREditmodes.Values.Floorplan && volume.InteriorFloorplans().Length > 0)
                        {
                            FLOORPLAN = (Floorplan)volume.InteriorFloorplans()[0];//directly set to avoid gui calls
                        }
                    }
                }
            }

            STAGE_TOOLBAR_TEXTURES    = new Texture2D[toolbarOptionCount];
            STAGE_TOOLBAR_TEXTURES[0] = volumeIcon;
            STAGE_TOOLBAR_TEXTURES[1] = floorplanIcon;
            STAGE_TOOLBAR_TEXTURES[2] = surfacesIcon;
            STAGE_TOOLBAR_TEXTURES[3] = facadesIcon;
            STAGE_TOOLBAR_TEXTURES[4] = roofsIcon;
            STAGE_TOOLBAR_TEXTURES[5] = exportIcon;
            STAGE_TOOLBAR_TEXTURES[6] = optionsIcon;

            HEADER_TEXTURE = new Texture2D(1, 1);
            HEADER_TEXTURE.SetPixel(0, 0, RED);
            HEADER_TEXTURE.Apply();

            LOGO = logo;//(Texture2D)AssetDatabase.LoadAssetAtPath("Assets/BuildR2/Internal/EditorImages/buildrLogo.png", typeof(Texture2D));

            BuildingVolumeEditor.OnEnable();

            IVolume[] volumes = BUILDING.AllPlans();
            foreach (Volume volume1 in volumes)
            {
                if (volume1 == null)
                {
                    continue;
                }
                volume1.hideFlags = building.settings.debug ? HideFlags.None : HideFlags.HideInInspector;
            }

            directionalLightIssueDetected = false;
            Light[] lights = FindObjectsOfType <Light>();
            int lightCount = lights.Length;
            for (int l = 0; l < lightCount; l++)
            {
                Light light = lights[l];
                if (light.type != LightType.Directional)
                {
                    continue;
                }

                if (light.shadowBias > building.settings.recommendedBias || light.shadowNormalBias > building.settings.recommendedNormalBias)
                {
                    directionalLightIssueDetected = true;
                }
            }
        }