Macroscript for all VRayStuff or a VRayToolbar?

Hi,

It’s possible add a macroscript for all VRay Stuff? For example, VRayPlane, Light (Sphere, PLane, Dome), VRayFur etc.. Just to create a shortcut or a VRayToolbar :slight_smile:

On a similar vein, is it possible to have the “VRay” category the default when I click on “Lights” or “Cameras” in the Create Panel? Some menu setting somewhere perhaps? I really don’t use the standard ones all that much anymore and I’m tired of always clicking the drop down list.

It appears that it is not possible. A work-around has been suggested with a start-up MaxScript that changes the categories when 3ds Max is loaded or reset, but I have to look for it.

Best regards,
Vlado

Here’s the scripts I use and bind to a Quad menu to create VRayLights

vraylight plane


macroScript VrayLightPlane category:"ColinScripts" tooltip:"VrayLightPlane" (
    on execute do (
        fn setType l = l.type = 0
        startObjectCreation VrayLight newNodeCallback:setType        
    )
)

and for a vraylight sphere


macroScript VrayLightSphere category:"ColinScripts" tooltip:"VrayLightSphere" (
    on execute do (
        fn setType l = l.type = 2
        startObjectCreation VrayLight newNodeCallback:setType        
    )
)

I know it’s not exactly what you’re looking for, but it is in the same vein.

Run the above macroscripts then bind them to a keyboard shortcut or quad menu in

Customize->Customize User Interface->Keybindings

Category: “ColinScripts” and bind away!

-Colin

hi Colin,

this is exactly what I want :slight_smile: Thanks! And, it’s possibile create the same shortcut for all other VRayStuff? Like VRayCamera, Plane, Fur? So, we can create a simple, but useful VRayToolbar?

Absolutely,
the key to this script is “startObjectCreation” it basically clicks the button on the create panel to create the object creation process, the “newNodeCallback” part specifies a callback to set the vraylight to type “Plane” or “Sphere”, if there isn’t a property you want to change (like Plane, Sphere, or any other type) just omit “newNodeCallback”

If you want to make your own toolbar type app you’ll want to start like this


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" (
     button btn_CreateVRayLightPlane "Create VRay Light Plane"
     button btn_HelpMe "Help"

    on btn_CreateVRayLightPlane pressed do (
        -- When you push the CreateVRayLightPlane Button this code is executed
        fn setType l = l.type = 0
        startObjectCreation VrayLight newNodeCallback:setType
    )

    on btn_HelpMe pressed do (
        messageBox "Here's your help!" beep:false
    )
)
createDialog rlt_VRayToolbar 300 250  -- creates the toolbar 300 pixels wide by 250 pixels high
)

```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.

By the way, I can comment more of the above code if you like. Let me know.

I Colin,

yes, this is what i need.But the first macro is ok for me. Just I need some shorcut for fast work. Damn, I must begin to study maxscript mmm… :slight_smile:

I think I’ll start a maxscript’ing 101 thread on here for everybody. I’m inspired to.

I’ll start it this weekend and do some basic maxscript lessons on the forum so everyone can begin to understand what’s going on with maxscript, and help you all automate your tasks quickly.

For anyone willing to learn maxscript for real, go on cgacademy and spend a few bucks to get Bobo’s and Laszlo basic dvd set.
Bobo writes the maxscript manual.
Sure, hey, they cost money, and some are somewhat allergic to the idea of parting from them… (ever so slight polemic tone? you got it.)

Yes, but first I need to read the F1 MAXScript Guide. A lots of info!. After, Internet, DVD and commercial stuff.

the what?
The examples in the maxscript manual alone are THE kickstarts of them all.
They are useful, and explained line by line.
And of course, they mostly come from the man himself, which more than expressing opinions, sets the standards.
Ofc, it’s a suggestion only.

I’m clearly not talking about supplicating the entire manual by any means. Bobo is certainly the expert, I think it would be helpful to give people a primer to maxscript so they can decide to continue learning it or at the least, have a basic understanding of scripting.

Colin, i didn’t mean to thwart your kind effort, by any means.
I am sure you’ll do a great job providing the basics, and some direction.
The polemic tone was directed somewhere else :slight_smile:

Oh no offense taken lele! I think it’ll be a nice way to show the beginnings of scripting in an arch-vis environment or at least inspire some. Your scripts are always an inspiration :slight_smile: Enjoy your day everyone, just started snowing in Kansas City

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 !?)

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 :wink:

Oh awesome! Really great job. Add this event handlers in your code above “on btn_CreateVRayLightPlane pressed do”


    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

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?

Subburb,

it’s possible add a “Macro” for each VRay Obj, so I can built my perosnal VRayToolbar?

Hi Again !
Nice to see that it helps ! :wink:

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 :wink:

here’s the new toolbar :

And the new code : (EDIT on 03/04/2009 - Code was truncated !?). This one works !

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
)

:wink: