public OSM_Editor(OSM_EditorWindow w)
        {
            backColor = new Color32(59, 62, 74, 255);
            knobColor = new Color32(126, 186, 255, 255);

            guideColor   = Color.gray;
            guideColor.a = 0.3f;

            _gridTex   = Resources.Load("Editor/Grid") as Texture2D;
            _backTex   = Resources.Load("Editor/Square") as Texture2D;
            _circleTex = Resources.Load("Editor/Circle") as Texture2D;

            _window = w;
        }
        private static bool OpenGraphAsset(int instanceID, int line)
        {
            Debug.Log(instanceID);
            var graphSelected = EditorUtility.InstanceIDToObject(instanceID) as OSM_Graph;

            if (graphSelected != null)
            {
                OSM_EditorWindow windowToUse = null;

                // Try to find an editor window without a graph...
                var windows = Resources.FindObjectsOfTypeAll <OSM_EditorWindow>();
                foreach (var w in windows)
                {
                    // The canvas is already opened
                    if (w.Graph == graphSelected)
                    {
                        return(false);
                    }

                    // Found a window with no active canvas.
                    if (w.Graph == null)
                    {
                        windowToUse = w;
                        break;
                    }
                }

                // No windows available...just make a new one.
                if (!windowToUse)
                {
                    windowToUse = EditorWindow.CreateInstance <OSM_EditorWindow>();
                    windowToUse.titleContent = new GUIContent("Node Editor");
                    windowToUse.Show();
                }

                windowToUse.SetGraph(graphSelected);
                // windowToUse._saveManager.InitState();
                windowToUse.Repaint();

                return(true);
            }

            return(false);
        }
Пример #3
0
 public OSM_SaveManager(OSM_EditorWindow w)
 {
     _window = w;
 }