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(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; m_Breadcrumb.TrimItems(0); 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>"; 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.GraphAssetModel.GraphModel.GetAssetPath(), graphToLoad.BoundObject, loadType: LoadGraphAssetAction.Type.KeepHistory)); }); } string newCurrentGraph = graphModel?.FriendlyScriptName; if (newCurrentGraph != null) { var boundObject = state.EditorDataModel.BoundObject; if (boundObject) { newCurrentGraph += $" ({boundObject.name})"; } m_Breadcrumb.CreateOrUpdateItem(i++, newCurrentGraph, null); } m_Breadcrumb.TrimItems(i); }