// TODO: maybe move this to GraphView since it's so connected? private void SetupToolbar() { _toolbar = new Toolbar() { name = "UdonToolbar", }; _rootView.Add(_toolbar); _toolbar.Add(new ToolbarButton(() => { ReloadWelcome(); }) { text = "Welcome" }); _graphAssetName = new Label() { name = "assetName", }; _toolbar.Add(_graphAssetName); #if UNITY_2019_3_OR_NEWER _toolbar.Add(new ToolbarSpacer() { flex = true, }); #else _toolbar.Add(new ToolbarFlexSpacer()); #endif _updateOrderField = new VisualElement() { visible = false, }; _updateOrderField.Add(new Label("UpdateOrder")); _updateOrderIntField = new IntegerField() { name = "UpdateOrderIntegerField", value = (_graphAsset == null) ? 0 : _graphAsset.graphData.updateOrder, }; #if UNITY_2019_3_OR_NEWER _updateOrderIntField.RegisterValueChangedCallback((e) => #else _updateOrderIntField.OnValueChanged(e => #endif { _graphView.graphProgramAsset.graphData.updateOrder = e.newValue; _updateOrderField.visible = false; }); _updateOrderIntField.isDelayed = true; _updateOrderField.Add(_updateOrderIntField); _toolbar.Add(_updateOrderField); _toolbarOptions = new ToolbarMenu { text = "Settings" }; // Show Variables Window _toolbarOptions.menu.AppendAction("Show Variables", (m) => { _graphView.ToggleShowVariables(!_graphView.GetBlackboardVisible()); }, (s) => { return(BoolToStatus(_graphView.GetBlackboardVisible())); }); // Show Minimap _toolbarOptions.menu.AppendAction("Show MiniMap", (m) => { _graphView.ToggleShowMiniMap(!_graphView.GetMinimapVisible()); }, (s) => { return(BoolToStatus(_graphView.GetMinimapVisible())); }); _toolbarOptions.menu.AppendSeparator(); // Show Update Order _toolbarOptions.menu.AppendAction("Show UpdateOrder", (m) => { #if UNITY_2019_3_OR_NEWER _updateOrderField.visible = !(m.status == DropdownMenuAction.Status.Checked); #else _updateOrderField.visible = !(m.status == DropdownMenu.MenuAction.StatusFlags.Checked); #endif if (_updateOrderField.visible) { _updateOrderIntField.value = _graphAsset.graphData.updateOrder; } _updateOrderIntField.Focus(); _updateOrderIntField.SelectAll(); }, (s) => { return(BoolToStatus(_updateOrderField.visible)); }); // Search On Noodle Drop _toolbarOptions.menu.AppendAction("Search on Noodle Drop", (m) => { Settings.SearchOnNoodleDrop = !Settings.SearchOnNoodleDrop; }, (s) => { return(BoolToStatus(Settings.SearchOnNoodleDrop)); }); // Search On Selected Node _toolbarOptions.menu.AppendAction("Search on Selected Node", (m) => { Settings.SearchOnSelectedNodeRegistry = !Settings.SearchOnSelectedNodeRegistry; }, (s) => { return(BoolToStatus(Settings.SearchOnSelectedNodeRegistry)); }); _toolbar.Add(_toolbarOptions); _graphCompile = new ToolbarButton(() => { if (_graphAsset != null && _graphAsset is AbstractUdonProgramSource udonProgramSource) { UdonEditorManager.Instance.QueueAndRefreshProgram(udonProgramSource); } }) { text = "Compile" }; _toolbar.Add(_graphCompile); _graphReload = new ToolbarButton(() => { _graphView.Reload(); }) { text = "Reload" }; _toolbar.Add(_graphReload); _graphStatus = new UdonGraphStatus(_rootView); _toolbar.Add(_graphStatus); ShowGraphTools(false); }
// TODO: maybe move this to GraphView since it's so connected? private void SetupToolbar() { _toolbar = new Toolbar() { name = "UdonToolbar", }; _rootView.Add(_toolbar); _toolbar.Add(new ToolbarButton(() => { ReloadWelcome(); }) { text = "Welcome" }); _graphAssetName = new Label() { name = "assetName", }; _toolbar.Add(_graphAssetName); _toolbar.Add(new ToolbarFlexSpacer()); _toolbarOptions = new ToolbarMenu { text = "Settings" }; // Show Variables Window _toolbarOptions.menu.AppendAction("Show Variables", (m) => { _graphView.ToggleShowVariables(!_graphView.GetBlackboardVisible()); }, (s)=> { return BoolToStatus(_graphView.GetBlackboardVisible());}); // Show Minimap _toolbarOptions.menu.AppendAction("Show MiniMap", (m) => { _graphView.ToggleShowMiniMap(!_graphView.GetMinimapVisible()); }, (s) => { return BoolToStatus(_graphView.GetMinimapVisible()); }); _toolbarOptions.menu.AppendSeparator(); // Search On Noodle Drop _toolbarOptions.menu.AppendAction("Search on Noodle Drop", (m) => { Settings.SearchOnNoodleDrop = !Settings.SearchOnNoodleDrop; }, (s) => { return BoolToStatus(Settings.SearchOnNoodleDrop); }); // Search On Selected Node _toolbarOptions.menu.AppendAction("Search on Selected Node", (m) => { Settings.SearchOnSelectedNodeRegistry = !Settings.SearchOnSelectedNodeRegistry; }, (s) => { return BoolToStatus(Settings.SearchOnSelectedNodeRegistry); }); _toolbar.Add(_toolbarOptions); _graphCompile = new ToolbarButton(() => { if (_graphAsset != null && _graphAsset is AbstractUdonProgramSource udonProgramSource) { UdonEditorManager.Instance.QueueAndRefreshProgram(udonProgramSource); } }) { text = "Compile" }; _toolbar.Add(_graphCompile); _graphReload = new ToolbarButton(() => { _graphView.Reload(); }) { text = "Reload" }; _toolbar.Add(_graphReload); _graphStatus = new UdonGraphStatus(_rootView); _toolbar.Add(_graphStatus); ShowGraphTools(false); } }