Saving / restoring collapsed ranges to / from file

Having quite big script, is there the way to save collapsed blocks point and restore it on loading the file?

I tried and can use GetOutlineRange and SetOutlineRange.

What works:

Collapse some code

Get outlines to List

Outline all

Restore with Set outline and previously taken ranges list.

Doesn’t :

Storing it to XML or binary file and reading back.

Can’t serialize as it is not marked as serializable.

I am sure there must be the way.

Thanks

Mike

Hi Mike,

Sorry for the late reply. It should be possible to save/load outline ranges with a bit of extra code, we will provide an example shortly.

Kind regards,
Dmitry

Please take a look at this demo project - it shows how to save outlining to an XML file load outlining back (or load only the visible state in the existing outline ranges).

https://drive.google.com/file/d/1wZGNwmPg8SuNKMoksJUgkKsohB7ff7xq/view?usp=share_link

Let me know if this is what you’re looking for.

Kind regards,
Dmitry