public override void OnInspectorGUI() { Undo.RecordObject(target, "Spine Animator Inspector"); serializedObject.Update(); FSpineAnimator Get = (FSpineAnimator)target; string title = drawDefaultInspector ? " Default Inspector" : " " + Get._editor_Title; if (!drawNewInspector) { title = " Old GUI Version"; } if (EditorPrefs.GetInt("FSpineHeader", 1) == 1) { HeaderBoxMain(title, ref Get.DrawGizmos, ref drawDefaultInspector, _TexSpineAnimIcon, Get, 27); GUILayout.Space(4f); } else { GUILayout.Space(2f); } #region Default Inspector if (drawDefaultInspector) { // Draw default inspector without not needed properties DrawPropertiesExcluding(serializedObject, new string[0] { }); } else #endregion { if (drawNewInspector) { GUILayout.Space(4f); DrawNewGUI(); } else { DrawOldGUI(); } } SetupLangs(); // Apply changed parameters variables serializedObject.ApplyModifiedProperties(); }
protected virtual void DrawPhysicalOptionsTab(FSpineAnimator spine) { EditorGUIUtility.labelWidth = 130; EditorGUILayout.BeginVertical(FEditor_Styles.Style(new Color(0.9f, 0.9f, 0.9f, 0.15f))); EditorGUI.indentLevel++; GUILayout.BeginHorizontal(FEditor_Styles.LGrayBackground); drawCollisionParams = EditorGUILayout.Foldout(drawCollisionParams, "Collisions (Experimental)", true); GUILayout.EndHorizontal(); if (drawCollisionParams) { GUILayout.Space(3f); DrawPhysicsStuff(spine); } EditorGUI.indentLevel--; EditorGUILayout.EndVertical(); EditorGUIUtility.labelWidth = 0; }
protected bool CheckForAnimator(FSpineAnimator spineAnimator) { Animation animation = null; Animator animator = spineAnimator.GetComponentInChildren <Animator>(); if (!animator) { if (spineAnimator.transform.parent) { if (spineAnimator.transform.parent.parent) { animator = spineAnimator.transform.parent.parent.GetComponentInChildren <Animator>(); } else { animator = spineAnimator.transform.parent.GetComponent <Animator>(); } } } if (!animator) { animation = spineAnimator.GetComponentInChildren <Animation>(); if (!animation) { if (spineAnimator.transform.parent) { if (spineAnimator.transform.parent.parent) { animation = spineAnimator.transform.parent.parent.GetComponentInChildren <Animation>(); } else { animation = spineAnimator.transform.parent.GetComponent <Animation>(); } } } } if (!animator && !animation) { if (spineAnimator.BaseTransform) { animator = spineAnimator.BaseTransform.GetComponentInChildren <Animator>(); if (!animator) { animation = spineAnimator.BaseTransform.GetComponentInChildren <Animation>(); } } if (!animator && !animation) { if (spineAnimator.SpineBones.Count > 0) { if (spineAnimator.SpineBones[0].transform.parent) { animator = spineAnimator.SpineBones[0].transform.parent.GetComponentInChildren <Animator>(); if (!animator) { animation = spineAnimator.SpineBones[0].transform.parent.GetComponentInChildren <Animation>(); } } } } } if (spineAnimator.SyncWithAnimator) { if (animator) { if (animator.runtimeAnimatorController == null) { EditorGUILayout.HelpBox("No 'Animator Controller' inside Animator", MessageType.Warning); animator = null; } } } if (animator != null || animation != null) { if (animator) { if (!animator.enabled) { return(false); } } if (animation) { if (!animation.enabled) { return(false); } } return(true); } else { return(false); } }
private void DrawPhysicsStuff(FSpineAnimator spine) { EditorGUIUtility.labelWidth = 140; EditorGUILayout.BeginVertical(FEditor_Styles.GrayBackground); EditorGUILayout.PropertyField(sp_UseCollisions); if (spine.UseCollisions) { if (!Application.isPlaying) { EditorGUILayout.HelpBox("Collision support is experimental and not working fully correct yet.", MessageType.Info); if (spine.IncludedColliders.Count == 0) { EditorGUILayout.BeginVertical(FEditor_Styles.RedBackground); } else { EditorGUILayout.BeginVertical(FEditor_Styles.Emerald); } Color c = GUI.color; 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"), EditorStyles.toolbarButton)) { GameObject act = Get.gameObject; ActiveEditorTracker.sharedTracker.isLocked = !ActiveEditorTracker.sharedTracker.isLocked; Selection.activeObject = act; } GUI.color = c; GUILayout.EndVertical(); EditorGUILayout.PropertyField(sp_IncludedColliders, true); EditorGUILayout.EndVertical(); FEditor_Styles.DrawUILine(new Color(0.5f, 0.5f, 0.5f, 0.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")); FEditor_Styles.DrawUILine(new Color(0.6f, 0.6f, 0.6f, 0.4f)); EditorGUILayout.PropertyField(sp_AllCollidersOffset, true); if (spine.UseTruePosition) { EditorGUILayout.BeginVertical(FEditor_Styles.RedBackground); } else { EditorGUILayout.BeginVertical(FEditor_Styles.YellowBackground); } EditorGUILayout.PropertyField(sp_UseTruePosition, true); EditorGUILayout.EndVertical(); Color preCol = GUI.color; if (spine.GravityPower != Vector3.zero) { if (!spine.DetailedCollision) { GUI.color = new Color(1f, 1f, 0.35f, 0.8f); } } GUI.color = preCol; EditorGUILayout.PropertyField(sp_DetailedCollision, true); FEditor_Styles.DrawUILine(new Color(0.6f, 0.6f, 0.6f, 0.4f)); EditorGUILayout.PropertyField(sp_GravityPower, true); GUILayout.Space(3f); } else // In Playmode { EditorGUILayout.BeginVertical(FEditor_Styles.Emerald); Color c = GUI.color; 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"), EditorStyles.toolbarButton)) { ActiveEditorTracker.sharedTracker.isLocked = !ActiveEditorTracker.sharedTracker.isLocked; } GUI.color = c; GUILayout.EndVertical(); EditorGUILayout.PropertyField(sp_IncludedColliders, true); EditorGUILayout.EndVertical(); // EditorGUI.indentLevel--; EditorGUILayout.HelpBox("Rescalling in playmode available only in editor not in build", MessageType.Warning); EditorGUILayout.PropertyField(sp_CollidersScaleMul, new GUIContent("Scale Multiplier")); EditorGUILayout.PropertyField(sp_CollidersScale, new GUIContent("Scale Curve")); EditorGUILayout.PropertyField(sp_CollidersAutoCurve, new GUIContent("Auto Curve")); FEditor_Styles.DrawUILine(new Color(0.6f, 0.6f, 0.6f, 0.4f)); EditorGUILayout.PropertyField(sp_AllCollidersOffset, true); if (spine.UseTruePosition) { EditorGUILayout.BeginVertical(FEditor_Styles.RedBackground); } else { EditorGUILayout.BeginVertical(FEditor_Styles.YellowBackground); } EditorGUILayout.PropertyField(sp_UseTruePosition, true); EditorGUILayout.EndVertical(); Color preCol = GUI.color; if (spine.GravityPower != Vector3.zero) { if (!spine.DetailedCollision) { GUI.color = new Color(1f, 1f, 0.35f, 0.8f); } } GUI.color = preCol; EditorGUILayout.PropertyField(sp_DetailedCollision, true); FEditor_Styles.DrawUILine(new Color(0.6f, 0.6f, 0.6f, 0.4f)); EditorGUILayout.PropertyField(sp_GravityPower, true); GUILayout.Space(3f); } } else { FEditor_Styles.DrawUILine(new Color(0.6f, 0.6f, 0.6f, 0.4f)); EditorGUILayout.PropertyField(sp_GravityPower, true); GUILayout.Space(3f); } EditorGUILayout.EndVertical(); }