Remove specific type of object from scene...
I would like to know how I can create a script that specifically deletes a certain object from the scene.
Example: I accidentally select a space warp or particle view or something and I want to be able to click a button that automatically finds particle view and removes it from my scene.
Here's my lousy attempt:
(
on press return (Particle_View.current!=undefined)
on execute do
(
if( Particle_View:Particle View.current==undefined ) then true
else Particle_View.current.DeleteSelected()
)
)
Comments
the fastest way is: if (pfs
the fastest way is:
if (pfs = getclassinstances PF_Source).count > 0 do delete pfs
Are you test your code? if
Are you test your code?
if (pfs = getclassinstances PF_Source).count > 0 do delete pfs
First "pfs" variable is local to the IF scope and become undefined for the delete ops, so the well known error appear:
-- No "delete" function for undefined
But that not is all, try this:
my recent MAXScripts RSS (archive here)
Thanks Anubis, this for loop
Thanks Anubis, this for loop is way more efficient and get rid of the Array.
the fast way to delete all
the fast way to delete all PF_Source in the scene:
for i in objects where classOf i == PF_Source do delete i
my recent MAXScripts RSS (archive here)
thank you very much guys.
thank you very much guys. I'm going to experiment with these and see if I can't learn something :)
Here is a version which ask
Here is a version which ask for user if he wants to delete the PF_Source with its name in the querybox.
I'm not sureif I understood
I'm not sureif I understood correctly, but you could loop through each scene object and make an array with only the PF_Source. Then in a for loop you could delete every object in the array. It's not really clean I'm no maxscript pro but this seems to work.