Skip to content

Commit

Permalink
Merge pull request #633 from mcneel/AndyPayne/DataTypesCompat
Browse files Browse the repository at this point in the history
modifying serialization for Resthopper Object
  • Loading branch information
andyopayne authored Nov 20, 2023
2 parents f2f6bdd + a117845 commit d197724
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
4 changes: 0 additions & 4 deletions src/compute.geometry/GrasshopperDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1223,13 +1223,9 @@ static ResthopperObject GetResthopperObject<T>(object goo, int rhinoVerion)
rhObj.Type = goo.GetType().FullName;

if (v is GeometryBase geometry)
{
rhObj.Data = geometry.ToJSON(new Rhino.FileIO.SerializationOptions() { RhinoVersion = rhinoVerion });
}
else
{
rhObj.Data = JsonConvert.SerializeObject(v, GeometryResolver.Settings(rhinoVerion));
}

return rhObj;
}
Expand Down
4 changes: 2 additions & 2 deletions src/compute.geometry/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ static void Main(string[] args)
// Uncomment the following to debug with core Rhino source. This
// tells compute to use a different RhinoCore than what RhinoInside thinks
// should use.
// (for McNeel devs only and only those devs who use the same path as Steve)
// (for McNeel devs only and only those devs who use the same path as Andy)

//string rhinoSystemDir = @"C:\dev\github\mcneelv8\rhino\src4\bin\Debug";
//string rhinoSystemDir = @"C:\dev\github\mcneel\rhino8\src4\bin\Debug";
//if (System.IO.File.Exists(rhinoSystemDir + "\\Rhino.exe"))
// RhinoInside.Resolver.RhinoSystemDirectory = rhinoSystemDir;

Expand Down
8 changes: 7 additions & 1 deletion src/hops/GrasshopperDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,13 @@ static ResthopperObject GetResthopperObject<T>(object goo)
var v = (T)goo;
ResthopperObject rhObj = new ResthopperObject();
rhObj.Type = goo.GetType().FullName;
rhObj.Data = JsonConvert.SerializeObject(v);//, GeometryResolver.Settings);
//rhObj.Data = JsonConvert.SerializeObject(v);//, GeometryResolver.Settings);

if (v is GeometryBase geometry)
rhObj.Data = geometry.ToJSON(new Rhino.FileIO.SerializationOptions());
else
rhObj.Data = JsonConvert.SerializeObject(v);

return rhObj;
}

Expand Down

0 comments on commit d197724

Please sign in to comment.