public static void DrawLayeredOverride(Graph graph) /// Drawing override in layers-style (can add, remove or switch) /// For graph defaults { Override ovd = graph.defaults; using (Cell.LinePx(0)) LayersEditor.DrawLayers( ovd.Count, onDraw: n => DrawLayer(ovd, n), onAdd: n => NewOverrideWindow.ShowWindow(ovd, n), onRemove: n => ovd.RemoveAt(n), onMove: (n1, n2) => ovd.Switch(n1, n2)); using (Cell.LinePx(20)) { using (Cell.Row) if (Draw.Button("Add All Exposed")) { graph.defaults.AddAllExposed(graph.exposed, graph); } using (Cell.Row) if (Draw.Button("Remove Unused")) { graph.defaults.RemoveAllUnused(graph.exposed); } } }
public static void ShowWindow(Override ovd, int num) { Vector2 curWinPos = focusedWindow != null ? focusedWindow.position.position : new Vector2(0, 0); Vector2 mousePos = Event.current.mousePosition + curWinPos; //before opening window NewOverrideWindow window = ScriptableObject.CreateInstance(typeof(NewOverrideWindow)) as NewOverrideWindow; window.ovd = ovd; window.num = num; window.titleContent = new GUIContent("New Variable"); window.ShowUtility(); Vector2 windowSize = new Vector2(200, 100); window.position = new Rect( new Vector2(Screen.currentResolution.width, Screen.currentResolution.height) / 2 - windowSize / 2, windowSize); }