Announcement

Collapse
No announcement yet.

script for adding color correct

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

  • #31
    Hmm - Over here it's actually taking the diffuse colour swatch back when it removes colour correct so not sure whats happening on your end - I'll look at the vray override material support though.

    Comment


    • #32
      Yeah it does take it back .. which is fine. Only problem if you have an existing scene with color correct maps which have textures but the diffuse slot is still the default red. it will copy thet back when you remove then CC maps.
      Perhaps you could just make it so that it always copies the diffuse swatch backwards and forwards, unless it is that red color in which cause it doesnt copy it when removing the CC map.

      Comment


      • #33
        Ah getcha - Done. I'll have a look at the mat override later today. I didn't include it cos I never use it myself - will add in vray light material support too and do a rewrite later - the way i've done it is a little dumb coding wise so it can be made way more efficient (not that it's huge in the first place.)

        In the middle of updating this I've also managed to wipe most of the contents of my website database too - there's a lot to be said for not writing your own code

        Comment


        • #34
          Ahh cool. will wait for the update

          hahaha doh, sure hope you had a backup

          Comment


          • #35
            Thank you John. Haven't had time to look at it so far, but looking forward to your updates.
            LunarStudio Architectural Renderings
            HDRSource HDR & sIBL Libraries
            Lunarlog - LunarStudio and HDRSource Blog

            Comment


            • #36
              After some searching I found this thread. Does this script still exist/work? I'm looking for a script that could assign a CC map to every diffuse color/bitmap in the scene, and also apply 2.2 to it.

              Thanks for any help!

              Comment


              • #37
                Here's the last version I had handy - hopefully it'll behave...

                Code:
                macroScript ColourCorrect category:"John O'Connell Tools"
                
                (
                
                	/*
                	
                	This script is provded as is and is in no way to be considered a bug free utility.
                	Any loss of time or information as a result of using this script is not the responsibility
                	of John O'Connell so use it at your own risk!
                	
                	To be done:
                	
                	1. Add in support for the vray override and light materials
                	2. Make function based cos it's smarter
                	3. Maybe look at adding in an averaging function for materials
                
                	
                	The latest version of this should always be available in the stuff section of 
                	http://www.joconnell.com so check back often
                	
                	*/
                	
                	
                	Rollout ColourCorrect "Learn to spell colour properly!"
                	
                	( -- Begin Rollout
                	
                		Spinner cc_gamma "Colour Correct gamma" type:#float align:#right range:[0.0,10.0, 2.2]
                		button applyCC "Apply Colour Correct" width:200 align:#right
                		button removeCC "Remove Colour Correct" width:200 align:#right
                		
                		on applyCC pressed do
                		
                		(
                	
                			temp_sel = selection as array
                			
                			for i = 1 to temp_sel.count do
                			(
                				
                				if temp_sel[i].material != undefined then  -- If the object doesnt have a multi sub mat material
                				(
                					mat_subs = getNumSubMtls temp_sel[i].material
                					
                					if mat_subs == 0 then
                					(
                						temp_mat = temp_sel[i].material
                
                						if (classof temp_mat == VRayMtl) then
                						(
                						
                							if (classof temp_mat.texmap_diffuse != ColorCorrect) then
                							(
                								diffuse_tex = temp_mat.texmap_diffuse
                								diffuse_colour = temp_mat.diffuse
                								cc = ColorCorrect()
                								temp_mat.texmap_diffuse = copy cc
                								temp_mat.texmap_diffuse.src_tex = diffuse_tex
                								temp_mat.texmap_diffuse.gamma = cc_gamma.value
                								temp_mat.texmap_diffuse.src_color = diffuse_colour
                							) else (
                								temp_mat.texmap_diffuse.gamma = cc_gamma.value
                							)
                							
                							
                						) else (
                						
                							if (classof temp_mat.diffuseMap != ColorCorrect) then
                							(
                								diffuse_tex = temp_mat.diffuseMap
                								diffuse_colour = temp_mat.diffuse
                								cc = ColorCorrect ()
                								temp_mat.diffuseMap = copy cc
                								temp_mat.diffuseMap.src_tex = diffuse_tex
                								temp_mat.diffuseMap.src_color = diffuse_colour
                								temp_mat.diffuseMap.gamma = cc_gamma.value
                							) else (
                								temp_mat.diffuseMap.gamma = cc_gamma.value
                							)
                							
                						)
                						
                					) else ( -- If the object has a multi sub mat material
                				
                						for m = 1 to mat_subs do
                						(
                						
                							temp_mat = temp_sel[i].material.materialList[m]
                							
                							if (classof temp_mat == VRayMtl) then
                							(
                								if (classof temp_mat.texmap_diffuse != ColorCorrect) then
                								(
                									diffuse_tex = temp_mat.texmap_diffuse
                									diffuse_colour = temp_mat.diffuse
                									cc = ColorCorrect ()
                									temp_mat.texmap_diffuse = copy cc
                									temp_mat.texmap_diffuse.src_tex = diffuse_tex
                									temp_mat.texmap_diffuse.src_color = diffuse_colour
                									temp_mat.texmap_diffuse.gamma = cc_gamma.value
                								) else (
                									temp_mat.texmap_diffuse.gamma = cc_gamma.value
                								)
                							) else (		
                								if (classof temp_mat.diffuseMap != ColorCorrect) then
                								(
                									diffuse_tex = temp_mat.diffuseMap
                									diffuse_colour = temp_mat.diffuse
                									cc = ColorCorrect ()
                									temp_mat.diffuseMap = copy cc
                									temp_mat.diffuseMap.src_tex = diffuse_tex
                									temp_mat.diffuseMap.src_color = diffuse_colour
                									temp_mat.diffuseMap.gamma = cc_gamma.value
                								) else (
                									temp_mat.diffuseMap.gamma = cc_gamma.value
                								)
                							)
                						)
                					) -- end else
                					
                				)
                			)
                		)
                		
                		on removeCC pressed do 
                		(
                		
                			temp_sel = selection as array
                			
                			for i = 1 to temp_sel.count do
                			(
                				
                				if temp_sel[i].material != undefined then  -- If the object doesnt have a multi sub mat material
                				(
                					mat_subs = getNumSubMtls temp_sel[i].material
                					
                					if mat_subs == 0 then
                					(
                						temp_mat = temp_sel[i].material
                
                						if (classof temp_mat == VRayMtl) then
                						(
                						
                							if (classof temp_mat.texmap_diffuse == ColorCorrect) then
                							(	
                								
                								if (temp_mat.texmap_diffuse.src_color != (color 255 0 0)) then
                								(
                									temp_mat.diffuse = temp_mat.texmap_diffuse.src_color
                								)
                								
                								temp_mat.texmap_diffuse = temp_mat.texmap_diffuse.src_tex								
                							)
                							
                						) else (
                						
                							if (classof temp_mat.diffuseMap == ColorCorrect) then
                							(
                							
                								if (temp_mat.diffuseMap.src_color != (color 255 0 0)) then
                								(
                									temp_mat.diffuse = temp_mat.diffuseMap.src_color
                								)
                								
                								temp_mat.diffuseMap = temp_mat.diffuseMap.src_tex
                							)
                							
                						)
                						
                					) else ( -- If the object has a multi sub mat material
                				
                						for m = 1 to mat_subs do
                						(
                						
                							temp_mat = temp_sel[i].material.materialList[m]
                							
                							if (classof temp_mat == VRayMtl) then
                							(
                							
                								if (classof temp_mat.texmap_diffuse == ColorCorrect) then
                								(
                									temp_mat.diffuse = temp_mat.texmap_diffuse.src_color
                									temp_mat.texmap_diffuse = temp_mat.texmap_diffuse.src_tex
                								)
                								
                							) else (
                							
                								if (classof temp_mat.diffuseMap == ColorCorrect) then
                								(
                									temp_mat.diffuse = temp_mat.diffuseMap.src_color
                									temp_mat.diffuseMap = temp_mat.diffuseMap.src_tex
                								)
                								
                							)
                						)
                					) -- end else
                					
                				)
                			)
                
                
                		
                		)
                		
                		
                	)
                	
                	CreateDialog ColourCorrect width:300
                
                )

                Comment

                Working...
                X