View Full Version : polyOp.attach gets slower the more is attached..why?
CapitanRed 08-19-2008, 10:59 PM I use this script to attach many objects to one polyMesh:
myObj = $X_frag_01_frag_01
tempArr = selection
for i = tempArr.count to 1 by -1 do(
polyOp.attach myObj tempArr[i]
print i
)
the more objects in the selection, the slower it gets towards the end. but the ram usage somehow stays the same. is there a workaround? because when I remove the print function, it gets little faster, but with more than 300 objects it seems like freezing somewhere.
|
|
Gravey
08-20-2008, 09:03 AM
print is a slow function but i believe the reason it gets slower and slower is that max is creating an undo buffer which is quite sizeable when attaching lots of objects. if you use undo off before you start your loop, it should be faster.
eg.undo off
for s in selection do
(
-- some code
)
Neuro69
08-20-2008, 09:16 AM
Turning off undo is probably the solution, but you might also consider material handling. I'm not sure how this is handled in maxscript, but the default behaviour when attaching with the UI could in some cases result in the creation of some massive multimaterials that will slow things down.
CapitanRed
08-20-2008, 09:17 AM
WOW! that speeded it up! awesome! (the "undo off")
thanks a lot :)
all the objects that get attached have 2 face ID's, and a multi/sub object material assigned. maybe that's also a issue. will test it...
...ok tested with multimaterial, 2 Id's and smoothing channels. It's slower, but does not slow down over time.
Neuro69
08-20-2008, 12:21 PM
The issue with materials arise when/if all the objects have different materials, and MAX creates/appends them to a new multimaterial that grows extremely large (hundreds or thousands of ID's). This wouldn't normally happen with geometry that you created yourself, because it's unlikely that you would create thousands of unique materials manually, but I've had this problem sometimes with geometry that has been generated and exported from other programs (CAD software).
CGTalk Moderation
08-20-2008, 12:21 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.