Browse Source

Hide transform in inspector and sequences in hierarchy

master
chrisgregan 11 years ago
parent
commit
7430a61da7
  1. 1
      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. BIN
      Assets/Shuttle/ShuttleGame.unity

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

@ -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);
}

27
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()
@ -32,16 +38,6 @@ namespace Fungus.Script
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<Sequence>();
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<Sequence>();

60
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<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>();
void Start()
{
if (startAutomatically)

BIN
Assets/Shuttle/ShuttleGame.unity

Binary file not shown.
Loading…
Cancel
Save