Browse Source

Hide transform in inspector and sequences in hierarchy

master
chrisgregan 11 years ago
parent
commit
7430a61da7
  1. 3
      Assets/Fungus/Editor/FungusScript/FungusEditorWindow.cs
  2. 27
      Assets/Fungus/Editor/FungusScript/FungusScriptEditor.cs
  3. 60
      Assets/Fungus/Editor/FungusScript/SequenceEditor.cs
  4. 1
      Assets/Fungus/VisualScripting/FungusScript.cs
  5. 4
      Assets/Fungus/VisualScripting/Sequence.cs
  6. BIN
      Assets/Shuttle/ShuttleGame.unity

3
Assets/Fungus/Editor/FungusScript/FungusEditorWindow.cs

@ -100,7 +100,7 @@ namespace Fungus.Script
for (int i = 0; i < sequences.Length; ++i) for (int i = 0; i < sequences.Length; ++i)
{ {
Sequence sequence = sequences[i]; Sequence sequence = sequences[i];
float titleWidth = windowStyle.CalcSize(new GUIContent(sequence.name)).x; float titleWidth = windowStyle.CalcSize(new GUIContent(sequence.name)).x;
float windowWidth = Mathf.Max (titleWidth + 10, 100); 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)); 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); windowSequenceMap.Add(sequence);
} }

27
Assets/Fungus/Editor/FungusScript/FungusScriptEditor.cs

@ -19,6 +19,12 @@ namespace Fungus.Script
{ {
variablesProperty = serializedObject.FindProperty("variables"); variablesProperty = serializedObject.FindProperty("variables");
} }
FungusScript t = target as FungusScript;
if (t != null)
{
t.transform.hideFlags = HideFlags.HideInInspector;
}
} }
public void OnInspectorUpdate() public void OnInspectorUpdate()
@ -31,17 +37,7 @@ namespace Fungus.Script
serializedObject.Update(); serializedObject.Update();
FungusScript t = target as FungusScript; 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"); GUIContent stepTimeLabel = new GUIContent("Step Time", "Minimum time to execute each step");
t.stepTime = EditorGUILayout.FloatField(stepTimeLabel, t.stepTime); 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."); GUIContent startAutomaticallyLabel = new GUIContent("Start Automatically", "Start this Fungus Script when the scene starts.");
t.startAutomatically = EditorGUILayout.Toggle(startAutomaticallyLabel, t.startAutomatically); 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(); EditorGUILayout.Separator();
GUILayout.Box("Sequence Editor", GUILayout.ExpandWidth(true)); GUILayout.Box("Sequence Editor", GUILayout.ExpandWidth(true));
@ -67,6 +72,7 @@ namespace Fungus.Script
{ {
GameObject go = new GameObject("Sequence"); GameObject go = new GameObject("Sequence");
go.transform.parent = t.transform; go.transform.parent = t.transform;
go.transform.hideFlags = HideFlags.HideInHierarchy;
Sequence s = go.AddComponent<Sequence>(); Sequence s = go.AddComponent<Sequence>();
FungusEditorWindow fungusEditorWindow = EditorWindow.GetWindow(typeof(FungusEditorWindow), false, "Fungus Editor") as FungusEditorWindow; FungusEditorWindow fungusEditorWindow = EditorWindow.GetWindow(typeof(FungusEditorWindow), false, "Fungus Editor") as FungusEditorWindow;
s.nodeRect.x = fungusEditorWindow.scrollPos.x; s.nodeRect.x = fungusEditorWindow.scrollPos.x;
@ -87,6 +93,7 @@ namespace Fungus.Script
{ {
GameObject copy = GameObject.Instantiate(t.selectedSequence.gameObject) as GameObject; GameObject copy = GameObject.Instantiate(t.selectedSequence.gameObject) as GameObject;
copy.transform.parent = t.transform; copy.transform.parent = t.transform;
copy.transform.hideFlags = HideFlags.HideInHierarchy;
copy.name = t.selectedSequence.name; copy.name = t.selectedSequence.name;
Sequence sequenceCopy = copy.GetComponent<Sequence>(); Sequence sequenceCopy = copy.GetComponent<Sequence>();

60
Assets/Fungus/Editor/FungusScript/SequenceEditor.cs

@ -49,66 +49,6 @@ namespace Fungus.Script
return result; 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<FungusCommand>();
/*
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();
}
}
}
} }
} }

1
Assets/Fungus/VisualScripting/FungusScript.cs

@ -24,7 +24,6 @@ namespace Fungus.Script
public List<FungusVariable> variables = new List<FungusVariable>(); public List<FungusVariable> variables = new List<FungusVariable>();
void Start() void Start()
{ {
if (startAutomatically) if (startAutomatically)

4
Assets/Fungus/VisualScripting/Sequence.cs

@ -13,7 +13,7 @@ namespace Fungus.Script
{ {
[HideInInspector] [HideInInspector]
public Rect nodeRect = new Rect(10, 10, 100, 100); public Rect nodeRect = new Rect(10, 10, 100, 100);
[HideInInspector] [HideInInspector]
public string description = ""; public string description = "";
@ -24,7 +24,7 @@ namespace Fungus.Script
public FungusCommand activeCommand; public FungusCommand activeCommand;
int executionCount; int executionCount;
public virtual void Start() public virtual void Start()
{ {
fungusScript = GetFungusScript(); fungusScript = GetFungusScript();

BIN
Assets/Shuttle/ShuttleGame.unity

Binary file not shown.
Loading…
Cancel
Save