public void DeserializeData() { BehaviorTreeBlueprintData mainData = editorWindow.CurrentData; if (mainData == null) { throw new Exception("No current data to deserialize!"); } stopwatch.Restart(); //Clear everything BehaviorTreeNodeAttribute.RescanAttributes(); graphView.DeleteAllElements(); RecalculateNodeInfo(); //Setup data allData = mainData.allNodes; //Start for (int i = 0; i < mainData.rootNodes.Length; i++) { DeserializeNode(allData[mainData.rootNodes[i]]); //Deserialize branch } stopwatch.Stop(); DebugHelper.Log($"Deserialized in {stopwatch.Elapsed.TotalMilliseconds} ms."); }
public NodeInfo(BehaviorTreeNodeAttribute attribute) { serializedName = attribute.serializedName; graphNodeType = GetTypeFromName(attribute.nodeTypeName); string name = BehaviorTreeNodeAttribute.SerializedNameToType[attribute.serializedName].Name; displayedName = name.Contains('`') ? name.Substring(0, name.IndexOf("`", StringComparison.Ordinal)) : name; }
public List <SearchTreeEntry> CreateSearchTree(SearchWindowContext context) { if (searchTree == null) { searchTree = new List <SearchTreeEntry> { new SearchTreeGroupEntry(new GUIContent("Create Node")) //First item in tree is the title }; BehaviorTreeNodeAttribute.RescanAttributes(); searchTree.AddRange ( from pair in BehaviorTreeNodeAttribute.SerializedNameToAttribute let entry = new NodeEntry(pair.Value) select new SearchTreeEntry(new GUIContent(entry.displayedName)) { level = 1, userData = entry } ); } return(searchTree); }
public NodeEntry(BehaviorTreeNodeAttribute attribute) : base(attribute) => this.attribute = attribute;