private void OnGUI() { var initiallyEnabled = GUI.enabled; if (SelectedLOD >= m_NumberOfLODs) { SelectedLOD = m_NumberOfLODs - 1; } GUILayout.BeginVertical(); GUILayout.Space(28); var sliderBarPosition = GUILayoutUtility.GetRect(0, LODGUI.kSliderBarHeight, GUILayout.ExpandWidth(true)); var lods = LODGUI.CreateLODInfos(m_NumberOfLODs, sliderBarPosition, i => string.Format("LOD {0}", i), i => m_LODs[i].screenPercentage); DrawLODLevelSlider(sliderBarPosition, lods); GUILayout.Space(LODGUI.kSliderBarBottomMargin); if (QualitySettings.lodBias != 1.0f) { EditorGUILayout.HelpBox(string.Format("Active LOD bias is {0:0.0#}. Distances are adjusted accordingly.", QualitySettings.lodBias), MessageType.Warning); } GUILayout.Space(8); GUILayout.Label(SelectedLOD < 0 ? "Culled" : "LOD " + SelectedLOD, LODGUI.selectStyle); GUILayout.Space(8); if (SelectedLOD >= 0) { var direct = m_LODs[SelectedLOD].GUI(m_direct); if (m_direct != direct) { m_direct = direct; UpdateBehavic(); } } GUILayout.EndVertical(); }
public LodUtil.Direct GUI(LodUtil.Direct direct) { if (meshes != null && go != null) { scroll = GUILayout.BeginScrollView(scroll); GUILayout.BeginVertical(); GUILayout.BeginHorizontal(); GUILayout.Label(go.name, LODGUI.totalStyle); direct = (LodUtil.Direct)EditorGUILayout.EnumPopup(direct, GUILayout.MaxWidth(80)); if (GUILayout.Button("Visualize Bounds", GUILayout.MaxWidth(110))) { LodUtil.AttachCollider(go); } GUILayout.EndHorizontal(); GUILayout.Label("total verts: " + vertCnt + " tris: " + triCnt, LODGUI.totalStyle); GUILayout.BeginHorizontal(); GUILayout.BeginVertical(); int i = 0; foreach (var mesh in meshes) { GUILayout.BeginHorizontal(); GUIMesh(mesh); GUILayout.BeginVertical(); GUILayout.Space(24); GUILayout.Label(mesh.name); GUILayout.Label("verts: " + mesh.vertexCount); GUILayout.Label("tris: " + mesh.triangles.Length / 3); GUILayout.Label("bounds: " + mesh.bounds); GUILayout.BeginHorizontal(); var render = renders[i++]; var desc = "render bones: " + render.bones.Length + " matrix:" + mesh.bindposes.Length + " weights:" + mesh.boneWeights.Length; if (GUILayout.Button(desc, UnityEngine.GUI.skin.label) || string.IsNullOrEmpty(boneInfo)) { BoneInfo(render); } GUILayout.EndHorizontal(); desc = "skin "; if (has(mesh.uv)) { desc += "uv "; } if (has(mesh.uv2)) { desc += "uv2 "; } if (has(mesh.uv3)) { desc += "uv3 "; } if (has(mesh.uv4)) { desc += "uv4 "; } if (has(mesh.normals)) { desc += "normal "; } if (has(mesh.tangents)) { desc += "tangent "; } if (has(mesh.colors)) { desc += "color "; } if (mesh.subMeshCount > 1) { desc += "submesh "; } GUILayout.Label(desc); GUILayout.EndVertical(); GUILayout.EndHorizontal(); } GUILayout.EndHorizontal(); GUILayout.Space(10); GUILayout.Label(boneInfo); GUILayout.EndHorizontal(); GUILayout.EndVertical(); GUILayout.EndScrollView(); } else { GUILayout.Label("no gameobject attached"); } return(direct); }
private void OnGUI() { var initiallyEnabled = GUI.enabled; if (SelectedLOD >= m_NumberOfLODs) { SelectedLOD = m_NumberOfLODs - 1; } GUILayout.BeginVertical(); GUILayout.Space(10); GUILayout.BeginHorizontal(); GUILayout.Label("Select Role: "); role_pop = EditorGUILayout.Popup(role_pop, roles); GUILayout.Space(8); if (GUILayout.Button("load")) { LoadRole(lodNode); UpdateInfo(); } if (GUILayout.Button("save")) { float[] levels = m_LODs.Where(x => x.screenPercentage > 0 && x.screenPercentage < 1).Select(x => x.screenPercentage).ToArray(); string prefab = lodNode.prefab; config.AddorUpdate(prefab, levels); config.Save(); LodExport.Export(m_LODs.ToArray(), lodNode); LodUtil.ReLoad(m_LODs, lodNode); return; } GUILayout.EndHorizontal(); GUILayout.Space(18); var sliderBarPosition = GUILayoutUtility.GetRect(0, LODGUI.kSliderBarHeight, GUILayout.ExpandWidth(true)); var lods = LODGUI.CreateLODInfos(m_NumberOfLODs, sliderBarPosition, i => string.Format("LOD {0}", i), i => m_LODs[i].screenPercentage); DrawLODLevelSlider(sliderBarPosition, lods); GUILayout.Space(LODGUI.kSliderBarBottomMargin); if (QualitySettings.lodBias != 1.0f) { EditorGUILayout.HelpBox(string.Format("Active LOD bias is {0:0.0#}. Distances are adjusted accordingly.", QualitySettings.lodBias), MessageType.Warning); } GUILayout.Space(8); GUILayout.Label(SelectedLOD < 0 ? "Culled" : "LOD " + SelectedLOD, LODGUI.selectStyle); GUILayout.Space(8); if (SelectedLOD >= 0) { var direct = m_LODs[SelectedLOD].GUI(m_direct); if (m_direct != direct) { m_direct = direct; UpdateBehavic(); } } GUILayout.EndVertical(); }