コード例 #1
0
ファイル: SceneGraphEditor.cs プロジェクト: Sherbb/xNode
 public override void OnInspectorGUI()
 {
     if (sceneGraph.graph == null)
     {
         if (GUILayout.Button("New graph", GUILayout.Height(40)))
         {
             if (graphType == null)
             {
                 Type[]      graphTypes = NodeEditorReflection.GetDerivedTypes(typeof(NodeGraph));
                 GenericMenu menu       = new GenericMenu();
                 for (int i = 0; i < graphTypes.Length; i++)
                 {
                     Type graphType = graphTypes[i];
                     menu.AddItem(new GUIContent(graphType.Name), false, () => CreateGraph(graphType));
                 }
                 menu.ShowAsContext();
             }
             else
             {
                 CreateGraph(graphType);
             }
         }
     }
     else
     {
         if (GUILayout.Button("Open graph", GUILayout.Height(40)))
         {
             NodeEditorWindow.Open(sceneGraph.graph);
         }
         if (removeSafely)
         {
             GUILayout.BeginHorizontal();
             GUILayout.Label("Really remove graph?");
             GUI.color = new Color(1, 0.8f, 0.8f);
             if (GUILayout.Button("Remove"))
             {
                 removeSafely = false;
                 Undo.RecordObject(sceneGraph, "Removed graph");
                 sceneGraph.graph = null;
             }
             GUI.color = Color.white;
             if (GUILayout.Button("Cancel"))
             {
                 removeSafely = false;
             }
             GUILayout.EndHorizontal();
         }
         else
         {
             GUI.color = new Color(1, 0.8f, 0.8f);
             if (GUILayout.Button("Remove graph"))
             {
                 removeSafely = true;
             }
             GUI.color = Color.white;
         }
     }
     base.OnInspectorGUI();
 }
コード例 #2
0
 public override void OnInspectorGUI()
 {
     if (GUILayout.Button("Edit graph", GUILayout.Height(40)))
     {
         NodeEditorWindow.Open(serializedObject.targetObject as XNode.NodeGraph);
     }
     base.OnInspectorGUI();
 }
コード例 #3
0
 public override void OnInspectorGUI()
 {
     if (GUILayout.Button("Edit graph", GUILayout.Height(40)))
     {
         SerializedProperty graphProp = serializedObject.FindProperty("graph");
         NodeEditorWindow   w         = NodeEditorWindow.Open(graphProp.objectReferenceValue as XNode.NodeGraph);
         w.Home(); // Focus selected node
     }
     base.OnInspectorGUI();
 }
コード例 #4
0
        public override void OnInspectorGUI()
        {
            if (GUILayout.Button("Edit graph", GUILayout.Height(40)))
            {
                NodeEditorWindow.Open(serializedObject.targetObject as XNode.NodeGraph);
            }

            GUILayout.Space(EditorGUIUtility.singleLineHeight);
            GUILayout.Label("Raw data", "BoldLabel");

            base.OnInspectorGUI();
        }
コード例 #5
0
        public override void OnInspectorGUI()
        {
            if (GUILayout.Button("Edit graph", GUILayout.Height(40)))
            {
                SerializedProperty graphProp = serializedObject.FindProperty("graph");
                NodeEditorWindow   w         = NodeEditorWindow.Open(graphProp.objectReferenceValue as XNode.NodeGraph);
                w.Home(); // Focus selected node
            }

            GUILayout.Space(EditorGUIUtility.singleLineHeight);
            GUILayout.Label("Raw data", "BoldLabel");

            base.OnInspectorGUI();
        }