Announcement

Collapse
No announcement yet.

simple script help..

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • simple script help..

    the guy i usually bug for scripts is on holiday.. one day ill actually learn myself, but since i expect this is only a couple of lines of code, i thought id ask:


    i want a script that scans all scene materials, and any that have a reflection glossiness below a specified threshold, turns off reflections for that material.


    its for a brutal optimisation of a massive scene with thousands of materials.

    any scripters around on this lovely friday eve? :P

  • #2
    Please let me know if you have any issues. The code will set the reflection colour to black and turn off the use map part. I also added a change to the glossiness to 1.0 and changing the subdivs

    Code:
    --Please Change this:
    myGlossinesThreshold = 1.0
    
    clearListener()
    
    showlog = queryBox "Do you want to show a log in the listener window?\nThis can slow things down a little."
    for m in (getclassInstances VrayMtl) do (
    	if m.reflection_glossiness < myGlossinesThreshold do (
    		if showlog do format "%\n" m.name
    			
    		if showlog do format "	Changing reflection  % to " m.reflection 	
    			m.reflection = black
    		if showlog do format "%\n" m.reflection 	
    
    		if showlog do format "	Changing texmap_reflection_on  % to " m.texmap_reflection_on 	
    			m.texmap_reflection_on = false
    		if showlog do format "%\n" m.texmap_reflection_on 	
    			
    		if showlog do format "	Changing m.reflection_glossiness % to " m.reflection_glossiness
    			m.reflection_glossiness	 = 1.0
    		if showlog do format "%\n" m.reflection_glossiness				
    			
    		if showlog do format "	Changing reflection_subdivs % to " m.reflection_subdivs
    			m.reflection_subdivs = 8
    		if showlog do format "%\n" m.reflection_subdivs
    			
    		if showlog do format "\n"		
    	)	
    )

    Comment

    Working...
    X