[Closed] select object with missing bitmaps
Is it possible to select objects on scene with missing textures, like get objects by missing classinstances or any other fast working way. There is some threads here but not working?
I know there are plugins to remove or relink missing files however I’m looking only for way to select objects with missing textures.
This seems to work though I am not sure it will in all cases.
(
arr = #()
fn CollectNodes arg node = append arr node
for j in objects do enumeratefiles j CollectNodes j #missing
select arr
)
find all objects associated with missed textures is very easy. the real problem is to find where they were missed.
Yes Denis, I see,it’s easy in code but not in sceene .
thanks, after I fired it up I was so happy because I spent 3 hours on it today and I couldn’t figure this out, but my happiness dont’ took to much time because it seems it work nice only with simple materials, when I test it on scene with missing textures in raytraced and multimaterials (383 objects: 10 multimaterials, standard 179,primitive 24, 39- missing bitmaps) it took 5 minutes , so I don’t even want to test it o scene with 5000 objects so is never easy in practice. Question’s still open then.How to wait for selection less than our lifetime:)
PolyTools3D shows you absolutely right solution. it takes almost nothing because this information stored in the system after loading(or after trying to load) any texture.
I am not sure, but there seems to be a bug when working with multimaterials because the slowdown is impressive. Or perhaps I am missing something.
Here is a different approach which runs around 150 times faster than the previous code, and it should be faster for larger amount of multimaterials and nodes.
(
st = timestamp(); sh = heapfree
materials = #()
fn CollectMaterials arg mat = appendifunique materials mat
for j in scenematerials do enumeratefiles j CollectMaterials j #missing
nodes = for j in objects where (finditem materials j.material) != 0 collect j
select nodes
format "time:% ram:%
" (timestamp()-st) (sh-heapfree)
)
Tested on:
200 Objects all with same material
1 Multimaterial (10 sub) each one misses one bitmap
Previous code (by node)
time:4617 ram:524296L
Latest code (by material)
time:31 ram:2824L
thank you very very much, I tested your new version and it took 2 minutes instead of 5 on some scenes but I noticed those scenes was created at first on 3dsmax 5 however later saved on 2013 so maybe it have something to do. Rest of tests is fine, time is one second or less, work with mental ray and more complex scenes. Thank you one more time.
I have one more question this night. I work on code which is very long and I used to get to objects(modyfiers, controllers etc.) by objects selection, it work fine but on long distance is very slow. I was wandering is there way to get to objects modyfiers other way around. Instead of checking all objects in selection and checking their modyfiers, controllers… can I check all kind of controllers in instances and then select object which are associated with it, like: select objects with meshsmooth modyfiers? Mekanizm would be this same like in case of this code for selecting textures, something like:
instead of:
for o in objects collect o
for o in s do (
for m in o.modifiers where classof m == meshsmooth select o
)
I’m looking for such a way:
take all modyfiers instances on scene and search all meshsmooth , select all objects with meshsmooth.
Is it possible to do it this way?
getclassintances
refs.dependentnodes
there are a lot of samples on this forum