Announcement

Collapse
No announcement yet.

Macroscript for all VRayStuff or a VRayToolbar?

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

  • #16
    Hi, All !
    MoonDoggie i've just followed your dev to make a complete VRay_Quickcreate Dialog. Very simple, but can be useful for Cecofuli, dlparisi and perhaps some other users !

    Here is the complete dialog :


    And here's the maxscript code (EDIT on 03/04/09 : new working code - last one was truncated !?)
    Code:
    macroScript VRayToolbar category:"VRay" tooltip:"VRayToolbar" 
    (
    
    	global rlt_VRayToolbar  -- sets the variable for the rollout
    
    	try (destroyDialog rlt_VRayToolbar) catch ()  -- This attempts to close the VRayToolbar if it's already opened
    
    	rollout rlt_VRayToolbar "VRay Toolbar" width:92 height:420
    	(
    		button btn_CreateVRayLightPlane "Plane" pos:[8,24] width:76 height:20
    		button btn_CreateVRayLightDome "Dome" pos:[8,44] width:76 height:20
    		button btn_CreateVRayLightSphere "Sphere" pos:[8,64] width:76 height:20
    		button btn_CreateVRayLightMesh "Mesh" pos:[8,84] width:76 height:20
    		button btn_CreateVRaySunSky "Sun + Sky" pos:[8,108] width:76 height:20
    		button btn_CreateVRayGeomPlane "Vray Plane" pos:[8,216] width:76 height:20
    		button btn_CreateVRayGeomSphere "Vray Sphere" pos:[8,236] width:76 height:20
    		button btn_CreateVRayGeomProxy "Vray Proxy" pos:[8,256] width:76 height:20
    		button btn_CreateVRayGeomFur "Vray Fur" pos:[8,276] width:76 height:20
    		button btn_CreateVRayCamDome "Dome Cam" pos:[8,152] width:76 height:20
    		button btn_CreateVRayCamPhysCam "Phys. Cam" pos:[8,172] width:76 height:20
    		button btn_CreateVRayModifDisplace "Displace Mod" pos:[8,320] width:76 height:20
    		button btn_Meditor "Materials..." pos:[8,368] width:76 height:20
    		button btn_ShowLast "Last Render" pos:[8,392] width:76 height:20
    		GroupBox grp1 "Vray Lights" pos:[4,8] width:84 height:124
    		GroupBox grp2 "Vray Geom." pos:[4,200] width:84 height:100
    		GroupBox grp3 "Vray Cameras" pos:[4,136] width:84 height:60
    		GroupBox grp4 "Modifiers" pos:[4,304] width:84 height:40
    		groupBox grp11 "Other" pos:[4,352] width:84 height:64
    		
    		local thetype
    		local sourcenode 
    		
    		fn setType obj = 
    		(
    			obj.type = thetype
    		)
    		
    		fn setfur obj =
    		(
    			obj.sourceNode = $
    		)
    		
    		on btn_CreateVRayLightPlane pressed do
    		(
    			thetype = 0
    			startObjectCreation VrayLight newNodeCallback:setType
    		)
    		on btn_CreateVRayLightDome pressed do
    		(
    			thetype = 1
    			startObjectCreation VrayLight newNodeCallback:setType
    		)
    		on btn_CreateVRayLightSphere pressed do
    		(
    			   thetype = 2
    				startObjectCreation VrayLight newNodeCallback:setType
    		)
    		on btn_CreateVRayLightMesh pressed do
    		(
    			thetype = 3
    			startObjectCreation VrayLight newNodeCallback:setType
    		)
    		on btn_CreateVRaySunSky pressed do
    			startObjectCreation VraySun
    		on btn_CreateVRayGeomPlane pressed do
    			startObjectCreation Vrayplane
    		on btn_CreateVRayGeomSphere pressed do
    			startObjectCreation VraySphere
    		on btn_CreateVRayGeomProxy pressed do
    			startObjectCreation Vrayproxy
    		on btn_CreateVRayGeomFur pressed do
    		(
    			if superclassof $ == GeometryClass then 
    			(
    				startObjectCreation Vrayfur newNodeCallback:setfur 
    			)
    			else messagebox("Please choose a valid object first...")
    		)
    		on btn_CreateVRayCamDome pressed do
    			startObjectCreation Vraydomecamera
    		on btn_CreateVRayCamPhysCam pressed do
    			startObjectCreation Vrayphysicalcamera
    		on btn_CreateVRayModifDisplace pressed do
    		(
    			if $ != undefined then modPanel.addModToSelection (VRayDisplacementMod ()) ui:on
    			else messagebox("You need to select something...")
    		)
    		on btn_Meditor pressed do
    		(
    			if MatEditor.isOpen() then MatEditor.Close() else MatEditor.open()
    		)
    		on btn_ShowLast pressed do
    		(
    			try(
    			if Renderers.current.output_on then Renderers.current.showLastVFB()
    			else	max show last img
    			)
    			catch(messagebox ("You need to use Vray as default renderer..."))
    		)
    	)
    	createdialog rlt_VRayToolbar 90 420
    )

    Run the above code, and go into your Customize->Customize User Interface->Toolbars and go to the category "VRay" and drag "VRayToolbar to a toolbar, anytime you want your toolbar to popup, just click the button! If you want it dockable etc, I can point you to those resources as well. Hope this helps.
    MoonDoggie, i'm interested by the dockable resources, if it's not a problem for you, of course
    Attached Files
    Last edited by Subburb; 03-04-2009, 12:27 AM. Reason: Edit : new code - last one was truncated !?
    Jérôme Prévost.
    SolidRocks, the V-Ray Wizard.
    http://solidrocks.subburb.com

    Comment


    • #17
      Oh awesome! Really great job. Add this event handlers in your code above "on btn_CreateVRayLightPlane pressed do"

      Code:
          on rlt_VRayToolbar open do (
              cui.RegisterDialogBar rlt_VRayToolbar style:#(#cui_dock_all,#cui_handles,#cui_floatable)
          )
      For more dockable options look up "cui.RegisterDialogBar" in the Maxscript help
      Colin Senner

      Comment


      • #18
        Hi Subburb,

        wow! It's super! I can add e request?
        I like the "M" button function. If we press it, we open the material editor. I you press again, we close the material editor. It's possible add this features to this toolbar?
        www.francescolegrenzi.com

        VRay - THE COMPLETE GUIDE - The book
        Corona - THE COMPLETE GUIDE - The book


        --- FACEBOOK ---

        Comment


        • #19
          Subburb,

          it's possible add a "Macro" for each VRay Obj, so I can built my perosnal VRayToolbar?
          www.francescolegrenzi.com

          VRay - THE COMPLETE GUIDE - The book
          Corona - THE COMPLETE GUIDE - The book


          --- FACEBOOK ---

          Comment


          • #20
            Hi Again !
            Nice to see that it helps !

            Moondoggie, many thanks for dock instructions.
            I've to see it deeper to permit a decend docking in horiz/vertical mode. i've to work a little bit more on that point.

            Cecofuli,

            I've added your request (simple to do) : Material editor switcher.

            and, Little useful gift, i've added too the SolidRocks derived "show last render" which works with both Max and Vray frame buffers

            here's the new toolbar :


            And the new code : (EDIT on 03/04/2009 - Code was truncated !?). This one works !
            Code:
            macroScript VRayToolbar category:"VRay" tooltip:"VRayToolbar" 
            (
            
            	global rlt_VRayToolbar  -- sets the variable for the rollout
            
            	try (destroyDialog rlt_VRayToolbar) catch ()  -- This attempts to close the VRayToolbar if it's already opened
            
            	rollout rlt_VRayToolbar "VRay Toolbar" width:92 height:420
            	(
            		button btn_CreateVRayLightPlane "Plane" pos:[8,24] width:76 height:20
            		button btn_CreateVRayLightDome "Dome" pos:[8,44] width:76 height:20
            		button btn_CreateVRayLightSphere "Sphere" pos:[8,64] width:76 height:20
            		button btn_CreateVRayLightMesh "Mesh" pos:[8,84] width:76 height:20
            		button btn_CreateVRaySunSky "Sun + Sky" pos:[8,108] width:76 height:20
            		button btn_CreateVRayGeomPlane "Vray Plane" pos:[8,216] width:76 height:20
            		button btn_CreateVRayGeomSphere "Vray Sphere" pos:[8,236] width:76 height:20
            		button btn_CreateVRayGeomProxy "Vray Proxy" pos:[8,256] width:76 height:20
            		button btn_CreateVRayGeomFur "Vray Fur" pos:[8,276] width:76 height:20
            		button btn_CreateVRayCamDome "Dome Cam" pos:[8,152] width:76 height:20
            		button btn_CreateVRayCamPhysCam "Phys. Cam" pos:[8,172] width:76 height:20
            		button btn_CreateVRayModifDisplace "Displace Mod" pos:[8,320] width:76 height:20
            		button btn_Meditor "Materials..." pos:[8,368] width:76 height:20
            		button btn_ShowLast "Last Render" pos:[8,392] width:76 height:20
            		GroupBox grp1 "Vray Lights" pos:[4,8] width:84 height:124
            		GroupBox grp2 "Vray Geom." pos:[4,200] width:84 height:100
            		GroupBox grp3 "Vray Cameras" pos:[4,136] width:84 height:60
            		GroupBox grp4 "Modifiers" pos:[4,304] width:84 height:40
            		groupBox grp11 "Other" pos:[4,352] width:84 height:64
            		
            		local thetype
            		local sourcenode 
            		
            		fn setType obj = 
            		(
            			obj.type = thetype
            		)
            		
            		fn setfur obj =
            		(
            			obj.sourceNode = $
            		)
            		
            		on btn_CreateVRayLightPlane pressed do
            		(
            			thetype = 0
            			startObjectCreation VrayLight newNodeCallback:setType
            		)
            		on btn_CreateVRayLightDome pressed do
            		(
            			thetype = 1
            			startObjectCreation VrayLight newNodeCallback:setType
            		)
            		on btn_CreateVRayLightSphere pressed do
            		(
            			   thetype = 2
            				startObjectCreation VrayLight newNodeCallback:setType
            		)
            		on btn_CreateVRayLightMesh pressed do
            		(
            			thetype = 3
            			startObjectCreation VrayLight newNodeCallback:setType
            		)
            		on btn_CreateVRaySunSky pressed do
            			startObjectCreation VraySun
            		on btn_CreateVRayGeomPlane pressed do
            			startObjectCreation Vrayplane
            		on btn_CreateVRayGeomSphere pressed do
            			startObjectCreation VraySphere
            		on btn_CreateVRayGeomProxy pressed do
            			startObjectCreation Vrayproxy
            		on btn_CreateVRayGeomFur pressed do
            		(
            			if superclassof $ == GeometryClass then 
            			(
            				startObjectCreation Vrayfur newNodeCallback:setfur 
            			)
            			else messagebox("Please choose a valid object first...")
            		)
            		on btn_CreateVRayCamDome pressed do
            			startObjectCreation Vraydomecamera
            		on btn_CreateVRayCamPhysCam pressed do
            			startObjectCreation Vrayphysicalcamera
            		on btn_CreateVRayModifDisplace pressed do
            		(
            			if $ != undefined then modPanel.addModToSelection (VRayDisplacementMod ()) ui:on
            			else messagebox("You need to select something...")
            		)
            		on btn_Meditor pressed do
            		(
            			if MatEditor.isOpen() then MatEditor.Close() else MatEditor.open()
            		)
            		on btn_ShowLast pressed do
            		(
            			try(
            			if Renderers.current.output_on then Renderers.current.showLastVFB()
            			else	max show last img
            			)
            			catch(messagebox ("You need to use Vray as default renderer..."))
            		)
            	)
            	createdialog rlt_VRayToolbar 90 420
            )
            Last edited by Subburb; 03-04-2009, 12:44 AM.
            Jérôme Prévost.
            SolidRocks, the V-Ray Wizard.
            http://solidrocks.subburb.com

            Comment


            • #21
              Cecofuli,
              to make each action as a macro, you've to follow MoonDoggie specifications, i think. each action have to be splitted into a single macroscript to see each of them in the bindings... of course if i'm not wrong !
              Jérôme Prévost.
              SolidRocks, the V-Ray Wizard.
              http://solidrocks.subburb.com

              Comment


              • #22
                Yes, both solutions are welcome . But, unfortunately. I don't know nothing about Maxscript.
                www.francescolegrenzi.com

                VRay - THE COMPLETE GUIDE - The book
                Corona - THE COMPLETE GUIDE - The book


                --- FACEBOOK ---

                Comment


                • #23
                  Yes but you're a VrayMaster...
                  this one is a good start, i think not so complicated, and useful ! that's the power of maxscript...

                  the material button is what you expected ?
                  Jérôme Prévost.
                  SolidRocks, the V-Ray Wizard.
                  http://solidrocks.subburb.com

                  Comment


                  • #24
                    Ehh, I'm a little VRay user with a write passion...
                    If it's possible split your UI in a little MACRO, like MoonDoggie. So I can create my toolbar or assign a shortcut the the VRayLight plane, VRayLight Sphere, VRayPlane etc...
                    www.francescolegrenzi.com

                    VRay - THE COMPLETE GUIDE - The book
                    Corona - THE COMPLETE GUIDE - The book


                    --- FACEBOOK ---

                    Comment


                    • #25
                      select the line and drag it to a button then...

                      Comment


                      • #26
                        OK ! here's the parsed code in individual macros
                        you'll find the macros into "VrayQuickSet" category.

                        i've tried to make the code clear, for good understanding, and short names to avoid UI button truncated text.

                        Just run this code, and you'll find all actions in customise UI-->VrayQuickset category.
                        EDIT : just added the Vray IES light

                        Code:
                        macroScript Plane_Light category:"VrayQuickSet" tooltip:"Create Plane VRayLight"
                        (
                        	on execute do
                        	(
                        		fn setType Thelight = 
                        		(
                        			Thelight.type = 0
                        		)
                                startObjectCreation VrayLight newNodeCallback:setType   
                        	)
                        )
                        
                        macroScript Dome_Light category:"VrayQuickSet" tooltip:"Create Dome VRayLight"
                        (
                        	on execute do
                        	(
                        		fn setType Thelight = 
                        		(
                        			Thelight.type = 1
                        		)
                                startObjectCreation VrayLight newNodeCallback:setType   
                        	)
                        )
                        
                        macroScript Sphere_Light category:"VrayQuickSet" tooltip:"Create Sphere VRayLight"
                        (
                        	on execute do
                        	(
                        		fn setType Thelight = 
                        		(
                        			Thelight.type = 2
                        		)
                                startObjectCreation VrayLight newNodeCallback:setType   
                        	)
                        )
                        
                        macroScript Mesh_Light category:"VrayQuickSet" tooltip:"Create Mesh VRayLight"
                        (
                        	on execute do
                        	(
                        		fn setType Thelight = 
                        		(
                        			Thelight.type = 3
                        		)
                                startObjectCreation VrayLight newNodeCallback:setType   
                        	)
                        )
                        
                        macroScript VRay_IES category:"VrayQuickSet" tooltip:"Create Vray IES light"
                        (
                        	on execute do startObjectCreation VrayIES
                        )
                        
                        macroScript Sun_Sky category:"VrayQuickSet" tooltip:"Create Vray Sun + Sky"
                        (
                        	on execute do startObjectCreation VraySun
                        )
                        	
                        macroScript VRay_Plane category:"VrayQuickSet" tooltip:"Create Vray Plane"
                        (
                        	on execute do startObjectCreation Vrayplane
                        )
                        	
                        macroScript VRay_Sphere category:"VrayQuickSet" tooltip:"Create Vray Sphere"
                        (
                        	on execute do startObjectCreation VraySphere
                        )
                        
                        
                        macroScript VRay_proxy category:"VrayQuickSet" tooltip:"Create Vray Proxy"
                        (
                        	on execute do startObjectCreation Vrayproxy
                        )
                        
                        macroScript VRay_Fur category:"VrayQuickSet" tooltip:"Apply VrayFur on Selected object"
                        (
                        	if superclassof $ == GeometryClass then 
                        	(
                        		fn setfurobject obj = 
                        		(
                        			obj.sourceNode = $
                        		)		
                        		startObjectCreation Vrayfur newNodeCallback:setfurobject
                        	)
                        	else messagebox("Please choose a valid object first...")
                        )
                        
                        macroScript Dome_Cam category:"VrayQuickSet" tooltip:"Create Vray Dome Camera"
                        (
                        	startObjectCreation Vraydomecamera
                        )
                        
                        macroScript Phys_Cam category:"VrayQuickSet" tooltip:"Create Vray Physical Camera"
                        (
                        	startObjectCreation Vrayphysicalcamera
                        )
                        
                        macroScript Disp_Mod category:"VrayQuickSet" tooltip:"Apply VrayDisplaceMod on Selected object"
                        (
                        	if $ != undefined then modPanel.addModToSelection (VRayDisplacementMod ()) ui:on
                        	else messagebox("You need to select something...")
                        )
                        
                        macroScript Mat_Edit category:"VrayQuickSet" tooltip:"Switch on/off Material Editor"
                        (
                        	if MatEditor.isOpen() then MatEditor.Close() else MatEditor.open()
                        )
                        
                        macroScript Show_Last category:"VrayQuickSet" tooltip:"Show Last Render"
                        (
                        	try
                        	(
                        		if Renderers.current.output_on then Renderers.current.showLastVFB()
                        		else	max show last img
                        	)
                        	catch
                        	(
                        		messagebox ("You need to use Vray as default renderer...")
                        	)
                        )
                        Hope it helps !
                        Last edited by Subburb; 03-04-2009, 01:04 AM.
                        Jérôme Prévost.
                        SolidRocks, the V-Ray Wizard.
                        http://solidrocks.subburb.com

                        Comment


                        • #27
                          Subburb, you are an heroe! finally my personal VRaytoolbar. Now I must built some VRayIcon
                          www.francescolegrenzi.com

                          VRay - THE COMPLETE GUIDE - The book
                          Corona - THE COMPLETE GUIDE - The book


                          --- FACEBOOK ---

                          Comment


                          • #28
                            You're welcome.
                            Yeah some icons would be nice
                            Jérôme Prévost.
                            SolidRocks, the V-Ray Wizard.
                            http://solidrocks.subburb.com

                            Comment


                            • #29
                              Some tool for make the icon?
                              www.francescolegrenzi.com

                              VRay - THE COMPLETE GUIDE - The book
                              Corona - THE COMPLETE GUIDE - The book


                              --- FACEBOOK ---

                              Comment


                              • #30
                                Erm...Photoshop ??

                                Comment

                                Working...
                                X