Message 1 of 1
function performs from call to call slower
Not applicable
01-13-2009
09:25 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
When I open a rollout I collect materials of specific objects in a scene. The function collects each material just once for all objects in the case that more objects share the same material. the rollout / dialog window is called mli. I save the object which are saved in arrays for each material in mli.oldMat and the materials in mli.oldMat.
Each time I close the dialog the following code will be performed to put the old material back to the objects. Each time the function is performed, it will become much slower the next time. If I perform that code manually in the listener, it want become slower. I have the same effect with other functions. I tried this in a scene with 1000 spheres and 24 materials randomly put on these spheres.
I think it has to do with the use of arrays, but even gc() brings no solution.
I hope someone can help me, because I tried everything and have absolutely no idea for a solution.
count = mli.oldMat.count
for i = count to 1 by -1 do
(
for j = mli.oldMat.count to 1 by -1 do if isValidObj mli.oldMat == false do deleteItem mli.oldMat j
mli.oldMat.mat = undefined
mli.oldMat.mat = mli.oldMat
)
Each time I close the dialog the following code will be performed to put the old material back to the objects. Each time the function is performed, it will become much slower the next time. If I perform that code manually in the listener, it want become slower. I have the same effect with other functions. I tried this in a scene with 1000 spheres and 24 materials randomly put on these spheres.
I think it has to do with the use of arrays, but even gc() brings no solution.
I hope someone can help me, because I tried everything and have absolutely no idea for a solution.
count = mli.oldMat.count
for i = count to 1 by -1 do
(
for j = mli.oldMat.count to 1 by -1 do if isValidObj mli.oldMat
mli.oldMat.mat = undefined
mli.oldMat.mat = mli.oldMat
)