Hi all, @DavidRutten,
For some reason, the Write() method in my gh types (inheriting GH_Goo) are never called. I don’t know what’s going on.
I have custom parameters and types inheriting from GH_PersistentParam< T> and GH_Goo< T> that are abstract classes (Param_Base and Goo_Base) and also other classes that inherit these. The abstract classes override the Write() and Read() methods just to check if they are being called, like this:
In the param:
public override bool Write(GH_IWriter writer)
{
RhinoApp.WriteLine("Write Param_Base"); // this returns as expected
foreach (var d in PersistentData.FlattenData())
Rhino.RhinoApp.WriteLine(d.ToString()); // this returns as expected, all data is there
return base.Write(writer);
}
In the goo:
public override bool Write(GH_IWriter writer)
{
RhinoApp.WriteLine("Write Goo_Base"); // this call never happens!
return base.Write(writer);
}
The non-abstract classes doesn’t implement this methods. For some reason, Goo_Base.Write() is never called.
I check a .ghx file and its chunk is missing the data of the values:
<chunk name="PersistentData">
<items count="1">
<item name="Count" type_name="gh_int32" type_code="3">1</item>
</items>
<chunks count="1">
<chunk name="Branch" index="0">
<items count="2">
<item name="Count" type_name="gh_int32" type_code="3">1</item>
<item name="Path" type_name="gh_string" type_code="10">{0}</item>
</items>
</chunk>
</chunks>
</chunk>
This is the third time I’ve tried to fix this, I need help, I don’t know what could be going wrong. Another strange thing is that the Extract Parameter doesn’t work, it doesn’t do anything.
Hierarchy of inheritance:
Param_Base< T> : GH_PersistentParam< T>
Param_Foo : Param_Base< Goo_Foo>
Goo_Base< T> : GH_Goo< T>
Goo_Foo : Goo_Base< Foo>
I’ve done this a thousand times and it worked, and it’s too much code to turn everything upside down to look for the error, so I need to understand better why the parameter Write method doesn’t call the goo Write method, PersistentData has values.
Please help.