ScriptSpot is a diverse online community of artists and developers who come together to find and share scripts that empower their creativity with 3ds Max. Our users come from all parts of the world and work in everything from visual effects to gaming, architecture, students or hobbyists.
function collectRealWorldMats savetoFile:False = (
rwMats = materialLibrary()for mat in sceneMaterialsdo(
local maps = getproperty mat "Maps"for m in maps where superclassof m == textureMap do(try(if getproperty m.coords "realWorldScale"!= undefined do(if m.coords.realWorldScale do(appendifunique rwMats mat)))catch()))if rwMats.count > 0 do(if savetoFile then (-- save these materials to C:\Users\User\AppData\Local\Autodesk\3dsMax\2013 - 64bit\ENU\temp\realWorldMats.mat
local rwMatsFile = getdir #temp + "\\realWorldMats.mat"
saveTempMaterialLibrary rwMats rwMatsFile
)else(for m in rwMats doprint m.name)-- or simply output to listener-- select objects with these mats
objs = #(); for m in rwMats do(for o in objects where o.material == m do append objs o)
select objs
)
rwMats
)
collectRealWorldMats()-- or if you want to save to realWorldMats.mat-- collectRealWorldMats savetoFile:true
Because it use sceneMaterials, the file needs to be saved before running this script. Edit: Now it uses "textureMap" instead of "BitmapTexture"
I forget that people dont use standardMaterial anymore. LOL.
Yes this works for coronaBitmap.
I change collection using object materials instead of sceneMaterials.
Will not work on any material class other than vrayMtl, CoronaMtl and standardMaterial.
(
function collectRealWorldMats = (
local mats = #(), rwMats = #()for o in objects where o.material != undefined do appendIfUnique mats o.material
for mat in mats do(
case classof mat of (
standardMaterial:(
local maps = getproperty mat "Maps"for m in maps where superclassof m == textureMap do(if isproperty m.coords "realWorldScale" and m.coords.realWorldScale do(appendifunique rwMats mat)))
default: (for m=1 to mat.numsubs do(ifclassof mat[m] == SubAnim and superclassof(tM = mat[m].object) == textureMap do(ifclassof mat == coronaMtl and isproperty mat[m]"realWorldScale" and mat[m].realWorldScale do appendifunique rwMats mat
ifclassof mat == VrayMtl and isproperty mat[m].coords "realWorldScale" and mat[m].coords.realWorldScale do appendifunique rwMats mat
)))))
rwMats
)
mats = collectRealWorldMats()
objs = #()for m in mats do(for o in objects where o.material == m do appendIfUnique objs o)
select objs
)
Comments
try
Because it use sceneMaterials, the file needs to be saved before running this script. Edit: Now it uses "textureMap" instead of "BitmapTexture"
Rivanoor Bren
https://rivanoor.info
Thank you very much!
But i got error in line 4:
-- Unknown property: "maps"
Script will run with CoronaBitmap as well?
turbosquid | behance | website
--
I forget that people dont use standardMaterial anymore. LOL.
Yes this works for coronaBitmap.
I change collection using object materials instead of sceneMaterials.
Will not work on any material class other than vrayMtl, CoronaMtl and standardMaterial.
Rivanoor Bren
https://rivanoor.info
Thanks again
Sorry for late respond but i had no time to tests
If i save scene and try to use script nothing happens:(
turbosquid | behance | website