public static InspectorTitlebar ( bool foldout, Object targetObj ) : bool | ||
foldout | bool | The foldout state shown with the arrow. |
targetObj | Object | The object (for example a component) or objects that the titlebar is for. |
Результат | bool |
public override void OnInspectorGUI() { if (Event.current.type == EventType.ValidateCommand && Event.current.commandName == "UndoRedoPerformed") { AvatarSetupTool.TransferPoseToDescription(base.serializedObject, base.root); for (int i = 0; i < this.m_Bones.Length; i++) { this.m_Bones[i].Serialize(base.serializedObject); } } this.UpdateSelectedBone(); if (Event.current.type == EventType.KeyDown && (Event.current.keyCode == KeyCode.Backspace || Event.current.keyCode == KeyCode.Delete) && AvatarMappingEditor.s_SelectedBoneIndex != -1 && AvatarMappingEditor.s_SelectedBoneIndex < this.m_Bones.Length) { Undo.RegisterCompleteObjectUndo(this, "Avatar mapping modified"); AvatarSetupTool.BoneWrapper boneWrapper = this.m_Bones[AvatarMappingEditor.s_SelectedBoneIndex]; boneWrapper.bone = null; boneWrapper.state = BoneState.None; boneWrapper.Serialize(base.serializedObject); Selection.activeTransform = null; GUI.changed = true; Event.current.Use(); } GUILayout.BeginVertical(new GUILayoutOption[0]); EditorGUI.BeginChangeCheck(); GUILayout.BeginVertical(string.Empty, "TE NodeBackground", new GUILayoutOption[0]); this.m_BodyView = AvatarControl.ShowBoneMapping(this.m_BodyView, new AvatarControl.BodyPartFeedback(this.IsValidBodyPart), this.m_Bones, base.serializedObject, this); this.HandleBodyView(this.m_BodyView); GUILayout.EndVertical(); this.m_FoldoutScroll = GUILayout.BeginScrollView(this.m_FoldoutScroll, AvatarMappingEditor.styles.box, new GUILayoutOption[] { GUILayout.MinHeight(80f), GUILayout.MaxHeight(500f), GUILayout.ExpandHeight(true) }); this.DisplayFoldout(); GUILayout.FlexibleSpace(); GUILayout.EndScrollView(); if (EditorGUI.EndChangeCheck()) { this.ValidateMapping(); SceneView.RepaintAll(); } this.DisplayMappingButtons(); GUILayout.EndVertical(); if (GUIUtility.hotControl == 0) { this.TransferPoseIfChanged(); } base.ApplyRevertGUI(); if (Selection.activeTransform != null) { if (this.m_CurrentTransformEditor != null && this.m_CurrentTransformEditor.target != Selection.activeTransform) { UnityEngine.Object.DestroyImmediate(this.m_CurrentTransformEditor); } if (this.m_CurrentTransformEditor == null) { this.m_CurrentTransformEditor = Editor.CreateEditor(Selection.activeTransform); } EditorGUILayout.Space(); this.m_CurrentTransformEditorFoldout = EditorGUILayout.InspectorTitlebar(this.m_CurrentTransformEditorFoldout, Selection.activeTransform, true); if (this.m_CurrentTransformEditorFoldout && this.m_CurrentTransformEditor != null) { this.m_CurrentTransformEditor.OnInspectorGUI(); } } else if (this.m_CurrentTransformEditor != null) { UnityEngine.Object.DestroyImmediate(this.m_CurrentTransformEditor); this.m_CurrentTransformEditor = null; } }
public override void OnInspectorGUI() { HandleUndoPerformed(); UpdateSelectedBone(); // case 837655. GUI.keyboardControl is overriden when changing scene selection. // Late update here to bypass this issue. if (s_KeyboardControl != 0) { GUIUtility.keyboardControl = s_KeyboardControl; s_KeyboardControl = 0; } GUILayout.BeginVertical(); { EditorGUI.BeginChangeCheck(); GUILayout.BeginVertical("", "TE NodeBackground"); { m_BodyView = AvatarControl.ShowBoneMapping(m_BodyView, new AvatarControl.BodyPartFeedback(this.IsValidBodyPart), m_Bones, serializedObject, this); HandleBodyView(m_BodyView); } GUILayout.EndVertical(); m_FoldoutScroll = GUILayout.BeginScrollView(m_FoldoutScroll, styles.box, GUILayout.MinHeight(80), GUILayout.MaxHeight(500), GUILayout.ExpandHeight(true)); { DisplayFoldout(); GUILayout.FlexibleSpace(); } GUILayout.EndScrollView(); if (EditorGUI.EndChangeCheck()) { ValidateMapping(); SceneView.RepaintAll(); } DisplayMappingButtons(); } GUILayout.EndVertical(); if (EditorGUIUtility.hotControl == 0) { TransferPoseIfChanged(); } //DebugPoseButtons (); ApplyRevertGUI(); if (Selection.activeTransform != null) { // Selection is changing, clean up before we create a new editor if (m_CurrentTransformEditor != null && m_CurrentTransformEditor.target != Selection.activeTransform) { DestroyImmediate(m_CurrentTransformEditor); } if (m_CurrentTransformEditor == null) { m_CurrentTransformEditor = Editor.CreateEditor(Selection.activeTransform); } EditorGUILayout.Space(); m_CurrentTransformEditorFoldout = EditorGUILayout.InspectorTitlebar(m_CurrentTransformEditorFoldout, Selection.activeTransform, true); if (m_CurrentTransformEditorFoldout && m_CurrentTransformEditor != null) { m_CurrentTransformEditor.OnInspectorGUI(); } } else if (m_CurrentTransformEditor != null) { DestroyImmediate(m_CurrentTransformEditor); m_CurrentTransformEditor = null; } }
public bool EditRenderers() { GameObject[] array; Renderer[] selectedObjectsOfType = SceneModeUtility.GetSelectedObjectsOfType <Renderer>(out array, new Type[] { typeof(MeshRenderer), typeof(SkinnedMeshRenderer) }); if (array.Length == 0) { return(false); } EditorGUILayout.InspectorTitlebar(selectedObjectsOfType); SerializedObject serializedObject = new SerializedObject(array); using (new EditorGUI.DisabledScope(!SceneModeUtility.StaticFlagField("Lightmap Static", serializedObject.FindProperty("m_StaticEditorFlags"), 1))) { SerializedObject serializedObject2 = new SerializedObject(selectedObjectsOfType); float num = LightmapVisualization.GetLightmapLODLevelScale(selectedObjectsOfType[0]); for (int i = 1; i < selectedObjectsOfType.Length; i++) { if (!Mathf.Approximately(num, LightmapVisualization.GetLightmapLODLevelScale(selectedObjectsOfType[i]))) { num = 1f; } } float lightmapScale = this.LightmapScaleGUI(serializedObject2, num) * LightmapVisualization.GetLightmapLODLevelScale(selectedObjectsOfType[0]); float cachedSurfaceArea = (!(selectedObjectsOfType[0] is MeshRenderer)) ? InternalMeshUtil.GetCachedSkinnedMeshSurfaceArea(selectedObjectsOfType[0] as SkinnedMeshRenderer) : InternalMeshUtil.GetCachedMeshSurfaceArea(selectedObjectsOfType[0] as MeshRenderer); this.ShowClampedSizeInLightmapGUI(lightmapScale, cachedSurfaceArea); EditorGUILayout.PropertyField(serializedObject2.FindProperty("m_ImportantGI"), LightingWindowObjectTab.s_Styles.ImportantGI, new GUILayoutOption[0]); LightingWindowObjectTab.LightmapParametersGUI(serializedObject2.FindProperty("m_LightmapParameters"), LightingWindowObjectTab.s_Styles.LightmapParameters, true); GUILayout.Space(10f); this.RendererUVSettings(serializedObject2); GUILayout.Space(10f); this.m_ShowBakedLM = EditorGUILayout.Foldout(this.m_ShowBakedLM, LightingWindowObjectTab.s_Styles.Atlas); if (this.m_ShowBakedLM) { this.ShowAtlasGUI(serializedObject2); } this.m_ShowRealtimeLM = EditorGUILayout.Foldout(this.m_ShowRealtimeLM, LightingWindowObjectTab.s_Styles.RealtimeLM); if (this.m_ShowRealtimeLM) { this.ShowRealtimeLMGUI(serializedObject2, selectedObjectsOfType[0]); } if (LightmapEditorSettings.HasZeroAreaMesh(selectedObjectsOfType[0])) { EditorGUILayout.HelpBox(LightingWindowObjectTab.s_Styles.ZeroAreaPackingMesh.text, MessageType.Warning); } if (LightmapEditorSettings.HasClampedResolution(selectedObjectsOfType[0])) { EditorGUILayout.HelpBox(LightingWindowObjectTab.s_Styles.ClampedPackingResolution.text, MessageType.Warning); } if (!LightingWindowObjectTab.HasNormals(selectedObjectsOfType[0])) { EditorGUILayout.HelpBox(LightingWindowObjectTab.s_Styles.NoNormalsNoLightmapping.text, MessageType.Warning); } serializedObject.ApplyModifiedProperties(); serializedObject2.ApplyModifiedProperties(); } GUILayout.Space(10f); return(true); }