From 7430a61da7ec9e9b5e5b90ef726e415fedaed1bd Mon Sep 17 00:00:00 2001 From: chrisgregan Date: Wed, 13 Aug 2014 12:54:58 +0100 Subject: [PATCH] Hide transform in inspector and sequences in hierarchy --- .../Editor/FungusScript/FungusEditorWindow.cs | 3 +- .../Editor/FungusScript/FungusScriptEditor.cs | 27 +++++--- .../Editor/FungusScript/SequenceEditor.cs | 60 ------------------ Assets/Fungus/VisualScripting/FungusScript.cs | 1 - Assets/Fungus/VisualScripting/Sequence.cs | 4 +- Assets/Shuttle/ShuttleGame.unity | Bin 81956 -> 81628 bytes 6 files changed, 21 insertions(+), 74 deletions(-) diff --git a/Assets/Fungus/Editor/FungusScript/FungusEditorWindow.cs b/Assets/Fungus/Editor/FungusScript/FungusEditorWindow.cs index 960b40df..2eff68da 100755 --- a/Assets/Fungus/Editor/FungusScript/FungusEditorWindow.cs +++ b/Assets/Fungus/Editor/FungusScript/FungusEditorWindow.cs @@ -100,7 +100,7 @@ namespace Fungus.Script for (int i = 0; i < sequences.Length; ++i) { Sequence sequence = sequences[i]; - + float titleWidth = windowStyle.CalcSize(new GUIContent(sequence.name)).x; float windowWidth = Mathf.Max (titleWidth + 10, 100); @@ -115,6 +115,7 @@ namespace Fungus.Script } sequence.nodeRect = GUILayout.Window(i, sequence.nodeRect, DrawWindow, sequence.name, GUILayout.Width(windowWidth), GUILayout.Height(20), GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)); + windowSequenceMap.Add(sequence); } diff --git a/Assets/Fungus/Editor/FungusScript/FungusScriptEditor.cs b/Assets/Fungus/Editor/FungusScript/FungusScriptEditor.cs index ac6782eb..de04dac0 100644 --- a/Assets/Fungus/Editor/FungusScript/FungusScriptEditor.cs +++ b/Assets/Fungus/Editor/FungusScript/FungusScriptEditor.cs @@ -19,6 +19,12 @@ namespace Fungus.Script { variablesProperty = serializedObject.FindProperty("variables"); } + + FungusScript t = target as FungusScript; + if (t != null) + { + t.transform.hideFlags = HideFlags.HideInInspector; + } } public void OnInspectorUpdate() @@ -31,17 +37,7 @@ namespace Fungus.Script serializedObject.Update(); FungusScript t = target as FungusScript; - - GUILayout.BeginHorizontal(); - GUILayout.FlexibleSpace(); - if (GUILayout.Button("Open Fungus Editor")) - { - EditorWindow.GetWindow(typeof(FungusEditorWindow), false, "Fungus Editor"); - } - GUILayout.FlexibleSpace(); - GUILayout.EndHorizontal(); - GUIContent stepTimeLabel = new GUIContent("Step Time", "Minimum time to execute each step"); t.stepTime = EditorGUILayout.FloatField(stepTimeLabel, t.stepTime); @@ -58,6 +54,15 @@ namespace Fungus.Script GUIContent startAutomaticallyLabel = new GUIContent("Start Automatically", "Start this Fungus Script when the scene starts."); t.startAutomatically = EditorGUILayout.Toggle(startAutomaticallyLabel, t.startAutomatically); + GUILayout.BeginHorizontal(); + GUILayout.FlexibleSpace(); + if (GUILayout.Button("Open Fungus Editor")) + { + EditorWindow.GetWindow(typeof(FungusEditorWindow), false, "Fungus Editor"); + } + GUILayout.FlexibleSpace(); + GUILayout.EndHorizontal(); + EditorGUILayout.Separator(); GUILayout.Box("Sequence Editor", GUILayout.ExpandWidth(true)); @@ -67,6 +72,7 @@ namespace Fungus.Script { GameObject go = new GameObject("Sequence"); go.transform.parent = t.transform; + go.transform.hideFlags = HideFlags.HideInHierarchy; Sequence s = go.AddComponent(); FungusEditorWindow fungusEditorWindow = EditorWindow.GetWindow(typeof(FungusEditorWindow), false, "Fungus Editor") as FungusEditorWindow; s.nodeRect.x = fungusEditorWindow.scrollPos.x; @@ -87,6 +93,7 @@ namespace Fungus.Script { GameObject copy = GameObject.Instantiate(t.selectedSequence.gameObject) as GameObject; copy.transform.parent = t.transform; + copy.transform.hideFlags = HideFlags.HideInHierarchy; copy.name = t.selectedSequence.name; Sequence sequenceCopy = copy.GetComponent(); diff --git a/Assets/Fungus/Editor/FungusScript/SequenceEditor.cs b/Assets/Fungus/Editor/FungusScript/SequenceEditor.cs index 928de16a..3bb10186 100644 --- a/Assets/Fungus/Editor/FungusScript/SequenceEditor.cs +++ b/Assets/Fungus/Editor/FungusScript/SequenceEditor.cs @@ -49,66 +49,6 @@ namespace Fungus.Script return result; } - - public override bool RequiresConstantRepaint() - { - return true; - } - - public override void OnInspectorGUI() - { - Sequence t = target as Sequence; - - EditorGUILayout.PrefixLabel(new GUIContent("Description", "Sequence description displayed in editor window")); - - string description = GUILayout.TextArea(t.description, GUILayout.ExpandWidth(true)); - if (description != t.description) - { - Undo.RecordObject(t, "Set Description"); - t.description = description; - } - - FungusCommand[] commands = t.GetComponents(); - - /* - if (Application.isPlaying) - { - foreach (FungusCommand command in commands) - { - if (command == FungusCommandEditor.selectedCommand) - { - activeCommand = command; - Debug.Log("Found it"); - } - } - } - */ - - EditorGUILayout.PrefixLabel("Commands"); - - foreach (FungusCommand command in commands) - { - /* - bool showCommandInspector = false; - if (command == activeCommand || - command.IsExecuting()) - { - showCommandInspector = true; - } - */ - - if (GUILayout.Button(command.GetCommandTitle())) - { - command.expanded = !command.expanded; - } - - if (command.expanded) - { - Editor commandEditor = Editor.CreateEditor(command); - commandEditor.OnInspectorGUI(); - } - } - } } } \ No newline at end of file diff --git a/Assets/Fungus/VisualScripting/FungusScript.cs b/Assets/Fungus/VisualScripting/FungusScript.cs index 2750e3a8..0e9ea2cc 100644 --- a/Assets/Fungus/VisualScripting/FungusScript.cs +++ b/Assets/Fungus/VisualScripting/FungusScript.cs @@ -24,7 +24,6 @@ namespace Fungus.Script public List variables = new List(); - void Start() { if (startAutomatically) diff --git a/Assets/Fungus/VisualScripting/Sequence.cs b/Assets/Fungus/VisualScripting/Sequence.cs index 99540a0b..febe58be 100644 --- a/Assets/Fungus/VisualScripting/Sequence.cs +++ b/Assets/Fungus/VisualScripting/Sequence.cs @@ -13,7 +13,7 @@ namespace Fungus.Script { [HideInInspector] public Rect nodeRect = new Rect(10, 10, 100, 100); - + [HideInInspector] public string description = ""; @@ -24,7 +24,7 @@ namespace Fungus.Script public FungusCommand activeCommand; int executionCount; - + public virtual void Start() { fungusScript = GetFungusScript(); diff --git a/Assets/Shuttle/ShuttleGame.unity b/Assets/Shuttle/ShuttleGame.unity index d9eccb3610240f16c6e37655ac47451817642424..416b784d5e30df2e1fd4d9c2474b8b94fd3a7a5d 100644 GIT binary patch delta 1551 zcmZA1O-vI(6bJA(u%(5l^d>6ELJPFeLe&7(gO>79X~=q#V?6tceE>nxNr=q83k}@}({K-*z|b+GP6i+xOngzM1VrK)0CW zj6})D#7-{~Q8vC$P8qFhtatjg~Bk%ORo*xX9%38Wx24@%z0z-oWTEQ8#{b z^5|`Q+U$jK8AL0Y=`ptXtl5{Zt@jWXgLSHMAHnzn637eO#cK$k>n-P70|i7=_^vEw z1Li!cP2PlsVA5iC~~qJS!HS1JgTCQit4#p}-YNU^pHCK#EtT{R0pKTukY(pHndvpo*`2vfRX zhQ-W8_f>Hvu=WxnAMCe0aVcyT=7If^tqew`TC>1BFhLz?1%`kPs^oIm!hgvXFuqJ% z&<69tT&i3<>^V$buM)Pp7bm3ly$a~CXp_&>jCKsb)Mvp3vsjhAOK(#hEDZBvVr7rr zuq{{+rff+)EKr^{Wjh;cgwYN|g*LDefg#ugl9hwh1asPm!m5HE*gWhqOgV(jQk-3T zSeJ^vcZFb25T|VCXPBcBixz;&s=r8qKE>Nplb2U>?djZNR(9^s}lc6M~*eK`hk_#iWi103VTe2xw2 z^4;_AUPQ+^c8`s(CJoWNEVjVJxSr*SUIXKz`wZ+hW0B}cHk;WWb>^{EE_F5PDq#LB zk+&dl-o$JyOH7(rt+=dbX3=YAHfg~W4VhWLUT3c->Jc+-%r4Ftkr1+?a*K@(u_M7c zqApyHxrr?9Y~-}{_VRan_$xQXB|R$?U3SDK@RlLYS&{4FnIXzM7_YjW$!f%OSF>2o EKh&zdjQ{`u delta 1655 zcmZA1TSydP6bJBga#q)%S}0>R%XN3n@tQ^0=8KzFXct=4hl&cz3@eqCiiL{tCEABB zg3)aCVj$(CBDFyo($fY8J`@=E(8Wr7S}RMdar=L}Gd1JD$L{>*eCIp!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