Home Technical Talk

maxscript help: custom toolbar

polycounter lvl 16
Offline / Send Message
Oniram polycounter lvl 16
hey everyone. i wrote a quick maxscript thats got some custom buttons for me, and i want to know how to be able to keep the rollout of the script docked as a toolbar if possible. here's a quick shot of what ive got.

maxscript-help.jpg

the 4 icons outlined in green are their own floating rollout which can be docked to any toolbar, but once docked i can not undock it, and when i close max it is not there when i restart.

any help would be appreciated, here's my code for you to look through and see if im overlooking something.
macroscript PrimitiveMenu
	category: "Oniram"

(
	rollout PrimitiveMenu "Menu"
		(
			local UndoName = "Undo Create Custom"
			
			button b_Box "Box" pos:[6,1] height:32 width:32 images:#("Standard_24i.bmp","Standard_24i.bmp",10,1,1,1,1)
			button b_Cylinder "Cylinder" pos:[44,1] height:32 width:32 images:#("Standard_24i.bmp","Standard_24i.bmp",10,3,3,1,1)
			button b_Plane "Plane" pos:[82,1] height:32 width:32 images:#("Standard_24i.bmp","Standard_24i.bmp",10,10,10,1,1)
			button b_Sphere "Sphere"	pos:[120,1] height:32 width:32 images:#("Standard_24i.bmp","Standard_24i.bmp",10,2,2,1,1)
		
			
			on b_Box pressed do with undo label:(UndoName) on
			(
				NewBox = Box pos:[0,0,0] 
				NewBox.Height = 20
				NewBox.Length = 20
				NewBox.Width = 20
				
				select NewBox
			)
			
			on b_Cylinder pressed do with undo label:(UndoName) on
			(
				NewCylinder = Cylinder pos:[0,0,0] 
				NewCylinder.Radius = 12
				NewCylinder.Height = 32
				NewCylinder.HeightSegs = 0
				NewCylinder.Sides =12
				
				if(viewport.getType() == #view_front) then
				(
					Rotate NewCylinder (eulerangles 90 0 0) 					
				)
				if(viewport.getType() == #view_left) then
				(
					Rotate NewCylinder (eulerangles -90 180 90) 					
				)
				if(viewport.getType() == #view_right) then
				(
					Rotate NewCylinder (eulerangles 90 0 90) 					
				)
				if(viewport.getType() == #view_back) then
				(
					Rotate NewCylinder (eulerangles 90 0 180) 					
				)
				
				select NewCylinder
			)
			
			on b_Plane pressed do with undo label:(UndoName) on
			(
								
				NewPlane = Plane pos:[0,0,0] 
				NewPlane.length = 20
				NewPlane.width = 20
				NewPlane.Widthsegs = 0
				NewPlane.lengthsegs = 0
				
				if(viewport.getType() == #view_front) then
				(
					Rotate NewPlane (eulerangles 90 0 0) 					
				)
				if(viewport.getType() == #view_left) then
				(
					Rotate NewPlane (eulerangles -90 180 90) 					
				)
				if(viewport.getType() == #view_right) then
				(
					Rotate NewPlane (eulerangles 90 0 90) 					
				)
				if(viewport.getType() == #view_back) then
				(
					Rotate NewPlane (eulerangles 90 0 180) 					
				)
				select NewPlane
			)
			
			on b_Sphere pressed do with undo label:(UndoName) on
			(
				NewSphere = Sphere pos:[0,0,0] 
				NewSphere.radius = 12
				NewSphere.segs = 24
				
				select NewSphere
			)
			
		)
		
	CreateDialog PrimitiveMenu 256 34
	cui.registerdialogbar PrimitiveMenu maxsize:[-1,-1]
	
)





Replies

  • DeadlyFreeze
    Options
    Offline / Send Message
    DeadlyFreeze polycounter lvl 17
    I don't really understand why you want to do it this way, a toolbar with each button using a macro is much simpler.

    If you want to do it with a rollout you need to use the 'cui.FloatDialogBar', there's a good example in this thread at the area, but even then I'm not sure you can get it where you want it since it will only attach to "top" and not a certain location.
  • Oniram
    Options
    Offline / Send Message
    Oniram polycounter lvl 16
    hmmm.. well then i may just go the route of making each button using a macro. i had figured what i was doing would be easier, since its all consolidated into 1 script. this is in fact my first maxscript so i am still trying to get a grasp of things. so would it be at all possible to get all 4(or more) buttons into 1 script while using macros? or would they each need to be their own.
  • DeadlyFreeze
    Options
    Offline / Send Message
    DeadlyFreeze polycounter lvl 17
    Don't think so, unless 2012 lets you make custom flyouts or something special with its ribbon UI.

    Have you considering throwing it on a quad menu instead? Seems like that would be a bit more piratical.
  • Oniram
    Options
    Offline / Send Message
    Oniram polycounter lvl 16
    yeah that actually could be a good alternative. ill try them both out and see which i lean toward more. thanks for the input. :D
Sign In or Register to comment.