public static ImNode Create(string file, JsonValue vl, bool ignoreId = false) { if (!vl.IsJsonObject) { return(null); } var type = vl["type"]; if (!type.IsString) { return(null); } var node = ImNodeRegistry.Create(type.AsString); if (node == null) { Log.Error($"Unknown node type {type.AsString}"); return(null); } node.Tip = type.AsString; node.File = file; node.Load(vl); if (ignoreId) { node.Id = LastId; } ImNodes.Nodes[node.Id] = node; return(node); }
public virtual void Save(JsonObject root) { root["id"] = Id; root["outputs"] = SaveConnections(Outputs); root["type"] = ImNodeRegistry.GetName(this); root["x"] = RealPosition.X; root["y"] = RealPosition.Y; }