[Closed] Access subtex diffuse properties
Hi,
Im struggling a bit with altering a texture in the selected object that are nested inside another texture and located in the diffuse of the material through Maxscript. Its not a issue when the textures is located as the first texture in the diffuse but when its nested it gets really tricky to fix it.
Material could look like this
selected object
multisub
–vrayblend
— vraymtl
—–diffuse
—— composite
——-colorcorrection
——– bitmap (blur for example)
How do I access the bitmap in the diffuse. The texture could be nested down in several nodes or textures but it could also just be the texture that are connected to a simple vraymtl diffuse slot
you can use getClassInstances to get all the bitmaps or any other class
getClassInstances bitmaptexture target:selection[1]
this way you can manipulate all the blur values at once
(getClassInstances StandardUVGen target:$).blur = 0.01
Exactly but the problem I have is that when I try to just manipulate the class in the diffuse channel of a material not the class through the whole material.
So you need to find and manipulate only the maps related to a particular material property?
fn GetMaterialPropertyBitmaps mtlclass propname target = -- what a terrible function name
(
local mtls = getClassInstances mtlclass target:target
local results = #()
for mtl in mtls where IsProperty mtl propname and (prop = getProperty mtl propname) != undefined do join results (getClassInstances BitmapTexture target:prop)
results
)
GetMaterialPropertyBitmaps CoronaMtl #texmapReflect $
Exactly, lets say the blur value in diffuse needs to be different from the bump or as a separate function I just want to shift the hue in the cc node in just the diffuse.
Thanks for the code, for some reason it prints all nodes accross the material and not only the one that are located in the diffuse.
GetMaterialPropertyBitmaps VrayMtl #texmap_diffuse $
I did call getclassinstances on material again instead of the property. It should work now. Updated my previous post
Works perfect so far, thanks. Will see if a jump into some other problems later.
This question might seam a bit off topic but is it possible to assign a argument to the function to control the for loop. In this case the expression, the expvalue is not a problem but when collecting the o.coordsblur from a argument I get unknown property (looks like it doesnt like dots)
fn GetMaterialPropertyBitmaps mtlclass texclass propname target expression expvalue =
(
local mtls = getClassInstances mtlclass target:target
local results = #()for mtl in mtls where IsProperty mtl propname and (prop = getProperty mtl propname) != undefined do join results (getClassInstances texclass target:prop)
for o in results do
(
expression = expvalue
)
)
GetMaterialPropertyBitmaps vrayMtl Bitmaptexture #texmap_diffuse $ o.coords.blur 0.8