you can make your own list of modifier classes which for sure can’t contain any texture in its properties. all other classes should be checked.
With this option I have now such results:
enumeratefiles <modifier>:1183ms ram:52552L
res = #()
for m in join modifier.classes SpacewarpModifier.classes do (
try (
local a = m()
) catch ( continue )
for p in getpropnames a where classof (getproperty a p) == UndefinedClass or hasproperty a #maps do appendifunique res m
)
This probably can help you a bit. There’re some false-positives in resulting array
Do you guys aware of any other ways of detecting mapbutton of modifier?
enumeratefiles for a specified taget modifier has to work very fast. i think that you lose speed on anything else.
here is 100,000 volume_select modifier tests:
(
txmaps = #()
fn addmap map =
(
appendifunique maps txmaps
)
m = volumeselect()
(
t = timestamp()
for k=1 to 100000 do enumeratefiles m addmap
timestamp() - t
)
)
The scene that I use is heavy, and except this it is located on a slow Hdd on LAN, and most files are found. Found files on LAN is the most awful thing I noticed for max. It takes a lot of time even to refresh asset tracking, however I’m not doing it – just the function itself.
you are trying to not search in instances. which is correct generally. but maybe file enumeration is faster than finding instances.
In my first post I tested the same scene without excluding instances:
enumeratefiles <modifier>:23322ms ram:7120L
With excluding them I get all the files in less then 2 seconds.
23 seconds vs 2.
Except this, I’ve noticed that inside bgworker, when multhithreading, if I use getinstances, then I get unknown error, I spent 3 hours to understand what was the reason till I got to that conclusion. That’s why I do this operation outside of bgworker. Now I get no errors
how many modifiers do you have in the scene?
just simply:
(
num = 0
for node in objects do num += node.modifiers.count
num
)
(
txmaps = #()
fn addmap map =
(
appendifunique maps txmaps
)
m = volumeselect()
(
t = timestamp()
for k=1 to 100000 do enumeratefiles m addmap
timestamp() - t
)
)
this takes 92 ms in an empty scene.
In my scene: 13007 modifiers.
I had to make a little correction:
fn addmap map =
(
append txmaps map
)
takes about 13827ms
but what is m = volumeselect() for, in your last code?
If I enumerate for missing as well:
for obj in objects do for m in obj.modifiers do
(
enumeratefiles m addmap
enumeratefiles m addmap #missing
)
then it takes 22066 ms
how long does this take:
(
global txmaps = #()
fn addmap map =
(
append maps txmaps
)
m = volumeselect()
(
t = timestamp()
for obj in objects do for m in obj.modifiers do enumeratefiles m addmap
timestamp() - t
)
)
it’s left from another code. you don’t need.
do your scene have a lot of materials which are used in a modifiers?