FLAMEGPU2 icon indicating copy to clipboard operation
FLAMEGPU2 copied to clipboard

JSON not formatted anymore

Open Robadob opened this issue 9 months ago • 0 comments

Discussed in https://github.com/FLAMEGPU/FLAMEGPU2/discussions/1204

Originally posted by bytetec May 13, 2024 Hi everyone Since the update from FLAME GPU 2.0.0-rc to FLAME GPU 2.0.0-rc.1 the export of the logfile in JSON produces only a one liner. Does anybody else has this issue? Before: image After: image


It appears the methods of RapidJSON's Writer are not virtual, hence when a pointer to the PrettyWriter subclass is cast to Writer, method calls are not forwarded to the sub class.

https://github.com/FLAMEGPU/FLAMEGPU2/blob/b5173e78765d03be8d1b393f8a037499b064b676/src/flamegpu/io/JSONStateWriter.cu#L33

This bug was introduced when the StateWriter interface was refactored to better enable partial state writes.

Solution would probably be to template JSONStateWriter so that the two different printers have distinct objects.

Robadob avatar May 14 '24 13:05 Robadob