private void Tab_DrawCorrections() { FGUI_Inspector.VSpace(-3, -4); GUILayout.BeginVertical(FGUI_Resources.ViewBoxStyle); GUILayout.BeginVertical(FGUI_Resources.BGInBoxStyle); GUILayout.Space(5f); El_DrawFixingPresetsSwitchesAndSettings(); EditorGUILayout.PropertyField(sp_angoff); EditorGUILayout.PropertyField(sp_backoff, new GUIContent("Backing Offset", sp_backoff.tooltip)); GUILayout.Space(3f); GUILayout.EndVertical(); GUILayout.BeginVertical(FGUI_Resources.BGInBoxBlankStyle); GUILayout.Space(3f); Fold_DrawBoneCorrectionRotations(); GUILayout.Space(5f); EditorGUILayout.PropertyField(sp_dray); GUILayout.Space(5f); GUILayout.EndVertical(); Fold_DrawHidden(); GUILayout.Space(-5f); GUILayout.EndVertical(); }
private void Tab_DrawLimiting() { FGUI_Inspector.VSpace(-3, -4); GUILayout.BeginVertical(FGUI_Resources.ViewBoxStyle); if (Application.isPlaying) { GUILayout.Space(6); GUI.enabled = false; EditorGUILayout.EnumPopup("Current Look State: ", Get.LookState); GUI.enabled = true; GUILayout.Space(5); } bool wrongLimit = false; if (Mathf.Abs(Get.XRotationLimits.x) > Get.StopLookingAbove) { wrongLimit = true; } if (Mathf.Abs(Get.XRotationLimits.y) > Get.StopLookingAbove) { wrongLimit = true; } El_DrawLimitXAngle(wrongLimit); El_DrawLimitYAngle(); if (Get.UseEyes) { El_DrawEyesLimitAngles(); } GUILayout.Space(-7f); GUILayout.EndVertical(); }
private void El_DrawLeadBone() { if (!Get.LeadBone) { GUILayout.BeginHorizontal(FGUI_Inspector.Style(new Color(0.9f, 0.2f, 0.2f, 0.2f), 0)); } else { GUILayout.BeginHorizontal(); } EditorGUILayout.PropertyField(sp_leadbone, new GUIContent("Lead bone / Head", sp_leadbone.tooltip)); El_DrawBoneSelectionButton(); if (Get.LeadBone != previousHead) { previousHead = Get.LeadBone; Get.UpdateForCustomInspector(); } if (GUILayout.Button(new GUIContent("Auto Find", "By pressing this button, algorithm will go trough hierarchy and try to find object which name includes 'head' or 'neck', be aware, this bone can not be correct but sure it will help you find right one quicker"), new GUILayoutOption[2] { GUILayout.MaxWidth(90), GUILayout.MaxHeight(18) })) { FindHeadBone(Get); EditorUtility.SetDirty(target); } GUILayout.EndHorizontal(); }
private void Tab_DrawSetup() { FGUI_Inspector.VSpace(-2, -4); GUILayout.BeginVertical(FGUI_Resources.ViewBoxStyle); if (Get.SpineBones == null) { Get.SpineBones = new System.Collections.Generic.List <FIMSpace.FSpine.FSpineAnimator.SpineBone>(); } El_BaseTransformsSetup(); GUILayout.Space(2f); GUILayout.BeginVertical(FGUI_Resources.BGInBoxLightStyle); GUILayout.Space(2f); EditorGUIUtility.labelWidth = 182f; EditorGUILayout.PropertyField(sp_forw, new GUIContent("Base Transform (Optional)", sp_forw.tooltip)); EditorGUIUtility.labelWidth = 0f; GUILayout.Space(2f); GUILayout.EndVertical(); GUILayout.Space(3f); GUILayout.BeginVertical(FGUI_Resources.BGInBoxBlankStyle); Fold_DrawSpineTransforms(); GUILayout.EndVertical(); GUILayout.BeginVertical(FGUI_Resources.BGInBoxLightStyle); GUILayout.Space(6f); GUILayout.BeginHorizontal(); EditorGUIUtility.labelWidth = 135f; EditorGUILayout.PropertyField(sp_LastBoneLeading, new GUIContent(Get.LastBoneLeading ? sp_LastBoneLeading.displayName : "Start Bone Is Head", sp_LastBoneLeading.tooltip)); EditorGUIUtility.labelWidth = 0f; if (GUILayout.Button(new GUIContent(Get.LastBoneLeading ? _TexLeadingRIcon : _TexLeadingLIcon), EditorStyles.label, new GUILayoutOption[] { GUILayout.Height(24), GUILayout.Width(96) })) { Get.LastBoneLeading = !Get.LastBoneLeading; } GUILayout.EndHorizontal(); EditorGUILayout.PropertyField(sp_ReverseForward); GUILayout.Space(5f); GUILayout.EndVertical(); GUILayout.Space(3f); GUILayout.Space(1f); GUILayout.BeginVertical(FGUI_Resources.BGInBoxBlankStyle); El_DrawAnimatorSetup(); GUILayout.EndVertical(); Fold_DrawAdditionalSetup(); GUILayout.EndVertical(); }
private void Tab_DrawTweaking() { FGUI_Inspector.VSpace(-2, -4); GUILayout.BeginVertical(FGUI_Resources.ViewBoxStyle); GUILayout.Space(7f); EditorGUIUtility.labelWidth = 160f; EditorGUILayout.PropertyField(sp_SpineAnimatorAmount); EditorGUIUtility.labelWidth = 0f; GUILayout.Space(4f); GUILayout.BeginVertical(FGUI_Resources.BGInBoxStyle); GUILayout.Space(2f); EditorGUILayout.BeginHorizontal(); if (drawFullPivotOffset) { EditorGUILayout.PropertyField(sp_MainPivotOffset); if (GUILayout.Button(new GUIContent("Z", "If you need only Z axis for pivot adjustement"), FGUI_Resources.ButtonStyle, new GUILayoutOption[2] { GUILayout.Width(20), GUILayout.Height(16) })) { drawFullPivotOffset = !drawFullPivotOffset; } } else { EditorGUI.BeginChangeCheck(); Get.MainPivotOffset.z = EditorGUILayout.FloatField(new GUIContent(sp_MainPivotOffset.displayName, sp_MainPivotOffset.tooltip), Get.MainPivotOffset.z); Get.MainPivotOffset.x = 0f; Get.MainPivotOffset.y = 0f; if (EditorGUI.EndChangeCheck()) { serializedObject.ApplyModifiedProperties(); Get.UpdatePivotOffsetState(); } if (GUILayout.Button(new GUIContent("XYZ", "If you want to adjust pivot offset with all axes - x,y,z"), FGUI_Resources.ButtonStyle, new GUILayoutOption[2] { GUILayout.Width(36), GUILayout.Height(16) })) { drawFullPivotOffset = !drawFullPivotOffset; } } EditorGUILayout.EndHorizontal(); GUILayout.Space(3f); GUILayout.EndVertical(); El_DrawBending(); El_DrawStraigtening(); El_DrawSmoothing(); GUILayout.Space(-5f); GUILayout.EndVertical(); }
private void Tab_DrawSetup() { FGUI_Inspector.VSpace(-3, -4); GUILayout.BeginVertical(FGUI_Resources.ViewBoxStyle); El_DrawBaseReferences(); //El_DrawAnimateWithSource(); Fold_DrawBackBones(); Fold_DrawCompensation(); Fold_DrawAdditionalSetup(); GUILayout.EndVertical(); }
private void Tab_DrawCorrections() { FGUI_Inspector.VSpace(-2, -4); GUILayout.BeginVertical(FGUI_Resources.ViewBoxStyle); GUILayout.Space(5f); EditorGUIUtility.labelWidth = 154f; EditorGUILayout.PropertyField(sp_DistancesMul); GUILayout.Space(5f); EditorGUIUtility.labelWidth = 0f; El_DrawFullChainCorrections(); El_DrawAnchoring(); //El_DrawRareCorrections(); GUILayout.Space(-4f); GUILayout.EndVertical(); }
private void Tab_DrawAdditionalFeatures() { FGUI_Inspector.VSpace(-3, -4); GUILayout.BeginVertical(FGUI_Resources.ViewBoxStyle); GUILayout.BeginVertical(FGUI_Resources.BGInBoxStyle); GUILayout.Space(5f); El_DrawNodding(); GUILayout.Space(3f); GUILayout.EndVertical(); GUILayout.BeginVertical(FGUI_Resources.BGInBoxLightStyle); GUILayout.Space(2f); Fold_DrawBirdMode(); GUILayout.Space(2f); GUILayout.EndVertical(); if (!Get._editor_hideEyes) { GUILayout.BeginVertical(FGUI_Resources.BGInBoxStyle); GUILayout.Space(2f); Fold_DrawEyesModule(); //GUILayout.BeginVertical(FGUI_Resources.BGInBoxLightStyle); //GUILayout.Space(2f); //Fold_DrawMomentTargets(); //GUILayout.Space(2f); //GUILayout.EndVertical(); } GUILayout.Space(-6f); GUILayout.EndVertical(); }
private void Tab_DrawTweaking() { FGUI_Inspector.VSpace(-2, -4); GUILayout.BeginVertical(FGUI_Resources.ViewBoxStyle); GUILayout.Space(4); EditorGUIUtility.labelWidth = 160f; EditorGUILayout.BeginVertical(FGUI_Resources.BGInBoxBlankStyle); EditorGUILayout.PropertyField(sp_TailAnimatorAmount); EditorGUIUtility.labelWidth = 0f; EditorGUILayout.EndVertical(); GUI.color = c; GUILayout.Space(-1f); Fold_TweakingBending(); Fold_TweakingLimiting(); Fold_TweakingSmoothing(); Fold_TweakingAdditional(); GUILayout.Space(-5f); GUILayout.EndVertical(); }
private void Fold_DrawAdditionalSetup() { GUILayout.BeginVertical(FGUI_Resources.BGInBoxStyle); if (GUILayout.Button(new GUIContent(FGUI_Resources.GetFoldSimbol(drawAdditionalSetup, 10, "►") + " Optimization & More", FGUI_Resources.TexAddIcon), FGUI_Resources.FoldStyle)) { drawAdditionalSetup = !drawAdditionalSetup; } if (drawAdditionalSetup) { if (animatorAnimPhys && Get.AnimatePhysics == false) { FGUI_Inspector.DrawWarning(" Unity's Animator is using 'Animate Physics'!"); GUI.color = new Color(.9f, .9f, 0.6f, 1f); } GUILayout.Space(5); EditorGUILayout.BeginHorizontal(); EditorGUILayout.PropertyField(sp_animphys); GUILayout.FlexibleSpace(); EditorGUILayout.PropertyField(sp_starttpose); EditorGUILayout.EndHorizontal(); GUI.color = Color.white; GUILayout.Space(3); El_DrawOptimizeWithMesh(); //GUILayout.Space(2); //if (Get.DetectZeroKeyframes == 0) GUI.color = unchangedC; //EditorGUILayout.PropertyField(sp_DetectZeroKeyframes); //GUI.color = c; GUILayout.Space(4f); } GUILayout.EndVertical(); GUILayout.Space(-5); }
private void Tab_DrawTweaking() { FGUI_Inspector.VSpace(-3, -4); GUILayout.BeginVertical(FGUI_Resources.ViewBoxStyle); GUILayout.BeginVertical(FGUI_Resources.BGInBoxBlankStyle); El_DrawToFollow(); GUILayout.Space(8); EditorGUILayout.PropertyField(sp_rotspd); GUILayout.Space(2f); if (Get.BirdMode && Get.UltraSmoother > 0.7f) { GUI.color = new Color(1f, 0.88f, 0.88f, 0.95f); } else if (Get.UltraSmoother <= 0f) { GUI.color = unchangedC; } EL_DrawUltraSmooth180(); GUI.color = c; EditorGUIUtility.labelWidth = 160f; EL_DrawBlendToOriginal(); EditorGUIUtility.labelWidth = 0f; GUILayout.EndVertical(); Fold_DrawBehaviourSettings(); Fold_DrawTargeting(); Fold_DrawAddMotionSettings(); GUILayout.EndVertical(); }
private void Tab_DrawPreSetup() { FGUI_Inspector.VSpace(-2, -4); GUILayout.BeginVertical(FGUI_Resources.ViewBoxStyle); GUILayout.Space(7f); GUI.color = new Color(1f, 1f, 1f, 0.7f); EditorGUILayout.LabelField(Lang("Select right bones of your model"), FGUI_Resources.HeaderStyle); GUI.color = c; EditorGUIUtility.labelWidth = 42f; if (startBone == null) { TryFindStartBone(); } if (endBone == null) { TryFindEndBone(); } if (startBone != null && endBone != null) { if (!IsChildOf(endBone, startBone)) { EditorGUILayout.HelpBox("! '" + startBone.name + "' is not child of '" + endBone.name + "' !", MessageType.Error); } } GUILayout.Space(12f); // START CHAIN BONE EditorGUILayout.BeginHorizontal(); startBone = (Transform)EditorGUILayout.ObjectField(new GUIContent("Start", "Put here first bone in hierarchy depth for automatically get chain of bones to end one"), startBone, typeof(Transform), true); // Select bone button if (largestSkin) { El_DrawBoneSelectionButton(true, ref Get._gizmosEditorStartPreview, Get.GetBaseTransform()); } // Go left / right in hierarchy icon if (startBone != null) { if (GUILayout.Button(new GUIContent("◄", "Get Parent Bone Of Current Selected"), FGUI_Resources.ButtonStyle, new GUILayoutOption[2] { GUILayout.Width(20), GUILayout.Height(16) })) { startBone = startBone.parent; EditorGUIUtility.PingObject(startBone); } if (startBone) { if (startBone.childCount > 0) { if (GUILayout.Button(new GUIContent("►", "Get Child Bone Of Current Selected"), FGUI_Resources.ButtonStyle, new GUILayoutOption[2] { GUILayout.Width(20), GUILayout.Height(16) })) { startBone = startBone.GetChild(0); EditorGUIUtility.PingObject(startBone); } } } } GUI.enabled = false; EditorGUILayout.LabelField(new GUIContent("(Pelvis + legs)", "Start bone should be pelvis bone which's children are legs"), GUILayout.Width(91)); GUI.enabled = true; EditorGUILayout.EndHorizontal(); // MIDDLE SPINE CHAIN ICON GUILayout.Space(7f); if (GUILayout.Button(new GUIContent(_TexSpineWideIcon, skins.Count > 0 ? "Click to toggle meshes visibility" : ""), FGUI_Resources.HeaderStyle, GUILayout.Height(24))) { hideSkin = !hideSkin; // Switching mesh visibility if can if (hideSkin) { for (int i = 0; i < skins.Count; i++) { skins[i].shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.ShadowsOnly; } } else { for (int i = 0; i < skins.Count; i++) { skins[i].shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.On; } } } //EditorGUILayout.LabelField(new GUIContent(_TexSpineWideIcon), FGUI_Resources.HeaderStyle, GUILayout.Height(24)); GUILayout.Space(10f); // END CHAIN BONE EditorGUILayout.BeginHorizontal(); endBone = (Transform)EditorGUILayout.ObjectField(new GUIContent("End", "Put here last bone in hierarchy depth for automatically get chain of bones from start one"), endBone, typeof(Transform), true); // Select bone button if (largestSkin) { El_DrawBoneSelectionButton(false, ref Get._gizmosEditorEndPreview, startBone); } // Go left / right in hierarchy icon if (endBone != null) { if (startBone != null) { if (endBone.childCount > 0) { if (GUILayout.Button(new GUIContent("L"), FGUI_Resources.ButtonStyle, new GUILayoutOption[2] { GUILayout.Width(20), GUILayout.Height(16) })) { endBone = GetLastChild(startBone); EditorGUIUtility.PingObject(endBone); } } } if (GUILayout.Button(new GUIContent("◄", "Get Parent Bone Of Current Selected"), FGUI_Resources.ButtonStyle, new GUILayoutOption[2] { GUILayout.Width(20), GUILayout.Height(16) })) { endBone = endBone.parent; EditorGUIUtility.PingObject(endBone); } if (endBone) { if (endBone.childCount > 0) { if (GUILayout.Button(new GUIContent("►", "Get Child Bone Of Current Selected"), FGUI_Resources.ButtonStyle, new GUILayoutOption[2] { GUILayout.Width(20), GUILayout.Height(16) })) { endBone = endBone.GetChild(0); EditorGUIUtility.PingObject(endBone); } } } } else { if (startBone != null) { if (GUILayout.Button(new GUIContent("L"), FGUI_Resources.ButtonStyle, new GUILayoutOption[2] { GUILayout.Width(20), GUILayout.Height(16) })) { endBone = GetLastChild(startBone); EditorGUIUtility.PingObject(endBone); } } } GUI.enabled = false; EditorGUILayout.LabelField(new GUIContent("(Neck/Head/Chest)", "End bone should be head/neck/chest bone of your model - depends what motion you want to achieve"), GUILayout.Width(120)); GUI.enabled = true; EditorGUILayout.EndHorizontal(); GUILayout.Space(12f); if (startBone == null || endBone == null) { GUI.enabled = false; } if (GUILayout.Button(new GUIContent(Lang("Create Spine Chain") + " (Get Bones)"))) { if (!IsChildOf(endBone, startBone)) { Debug.LogError("! '" + startBone.name + "' is not child of '" + endBone.name + "' !"); } else { Get.CreateSpineChain(Get._gizmosEditorStartPreview, Get._gizmosEditorEndPreview); EditorUtility.SetDirty(target); } if (Application.isPlaying) { Get.Init(); } drawSetup = true; drawTweaking = true; } GUI.enabled = true; GUILayout.Space(3f); EditorGUILayout.HelpBox(Lang("Lang_SpineCreateInfo"), MessageType.Info); //EditorGUILayout.HelpBox("After creating spine chain you will unlock rest of the parameters (You will be able to adjust it again after that)", MessageType.Info); GUILayout.EndVertical(); }
private void Tab_DrawPhysics() { FGUI_Inspector.VSpace(-2, -4); GUILayout.BeginVertical(FGUI_Resources.ViewBoxStyle); // Gravity power GUILayout.Space(7f); EditorGUILayout.PropertyField(sp_GravityPower, true); GUILayout.Space(5f); // Physics switch button GUILayout.BeginVertical(FGUI_Resources.BGInBoxLightStyle); GUILayout.Space(2f); // Tab to switch collisions GUILayout.BeginHorizontal(); if (Get.UseCollisions) { if (GUILayout.Button(new GUIContent(" " + FGUI_Resources.GetFoldSimbol(drawColl, 8, "►") + " " + Lang("Use Collisions") + " (Experimental)", FGUI_Resources.Tex_Collider, sp_UseCollisions.tooltip), FGUI_Resources.FoldStyle, GUILayout.Height(21))) { drawColl = !drawColl; } } else if (GUILayout.Button(new GUIContent(" " + Lang("Use Collisions") + " (Experimental)", FGUI_Resources.Tex_Collider, sp_UseCollisions.tooltip), FGUI_Resources.FoldStyle, GUILayout.Height(21))) { Get.UseCollisions = !Get.UseCollisions; serializedObject.ApplyModifiedProperties(); } GUILayout.FlexibleSpace(); EditorGUILayout.PropertyField(sp_UseCollisions, new GUIContent("", sp_UseCollisions.tooltip), GUILayout.Width(22)); GUILayout.EndHorizontal(); // if (Get.UseCollisions && drawColl) { GUILayout.Space(5f); GUI.color = new Color(0.85f, 1f, 0.85f, 1f); EditorGUILayout.BeginHorizontal(FGUI_Resources.HeaderBoxStyleH); string f = FGUI_Resources.GetFoldSimbol(drawInclud); int iconSize = 24; int inclC = Get.IncludedColliders.Count; GUI.color = c; GUILayout.Label(new GUIContent(" "), GUILayout.Width(1)); if (GUILayout.Button(new GUIContent(" " + f + " " + Lang("Collide With") + " (" + (inclC == 0 ? "0 !!!)" : inclC + ")"), FGUI_Resources.TexBehaviourIcon), FGUI_Resources.FoldStyle, GUILayout.Height(24))) { drawInclud = !drawInclud; } if (drawInclud) { if (GUILayout.Button("+", new GUILayoutOption[2] { GUILayout.MaxWidth(24), GUILayout.MaxHeight(22) })) { Get.IncludedColliders.Add(null); serializedObject.Update(); serializedObject.ApplyModifiedProperties(); } } EditorGUILayout.EndHorizontal(); if (drawInclud) { FGUI_Inspector.VSpace(-3, -5); GUI.color = new Color(0.6f, .9f, 0.6f, 1f); EditorGUILayout.BeginVertical(FGUI_Resources.BGInBoxStyleH); GUI.color = c; GUILayout.Space(5f); // Drawing colliders from list if (Get.IncludedColliders.Count == 0) { EditorGUILayout.LabelField("Please add here colliders", FGUI_Resources.HeaderStyle); GUILayout.Space(2f); } else { EditorGUI.BeginChangeCheck(); for (int i = 0; i < Get.IncludedColliders.Count; i++) { EditorGUILayout.BeginHorizontal(); Get.IncludedColliders[i] = (Collider)EditorGUILayout.ObjectField(Get.IncludedColliders[i], typeof(Collider), true); if (GUILayout.Button("X", new GUILayoutOption[2] { GUILayout.MaxWidth(22), GUILayout.MaxHeight(16) })) { Get.IncludedColliders.RemoveAt(i); serializedObject.Update(); serializedObject.ApplyModifiedProperties(); return; } EditorGUILayout.EndHorizontal(); } if (EditorGUI.EndChangeCheck()) { Get.CheckForColliderDuplicates(); serializedObject.Update(); serializedObject.ApplyModifiedProperties(); } } GUILayout.Space(6f); // Lock button GUILayout.BeginVertical(); if (ActiveEditorTracker.sharedTracker.isLocked) { GUI.color = new Color(0.44f, 0.44f, 0.44f, 0.8f); } else { GUI.color = new Color(0.95f, 0.95f, 0.99f, 0.9f); } if (GUILayout.Button(new GUIContent("Lock Inspector for Drag & Drop Colliders", "Drag & drop colliders to 'Included Colliders' List from the hierarchy"), FGUI_Resources.ButtonStyle, GUILayout.Height(18))) { ActiveEditorTracker.sharedTracker.isLocked = !ActiveEditorTracker.sharedTracker.isLocked; } GUI.color = c; GUILayout.EndVertical(); // Drag and drop box El_DrawDragAndDropCollidersBox(); GUILayout.Space(3f); EditorGUILayout.EndVertical(); } GUILayout.Space(5f); f = FGUI_Resources.GetFoldSimbol(drawCollSetup); GUI.color = new Color(1f, .85f, .85f, 1f); EditorGUILayout.BeginHorizontal(FGUI_Resources.HeaderBoxStyleH); iconSize = 22; GUI.color = c; GUILayout.Label(new GUIContent(" "), GUILayout.Width(1)); if (GUILayout.Button(FGUI_Resources.Tex_GearSetup, EditorStyles.label, new GUILayoutOption[2] { GUILayout.Width(iconSize), GUILayout.Height(iconSize) })) { drawCollSetup = !drawCollSetup; } if (GUILayout.Button(f + " " + "Colliders Setup" + " " + f, FGUI_Resources.HeaderStyle, GUILayout.Height(24))) { drawCollSetup = !drawCollSetup; } if (GUILayout.Button(FGUI_Resources.Tex_GearSetup, EditorStyles.label, new GUILayoutOption[2] { GUILayout.Width(iconSize), GUILayout.Height(iconSize) })) { drawCollSetup = !drawCollSetup; } GUILayout.Label(new GUIContent(" "), GUILayout.Width(1)); EditorGUILayout.EndHorizontal(); if (drawCollSetup) { FGUI_Inspector.VSpace(-3, -5); GUI.color = new Color(1f, .55f, .55f, 1f); EditorGUILayout.BeginVertical(FGUI_Resources.BGInBoxStyleH); GUI.color = c; GUILayout.Space(6f); EditorGUILayout.PropertyField(sp_CollidersScaleMul, new GUIContent("Scale Multiplier")); EditorGUILayout.PropertyField(sp_CollidersScale, new GUIContent("Scale Curve")); EditorGUILayout.PropertyField(sp_CollidersAutoCurve, new GUIContent("Auto Curve")); EditorGUILayout.PropertyField(sp_AllCollidersOffset, true); GUILayout.Space(6f); El_DrawSelectiveCollision(); GUILayout.Space(3f); EditorGUILayout.EndVertical(); } GUILayout.Space(5f); if (Get.UseTruePosition) { GUI.color = new Color(1f, 0.7f, 0.7f, 1f); } else { GUI.color = new Color(1f, 1f, 0.7f, 1f); } GUILayout.BeginVertical(FGUI_Resources.BGInBoxLightStyle); GUILayout.Space(2f); EditorGUILayout.PropertyField(sp_UseTruePosition, true); GUILayout.Space(2f); GUILayout.EndVertical(); GUI.color = c; GUILayout.BeginVertical(FGUI_Resources.BGInBoxStyle); GUILayout.Space(2f); EditorGUILayout.PropertyField(sp_DetailedCollision, true); GUILayout.Space(2f); GUILayout.EndVertical(); GUILayout.Space(2f); } GUILayout.Space(2f); GUILayout.EndVertical(); GUILayout.Space(-5f); GUILayout.EndVertical(); }
private void Tab_DrawTweaking() { FGUI_Inspector.VSpace(-2, -4); GUILayout.BeginVertical(FGUI_Resources.ViewBoxStyle); GUILayout.Space(7f); EditorGUIUtility.labelWidth = 160f; EditorGUILayout.PropertyField(sp_SpineAnimatorAmount); EditorGUIUtility.labelWidth = 0f; GUILayout.Space(4f); GUILayout.BeginVertical(FGUI_Resources.BGInBoxStyle); GUILayout.Space(2f); EditorGUILayout.BeginHorizontal(); if (Get._Editor_PivotoffsetXYZ) { EditorGUILayout.PropertyField(sp_MainPivotOffset); if (GUILayout.Button(new GUIContent("Z", "If you need only Z axis for pivot adjustement"), FGUI_Resources.ButtonStyle, new GUILayoutOption[2] { GUILayout.Width(20), GUILayout.Height(16) })) { Get._Editor_PivotoffsetXYZ = !Get._Editor_PivotoffsetXYZ; } } else { EditorGUI.BeginChangeCheck(); Get.MainPivotOffset.z = EditorGUILayout.FloatField(new GUIContent(sp_MainPivotOffset.displayName, sp_MainPivotOffset.tooltip), Get.MainPivotOffset.z); Get.MainPivotOffset.x = 0f; Get.MainPivotOffset.y = 0f; if (EditorGUI.EndChangeCheck()) { serializedObject.ApplyModifiedProperties(); Get.UpdatePivotOffsetState(); } if (GUILayout.Button(new GUIContent("XYZ", "If you want to adjust pivot offset with all axes - x,y,z"), FGUI_Resources.ButtonStyle, new GUILayoutOption[2] { GUILayout.Width(36), GUILayout.Height(16) })) { Get._Editor_PivotoffsetXYZ = !Get._Editor_PivotoffsetXYZ; } } EditorGUILayout.EndHorizontal(); #if UNITY_2018_4_OR_NEWER if (Application.isPlaying == false) { // Not in islotated scene mode if (Get.transform.gameObject.scene.rootCount != 1) { SerializedProperty p = serializedObject.FindProperty("mainPivotOffsetTransform"); if (p.objectReferenceValue == null) { GameObject prefabed; prefabed = PrefabUtility.GetNearestPrefabInstanceRoot(Get); if (PrefabUtility.GetPrefabAssetType(Get) == PrefabAssetType.Model) { prefabed = null; } if (prefabed != null) { EditorGUILayout.HelpBox("Pivot offset can be generated only inside prefab mode!", MessageType.None); } } } } #endif GUILayout.Space(3f); GUILayout.EndVertical(); El_DrawBending(); El_DrawStraigtening(); El_DrawSmoothing(); GUILayout.Space(-5f); GUILayout.EndVertical(); }
private void DrawNewGUI() { #region Preparations for unity versions and skin c = Color.Lerp(GUI.color * new Color(0.8f, 0.8f, 0.8f, 0.7f), GUI.color, Mathf.InverseLerp(0f, 0.15f, Get.LookAnimatorAmount)); RectOffset zeroOff = new RectOffset(0, 0, 0, 0); float bgAlpha = 0.05f; if (EditorGUIUtility.isProSkin) { bgAlpha = 0.1f; } #if UNITY_2019_3_OR_NEWER int headerHeight = 22; #else int headerHeight = 25; #endif #endregion GUILayout.BeginVertical(FGUI_Resources.BGBoxStyle); GUILayout.Space(1f); GUILayout.BeginVertical(FGUI_Inspector.Style(zeroOff, zeroOff, new Color(.7f, .7f, 0.7f, bgAlpha), Vector4.one * 3, 3)); FGUI_Inspector.HeaderBox(ref drawSetup, Lang("Character Setup"), true, FGUI_Resources.Tex_GearSetup, headerHeight, headerHeight - 1, LangBig()); if (drawSetup) { Tab_DrawSetup(); } GUILayout.EndVertical(); // ------------------------------------------------------------------------ GUILayout.BeginVertical(FGUI_Inspector.Style(zeroOff, zeroOff, new Color(.3f, .4f, 1f, bgAlpha), Vector4.one * 3, 3)); FGUI_Inspector.HeaderBox(ref drawTweaking, Lang("Tweak Animation"), true, FGUI_Resources.Tex_Sliders, headerHeight, headerHeight - 1, LangBig()); if (drawTweaking) { Tab_DrawTweaking(); } GUILayout.EndVertical(); // ------------------------------------------------------------------------ GUILayout.BeginVertical(FGUI_Inspector.Style(zeroOff, zeroOff, new Color(.675f, .675f, 0.275f, bgAlpha), Vector4.one * 3, 3)); FGUI_Inspector.HeaderBox(ref drawLimiting, Lang("Limit Animation Behaviour"), true, FGUI_Resources.Tex_Knob, headerHeight, headerHeight - 1, LangBig()); Get._gizmosDrawingLimiting = drawLimiting; if (drawLimiting) { Tab_DrawLimiting(); } GUILayout.EndVertical(); // ------------------------------------------------------------------------ GUILayout.BeginVertical(FGUI_Inspector.Style(zeroOff, zeroOff, new Color(.3f, 1f, .7f, bgAlpha), Vector4.one * 3, 3)); FGUI_Inspector.HeaderBox(ref drawAdditional, Lang("Additional Modules"), true, FGUI_Resources.Tex_Module, headerHeight, headerHeight - 1, LangBig()); if (drawAdditional) { Tab_DrawAdditionalFeatures(); } GUILayout.EndVertical(); // ------------------------------------------------------------------------ GUILayout.BeginVertical(FGUI_Inspector.Style(zeroOff, zeroOff, new Color(1f, .4f, .4f, bgAlpha * 0.5f), Vector4.one * 3, 3)); FGUI_Inspector.HeaderBox(ref drawCorrecting, Lang("Corrections"), true, FGUI_Resources.Tex_Repair, headerHeight, headerHeight - 1, LangBig()); if (drawCorrecting) { Tab_DrawCorrections(); } GUILayout.EndVertical(); GUILayout.Space(2f); GUILayout.EndVertical(); }
private void HeaderBoxMain(string title, ref bool drawGizmos, ref bool defaultInspector, Texture2D scrIcon, MonoBehaviour target, int height = 22) { EditorGUILayout.BeginVertical(FGUI_Resources.HeaderBoxStyle); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button(new GUIContent(scrIcon), EditorStyles.label, new GUILayoutOption[2] { GUILayout.Width(height - 2), GUILayout.Height(height - 2) })) { MonoScript script = MonoScript.FromMonoBehaviour(target); if (script) { EditorGUIUtility.PingObject(script); } drawHeaderFoldout = !drawHeaderFoldout; } if (GUILayout.Button(title, FGUI_Resources.GetTextStyle(14, true, TextAnchor.MiddleLeft), GUILayout.Height(height))) { MonoScript script = MonoScript.FromMonoBehaviour(target); if (script) { EditorGUIUtility.PingObject(script); } drawHeaderFoldout = !drawHeaderFoldout; } if (EditorGUIUtility.currentViewWidth > 326) { // Youtube channel button if (GUILayout.Button(new GUIContent(FGUI_Resources.Tex_Tutorials, "Open FImpossible Creations Channel with tutorial videos in your web browser"), FGUI_Resources.ButtonStyle, new GUILayoutOption[2] { GUILayout.Width(height), GUILayout.Height(height) })) { Application.OpenURL("https://www.youtube.com/c/FImpossibleCreations"); } } if (EditorGUIUtility.currentViewWidth > 292) { // Store site button if (GUILayout.Button(new GUIContent(FGUI_Resources.Tex_Website, "Open FImpossible Creations Asset Store Page inside your web browser"), FGUI_Resources.ButtonStyle, new GUILayoutOption[2] { GUILayout.Width(height), GUILayout.Height(height) })) { Application.OpenURL("https://assetstore.unity.com/publishers/37262"); } } // Manual file button if (_manualFile == null) { _manualFile = AssetDatabase.LoadAssetAtPath <UnityEngine.Object>(System.IO.Path.GetDirectoryName(AssetDatabase.GetAssetPath(MonoScript.FromMonoBehaviour(target))) + "/Spine Animator User Manual.pdf"); } if (_manualFile) { if (GUILayout.Button(new GUIContent(FGUI_Resources.Tex_Manual, "Open .PDF user manual file for Spine Animator"), FGUI_Resources.ButtonStyle, new GUILayoutOption[2] { GUILayout.Width(height), GUILayout.Height(height) })) { EditorGUIUtility.PingObject(_manualFile); Application.OpenURL(Application.dataPath + "/" + AssetDatabase.GetAssetPath(_manualFile).Replace("Assets/", "")); } } FGUI_Inspector.DrawSwitchButton(ref drawGizmos, FGUI_Resources.Tex_GizmosOff, FGUI_Resources.Tex_Gizmos, "Toggle drawing gizmos on character in scene window", height, height, true); FGUI_Inspector.DrawSwitchButton(ref drawHeaderFoldout, FGUI_Resources.Tex_LeftFold, FGUI_Resources.Tex_DownFold, "Toggle to view additional options for foldouts", height, height); EditorGUILayout.EndHorizontal(); if (drawHeaderFoldout) { FGUI_Inspector.DrawUILine(0.07f, 0.1f, 1, 4, 0.99f); EditorGUILayout.BeginHorizontal(); EditorGUI.BeginChangeCheck(); choosedLang = (ELangs)EditorGUILayout.EnumPopup(choosedLang, new GUIStyle(EditorStyles.layerMaskField) { fixedHeight = 0 }, new GUILayoutOption[2] { GUILayout.Width(80), GUILayout.Height(22) }); if (EditorGUI.EndChangeCheck()) { PlayerPrefs.SetInt("FimposLang", (int)choosedLang); SetupLangs(); } GUILayout.FlexibleSpace(); bool hierSwitchOn = PlayerPrefs.GetInt("AnimsH", 1) == 1; FGUI_Inspector.DrawSwitchButton(ref hierSwitchOn, FGUI_Resources.Tex_HierSwitch, null, "Switch drawing small icons in hierarchy", height, height, true); PlayerPrefs.SetInt("AnimsH", hierSwitchOn ? 1 : 0); if (GUILayout.Button(new GUIContent(FGUI_Resources.Tex_Rename, "Change component title to yours (current: '" + Get._editor_Title + "'"), FGUI_Resources.ButtonStyle, new GUILayoutOption[2] { GUILayout.Width(height), GUILayout.Height(height) })) { string filename = EditorUtility.SaveFilePanelInProject("Type your title (no file will be created)", Get._editor_Title, "", "Type your title (no file will be created)"); if (!string.IsNullOrEmpty(filename)) { filename = System.IO.Path.GetFileNameWithoutExtension(filename); if (!string.IsNullOrEmpty(filename)) { Get._editor_Title = filename; serializedObject.ApplyModifiedProperties(); } } } // Default inspector switch FGUI_Inspector.DrawSwitchButton(ref drawNewInspector, FGUI_Resources.Tex_AB, null, "Switch GUI Style to old / new", height, height, true); if (!drawNewInspector && drawDefaultInspector) { drawDefaultInspector = false; } // Old new UI Button FGUI_Inspector.DrawSwitchButton(ref defaultInspector, FGUI_Resources.Tex_Default, null, "Toggle inspector view to default inspector.\n\nIf you ever edit source code of Look Animator and add custom variables, you can see them by entering this mode, also sometimes there can be additional/experimental variables to play with.", height, height); if (!drawNewInspector && drawDefaultInspector) { drawNewInspector = false; } EditorGUILayout.EndHorizontal(); } EditorGUILayout.EndVertical(); }
void DrawNewGUI() { #region Preparations for unity versions and skin c = Color.Lerp(GUI.color * new Color(0.8f, 0.8f, 0.8f, 0.7f), GUI.color, Mathf.InverseLerp(0f, 0.15f, Get.SpineAnimatorAmount)); RectOffset zeroOff = new RectOffset(0, 0, 0, 0); float bgAlpha = 0.05f; if (EditorGUIUtility.isProSkin) { bgAlpha = 0.1f; } #if UNITY_2019_3_OR_NEWER int headerHeight = 22; #else int headerHeight = 25; #endif if (Get.SpineBones == null) { Get.SpineBones = new System.Collections.Generic.List <FIMSpace.FSpine.FSpineAnimator.SpineBone>(); } #endregion GUILayout.BeginVertical(FGUI_Resources.BGBoxStyle); GUILayout.Space(1f); // ------------------------------------------------------------------------ // If spine setup is not finished, then not drawing rest of the inspector if (Get.SpineBones.Count <= 1) { GUILayout.BeginVertical(FGUI_Inspector.Style(zeroOff, zeroOff, new Color(.7f, .7f, 0.7f, bgAlpha), Vector4.one * 3, 3)); EditorGUILayout.BeginHorizontal(FGUI_Resources.HeaderBoxStyle); GUILayout.Label(new GUIContent(" "), GUILayout.Width(1)); if (GUILayout.Button(new GUIContent(FGUI_Resources.Tex_GearSetup), EditorStyles.label, new GUILayoutOption[2] { GUILayout.Width(headerHeight), GUILayout.Height(headerHeight) })) { } if (GUILayout.Button(Lang("Prepare Spine Chain"), LangBig() ? FGUI_Resources.HeaderStyleBig : FGUI_Resources.HeaderStyle, GUILayout.Height(headerHeight))) { } if (GUILayout.Button(new GUIContent(FGUI_Resources.Tex_Repair), EditorStyles.label, new GUILayoutOption[2] { GUILayout.Width(headerHeight), GUILayout.Height(headerHeight) })) { } GUILayout.Label(new GUIContent(" "), GUILayout.Width(1)); EditorGUILayout.EndHorizontal(); Tab_DrawPreSetup(); GUILayout.EndVertical(); GUILayout.EndVertical(); return; } GUILayout.BeginVertical(FGUI_Inspector.Style(zeroOff, zeroOff, new Color(.7f, .7f, 0.7f, bgAlpha), Vector4.one * 3, 3)); FGUI_Inspector.HeaderBox(ref drawSetup, Lang("Character Setup"), true, FGUI_Resources.Tex_GearSetup, headerHeight, headerHeight - 1, LangBig()); Get._editorSetupDrawing = drawSetup; if (drawSetup) { Tab_DrawSetup(); } GUILayout.EndVertical(); // ------------------------------------------------------------------------ GUILayout.BeginVertical(FGUI_Inspector.Style(zeroOff, zeroOff, new Color(.3f, .4f, 1f, bgAlpha), Vector4.one * 3, 3)); FGUI_Inspector.HeaderBox(ref drawTweaking, Lang("Tweak Animation"), true, FGUI_Resources.Tex_Sliders, headerHeight, headerHeight - 1, LangBig()); if (drawTweaking) { Tab_DrawTweaking(); } GUILayout.EndVertical(); // ------------------------------------------------------------------------ GUILayout.BeginVertical(FGUI_Inspector.Style(zeroOff, zeroOff, new Color(.825f, .825f, 0.225f, bgAlpha * 0.8f), Vector4.one * 3, 3)); FGUI_Inspector.HeaderBox(ref drawCorrecting, Lang("Adjustements"), true, FGUI_Resources.Tex_Repair, headerHeight, headerHeight - 1, LangBig()); if (drawCorrecting) { Tab_DrawCorrections(); } GUILayout.EndVertical(); // ------------------------------------------------------------------------ GUILayout.BeginVertical(FGUI_Inspector.Style(zeroOff, zeroOff, new Color(.4f, 1f, .7f, bgAlpha), Vector4.one * 3, 3)); FGUI_Inspector.HeaderBox(ref drawPhysics, Lang("Physical Parameters"), true, FGUI_Resources.Tex_Physics, headerHeight, headerHeight - 1, LangBig()); Get._editorPhysicsDrawing = drawPhysics; if (drawPhysics) { Tab_DrawPhysics(); } GUILayout.EndVertical(); // ------------------------------------------------------------------------ GUILayout.EndVertical(); }
private void El_DrawEyesLimitAngles() { FGUI_Inspector.HeaderBox(Lang("Eyes Module") + " Limits", true, _TexEyesIcon, 22, 22 - 1, LangBig()); GUILayout.BeginVertical(FGUI_Resources.BGInBoxBlankStyle); GUILayout.Space(3f); // X GUILayout.BeginHorizontal(); GUILayout.Label(" Clamp Angle Horizontal (X)", GUILayout.MaxWidth(170f)); GUILayout.FlexibleSpace(); EditorGUILayout.BeginHorizontal(FGUI_Resources.FrameBoxStyle); GUILayout.Label(Mathf.Round(Get.EyesXRange.x) + "°", GUILayout.MaxWidth(30f)); EditorGUILayout.EndHorizontal(); FEditor_CustomInspectorHelpers.DrawMinMaxSphere(Get.EyesXRange.x, Get.EyesXRange.y, 14); EditorGUILayout.BeginHorizontal(FGUI_Resources.FrameBoxStyle); GUILayout.Label(Mathf.Round(Get.EyesXRange.y) + "°", GUILayout.MaxWidth(30f)); EditorGUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); EditorGUILayout.MinMaxSlider(ref Get.EyesXRange.x, ref Get.EyesXRange.y, -90f, 90f); eyesbothX = EditorGUILayout.Slider("Adjust symmetrical", eyesbothX, 1f, 90f); if (eyeslastBothX != eyesbothX) { Get.EyesXRange.x = -eyesbothX; Get.EyesXRange.y = eyesbothX; eyeslastBothX = eyesbothX; serializedObject.ApplyModifiedProperties(); EditorUtility.SetDirty(target); } GUILayout.Space(7f); GUILayout.EndVertical(); GUILayout.BeginVertical(FGUI_Resources.BGInBoxLightStyle); // Y GUILayout.Space(5f); GUILayout.BeginHorizontal(); GUILayout.Label(" Clamp Angle Vertical (Y)", GUILayout.MaxWidth(170f)); GUILayout.FlexibleSpace(); EditorGUILayout.BeginHorizontal(FGUI_Resources.FrameBoxStyle); GUILayout.Label(Mathf.Round(Get.EyesYRange.x) + "°", GUILayout.MaxWidth(30f)); EditorGUILayout.EndHorizontal(); //GUILayout.Label(Mathf.Round(Get.EyesYRange.x) + "°", FEditor_Styles.GrayBackground, GUILayout.MaxWidth(40f)); FEditor_CustomInspectorHelpers.DrawMinMaxVertSphere(-Get.EyesYRange.y, -Get.EyesYRange.x, 14); EditorGUILayout.BeginHorizontal(FGUI_Resources.FrameBoxStyle); GUILayout.Label(Mathf.Round(Get.EyesYRange.y) + "°", GUILayout.MaxWidth(30f)); EditorGUILayout.EndHorizontal(); //GUILayout.Label(Mathf.Round(Get.EyesYRange.y) + "°", FEditor_Styles.GrayBackground, GUILayout.MaxWidth(40f)); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); EditorGUILayout.MinMaxSlider(ref Get.EyesYRange.x, ref Get.EyesYRange.y, -90f, 90f); eyesbothY = EditorGUILayout.Slider("Adjust symmetrical", eyesbothY, 1f, 90f); if (eyeslastBothY != eyesbothY) { Get.EyesYRange.x = -eyesbothY; Get.EyesYRange.y = eyesbothY; eyeslastBothY = eyesbothY; serializedObject.ApplyModifiedProperties(); EditorUtility.SetDirty(target); } GUILayout.Space(9f); GUILayout.EndVertical(); GUILayout.Space(3f); }
private void Tab_DrawSetup() { FGUI_Inspector.VSpace(-2, -4); GUILayout.BeginVertical(FGUI_Resources.ViewBoxStyle); GUILayout.BeginVertical(FGUI_Resources.BGInBoxBlankStyle); GUILayout.Space(7f); Transform startField = Get.StartBone; if (Get.StartBone == null) { startField = Get.transform; GUI.color = new Color(1f, 1f, 1f, 0.7f); } if (topWarningAlpha > 0f) { if (topWarning != "") { GUI.color = new Color(c.r, c.g, c.b, c.a * Mathf.Min(1f, topWarningAlpha)); //EditorGUILayout.HelpBox(topWarning, MessageType.Info); if (GUILayout.Button(topWarning, FGUI_Inspector.Style(new Color(0.8f, 0.8f, 0f, 0.1f), 0), GUILayout.ExpandWidth(true))) { topWarningAlpha = 0f; } GUI.color = c; topWarningAlpha -= 0.05f; } } EditorGUI.BeginChangeCheck(); EditorGUIUtility.labelWidth = 82; Transform preStart = Get.StartBone; if (Application.isPlaying) { GUI.enabled = false; } try { GUILayout.BeginHorizontal(); } catch (System.Exception) { GUILayout.BeginHorizontal(); } Transform startB = (Transform)EditorGUILayout.ObjectField(new GUIContent(sp_StartBone.displayName), startField, typeof(Transform), true); if (startB != preStart) { Get.EndBone = null; serializedObject.ApplyModifiedProperties(); } if (Application.isPlaying) { GUI.enabled = true; } //bool canInclude = false; //if (startB) if (startB.parent) canInclude = true; bool boneInSkin = true; if (skins.Count != 0) { boneInSkin = false; for (int s = 0; s < skins.Count; s++) { if (boneInSkin) { break; } for (int i = 0; i < skins[s].bones.Length; i++) { if (startB == skins[s].bones[i]) { boneInSkin = true; break; } } } } if (!boneInSkin) { GUILayout.Space(4); EditorGUILayout.LabelField(new GUIContent(FGUI_Resources.Tex_Warning, "'Start Bone' was not found in mesh renderer of this object, are you sure you assigned correct 'Start Bone'?"), new GUILayoutOption[] { GUILayout.Height(18), GUILayout.Width(20) }); } { EditorGUI.BeginChangeCheck(); Get.IncludeParent = EditorGUILayout.IntPopup(new GUIContent("", "If start bone should be included in tail motion or just be anchor for rest of the bones"), Get.IncludeParent ? 1 : 0, setp_includeParentNames, setp_includeParent, GUILayout.Width(64)) == 1; if (EditorGUI.EndChangeCheck()) { GetSelectedTailAnimators(); for (int i = 0; i < lastSelected.Count; i++) { lastSelected[i].IncludeParent = Get.IncludeParent; new SerializedObject(lastSelected[i]).ApplyModifiedProperties(); } } //if (Get.IncludeParent) // if (!canInclude) // { // GUILayout.Space(4); // EditorGUILayout.LabelField(new GUIContent(FGUI_Resources.Tex_Info, "Start bone need to have parent in order to be included in chain.\nAfter entering playmode this parameter will be set to 'Excluded'"), new GUILayoutOption[] { GUILayout.Height(18), GUILayout.Width(20) }); // } } GUILayout.EndHorizontal(); EditorGUIUtility.labelWidth = 0; if (EditorGUI.EndChangeCheck()) { Get.StartBone = startB; serializedObject.ApplyModifiedProperties(); Get.GetGhostChain(); serializedObject.Update(); } GUI.color = c; GUILayout.Space(4f); GUILayout.EndVertical(); GUILayout.BeginVertical(FGUI_Resources.BGInBoxStyle); Fold_TailChainSetup(); GUILayout.Space(-5f); GUILayout.EndVertical(); //Fold_DrawCoreAnimatorSetup(); Fold_DrawAdditionalSetup(); GUILayout.EndVertical(); }
private void Tab_DrawShaping() { FGUI_Inspector.VSpace(-2, -4); GUILayout.BeginVertical(FGUI_Resources.ViewBoxStyle); GUILayout.BeginVertical(FGUI_Resources.BGInBoxBlankStyle); GUILayout.Space(2f); EditorGUIUtility.labelWidth = 120; if (FEngineering.QIsZero(Get.RotationOffset)) { GUI.color = defaultValC; } else { GUI.color = c; } EditorGUI.BeginChangeCheck(); Get.RotationOffset = Quaternion.Euler(EditorGUILayout.Vector3Field(new GUIContent(sp_tailRotOff.displayName, sp_tailRotOff.tooltip), FEngineering.WrapVector(Get.RotationOffset.eulerAngles))); if (EditorGUI.EndChangeCheck()) { serializedObject.ApplyModifiedProperties(); GetSelectedTailAnimators(); for (int i = 0; i < lastSelected.Count; i++) { lastSelected[i].RotationOffset = Get.RotationOffset; new SerializedObject(lastSelected[i]).ApplyModifiedProperties(); } } // Curving Tail GUILayout.Space(2f); if (FEngineering.QIsZero(Get.Curving) && !Get.UseCurlingCurve) { GUI.color = defaultValC; } else { GUI.color = c; } EditorGUILayout.BeginHorizontal(); EditorGUI.BeginChangeCheck(); Get.Curving = Quaternion.Euler(EditorGUILayout.Vector3Field(new GUIContent(sp_curving.displayName, sp_curving.tooltip), FEngineering.WrapVector(Get.Curving.eulerAngles))); if (EditorGUI.EndChangeCheck()) { serializedObject.ApplyModifiedProperties(); GetSelectedTailAnimators(); for (int i = 0; i < lastSelected.Count; i++) { lastSelected[i].Curving = Get.Curving; new SerializedObject(lastSelected[i]).ApplyModifiedProperties(); } } if (Get.UseCurvingCurve) { EditorGUILayout.LabelField(new GUIContent("*", "Curving offset value weight for tail segments multiplied by curve"), GUILayout.Width(9)); EditorGUILayout.PropertyField(sp_CurvCurve, new GUIContent("", sp_curving.tooltip), GUILayout.MaxWidth(32)); } else { GUILayout.Space(4f); } EditorGUI.BeginChangeCheck(); SwitchButton(ref Get.UseCurvingCurve, "Spread curving rotation offset weight over tail segments", curveIcon); if (EditorGUI.EndChangeCheck()) { GetSelectedTailAnimators(); for (int i = 0; i < lastSelected.Count; i++) { lastSelected[i].UseCurvingCurve = Get.UseCurvingCurve; new SerializedObject(lastSelected[i]).ApplyModifiedProperties(); } } EditorGUILayout.EndHorizontal(); GUILayout.Space(3f); // Length Stretch if (Get.LengthMultiplier == 1f && !Get.UseLengthMulCurve) { GUI.color = defaultValC; } else { GUI.color = c; } EditorGUILayout.BeginHorizontal(); if (!Get.UseLengthMulCurve) { EditorGUILayout.PropertyField(sp_LengthMultiplier); GUILayout.Space(4f); EditorGUI.BeginChangeCheck(); SwitchButton(ref Get.UseLengthMulCurve, "Spread length multiplier weight over tail segments", curveIcon); if (EditorGUI.EndChangeCheck()) { GetSelectedTailAnimators(); for (int i = 0; i < lastSelected.Count; i++) { lastSelected[i].UseLengthMulCurve = Get.UseLengthMulCurve; new SerializedObject(lastSelected[i]).ApplyModifiedProperties(); } } } else { EditorGUILayout.PropertyField(sp_LengthMulCurve, new GUIContent(sp_LengthMultiplier.displayName, sp_LengthMultiplier.tooltip)); GUILayout.Space(4f); EditorGUI.BeginChangeCheck(); SwitchButton(ref Get.UseLengthMulCurve, "Spread length multiplier weight over tail segments", curveIcon); if (EditorGUI.EndChangeCheck()) { GetSelectedTailAnimators(); for (int i = 0; i < lastSelected.Count; i++) { lastSelected[i].UseLengthMulCurve = Get.UseLengthMulCurve; new SerializedObject(lastSelected[i]).ApplyModifiedProperties(); } } } EditorGUILayout.EndHorizontal(); EditorGUIUtility.labelWidth = 0; GUILayout.EndVertical(); GUILayout.EndVertical(); }
private void Tab_DrawAdditionalFeatures() { FGUI_Inspector.VSpace(-2, -3); EditorGUILayout.BeginHorizontal(FGUI_Resources.HeaderBoxStyle); DrawCategoryButton(TailAnimator2.ETailFeaturesCategory.Main, FGUI_Resources.Tex_Movement, "Main"); DrawCategoryButton(TailAnimator2.ETailFeaturesCategory.Collisions, FGUI_Resources.Tex_Collider, "Collisions"); DrawCategoryButton(TailAnimator2.ETailFeaturesCategory.IK, _TexIKIcon, "IK"); DrawCategoryButton(TailAnimator2.ETailFeaturesCategory.Experimental, _TexDeflIcon, "Experimental"); EditorGUILayout.EndHorizontal(); GUILayout.Space(3); GUILayout.BeginVertical(FGUI_Resources.ViewBoxStyle); if (Get._Editor_FeaturesCategory == TailAnimator2.ETailFeaturesCategory.Main) { // Waving GUILayout.BeginVertical(FGUI_Resources.BGInBoxLightStyle); GUILayout.Space(5f); Fold_ModuleWaving(); GUILayout.Space(3f); GUILayout.EndVertical(); // Partial Blend GUILayout.BeginVertical(FGUI_Resources.BGInBoxLightStyle); GUILayout.Space(2f); Fold_ModulePartialBlend(); GUILayout.Space(2f); GUILayout.EndVertical(); // Max Distance GUILayout.BeginVertical(FGUI_Resources.BGInBoxStyle); GUILayout.Space(2f); Fold_ModuleMaxDistance(); GUILayout.Space(2f); GUILayout.EndVertical(); } else if (Get._Editor_FeaturesCategory == TailAnimator2.ETailFeaturesCategory.Collisions) { // Module Collision GUILayout.BeginVertical(FGUI_Resources.BGInBoxStyle); GUILayout.Space(2f); Fold_ModuleCollisions(); GUILayout.Space(2f); GUILayout.EndVertical(); } else if (Get._Editor_FeaturesCategory == TailAnimator2.ETailFeaturesCategory.IK) { // IK GUILayout.BeginVertical(FGUI_Resources.BGInBoxStyle); GUILayout.Space(2f); Fold_ModuleIK(); GUILayout.Space(2f); GUILayout.EndVertical(); } else if (Get._Editor_FeaturesCategory == TailAnimator2.ETailFeaturesCategory.Experimental) { // Deflection Module GUILayout.BeginVertical(FGUI_Resources.BGInBoxLightStyle); GUILayout.Space(2f); Fold_ModuleDeflection(); GUILayout.Space(2f); GUILayout.EndVertical(); // Physical effectors GUILayout.BeginVertical(FGUI_Resources.BGInBoxLightStyle); GUILayout.Space(2f); Fold_ModulePhysEffectors(); GUILayout.Space(2f); GUILayout.EndVertical(); } GUILayout.Space(-5f); GUILayout.EndVertical(); }
private void Fold_DrawBirdMode() { GUILayout.BeginHorizontal(); if (Get.BirdMode) { if (GUILayout.Button(new GUIContent(" " + FGUI_Resources.GetFoldSimbol(drawBirdMode, 10, "►") + " " + Lang("Bird Mode"), _TexBirdIcon, sp_bird.tooltip), LangBig() ? FGUI_Resources.FoldStyleBig : FGUI_Resources.FoldStyle)) { drawBirdMode = !drawBirdMode; } Get.BirdMode = EditorGUILayout.Toggle(Get.BirdMode, GUILayout.Width(16)); } else { GUILayout.Button(new GUIContent(" " + Lang("Bird Mode"), _TexBirdIcon, sp_bird.tooltip), LangBig() ? FGUI_Resources.FoldStyleBig : FGUI_Resources.FoldStyle); Get.BirdMode = EditorGUILayout.Toggle(Get.BirdMode, GUILayout.Width(16)); } GUILayout.EndHorizontal(); if (drawBirdMode && Get.BirdMode) { //FGUI_Inspector.DrawUILine(0.1f, 0.8f, 1, 4, 1f); if (Get.RotationSpeed < 1.85f) { GUILayout.Space(3f); GUILayout.BeginHorizontal(); EditorGUILayout.HelpBox("To make bird mode look better increase 'Rotation Speed' Parameter under Tweaking Tab", MessageType.Warning); if (GUILayout.Button("Adjust", new GUILayoutOption[] { GUILayout.Width(48), GUILayout.Height(38) })) { Get.MaxRotationSpeed = 2.5f; Get.RotationSpeed = 2.35f; } GUILayout.EndHorizontal(); } else if (Get.MaxRotationSpeed < 1.8f) { GUILayout.Space(3f); GUILayout.BeginHorizontal(); EditorGUILayout.HelpBox("To make bird mode look better increase 'Max Rotation Speed' Parameter under 'Additional Motion Settings' Tab", MessageType.Info); if (GUILayout.Button("Adjust", new GUILayoutOption[] { GUILayout.Width(48), GUILayout.Height(38) })) { Get.MaxRotationSpeed = 2.5f; } GUILayout.EndHorizontal(); } GUILayout.Space(5f); EditorGUILayout.PropertyField(sp_birdlag); EditorGUILayout.PropertyField(sp_birdfreq); FGUI_Inspector.DrawUILine(0.1f, 0.05f, 1, 12, 0.95f); EditorGUILayout.PropertyField(sp_birddel); if (Get.DelayPosition > 0f) { EditorGUILayout.PropertyField(sp_birmaxdist); EditorGUILayout.PropertyField(sp_birddelgospeed); } GUILayout.Space(5f); } }
void El_DrawSelectiveCollisionBox2D() { GUILayout.Space(1f); GUI.color = new Color(0.85f, 1f, 0.85f, 1f); EditorGUILayout.BeginHorizontal(FGUI_Resources.HeaderBoxStyleH); string f = FGUI_Resources.GetFoldSimbol(drawInclud); int inclC = Get.IncludedColliders2D.Count; GUI.color = c; GUILayout.Label(new GUIContent(" "), GUILayout.Width(1)); string inclColFoldTitle = ""; inclColFoldTitle = "2D " + Lang("Collide With") + " (" + (inclC == 0 ? "None" : inclC.ToString()) + ")"; if (GUILayout.Button(new GUIContent(" " + f + " " + inclColFoldTitle, FGUI_Resources.TexBehaviourIcon), FGUI_Resources.FoldStyle, GUILayout.Height(24))) { drawInclud = !drawInclud; } if (drawInclud) { if (GUILayout.Button("+", new GUILayoutOption[2] { GUILayout.MaxWidth(24), GUILayout.MaxHeight(22) })) { Get.IncludedColliders2D.Add(null); serializedObject.Update(); serializedObject.ApplyModifiedProperties(); } } EditorGUILayout.EndHorizontal(); if (drawInclud) { FGUI_Inspector.VSpace(-3, -5); GUI.color = new Color(0.6f, .9f, 0.6f, 1f); EditorGUILayout.BeginVertical(FGUI_Resources.BGInBoxStyleH); GUI.color = c; GUILayout.Space(5f); EditorGUILayout.HelpBox("2D Collision is supported ONLY FOR CIRCLE, CAPSULE, BOX and POLYGON colliders for now!", MessageType.None); // Drawing colliders from list if (Get.IncludedColliders2D.Count == 0) { EditorGUILayout.LabelField("Please add here 2D colliders", FGUI_Resources.HeaderStyle); GUILayout.Space(2f); } else { Get.CheckForColliderDuplicatesAndNulls2D(); EditorGUI.BeginChangeCheck(); for (int i = 0; i < Get.IncludedColliders2D.Count; i++) { EditorGUILayout.BeginHorizontal(); if (Get.IncludedColliders2D[i] != null) { if (!Get.IncludedColliders2D[i].gameObject.activeInHierarchy) { GUI.color = new Color(1f, 1f, 1f, 0.5f); } Get.IncludedColliders2D[i] = (Collider2D)EditorGUILayout.ObjectField(Get.IncludedColliders2D[i], typeof(Collider2D), true); if (!Get.IncludedColliders2D[i].gameObject.activeInHierarchy) { GUI.color = c; } } else { Get.IncludedColliders2D[i] = (Collider2D)EditorGUILayout.ObjectField(Get.IncludedColliders2D[i], typeof(Collider2D), true); } if (GUILayout.Button("X", new GUILayoutOption[2] { GUILayout.MaxWidth(22), GUILayout.MaxHeight(16) })) { Get.IncludedColliders2D.RemoveAt(i); serializedObject.Update(); serializedObject.ApplyModifiedProperties(); return; } EditorGUILayout.EndHorizontal(); } if (EditorGUI.EndChangeCheck()) { Get.CheckForColliderDuplicatesAndNulls(); serializedObject.Update(); serializedObject.ApplyModifiedProperties(); } } GUILayout.Space(3f); // Lock button GUILayout.BeginVertical(); if (ActiveEditorTracker.sharedTracker.isLocked) { GUI.color = new Color(0.44f, 0.44f, 0.44f, 0.8f); } else { GUI.color = new Color(0.95f, 0.95f, 0.99f, 0.9f); } if (GUILayout.Button(new GUIContent("Lock Inspector for Drag & Drop Colliders", "Drag & drop colliders to 'Included Colliders' List from the hierarchy"), FGUI_Resources.ButtonStyle, GUILayout.Height(18))) { ActiveEditorTracker.sharedTracker.isLocked = !ActiveEditorTracker.sharedTracker.isLocked; } GUI.color = c; GUILayout.EndVertical(); // Drag and drop box El_DrawDragAndDropCollidersBox(); GUILayout.Space(3f); EditorGUILayout.EndVertical(); } }
void El_DrawSelectiveCollisionBox() { Get._editor_IsInspectorViewingIncludedColliders = drawInclud; GUILayout.Space(1f); GUI.color = new Color(0.85f, 1f, 0.85f, 1f); EditorGUILayout.BeginHorizontal(FGUI_Resources.HeaderBoxStyleH); string f = FGUI_Resources.GetFoldSimbol(drawInclud); int inclC = Get.IncludedColliders.Count; GUI.color = c; GUILayout.Label(new GUIContent(" "), GUILayout.Width(1)); string inclColFoldTitle = ""; if (Get.DynamicWorldCollidersInclusion) { if (Application.isPlaying) { inclColFoldTitle = Lang("Collide With") + " (Dynamic" + " : " + inclC + ")"; } else { inclColFoldTitle = "Always Include (" + inclC + ")"; } } else { inclColFoldTitle = Lang("Collide With") + " (" + (inclC == 0 ? "0 !!!" : inclC.ToString()) + ")"; } if (GUILayout.Button(new GUIContent(" " + f + " " + inclColFoldTitle, FGUI_Resources.TexBehaviourIcon), FGUI_Resources.FoldStyle, GUILayout.Height(24))) { drawInclud = !drawInclud; } //if (!Application.isPlaying) // if (Get.DynamicWorldCollidersInclusion) drawInclud = false; //bool checkNullIncludColls = true; if (drawInclud) { //if (GUILayout.Button("+", new GUILayoutOption[2] { GUILayout.MaxWidth(24), GUILayout.MaxHeight(22) })) //{ // Get.IncludedColliders.Add(null); // //Get._editor_checkInclCollidersForNulls = -10; // //checkNullIncludColls = false; // serializedObject.Update(); // serializedObject.ApplyModifiedProperties(); //} } EditorGUILayout.EndHorizontal(); if (drawInclud) { FGUI_Inspector.VSpace(-3, -5); GUI.color = new Color(0.6f, .9f, 0.6f, 1f); EditorGUILayout.BeginVertical(FGUI_Resources.BGInBoxStyleH); GUI.color = c; GUILayout.Space(5f); // Drawing colliders from list if (Get.IncludedColliders.Count == 0) { EditorGUILayout.LabelField("Please add here colliders", FGUI_Resources.HeaderStyle); GUILayout.Space(2f); } else { Get.CheckForColliderDuplicatesAndNulls(); EditorGUI.BeginChangeCheck(); for (int i = 0; i < Get.IncludedColliders.Count; i++) { EditorGUILayout.BeginHorizontal(); if (Get.IncludedColliders[i] != null) { if (!Get.IncludedColliders[i].gameObject.activeInHierarchy) { GUI.color = new Color(1f, 1f, 1f, 0.5f); } Get.IncludedColliders[i] = (Collider)EditorGUILayout.ObjectField(Get.IncludedColliders[i], typeof(Collider), true); if (!Get.IncludedColliders[i].gameObject.activeInHierarchy) { GUI.color = c; } } if (GUILayout.Button("X", new GUILayoutOption[2] { GUILayout.MaxWidth(22), GUILayout.MaxHeight(16) })) { Get.IncludedColliders.RemoveAt(i); serializedObject.Update(); serializedObject.ApplyModifiedProperties(); return; } EditorGUILayout.EndHorizontal(); } if (EditorGUI.EndChangeCheck()) { Get.CheckForColliderDuplicatesAndNulls(); serializedObject.Update(); serializedObject.ApplyModifiedProperties(); } } GUILayout.Space(6f); // Lock button GUILayout.BeginVertical(); if (ActiveEditorTracker.sharedTracker.isLocked) { GUI.color = new Color(0.44f, 0.44f, 0.44f, 0.8f); } else { GUI.color = new Color(0.95f, 0.95f, 0.99f, 0.9f); } if (GUILayout.Button(new GUIContent("Lock Inspector for Drag & Drop Colliders", "Drag & drop colliders to 'Included Colliders' List from the hierarchy"), FGUI_Resources.ButtonStyle, GUILayout.Height(18))) { ActiveEditorTracker.sharedTracker.isLocked = !ActiveEditorTracker.sharedTracker.isLocked; } GUI.color = c; GUILayout.EndVertical(); // Drag and drop box El_DrawDragAndDropCollidersBox(); GUILayout.Space(3f); if (Get.IncludedColliders.Count > 0) { EditorGUILayout.HelpBox("You can disable collider components on the objects - tail animator will still detect collision. If you deactivate the Game Object with collider - tail animator will not detect collision with it.", MessageType.Info); } EditorGUILayout.EndVertical(); } }
void DrawNewGUI() { #region Preparations for unity versions and skin c = Color.Lerp(GUI.color * new Color(0.8f, 0.8f, 0.8f, 0.7f), GUI.color, Mathf.InverseLerp(0f, 0.15f, Get.TailAnimatorAmount)); bc = GUI.backgroundColor; RectOffset zeroOff = new RectOffset(0, 0, 0, 0); float substr = .18f; float bgAlpha = 0.08f; if (EditorGUIUtility.isProSkin) { bgAlpha = 0.1f; substr = 0f; } #if UNITY_2019_3_OR_NEWER int headerHeight = 22; #else int headerHeight = 25; #endif Get._editor_IsInspectorViewingColliders = Get._Editor_FeaturesCategory == TailAnimator2.ETailFeaturesCategory.Collisions; Get._editor_IsInspectorViewingIncludedColliders = drawInclud && Get._editor_IsInspectorViewingColliders; Get.RefreshTransformsList(); #endregion GUILayout.Space(2); EditorGUILayout.BeginHorizontal(); DrawCategoryButton(TailAnimator2.ETailCategory.Setup, FGUI_Resources.Tex_GearSetup, "Setup"); DrawCategoryButton(TailAnimator2.ETailCategory.Tweak, FGUI_Resources.Tex_Sliders, "Tweak"); DrawCategoryButton(TailAnimator2.ETailCategory.Features, FGUI_Resources.Tex_Module, "Features"); DrawCategoryButton(TailAnimator2.ETailCategory.Shaping, FGUI_Resources.Tex_Repair, "Shaping"); EditorGUILayout.EndHorizontal(); GUILayout.Space(4); switch (Get._Editor_Category) { case TailAnimator2.ETailCategory.Setup: GUILayout.BeginVertical(FGUI_Inspector.Style(zeroOff, zeroOff, new Color(.7f - substr, .7f - substr, 0.7f - substr, bgAlpha), Vector4.one * 3, 3)); FGUI_Inspector.HeaderBox(Lang("Main Setup"), true, FGUI_Resources.Tex_GearSetup, headerHeight, headerHeight - 1, LangBig()); Tab_DrawSetup(); GUILayout.EndVertical(); break; case TailAnimator2.ETailCategory.Tweak: GUILayout.BeginVertical(FGUI_Inspector.Style(zeroOff, zeroOff, new Color(.3f - substr, .4f - substr, 1f - substr, bgAlpha), Vector4.one * 3, 3)); FGUI_Inspector.HeaderBox(Lang("Tweak Animation"), true, FGUI_Resources.Tex_Sliders, headerHeight, headerHeight - 1, LangBig()); Tab_DrawTweaking(); GUILayout.EndVertical(); break; case TailAnimator2.ETailCategory.Features: GUILayout.BeginVertical(FGUI_Inspector.Style(zeroOff, zeroOff, new Color(.4f - substr, 1f - substr, .8f - substr, bgAlpha * 0.6f), Vector4.one * 3, 3)); //FGUI_Inspector.HeaderBox(Lang("Additional Modules"), true, FGUI_Resources.Tex_Module, headerHeight, headerHeight - 1, LangBig()); Tab_DrawAdditionalFeatures(); GUILayout.EndVertical(); break; case TailAnimator2.ETailCategory.Shaping: GUILayout.BeginVertical(FGUI_Inspector.Style(zeroOff, zeroOff, new Color(1f - substr, .55f - substr, .55f - substr, bgAlpha * 0.5f), Vector4.one * 3, 3)); FGUI_Inspector.HeaderBox(Lang("Additional Shaping"), true, FGUI_Resources.Tex_Repair, headerHeight, headerHeight - 1, LangBig()); Tab_DrawShaping(); GUILayout.EndVertical(); break; } GUILayout.Space(2f); }