Notifications
Clear all

[Closed] Keyboard stuff

I want to write a plugin where you press a quick key, ie. Ctrl-B, enter a value (100) and the Paint Selection Brush size is set to that value, all without creating dialogs etc., I’ve done it like this.

maxOps.paintSelBrushSize = getKBLine() as integer

but the bugger is that it opens up the listener window…
Is there a way around this?

What other methods are there for polling the keyboard?

Thanks.

5 Replies

hmm… im not that good with maxscript, but can i make some suggestions? though i cant really assure u if its possible in max…

create a macroscript with a getkbkline, and something that checks whether you’ve pressed the ENTER key… thus store the value to a variable which sends it to the brush size…

or create a When script, that looks at the change in a box’s transform when it is changed, gets the value of one of its axis then applies that value to the brush size…

i mightt not be making any sense in this hehe, just trying to help.

Thanks galagast, but no cigar :shrug:

kbGetLine() takes all your keyboard input and as soon as you press enter it returns whatever you typed in. What I want is a function, like kbGetLine(), that doesn’t open the maxscript listener.

1 Reply
(@bobo)
Joined: 2 years ago

Posts: 0

I don’t think it would be easier for the user to type in into nothing, hoping that the value he is entering is received correctly. Why don’t you create a dialog and define it as a dockable toolbar, then dock it in the interface and whenever you need the brush settings, just type in there? It does not eat too much space, esp. if you already have other toolbars docked…

Like this:

(
 global SetBrushSize_Dialog
 try(cui.UnRegisterDialogBar SetBrushSize_Dialog )catch()
 try(destroyDialog SetBrushSize_Dialog )catch()
 rollout SetBrushSize_Dialog "Brush"
 (
 spinner theSize "PSB Size:" range:[0,1000,maxOps.paintSelBrushSize] type:#float fieldwidth:50
 on theSize changed val do maxOps.paintSelBrushSize = val
 )
 createDialog SetBrushSize_Dialog 120 25
 cui.RegisterDialogBar SetBrushSize_Dialog style:#(#cui_dock_all)
 cui.DockDialogBar SetBrushSize_Dialog #cui_dock_bottom
 )

I was hoping to make it kinda like photoshop, but as always Bobo your shaman-like wisdom comes to the rescue. I think I’ll do that.

But I do have another question… Is there a way to show and hide any max toolbar through maxscript?

Thanks.

1 Reply
(@bobo)
Joined: 2 years ago

Posts: 0

Gonzalo Rueda used to have a DLX for Max 4 that did this. (Yascript)
Does not seem to be available for Max 6/7 though.
You might want to drop him an email and ask for recompile?