If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.
Exciting News: Chaos acquires EvolveLAB = AI-Powered Design.
To learn more, please visit this page!
New! You can now log in to the forums with your chaos.com account as well as your forum account.
Announcement
Collapse
No announcement yet.
VRayDirt - Maxscript to change all subdivs in scene?
No idea off the top of my head if the macrorecorder doesn't do it, but as a general rule you can do a quick thing by assigning a material like a vray material to a temp object, then do "showproperties $.material" in the listener. It'll feed out the names of all the parameters but also the map channels. I think the vray material uses .diffuse_map as it's slot for diffuse, so if you pop a dirt into that slot and then use showproperties $.material.diffuse_map it'll give you all the maxscript properties for whatever map is in the diffuse slot, and you'll get your parameters to target for the subdivs.
Another handy one is "classof" and it'll tell you what type of max object something is. So if you had a vray dirt in that material diffuse slot and did "classof $.material.diffuse_map" it'll feed something back like "vray_dirt()" - this is what you'll use to select all of them in the scene.
The last little bit is getting all of the vray dirts based on the above. There's a really handy maxscript command called getClassInstances and it'll select everything of a type of object in a scene. So if you wanna get all your vray dirts, if the classof thing above says a vray dirt is called vray_dirt() by maxscript, you'd do soemthing like "theDirtMaps = getClassInstances vray_dirt()". This gets you an array of all your dirts. Then it's a case of a for loop to run through all the dirts and use the commands you learned from the showproperties of the dirt to get the right name for it's subdivs property.
You can use the following steps in order to change the V-Ray Dirt maps subdivs for the entire scene:
*) Download and extract the Maxscript file: Getallmats.zip
*)Evaluate it in 3ds Max via Maxscript/Run Script
*) Open 3ds Мax script listener and evaluate allDirts=(getAllTextures sceneMaterials)
It will return all Dirt maps.
*) then evaluate setSubdivs allDirts 20
to change all subdivs to "20", for an example.
for o in getclassinstances vrayDirt do o.subdivs = 64
Hey Dave, Just curious : does getclassinstances get all of the textures in the scene, even if they are nested inside things like mix maps, VrayCompTex, multimaterials,etc ? Or do these situations require additional code to dig through the hierarchies ?
Hey Dave, Just curious : does getclassinstances get all of the textures in the scene, even if they are nested inside things like mix maps, VrayCompTex, multimaterials,etc ? Or do these situations require additional code to dig through the hierarchies ?
Yes, that's the nice thing about GetClassInstances()
Comment