[Closed] accessing all maps in specific or one channel
here the matter : i have a large scene with many complex materials some of those materials for example has in the following>diffusemap>falloff>checker>bitmap…etc
i.e diffusemap channel has falloff texmap that has in one map a checker map and that one has a bitmap and so on.
i want to access a specific map within this branching lets say iwant to replace any raytrace within this branching with bitmap and what so ever.
getNumSubTexmaps /getSubTexmap methods work fine for one level but not so deep so every time i want to go deeper i will write specific code according the material , really wiped up the reference and topic here but invain
heres a thread with SIMILAR question
http://forums.cgsociety.org/showthread.php?f=98&t=591947&page=1&pp=15&highlight=maps
but he didnt get it all
This depends what you’re after:
If you want to replace all instances of raytrace with something else, look into the getClassInstances command.
If you want an array of all submaps of the material and/or sub-material you need a recursive function.
thats fine but how can i use GetClassInstance to replace certain map like raytrace with watever else ? i couldnt do that
for all materials:
for m in (getClassinstances raytrace) do replaceInstances m (bitmaptex())
for a specific material:
for m in (getClassinstances raytrace target:theMat) do replaceInstances m (bitmaptex())
thanks lo that works fine but what if wanted to clear this map i.e if the class of the material i bitmaptex so make it undefined one , i used notexuremap or referncing it to a tepmorary object with channel i s undefined so what do u suggest for that ?
hi , i managed to do it successfully , heres the code
(
for m in (getClassinstances checker) do ( for y in (refs.dependents m ) do
(
if ((superclassof y)==texturemap) do
(a=getNumSubTexmaps y
if (a!=0) do
( for i in 1 to a do
(b=getSubTexmap y i
if ((classof b)==checker) do
(setSubTexmap y i undefined)
)---i end do
)---- if a!=0 end
)---do end of texture map
)---do end of refs dependannts
)---do end of classinstance
)---global scope
hope it help
you are doing everything right but it might be done more optimal way:
for tex in (getClassinstances checker [b]target:[color=Red]rootnode[/color][/b]) do
-- use rootnode Target to search only checkers used in scene materials
(
for target in (refs.dependents tex [b]immediateOnly:on[/b]) where iskindof target texturemap do
-- check only immediate dependents
(
for i=1 to (getNumSubTexmaps target) where iskindof (getSubTexmap target i) checker do
setSubTexmap target i undefined
)
)
i found easier and faster way how to replace all Checker(for example) TextureMaps with undefined:
(
for t in (getclassinstances Checker asTrackViewPick:on)
where t.subnum > 0 and iskindof t.client[t.subnum].value Checker do t.client[t.subnum].value = undefined
)