public void AssignPaths(List <WDOMNode> loaded_actors) { List <WDOMNode> v1_paths = loaded_actors.FindAll(x => x.GetType() == typeof(Path_v1)); List <WDOMNode> v1_points = loaded_actors.FindAll(x => x.GetType() == typeof(PathPoint_v1)); foreach (WDOMNode path_v1 in v1_paths) { Path_v1 cur_path = (Path_v1)path_v1; cur_path.Name = $"path_{ v1_paths.IndexOf(cur_path) }"; cur_path.SetNodes(v1_points); } List <WDOMNode> v2_paths = loaded_actors.FindAll(x => x.GetType() == typeof(Path_v2)); List <WDOMNode> v2_points = loaded_actors.FindAll(x => x.GetType() == typeof(PathPoint_v2)); foreach (WDOMNode path_v2 in v2_paths) { Path_v2 cur_path = (Path_v2)path_v2; cur_path.Name = $"path_{ v2_paths.IndexOf(cur_path) }"; cur_path.SetNodes(v2_points); } }
public void SavePaths(Dictionary <FourCC, List <SerializableDOMNode> > actorCategories) { if (actorCategories.ContainsKey(FourCC.PATH)) { var v1_paths = actorCategories[FourCC.PATH]; List <SerializableDOMNode> v1_points; actorCategories.TryGetValue(FourCC.PPNT, out v1_points); if (v1_points == null) { v1_points = new List <SerializableDOMNode>(); } foreach (WDOMNode path_v1 in v1_paths) { Path_v1 cur_path = (Path_v1)path_v1; cur_path.SetNodeOffset(v1_points); } } if (actorCategories.ContainsKey(FourCC.RPAT)) { var v2_paths = actorCategories[FourCC.RPAT]; List <SerializableDOMNode> v2_points; actorCategories.TryGetValue(FourCC.RPPN, out v2_points); if (v2_points == null) { v2_points = new List <SerializableDOMNode>(); } foreach (WDOMNode path_v2 in v2_paths) { Path_v2 cur_path = (Path_v2)path_v2; cur_path.SetNodeOffset(v2_points); } } }