Problem I’m solving
Sometimes I want to delete every single hidden objects to save a cleaned file that only have visible stuff. I just want a way to do this though scripting so that I can programmatically using this.
Solution
This script, more like a code snippet, can delete all hidden objects.
Installation
- Simply just drag the script to the viewport to install.
- Right-click on the toolbar > Customize…
- Choose the tab ‘Toolbars’
- In the Category: dropdown, select ‘ManniiCode’
- Drag the script to the toolbar where ever you want!
Code
Macroscript (Maxscript)
macroscript DeleteAllHiddenObjects Category:"ManniiCode" toolTip:"Delete All Hidden Objects" ( delete (for obj in objects where obj.ishidden collect(obj)) )
Maxscript Snippet
delete (for obj in objects where obj.ishidden collect(obj))
Python
from pymxs import runtime as rt rt.delete([x for x in rt.objects if x.ishidden == True])