From fc9ebdb444b87b569bc1187a5653a61f07d297b4 Mon Sep 17 00:00:00 2001 From: Daniel Borges Date: Sat, 4 Jul 2020 09:50:52 +0200 Subject: [PATCH 1/4] Fixed massive editor slowdown when there is MANY objects in the scene --- Assets/Fungus/Scripts/Editor/ViewEditor.cs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/Assets/Fungus/Scripts/Editor/ViewEditor.cs b/Assets/Fungus/Scripts/Editor/ViewEditor.cs index 898c3d7ea..db4da11f0 100644 --- a/Assets/Fungus/Scripts/Editor/ViewEditor.cs +++ b/Assets/Fungus/Scripts/Editor/ViewEditor.cs @@ -18,17 +18,14 @@ public class ViewEditor : Editor // Draw Views when they're not selected #if UNITY_5_0 - [DrawGizmo(GizmoType.NotSelected | GizmoType.SelectedOrChild)] + [DrawGizmo(GizmoType.NotSelected | GizmoType.SelectedOrChild, typeof(View))] #else - [DrawGizmo(GizmoType.NotInSelectionHierarchy | GizmoType.InSelectionHierarchy)] + [DrawGizmo(GizmoType.NotInSelectionHierarchy | GizmoType.InSelectionHierarchy, typeof(View))] #endif static void RenderCustomGizmo(Transform objectTransform, GizmoType gizmoType) { View view = objectTransform.gameObject.GetComponent(); - if (view != null) - { - DrawView(view, false); - } + DrawView(view, false); } protected virtual Vector2 LookupAspectRatio(int index) @@ -264,4 +261,4 @@ static float CalculateLocalViewSize(View view) return view.transform.InverseTransformPoint(view.transform.position + new Vector3(0, view.ViewSize, 0)).magnitude; } } -} \ No newline at end of file +} From a3131671efac358c592c4bb6fd24a2929ef8709b Mon Sep 17 00:00:00 2001 From: Steve Halliwell Date: Sat, 11 Jul 2020 08:19:49 +1000 Subject: [PATCH 2/4] Fix ViewEditor Gizmo param Type By setting the type in the attribute info Unity expects the param to be of matching type rather than common unity component --- Assets/Fungus/Scripts/Editor/ViewEditor.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Assets/Fungus/Scripts/Editor/ViewEditor.cs b/Assets/Fungus/Scripts/Editor/ViewEditor.cs index db4da11f0..127465ef3 100644 --- a/Assets/Fungus/Scripts/Editor/ViewEditor.cs +++ b/Assets/Fungus/Scripts/Editor/ViewEditor.cs @@ -22,10 +22,9 @@ public class ViewEditor : Editor #else [DrawGizmo(GizmoType.NotInSelectionHierarchy | GizmoType.InSelectionHierarchy, typeof(View))] #endif - static void RenderCustomGizmo(Transform objectTransform, GizmoType gizmoType) + public static void RenderCustomGizmo(View view, GizmoType gizmoType) { - View view = objectTransform.gameObject.GetComponent(); - DrawView(view, false); + DrawView(view, false); } protected virtual Vector2 LookupAspectRatio(int index) From 1a5291e2fe6445d4c344526b0cefad741b23eae6 Mon Sep 17 00:00:00 2001 From: Steve Halliwell Date: Sat, 11 Jul 2020 08:26:17 +1000 Subject: [PATCH 3/4] Change TMProLinkAnim, prevent dups Fix #848 Thanks to yano --- Assets/Fungus/Scripts/Utils/TMProLinkAnimLookup.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Assets/Fungus/Scripts/Utils/TMProLinkAnimLookup.cs b/Assets/Fungus/Scripts/Utils/TMProLinkAnimLookup.cs index 8cb48985d..458f6aa30 100644 --- a/Assets/Fungus/Scripts/Utils/TMProLinkAnimLookup.cs +++ b/Assets/Fungus/Scripts/Utils/TMProLinkAnimLookup.cs @@ -81,17 +81,23 @@ public static class TMProLinkAnimLookup static public void AddHelper(string linkIdText, TMProAnimFunc func) { - LinkHashToEffect.Add(TMPro.TMP_TextUtilities.GetSimpleHashCode(linkIdText), func); + var hashCode = TMPro.TMP_TextUtilities.GetSimpleHashCode(linkIdText); + if(!LinkHashToEffect.ContainsKey(hashCode)) + LinkHashToEffect.Add(hashCode, func); } static public void AddHelper(string linkIdText, TMProLinkAnimEffects.BaseEffect baseEffect) { - LinkHashToEffect.Add(TMPro.TMP_TextUtilities.GetSimpleHashCode(linkIdText), baseEffect.DoEffect); + var hashCode = TMPro.TMP_TextUtilities.GetSimpleHashCode(linkIdText); + if (!LinkHashToEffect.ContainsKey(hashCode)) + LinkHashToEffect.Add(TMPro.TMP_TextUtilities.GetSimpleHashCode(linkIdText), baseEffect.DoEffect); } static public void Remove(string linkIdText) { - LinkHashToEffect.Remove(TMPro.TMP_TextUtilities.GetSimpleHashCode(linkIdText)); + var hashCode = TMPro.TMP_TextUtilities.GetSimpleHashCode(linkIdText); + if (LinkHashToEffect.ContainsKey(hashCode)) + LinkHashToEffect.Remove(hashCode); } static public void RemoveAll() From 2580345f13e0e8e81377c0c42df471484be84112 Mon Sep 17 00:00:00 2001 From: Steve Halliwell Date: Sat, 11 Jul 2020 08:59:12 +1000 Subject: [PATCH 4/4] Fix DivEquals characters in menu Move to Unicode rather than slash to avoid Unity turn it into a menu or spacer Fix #852 --- Assets/Fungus/Scripts/Utils/VariableUtil.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Assets/Fungus/Scripts/Utils/VariableUtil.cs b/Assets/Fungus/Scripts/Utils/VariableUtil.cs index 7744905b5..2b84a3345 100644 --- a/Assets/Fungus/Scripts/Utils/VariableUtil.cs +++ b/Assets/Fungus/Scripts/Utils/VariableUtil.cs @@ -65,8 +65,11 @@ public static string GetSetOperatorDescription(SetOperator setOperator) break; case SetOperator.Divide: - return "/="; - break; + //https://answers.unity.com/questions/398495/can-genericmenu-item-content-display-.html + // '/' in a menu means submenu and because it had no leading text, Unity thinks we want a spacer + // using unicode alternates for / fix the problem. + return "\u200A\u2215\u200A="; + break; } return string.Empty;