public override void OnInspectorGUI() { GUIDraw.DrawSpacer(); GUI.color = Color.red; EditorGUILayout.BeginVertical("Box"); GUI.color = Color.white; GUIDraw.Label("Modifications to this LOD Group will apply to all children", 12); EditorGUILayout.EndVertical(); GUIDraw.DrawSpacer(); }
void DrawSearchOptions(Color color) { GUI.color = color; EditorGUILayout.BeginVertical("Box"); GUI.color = Color.white; GUIDraw.LabelWidthUnderline("Search Options", 14); EditorGUILayout.PropertyField(drawGizmos); EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("Show Cell Grid"); EditorGUILayout.LabelField("X", GUILayout.Width(13)); EditorGUILayout.PropertyField(searchBoxGridX, new GUIContent(""), GUILayout.Width(25)); EditorGUILayout.LabelField("Y", GUILayout.Width(13)); EditorGUILayout.PropertyField(searchBoxGridY, new GUIContent(""), GUILayout.Width(25)); EditorGUILayout.LabelField("Z", GUILayout.Width(13)); EditorGUILayout.PropertyField(searchBoxGridZ, new GUIContent(""), GUILayout.Width(25)); EditorGUILayout.EndHorizontal(); EditorGUILayout.PropertyField(searchBoxSquare); EditorGUILayout.PropertyField(parent); EditorGUILayout.PropertyField(layerMask); EditorGUILayout.PropertyField(useTag); if (useTag.boolValue) { tag.stringValue = EditorGUILayout.TagField("Tag", tag.stringValue); } EditorGUILayout.PropertyField(onlyStatic); EditorGUILayout.PropertyField(useVertexInputLimit); if (useVertexInputLimit.boolValue) { EditorGUILayout.PropertyField(vertexInputLimit); } if (vertexInputLimit.intValue < 1) { vertexInputLimit.intValue = 1; } EditorGUILayout.PropertyField(nameContains); if (nameContains.boolValue) { GUIDraw.PropertyArray(nameContainList); } EditorGUILayout.EndVertical(); }
void DrawRuntime(Color color) { GUI.color = color; EditorGUILayout.BeginVertical("Box"); GUI.color = Color.white; GUIDraw.LabelWidthUnderline("Runtime", 14); EditorGUILayout.PropertyField(combineInRuntime); if (combineInRuntime.boolValue) { EditorGUILayout.PropertyField(combineOnStart); EditorGUILayout.PropertyField(useCombineSwapKey); if (useCombineSwapKey.boolValue) { EditorGUILayout.PropertyField(combineSwapKey); } EditorGUILayout.PropertyField(originalObjects); EditorGUILayout.PropertyField(originalObjectsLODGroups); } EditorGUILayout.EndVertical(); }
void DrawInspectorGUI() { GUIDraw.DrawSpacer(); EditorGUILayout.BeginVertical("Box"); EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("Version 1.0"); GUI.backgroundColor = Color.green; if (GUILayout.Button("Documentation")) { Application.OpenURL("http://www.terraincomposer.com/mcs-documentation/"); } GUI.backgroundColor = Color.white; EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); GUIDraw.DrawSpacer(); DrawSearchOptions(Color.red * editorSkinMulti); GUIDraw.DrawSpacer(); DrawOutputSettings(Color.blue * editorSkinMulti); GUIDraw.DrawSpacer(); DrawRuntime(Color.green * editorSkinMulti); GUIDraw.DrawSpacer(); }
public override void OnInspectorGUI() { // DrawDefaultInspector(); CombinedLODManager combinedLODManager = (CombinedLODManager)target; serializedObject.Update(); GUI.color = Color.yellow * editorSkinMulti; EditorGUILayout.BeginVertical("Box"); GUI.color = Color.white; GUIDraw.LabelWidthUnderline(new GUIContent("LOD Settings", ""), 14); EditorGUILayout.PropertyField(drawGizmos); EditorGUILayout.PropertyField(lodMode); GUI.changed = false; EditorGUILayout.PropertyField(lodDistanceMode); if (GUI.changed) { MeshCombiner meshCombiner = combinedLODManager.GetComponent <MeshCombiner>(); if (meshCombiner != null) { serializedObject.ApplyModifiedProperties(); combinedLODManager.UpdateDistances(meshCombiner); return; } } EditorGUILayout.PropertyField(lodCulled); if (lodCulled.boolValue) { EditorGUILayout.PropertyField(lodCullDistance); if (lodCullDistance.floatValue < 0) { lodCullDistance.floatValue = 0; } } if (lodMode.enumValueIndex == 1) { EditorGUILayout.PropertyField(showLod); if (showLod.intValue < 0) { showLod.intValue = 0; } if (showLod.intValue >= distances.arraySize) { showLod.intValue = distances.arraySize - 1; } } else { GUI.changed = false; GUIDraw.PropertyArray(distances, new GUIContent(""), false, false); if (GUI.changed) { lodDistanceMode.enumValueIndex = 1; } if (distanceElements == null || distanceElements.Length != distances.arraySize) { distanceElements = new SerializedProperty[distances.arraySize]; } for (int i = 0; i < distances.arraySize; i++) { distanceElements[i] = distances.GetArrayElementAtIndex(i); if (i == 0) { distanceElements[i].floatValue = 0; } else if (distanceElements[i].floatValue < distanceElements[i - 1].floatValue) { distanceElements[i].floatValue = distanceElements[i - 1].floatValue + 0.1f; } } } EditorGUILayout.EndVertical(); serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { meshCombiner = (MeshCombiner)target; serializedObject.Update(); DrawInspectorGUI(); serializedObject.ApplyModifiedProperties(); // DrawDefaultInspector(); if (!meshCombiner.combined && (meshCombiner.transform.position != meshCombiner.oldPosition || meshCombiner.transform.lossyScale != meshCombiner.oldScale)) { if (meshCombiner.octreeCreated) { // Debug.Log("Reset"); meshCombiner.ResetOctree(); } meshCombiner.oldPosition = meshCombiner.transform.position; meshCombiner.oldScale = meshCombiner.transform.localScale; } EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Search")) { meshCombiner.AddToOctree(); SceneView.RepaintAll(); } Transform t = meshCombiner.transform; if (searchBoxSquare.boolValue) { Vector3 localScale = t.localScale; t.localScale = new Vector3(localScale.x, localScale.x, localScale.x); } if (!combineInRuntime.boolValue) { GUILayout.Space(10); if (GUILayout.Button("Combine")) { meshCombiner.CombineLods(); } } EditorGUILayout.EndHorizontal(); if (meshCombiner.octreeCreated) { DisplayOctreeInfo(); } GUIDraw.DrawSpacer(); if (meshCombiner.combinedList.Count > 0) { if (GUILayout.Button("Delete Combined Objects")) { meshCombiner.DestroyCombinedGameObjects(); } GUIDraw.DrawSpacer(); } }
void DrawOutputSettings(Color color) { GUI.color = color; EditorGUILayout.BeginVertical("Box"); GUI.color = Color.white; GUIDraw.LabelWidthUnderline("Output Settings", 14); GUI.changed = false; int oldCellSize = cellSize.intValue; EditorGUILayout.PropertyField(cellSize); if (GUI.changed) { if (cellSize.intValue < 4) { cellSize.intValue = 4; } if (oldCellSize != cellSize.intValue) { if (meshCombiner.octreeCreated) { meshCombiner.ResetOctree(); } if (meshCombiner.combinedLODManager != null) { serializedObject.ApplyModifiedProperties(); meshCombiner.combinedLODManager.UpdateDistances(meshCombiner); } } } GUI.changed = false; EditorGUILayout.PropertyField(lodAmount); if (lodAmount.intValue < 1) { lodAmount.intValue = 1; } if (GUI.changed) { serializedObject.ApplyModifiedProperties(); if (lodAmount.intValue > 1) { meshCombiner.AddCombinedLODManager(); } else { meshCombiner.DestroyCombinedLODManager(); } } if (lodAmount.intValue > 1) { EditorGUILayout.PropertyField(lodSeachText); } EditorGUILayout.PropertyField(addMeshColliders); EditorGUILayout.PropertyField(useVertexOutputLimit); if (useVertexOutputLimit.boolValue) { EditorGUILayout.PropertyField(vertexOutputLimit); } if (vertexOutputLimit.intValue < 1) { vertexOutputLimit.intValue = 1; } //EditorGUILayout.PropertyField(removeGeometryBelowTerrain); //if (removeGeometryBelowTerrain.boolValue) //{ // DrawPropertyArray(terrains); //} EditorGUILayout.EndVertical(); }