Hello,
Here i am creating a script of Set U and V tiling of all Bitmap textures of selection
but script has bug and i can not solve it.
can any one correct the script
thanks
-- Function to set U and V tiling of all Bitmap textures in a V-Ray material to 1.0
fn setVrayMaterialTilingToOne mat =
(
-- Function to set tiling for a Bitmap texture
fn setBitmapTiling tex =
(
if classOf tex == Bitmaptexture do
(
tex.U_Tiling = 1.0
tex.V_Tiling = 1.0
)
)
-- Check and set tiling for all relevant maps in V-Ray material
if (mat != getClassInstances vraymtl) do
(
print mat
-- Diffuse map
if mat.diffuseMap != undefined do setBitmapTiling mat.diffuseMap
-- Bump map
if mat.bumpMap != undefined do setBitmapTiling mat.bumpMap
-- Reflection map
if mat.reflectionMap != undefined do setBitmapTiling mat.reflectionMap
-- Refraction map
if mat.refractionMap != undefined do setBitmapTiling mat.refractionMap
-- Specular map
if mat.specularMap != undefined do setBitmapTiling mat.specularMap
-- Self-illumination map
if mat.selfIllumMap != undefined do setBitmapTiling mat.selfIllumMap
-- Displacement map
if mat.displacementMap != undefined do setBitmapTiling mat.displacementMap
-- Coat map
if mat.coatMap != undefined do setBitmapTiling mat.coatMap
-- Check if the material is a Multi/Sub-Object material
if classOf mat == Multimaterial do
(
for i = 1 to mat.numsubs do
(
local subMat = mat[i]
setVrayMaterialTilingToOne subMat
)
)
)
)
-- Iterate over selected objects and set tiling for their V-Ray materials
for obj in selection do
(
-- local mat = getMaterial obj
local mat = getClassInstances vraymtl target:obj.mat
setVrayMaterialTilingToOne mat
)