void UpdateBreadcrumbMenu(GraphToolState state) { bool isEnabled = state.WindowState.GraphModel != null; if (!isEnabled) { m_Breadcrumb.style.display = DisplayStyle.None; return; } m_Breadcrumb.style.display = StyleKeyword.Null; var i = 0; var graphModels = state.WindowState.SubGraphStack; for (; i < graphModels.Count; i++) { var label = GetBreadcrumbLabel(state, i); m_Breadcrumb.CreateOrUpdateItem(i, label, BreadcrumbClickedEvent); } var newCurrentGraph = GetBreadcrumbLabel(state, -1); if (newCurrentGraph != null) { m_Breadcrumb.CreateOrUpdateItem(i, newCurrentGraph, BreadcrumbClickedEvent); i++; } m_Breadcrumb.TrimItems(i); }
void UpdateBreadcrumbMenu(bool isEnabled) { m_Breadcrumb.SetEnabled(isEnabled); State state = m_Store.GetState(); IGraphModel graphModel = state.CurrentGraphModel; int i = 0; for (; i < state.EditorDataModel.PreviousGraphModels.Count; i++) { var graphToLoad = state.EditorDataModel.PreviousGraphModels[i]; string label = graphToLoad.GraphAssetModel && graphToLoad.GraphAssetModel.GraphModel != null ? graphToLoad.GraphAssetModel.GraphModel.FriendlyScriptName : "<Unknown>"; m_Breadcrumb.CreateOrUpdateItem(i, label, ClickedEvent); } string newCurrentGraph = graphModel?.FriendlyScriptName; if (newCurrentGraph != null) { var boundObject = state.EditorDataModel.BoundObject; if (boundObject) { newCurrentGraph += $" ({boundObject.name})"; } m_Breadcrumb.CreateOrUpdateItem(i, newCurrentGraph, ClickedEvent); i++; } m_Breadcrumb.TrimItems(i); }
void UpdateBreadcrumbMenu(bool isEnabled) { m_BreadcrumbButton.SetEnabled(isEnabled); m_Breadcrumb.SetEnabled(isEnabled); State state = m_Store.GetState(); IGraphModel graphModel = state.CurrentGraphModel; int i = 0; for (; i < state.EditorDataModel.PreviousGraphModels.Count; i++) { GraphModel graphToLoad = state.EditorDataModel.PreviousGraphModels[i]; string label = graphToLoad ? graphToLoad.FriendlyScriptName : "<Unknown>"; int i1 = i; m_Breadcrumb.CreateOrUpdateItem(i, label, () => { while (state.EditorDataModel.PreviousGraphModels.Count > i1) { state.EditorDataModel.PreviousGraphModels.RemoveAt(state.EditorDataModel.PreviousGraphModels.Count - 1); } m_Store.Dispatch(new LoadGraphAssetAction(graphToLoad.GetAssetPath(), loadType: LoadGraphAssetAction.Type.KeepHistory)); }); } string newCurrentGraph = graphModel?.FriendlyScriptName; if (newCurrentGraph != null) { m_Breadcrumb.CreateOrUpdateItem(i++, newCurrentGraph, null); } object boundObject = state.EditorDataModel.BoundObject; string newBoundObjectName = boundObject?.ToString(); if (newBoundObjectName != null) { m_Breadcrumb.CreateOrUpdateItem(i++, newBoundObjectName, null); } m_Breadcrumb.TrimItems(i); }