private void DrawActions() { EditorGUILayout.LabelField("Synchronize"); EditorGUILayout.BeginHorizontal(); EditorGUILayout.BeginVertical(); LizEditorGUIUtil.BeginLabelWidth(50); m_From = EditorGUILayout.ObjectField("From", m_From, typeof(Outfit), true) as Outfit; m_To = EditorGUILayout.ObjectField("To", m_To, typeof(Outfit), true) as Outfit; LizEditorGUIUtil.EndLabelWidth(); EditorGUILayout.EndVertical(); GUI.enabled = (m_From && m_To); var settings = Target; if (GUILayout.Button("Apply", GUILayout.MaxWidth(70))) { SynchronizeState( m_To, m_From, settings.IncludeBlockedStatus, settings.IncludeContext, settings.IncludeContext); } GUI.enabled = true; EditorGUILayout.EndHorizontal(); }
private void DrawSettingsActions() { EditorGUILayout.Space(); EditorGUILayout.LabelField("Inspector Settings", EditorStyles.boldLabel); LizEditorGUIUtil.BeginLabelWidth(80); OutfitterEditorUtil.AutoOffset = EditorGUILayout.Slider(AutoOffsetLabel, OutfitterEditorUtil.AutoOffset, 0, 5); LizEditorGUIUtil.EndLabelWidth(); }
public void DrawColliderActions() { const float BtnWidth = 60; EditorGUILayout.LabelField("Manage Colliders"); var outfit = Target; LizEditorGUIUtil.BeginLabelWidth(50); EditorGUILayout.LabelField("Behavior"); EditorGUILayout.BeginHorizontal(); m_RigidbodyBehaviorChoice = (RigidbodyBehavior)EditorGUILayout.EnumPopup(m_RigidbodyBehaviorChoice); GUI.enabled = outfit.BodyPartCount > 0; if (GUILayout.Button(BodyPartStatusLabel, GUILayout.MaxWidth(BtnWidth))) { ApplyBodyPartColliderStatus(outfit, m_RigidbodyBehaviorChoice); } GUI.enabled = true; GUI.enabled = outfit.PrimaryRigidbody; if (GUILayout.Button(PrimaryStatusLabel, GUILayout.MaxWidth(BtnWidth))) { LizEditorGUIUtil.SetRigidbodyBehavior(outfit.PrimaryRigidbody, m_RigidbodyBehaviorChoice); } GUI.enabled = true; EditorGUILayout.EndHorizontal(); EditorGUILayout.LabelField("Layer"); EditorGUILayout.BeginHorizontal(); m_ColliderLayer = EditorGUILayout.LayerField(m_ColliderLayer); GUI.enabled = outfit.BodyPartCount > 0; if (GUILayout.Button(BodyPartStatusLabel, GUILayout.MaxWidth(BtnWidth))) { ApplyBodyPartLayer(outfit, m_ColliderLayer); } GUI.enabled = true; GUI.enabled = outfit.PrimaryCollider; if (GUILayout.Button(PrimaryStatusLabel, GUILayout.MaxWidth(BtnWidth))) { SetPrimaryColliderLayer(outfit, m_ColliderLayer); } GUI.enabled = true; EditorGUILayout.EndHorizontal(); LizEditorGUIUtil.EndLabelWidth(); }
private void DrawMaterialAction(OutfitMaterialType matType) { var outfit = Target; LizEditorGUIUtil.BeginLabelWidth(70); var cmat = outfit.GetSharedMaterial(matType); var nmat = EditorGUILayout.ObjectField(matType.ToString(), cmat, typeof(Material), false) as Material; LizEditorGUIUtil.EndLabelWidth(); if (nmat || nmat != cmat) { ApplyOutfitMaterial(outfit, matType, nmat); } }
public override void OnInspectorGUI() { LizEditorGUIUtil.BeginLabelWidth(115); base.OnInspectorGUI(); LizEditorGUIUtil.EndLabelWidth(); EditorGUILayout.Space(); var targ = target as BodyPrototyperManager; var prefix = targ.InvertButtons ? "Mouse0: Rotate camera.\nMouse1: Rotate body." : "Mouse0: Rotate body.\nMouse1: Rotate camera."; EditorGUILayout.HelpBox(prefix + "\nMouse2: Camera height.\nWheel: Camera distance.", MessageType.None); }
public void DrawBodyPartActions() { EditorGUILayout.LabelField("Body Parts"); LizEditorGUIUtil.BeginLabelWidth(70); m_ContextChoice = EditorGUILayout.ObjectField(ContextLabel, m_ContextChoice, typeof(GameObject), true) as GameObject; var outfit = Target; EditorGUILayout.BeginHorizontal(); m_PartTypeChoice = (BodyPartType)EditorGUILayout.EnumPopup(m_PartTypeChoice); if (m_ColliderPopup == null) { m_ColliderPopup = new LocalComponentPopup(typeof(Collider), false); } m_ColliderChoice = m_ColliderPopup.OnGUI( EditorGUILayout.GetControlRect(false, EditorGUIUtility.singleLineHeight * 1.1f), m_ColliderChoice, GUIContent.none, outfit.gameObject) as Collider; EditorGUILayout.EndHorizontal(); GUI.enabled = m_ColliderChoice; if (GUILayout.Button("Create Boby Part")) { if (m_ColliderChoice.gameObject.GetComponent <BodyPart>()) { Debug.LogError(m_ColliderChoice.name + " Already has a body part attached.", outfit); } else if (outfit.GetBodyPart(m_PartTypeChoice)) { Debug.LogError("Outfit already has a body part of type: " + m_PartTypeChoice, outfit); } else { // Note for prefabs: If there is a missing body part in the array before the action and the // user undoes the action, the mount point array may end up containing an invalid reference // to the prefab's asset. This appears to be some kind of prefab related bug. const string undoLabel = "Create Body Part"; Undo.IncrementCurrentGroup(); Undo.RecordObjects(Outfit.UnsafeGetUndoObjects(outfit).ToArray(), undoLabel); // For refresh. var bp = Undo.AddComponent <BodyPart>(m_ColliderChoice.gameObject); Undo.RecordObject(bp, undoLabel); bp.Collider = m_ColliderChoice; bp.PartType = m_PartTypeChoice; bp.Context = m_ContextChoice; StandardOutfit.UnsafeRefreshBodyParts(outfit); Undo.CollapseUndoOperations(Undo.GetCurrentGroup()); m_ColliderChoice = null; } } GUI.enabled = true; EditorGUILayout.BeginHorizontal(); if (GUILayout.Button(ApplyBodyPartContextLabel)) { string undoLabel = "Apply Body Part Context"; Undo.IncrementCurrentGroup(); Undo.RecordObjects(Outfit.UnsafeGetUndoObjects(outfit).ToArray(), undoLabel); outfit.ApplyBodyPartContext(m_ContextChoice); Undo.CollapseUndoOperations(Undo.GetCurrentGroup()); } if (GUILayout.Button(RefreshBodyPartsLabel)) { Undo.RecordObject(outfit, "Refresh Body Parts"); StandardOutfit.UnsafeRefreshBodyParts(outfit, false); } if (GUILayout.Button(ResetBodyPartsLabel)) { Undo.RecordObject(outfit, "Reset Body Parts"); StandardOutfit.UnsafeClearBodyParts(outfit); } EditorGUILayout.EndHorizontal(); LizEditorGUIUtil.EndLabelWidth(); }