//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ /// <summary> /// Adds to the default serialization method to save the current child status so it persists on copy/paste and save/reopen. /// </summary> public override bool Write(GH_IWriter writer) { writer.SetInt32("mIndex", mIndex); writer.SetInt32("tIndex", tIndex); return(base.Write(writer)); }
public override bool Write(GH_IWriter writer) { writer.SetInt32("Mode", ModeLighting); writer.SetInt32("Stack", ModeStack); return(base.Write(writer)); }
public override bool Write(GH_IWriter writer) { writer.SetInt32("Label", LabelStatus); writer.SetInt32("Mode", modeStatus); return(base.Write(writer)); }
public bool Write(GH_IWriter writer) { writer.SetString("name", Name); GH_IWriter val = writer.CreateChunk("params"); GH_IWriter val2 = val.CreateChunk("input"); val2.SetInt32("index", 0); val2.SetInt32("count", Inputs.Count); for (int i = 0; i < inputs.Count; i++) { if (inputs[i].Parameter.Attributes != null) { GH_IWriter val3 = val2.CreateChunk("p", i); inputs[i].Parameter.Write(val3); } } GH_IWriter val4 = val.CreateChunk("output"); val4.SetInt32("index", 0); val4.SetInt32("count", Outputs.Count); for (int j = 0; j < outputs.Count; j++) { if (outputs[j].Parameter.Attributes != null) { GH_IWriter val5 = val4.CreateChunk("p", j); outputs[j].Parameter.Write(val5); } } GH_IWriter writer2 = writer.CreateChunk("context"); return(cxt.Collection.Write(writer2)); }
public override bool Write(GH_IWriter writer) { writer.SetInt32("FPSIndex", FPSindex); writer.SetInt32("SizeWidth", PictWidth); writer.SetInt32("SizeHeight", PictHeight); writer.SetInt32("SizeIndex", Sizeindex); writer.SetInt32("TypeIndex", Typeindex); writer.SetBoolean("Duration", Duration); writer.SetBoolean("Remap", Remap); writer.SetDouble("TimeInFrame", TimeInFrame); writer.SetDouble("DelayLog", DelayLog); writer.SetBoolean("Save", Save); writer.SetDouble("SliderMul", SliderMultiple); writer.SetDouble("ViewportReduce", ViewportReduce); writer.SetBoolean("ShowLabel", ShowLabel); writer.SetDouble("LabelSize", LabelSize); writer.SetBoolean("ShowFrame", ShowFrame); writer.SetBoolean("ShowTime", ShowTime); writer.SetBoolean("ShowPercent", ShowPercent); writer.SetBoolean("ShowRemain", ShowRemain); writer.SetBoolean("ShowGraph", ShowGraph); writer.SetBoolean("ShowGraphEvent", ShowGraphOnEvent); return(base.Write(writer)); }
public override bool Write(GH_IWriter writer) { writer.SetInt32("Modes", (int)modes); writer.SetInt32("steps", this.steps); return(base.Write(writer)); }
public override bool Write(GH_IWriter writer) { writer.SetInt32("Pattern", GradientType); writer.SetInt32("Space", GradientSpace); return(base.Write(writer)); }
/* * public void DrawViewportMeshes(GH_PreviewMeshArgs args) * { * if (DisplayMesh != null) * args.Pipeline.DrawMeshShaded(DisplayMesh, args.Material); * } * * public void DrawViewportWires(GH_PreviewWireArgs args) * { * if (DisplayMesh != null) * args.Pipeline.DrawMeshWires(DisplayMesh, args.Color); * } */ #region Serialization public override bool Write(GH_IWriter writer) { if (Value == null) { return(false); } byte[] centrelineBytes = GH_Convert.CommonObjectToByteArray(Value.Centreline); writer.SetByteArray("guide", centrelineBytes); //writer.SetInt32("num_frames", Value.Frames.Count); //for (int i = 0; i < Value.Frames.Count; ++i) //{ // Plane p = Value.Frames[i].Item2; // // writer.SetPlane("frames", i, new GH_IO.Types.GH_Plane( // p.OriginX, p.OriginY, p.OriginZ, p.XAxis.X, p.XAxis.Y, p.XAxis.Z, p.YAxis.X, p.YAxis.Y, p.YAxis.Z)); //} writer.SetInt32("lcx", Value.Data.NumWidth); writer.SetInt32("lcy", Value.Data.NumHeight); writer.SetDouble("lsx", Value.Data.LamWidth); writer.SetDouble("lsy", Value.Data.LamHeight); writer.SetInt32("interpolation", (int)Value.Data.InterpolationType); writer.SetInt32("samples", Value.Data.Samples); return(true); }
/// <summary> /// Adds to the default serialization method to save the current child status so it persists on copy/paste and save/reopen. /// </summary> public override bool Write(GH_IWriter writer) { writer.SetInt32("indexIn", inputIndex); writer.SetInt32("indexOut", outputIndex); return(base.Write(writer)); }
public override bool Write(GH_IWriter writer) { writer.SetInt32("Size", SpacingMode); writer.SetInt32("Pattern", PatternModeStatus); writer.SetDouble("Width", PatternWeight); return(base.Write(writer)); }
public override bool Write(GH_IWriter writer) { writer.SetInt32("Cap", CapMode); writer.SetInt32("Corner", CornerMode); writer.SetInt32("Pattern", PatternMode); return(base.Write(writer)); }
public static void WriteGlulamData(GH_IWriter writer, GlulamData data) { writer.SetInt32("data_NumWidth", data.NumWidth); writer.SetInt32("data_NumHeight", data.NumHeight); writer.SetDouble("data_LamWidth", data.LamWidth); writer.SetDouble("data_LamHeight", data.LamHeight); writer.SetInt32("data_Samples", data.Samples); writer.SetInt32("data_Interpolation", (int)data.InterpolationType); writer.SetInt32("data_SectionAlignment", (int)data.SectionAlignment); }
public override bool Write(GH_IWriter writer) { writer.SetInt32("Vertical", hJustify); writer.SetInt32("Horizontal", vJustify); writer.SetBoolean("Bold", IsBold); writer.SetBoolean("Italic", IsItalic); writer.SetBoolean("Under", IsUnder); return(base.Write(writer)); }
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ /// <summary> /// Adds to the default serialization method to save the current child status so it persists on copy/paste and save/reopen. /// </summary> public override bool Write(GH_IWriter writer) { writer.SetInt32("mIndex", mIndex); writer.SetInt32("iIndex", iIndex); writer.SetInt32("fIndex", fIndex); writer.SetBoolean("PerturbA", pA); writer.SetBoolean("PerturbB", pB); return(base.Write(writer)); }
public bool WriteOne(Tensor tens, GH_IWriter writer, string Suffix) { writer.SetInt32("ShapeCount_" + Suffix, tens.ShapeCount); List <int> shape = tens.GetShape; for (int i = 0, loopTo = tens.ShapeCount - 1; i <= loopTo; i += 1) { writer.SetInt32("S" + i + "_" + Suffix, shape[i]); } writer.SetDoubleArray("Data_" + Suffix, tens.ToArray); return(true); }
public override bool Write(GH_IWriter writer) { writer.SetInt32("ShapeCount", this.Value.ShapeCount); List <int> shape = this.Value.GetShape; for (int i = 0, loopTo = this.Value.ShapeCount - 1; i <= loopTo; i += 1) { writer.SetInt32("S" + i, shape[i]); } writer.SetDoubleArray("Data", this.Value.ToArray); return(true); }
public override bool Write(GH_IWriter writer) { try { GH_IWriter writer2 = writer.CreateChunk("Hoopsnake_Data"); writer2.SetInt32("dataLimit", dataLimit); writer2.SetBoolean("resetCounter", resetCounterOnLoop); writer2.SetBoolean("updateView", updateView); writer2.SetBoolean("autoUpdate", autoUpdate); writer2.SetInt32("delay", delay); } catch {} return(base.Write(writer)); }
public override bool Write(GH_IWriter writer) { int n = 0; foreach (var kps in keyPoints) { writer.SetInt32(n.ToString() + "K", kps.Key); writer.SetDouble(n.ToString() + "V", kps.Value); n++; } writer.SetInt32("Count", n); writer.SetBoolean("ShowGraphSlider", ShowGraphOnSlider); return(base.Write(writer)); }
/* * public void Dispose() * { * foreach (Mesh m in this._meshCache) * { * m.Dispose(); * } * }*/ public override bool Write(GH_IWriter writer) { base.Write(writer); try { writer.RemoveChunk("PersistentData"); writer.SetInt32("GridCount", PersistentData.DataCount); var total = 0; for (var i = 0; i < PersistentData.Branches.Count; i++) { var path = PersistentData.Paths[i]; foreach (var ghvg in PersistentData.Branches[i]) { var currentGrid = writer.CreateChunk("Grid", total); currentGrid.SetString("Data", ByteHelper.ByteToHex(ByteHelper.Compress(ByteHelper.ToByte(ghvg.Value)))); currentGrid.SetString("Path", path.ToString()); total++; } } return(true); } catch (Exception e) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, e + " " + e.StackTrace); return(true); } }
public override bool Write(GH_IWriter writer) { writer.SetInt32("ListMode", (int)this.ListMode); writer.SetInt32("ListCount", this.m_userItems.Count); int arg_36_0 = 0; int num = this.m_userItems.Count - 1; for (int i = arg_36_0; i <= num; i++) { GH_IWriter chunk = writer.CreateChunk("ListItem", i); chunk.SetString("Name", this.m_userItems[i].Name); chunk.SetString("Expression", this.m_userItems[i].Expression); chunk.SetBoolean("Selected", this.m_userItems[i].Selected); } return(base.Write(writer)); }
public override bool Write(GH_IWriter writer) { writer.SetInt32("ListMode", (int)ListMode); writer.SetInt32("ListCount", m_userItems.Count); int num1 = 0; int num2 = m_userItems.Count - 1; for (int chunk_index = num1; chunk_index <= num2; ++chunk_index) { GH_IWriter chunk = writer.CreateChunk("ListItem", chunk_index); chunk.SetString("Name", m_userItems[chunk_index].Name); chunk.SetString("Expression", m_userItems[chunk_index].Expression); chunk.SetBoolean("Selected", m_userItems[chunk_index].Selected); } return(base.Write(writer)); }
public override bool Write(GH_IWriter writer) { var nn = new BinaryFormatter(); writer.SetInt32("FunctionCount", this.Value.NeuronFunctions.Count); for (int i = 0, loopTo = this.Value.NeuronFunctions.Count - 1; i <= loopTo; i += 1) { using (var mstr = new MemoryStream()) { nn.Serialize(mstr, this.Value.NeuronFunctions(i)); writer.SetByteArray("Function_" + i, mstr.ToArray()); } } using (var mstr = new MemoryStream()) { Owl.Core.IO.WriteTensors(mstr, this.Value.Biases); writer.SetByteArray("Biases", mstr.ToArray()); } using (var mstr = new MemoryStream()) { Owl.Core.IO.WriteTensors(mstr, this.Value.Weights); writer.SetByteArray("Weights", mstr.ToArray()); } return(true); }
public override bool Write(GH_IWriter writer) { writer.SetInt32("NormalCount", normalExceptionGuid.Count); for (int i = 0; i < normalExceptionGuid.Count; i++) { writer.SetGuid("Normal" + i.ToString(), normalExceptionGuid[i]); } writer.SetInt32("PluginCount", pluginExceptionGuid.Count); for (int j = 0; j < pluginExceptionGuid.Count; j++) { writer.SetGuid("Plugin" + j.ToString(), pluginExceptionGuid[j]); } return(base.Write(writer)); }
/// <summary> /// Write all required data for deserialization to an IO archive. /// </summary> /// <param name="writer">Object to write with.</param> /// <returns> /// True on success, false on failure. /// </returns> public override bool Write(GH_IWriter writer) { //serialize the states GH_IWriter stateSetChunk = writer.CreateChunk("stateSetChunk"); stateSetChunk.SetInt32("StateCount", savedStates.states.Count); int i = 0; //the state //for each state in saved states foreach (KeyValuePair <string, State> statePair in savedStates.states) { string stateName = statePair.Key; GH_IWriter StateChunk = stateSetChunk.CreateChunk("State", i); StateChunk.SetString("stateName", stateName); State state = statePair.Value; StateChunk.SetInt32("itemCount", state.stateDict.Count); int j = 0; //Custom serialization logic //for each element in the state foreach (KeyValuePair <UIElement_Goo, object> stateItem in state.stateDict) { //get element and value UIElement_Goo element = stateItem.Key; object value = stateItem.Value; GH_IWriter stateItemChunk = StateChunk.CreateChunk("stateItem", j); //this info is used to retrieve the dynamic UI element on reserialization, by grabbing the component with matching instance guid //and getting the output item at the matching index. stateItemChunk.SetString("ElementID", element.instanceGuid.ToString()); stateItemChunk.SetInt32("ElementIndex", element.index); string stringValue = value.ToString(); string typeString = value.GetType().ToString(); //special case for lists of bool - all other element "states" are single items. This only applies to a checklist object. if (value is List <bool> ) { typeString = "LIST OF BOOL"; stringValue = HUI_Util.stringFromBools((List <bool>)value); } if (value is List <string> ) { typeString = "LIST OF STRING"; stringValue = HUI_Util.stringFromStrings((List <string>)value); } //store the value and a hint as to its type stateItemChunk.SetString("ElementValue", stringValue); stateItemChunk.SetString("ElementValueType", typeString); j++; //counting up elements in state } i++; //counting up states } return(base.Write(writer)); }
private void writeCustomControls(GH_IWriter writer, IEnumerable <GHControl> customControls, string path) { foreach (GHControl control in customControls) { string name = (path.Length > 0) ? (path + "." + control.Name): control.Name; if (control is GHParameter) { GHParameter param = (GHParameter)control; switch (param.DataType) { case GH_Types.gh_bool: writer.SetBoolean(name, (bool)param.CurrentValue); break; case GH_Types.gh_double: writer.SetDouble(name, (double)param.CurrentValue); break; case GH_Types.gh_int32: writer.SetInt32(name, (int)param.CurrentValue); break; case GH_Types.gh_decimal: writer.SetDecimal(name, Convert.ToDecimal(param.CurrentValue)); break; } } if (control is IGHPanel) { writeCustomControls(writer, ((IGHPanel)control).Items, name); } } }
public override bool Write(GH_IWriter writer) { writer.SetInt32("Vertical", hJustify); writer.SetInt32("Horizontal", vJustify); writer.SetBoolean("Bold", IsBold); writer.SetBoolean("Italic", IsItalic); writer.SetBoolean("Under", IsUnder); writer.SetDrawingColor("Color", DrawColor); writer.SetString("FontName", fName); writer.SetDouble("FontSize", fSize); return(base.Write(writer)); }
public override bool Write(GH_IWriter writer) { writer.SetInt32("FilterMode", FilterMode); writer.SetBoolean("Optimize", OptimizeCurve); return(base.Write(writer)); }
public override bool Write(GH_IWriter writer) { staticData.PrepareWrite(activeUnit); bool result = base.Write(writer); staticData.RestoreWrite(activeUnit); if (activeUnit != null) { writer.CreateChunk("ActiveUnit").SetString("unitname", activeUnit.Name); } try { GH_IWriter val = writer.CreateChunk("EvalUnits"); val.SetInt32("count", evalUnits.Units.Count); for (int i = 0; i < evalUnits.Units.Count; i++) { EvaluationUnit evaluationUnit = evalUnits.Units[i]; GH_IWriter writer2 = val.CreateChunk("unit", i); evaluationUnit.Write(writer2); } return(result); } catch (Exception ex) { RhinoApp.WriteLine(ex.Message + "\n" + ex.StackTrace); throw ex; } }
public override bool Write(GH_IWriter writer) { if (Value == null) { return(false); } writer.SetInt32("lcx", Value.NumWidth); writer.SetInt32("lcy", Value.NumHeight); writer.SetDouble("lsx", Value.LamWidth); writer.SetDouble("lsy", Value.LamHeight); writer.SetInt32("interpolation", (int)Value.InterpolationType); writer.SetInt32("samples", Value.Samples); return(true); }
public override bool Write(GH_IWriter writer) { var result = base.Write(writer); writer.SetInt32("ScriptParamAccess", (int)Access); return(result); }
public override bool Write(GH_IWriter writer) { if (m_settings != null && m_settings.Length > 0) { writer.SetInt32("StringCount", m_settings.Length); for (int i = 0; i < m_settings.Length; i++) { writer.SetString("String", i, m_settings[i]); } } return base.Write(writer); }