Announcement

Collapse
No announcement yet.

VrayLightMtl Global control Script

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

  • VrayLightMtl Global control Script

    Hello All

    Has anyone scripted? (or can quickly script!)
    A way of changing the multiplier in the vray light material on multiple selected object/materials.

    Ideally what would be great is:

    I have say 10 objects each with there own vray light material with a different map in the first slot. Then I can say select 5 of the objects and change the multiplier light value in the material all to perhaps 100.

    I'm thinking it would be useful for controlling multiple plane objects with self illuminating images on - for use in shop fronts etc.

    I have 100 of shops to deal with someone help me !!!

  • #2
    yeah thats a wish of mine too. It would be nice if someone could add support for the vraylight material in the light lister
    Chris Jackson
    Shiftmedia
    www.shiftmedia.sydney

    Comment


    • #3
      Yeah that would be the ideal solution!

      Anybody?!

      Comment


      • #4
        If every object has his own unique material then you can "mass-change" their light multiplier the following way:

        - Select the objects you want to change their light multiplier
        - Run this script from maxcript listener: $.material.multiplier = X
        ( change X for value you want multiplier to be )

        The problem would be if you want to apply different multipliers to objects with the same material...

        hope it helps

        Comment


        • #5
          Ok tried that but got...

          Unknown property: "material" in $selection <<

          Comment


          • #6
            Doh , my bad

            try this code instead:

            for o in $ do o.material.multiplier = X

            Comment


            • #7
              Originally posted by martindrake81
              Ok tried that but got...

              Unknown property: "material" in $selection <<
              That's because one of the objects you had selected did not have a material property (like a light/camera, etc)

              Run this

              Code:
              objs = getCurrentSelection&#40;&#41;
              
              for o in objs do &#40;
                   if &#40;isProperty o #material&#41; then &#40;
                        if &#40;isProperty o.material #multiplier&#41; then &#40;
                             o.material.multiplier = X   -- alternatively, you can multiply it by itself like
                             o.material.multiplier = o.material.multiplier * 2
                             format "object&#58; %   multiplier changed to&#58; %\n" o.name o.material.multiplier
                        &#41;
                   &#41;
              &#41;
              This code will make sure the object you are trying to do that to has a material and a multiplier property first then if it does change it's value!
              Colin Senner

              Comment


              • #8
                Codi you are a legend that works a treat!

                Have same issues with yours as before though MoonDoggie

                Unknown property: "material" in undefined.

                Right all I need now is a nice button and somewhere to stick in the X value!
                Any takers?

                Comment


                • #9
                  The other issue of course multi-subs - any easy way to deal with these?

                  Comment


                  • #10
                    You can give this a go:

                    Code:
                    -- Mass VRayLightMaterial Multiplier Updater
                    -- by Codi
                    Rollout light_mult "Mass Multiplier Updater"
                    &#40;
                    	spinner mult_value "Multiplier&#58; " type&#58;#float fieldWidth&#58;50 range&#58;&#91;0,30000,1&#93;
                    	button apply_mult "Change Multiplier" width&#58;120 align&#58;#center
                    
                    	on apply_mult pressed do 
                    	&#40;
                    		for obj in $ do 
                    		&#40;
                    			if &#40;obj.material != undefined&#41; then 
                    			&#40;
                    				if &#40;classof obj.material as string == "VRayLightMtl"&#41; then 
                    				&#40;
                    					obj.material.multiplier = mult_value.value
                    					format "Object % material multiplier changed to %\n" obj.name mult_value.value
                    				&#41;
                    				else 
                    				&#40;
                    					if &#40;classof obj.material as string== "Multimaterial"&#41; then 
                    					&#40;
                    						for i = 1 to obj.material.numsubs do 
                    						&#40;
                    							if &#40; classof obj.material.materialList&#91;i&#93; as string == "VRayLightMtl"&#41; then
                    							&#40;
                    								obj.material.materialList&#91;i&#93;.multiplier = mult_value.value
                    								format "Object % submaterial % multiplier changed to %\n" &#40;obj.name as string&#41; i mult_value.value
                    							&#41;
                    							else &#40;
                    								format "Object % submaterial % isn't a VRayLightMaterial\n" &#40;obj.name as string&#41; i
                    							&#41;
                    						&#41;
                    					&#41;
                    					else &#40;
                    						format "&#40;Object % has no proper material assigned&#41;\n" obj.name
                    					&#41;
                    				&#41;
                    			&#41;
                    			else
                    			&#40;
                    					format "&#40;Object % has no material&#41;\n" obj.name
                    			&#41;
                    		&#41;
                    	&#41;
                    &#41;
                    
                    if light_mult_floater != undefined then CloseRolloutFloater light_mult_floater
                    light_mult_floater = newRolloutFloater "VRayLightMtl Tool" 180 100
                    addRollout light_mult light_mult_floater
                    To "install" it you just have to select all the text inside the Code box and drag the selection in your toolbar.

                    If the script finds a selected object with VrayLightMaterial it changes the multiplier value, and if it finds an object with a Multimaterial it will change the multipliers of any VrayLightMaterial it finds on it (it's not recursive thoug, doesn't check multimaterials inside multimaterials)

                    Hope it's what you need.

                    BTW, use at your own risk and better save a copy of your work before runing this script.

                    Comment


                    • #11
                      The vraylightmtl will almost be made void soon when Vlado finishes ( if he hasnt already) proper mesh based vraylights. So any mesh can be a vraylight so vraylightmtl will not be used as much anymore.

                      Comment


                      • #12
                        Thats very interesting. Any idea as to when that feature will be available to us?
                        Vivek

                        Comment


                        • #13
                          Well if Vlado releases anything at siggy it might well be included in that

                          Comment


                          • #14
                            Codi thanks for the Code it works a treat, I can't thank you enough for your time!

                            So these proper mesh based vraylights would mean you could just add a multiplier to an object e.g. a plane and it would become a light!?!

                            Would this be more advanced than just say increasing the Generate GI of that mesh?

                            Comment


                            • #15
                              No problem, was needing some scripting practice

                              Comment

                              Working...
                              X