public override string GetJson() { GraphInstanceNodeData d = new GraphInstanceNodeData(); FillBaseNodeData(d); d.rawData = GraphData; d.path = path; return(JsonConvert.SerializeObject(d)); }
public override string GetJson() { GraphInstanceNodeData d = new GraphInstanceNodeData(); FillBaseNodeData(d); d.rawData = GraphData; d.path = path; d.parameters = GraphInst.GetConstantParameters(); d.customParameters = GraphInst.GetCustomParameters(); d.randomSeed = RandomSeed; return(JsonConvert.SerializeObject(d)); }
public override void FromJson(string data) { GraphInstanceNodeData d = JsonConvert.DeserializeObject <GraphInstanceNodeData>(data); SetBaseNodeDate(d); GraphData = d.rawData; path = d.path; jsonParameters = d.parameters; jsonCustomParameters = d.customParameters; randomSeed = d.randomSeed; ValidatePixelType(); bool didLoad = false; //we do this incase //the original graph was updated //and thus we should pull it in //if it exists //otherwise we fall back on //last saved graph data //also we do this //to try and load from //archive first didLoad = Load(path); //if path not found or could not load //fall back to last instance data saved if (!didLoad) { nameMap = new Dictionary <string, GraphParameterValue>(); loading = true; GraphInst = new Graph(Name, 256, 256, true, topGraph); GraphInst.AssignParentNode(this); GraphInst.Synchronized = !Async; GraphInst.FromJson(GraphData); GraphInst.AssignParameters(jsonParameters); GraphInst.AssignCustomParameters(jsonCustomParameters); GraphInst.AssignSeed(randomSeed); GraphInst.AssignPixelType(internalPixelType); GraphInst.ResizeWith(width, height); GraphInst.OnGraphParameterUpdate += GraphParameterValue_OnGraphParameterUpdate; Setup(); loading = false; } }
public override void FromJson(Dictionary <string, Node> nodes, string data) { GraphInstanceNodeData d = JsonConvert.DeserializeObject <GraphInstanceNodeData>(data); SetBaseNodeDate(d); GraphData = d.rawData; path = d.path; jsonParameters = d.parameters; jsonCustomParameters = d.customParameters; randomSeed = d.randomSeed; bool didLoad = false; //we do this incase //the original graph was updated //and thus we should pull it in //if it exists //otherwise we fall back on //last saved graph data if (File.Exists(path)) { didLoad = Load(path); } //if path not found or could not load //fall back to last instance data saved if (!didLoad) { GraphInst = new Graph(Name); GraphInst.FromJson(GraphData); GraphInst.SetJsonReadyParameters(jsonParameters); GraphInst.SetJsonReadyCustomParameters(jsonCustomParameters); GraphInst.RandomSeed = randomSeed; GraphInst.ResizeWith(width, height); Setup(); } }
public override void FromJson(string data) { GraphInstanceNodeData d = JsonConvert.DeserializeObject <GraphInstanceNodeData>(data); SetBaseNodeDate(d); GraphData = d.rawData; path = d.path; jsonParameters = d.parameters; jsonCustomParameters = d.customParameters; randomSeed = d.randomSeed; isLayer = d.isLayer; ValidatePixelType(); bool didLoad = false; //we do this incase //the original graph was updated //and thus we should pull it in //if it exists //otherwise we fall back on //last saved graph data //also we do this //to try and load from //archive first didLoad = Load(path); //if path not found or could not load //fall back to last instance data saved if (!didLoad && !string.IsNullOrEmpty(GraphData)) { nameMap = new Dictionary <string, GraphParameterValue>(); loading = true; PrepareGraph(); loading = false; } }