ScriptSpot

Forum topic · General Scripting

Channels script last hurdle

By FATdan · 2012-08-01

Description

Hi, I have written the following script to generate a wire colour type image. The difference is it uses the same colour per material. I am trying to add in an exception for transparent/refractive materials by testing

"if (mat.texmap_refraction == undefined or mat.Refraction == color 0 0 0) then"

The script will run with no errors but still processes the refractive materials. I want them to be left untouched.

 

Here is the entire script:


    vr=renderers.current    
    select cameras
    setTransformLockFlags $ #all
    x = $*Target as array
    deselect x    
    $.exposure = false
    $.vignetting = false
    ClearSelection()
           

Materials = #()
MappedMaterials = #()

for o in objects do    
    (
        if classof o.material == VRayMtl or classof o.material == Multimaterial or classof o.material == VRayOverrideMtl or classof o.material == VRayBlendMtl or classof o.material == Blend then
        (     
            Index = (findItem Materials o.material);
            if (Index != 0) then
            (
                MappedMaterial = MappedMaterials[Index]          
                o.material = MappedMaterial
            )
            else
            (
                mat = o.material;
                if (mat.texmap_refraction == undefined or mat.Refraction == color 0 0 0) then
                (
                Mat = StandardMaterial()
                Mat.selfillumamount = 100
                Mat.Diffuse.Saturation = 255
                Mat.Diffuse.Value = 255
                Mat.Diffuse = color (random 0 255) (random 0 255) (random 0 255)
             
                append Materials o.material
                append MappedMaterials Mat
              
                o.material = Mat
            )
            )
        )
       
    )

 

Any thoughts on what the problem might be?

 

Danny

Comments (1)

kimarotta · 2012-08-01

not quite understand what you're wanting ... can explain?