Itoo Software Forum

Author Topic: Idea for a script/ forest tool : Forest geomerty cleaner - garbage collector  (Read 570 times)

Pixelab

  • Jr. Member
  • **
  • Posts: 74
  • Suave mari magno
    • pixelab.be
We often end up changing / testing a lot of different geomerty within a forest object, and with a file with 5+ forest objects with 10 geomerty objects each, the forest_templates layer often end up filled with unused proxies, xref, or actual geometry. This bloats file size, increase load/ save time and it's a tedious task to clean it up.

I read that forest automatically deletes the unused geometry, but I'm not sure and I found some files with orphaned geometry.

Would it be possible to add in the forest tools, or to provide a simple script doing the following :

List all the objects in the forest_templates layer, and delete (or select to add a validation step) all the objects not referenced inside a forest object.

thx !

iToo

  • Administrator
  • Hero Member
  • *****
  • Posts: 3158
    • iToo Software
Hi, that's correct. Currently Forest checks what objects in the template layer are not referenced, and delete them. But there are some restrictions:

- At least must be one Forest object in the scene.
- Billboards (_forest_template_???) never are deleted, because are used internally by Forest.
- Objects not imported from the library (i.e. moved manually to the layer) are not checked.
- If a Forest object has been deleted recently, Max stores it in the "Undo" queue... and it's considered as not deleted. We respect this restriction to keep the integrity of the undo/redo operations.

The layer is cleaned when scene is saved. In your case it's possible that there are FP objects in the Undo queue, and for this reason their references are not deleted.
You can try forcing to clear the Undo queue before saving. This is done from Maxscript with the command gc().

As you suggested, to make things easier we would replicate this process from Forest Tools, adding also an option to clear undo objects.
I added it to the wishlist.
« Last Edit: March 02, 2017, 09:55:54 AM by iToo »
Carlos Quintero
iToo Software

Pixelab

  • Jr. Member
  • **
  • Posts: 74
  • Suave mari magno
    • pixelab.be
Hi, that's correct. Currently Forest checks what objects in the template layer are not referenced, and delete them. But there are some restrictions:

- At least must be one Forest object in the scene.
- Billboards (_forest_template_???) never are deleted, because are used internally by Forest.
- Objects not imported from the library (i.e. moved manually to the layer) are not checked.
- If a Forest object has been deleted recently, Max stores it in the "Undo" queue... and it's considered as not deleted. We respect this restriction to keep the integrity of the undo/redo operations.

The layer is cleaned when scene is saved. In your case it's possible that there are FP objects in the Undo queue, and for this reason their references are not deleted.
You can try forcing to clear the Undo queue before saving. This is done from Maxscript with the command gc().

As you suggested, to make things easier we would replicate this process from Forest Tools, adding also an option to clear undo objects.
I added it to the wishlist.

Thanks a lot Carlos. It's amazing to learn all the little things that happens under the hood, and that makes Forest so powerful.

Quote
Objects not imported from the library (i.e. moved manually to the layer) are not checked.

Would it be possible to check also those ? The idea would be to have check everything, no matter the origin of the prop (library or not, mesh, proxy, xref, etc.)

Of course, this would mean that what you put in the forest_template layer is "at your own risk" but I don't think anyone uses this layer and a garbage collector script/ tool for anything else than objects scattered by forest

iToo

  • Administrator
  • Hero Member
  • *****
  • Posts: 3158
    • iToo Software
Quote
Quote
Objects not imported from the library (i.e. moved manually to the layer) are not checked.
Quote
Would it be possible to check also those ? The idea would be to have check everything, no matter the origin of the prop (library or not, mesh, proxy, xref, etc.)

Of course, this would mean that what you put in the forest_template layer is "at your own risk" but I don't think anyone uses this layer and a garbage collector script/ tool for anything else than objects scattered by forest

Yes, we would add it as an option in Forest Tool (disabled by default). That should be safe enough, i guess.
I prefer not do it in the default cleaning process, because there are so many different workflows as customers... you know. :)


« Last Edit: March 02, 2017, 01:20:05 PM by iToo »
Carlos Quintero
iToo Software