[Closed] Mouse Clicks Catch?
Hi,
is there a way to assign something on mouse double click?
Thank you
as far as know – NO
in mouse tool, max catches only mouse_up event (and the first mouse_down). why? i do not know.
This could be done manually. Take clicks to memory and check is user clicked two times in some period time, like 2sec.
Mouse tools counts the mouse clicks as
1: down
2: up
3: down
4: up
and so on. So the second click would be 3. And like was suggested you can check that inside a period of time or I guess exit the tool within a period of time.
I’m not sure that this is going to help if you just want to be able to double click on the screen as that is reserved for selecting a hierarchy, so you would have to initiate the mouse tools in some way to over ride it.
please check this, it will print clicks 3dsmax can catch with mouse tool
tool foo
(
on mousePoint clickno do (print clickno)
)
startTool foo
Hi,
This code will catch doubleclicks from a mouse tool. I played around with it but realistically didn’t find it that useful. You’re welcome to adjust it for your own uses.
Regards,
Josh.
tol=300 -- time in milliseconds for the doubleclick!
global c1,c2
--print c1
tool doubleclick
(
on start do c1=0
on mousepoint n do
(
print n
if n>1 then -- the second click is always the mouse up event from the first press
(
if c1==0 then -- check for first click
(
c1=timestamp() -- make the first timestamp
) else
(
c2=timestamp() -- make the second timestamp
t=c2-c1 -- claculate the difference
if t<tol then -- check to see if it's below the tolerance
( -- my doubleclick action!
format "doubleclick in %
" t
c1=0 -- clear the first click
) else
(
c1=c2 -- make the second click the first!
)
)
)
)
)
starttool doubleclick
j_man – Thats good, too bad it only works while in toolmode though.
Catching double clicks would actually be very easy if it was not for the slow update for selecting in max. If you try to Ctrl+click an edge to select and click immeditaly on it again nothing happens, it takes almost a second before you can reselect/deselect that edge…and yes that sucks.
edit: actually I think max is specifically setup to ignore double-clicks and that’s the reason it behaves that way.
CML
Ok max seems to ignore the second click but a triple-click should definately be possible lol. I’ll play with it a bit more and report back my findings
CML
Hey, I have written a triple-click mode now for selecting edgeloops or edgerings. You can actually click two times if you click a bit slower. Here is you use it:
Once you activate the script the triple-click mode is constantly active for any Editable poly object in that max session. In fact you can place this script in your Scripts/startup folder and that mode will always be active in your max sessions. If you didn’t know it was there you would probably not even notice it was active. To select an edgeloop simply click 3 times on the same spot on an edge, if you hold shift an edgering will be selected instead. If you wait about half a second after the first click 2 clicks is enough, but clicking 3 times is faster. When you run the script you will also get a macroscript that you can assign to a shortcut to toggle this mode on and off. Running the script itself will also do this. The shortcut can be found under the category “CMLCreative” in the customize menu. It is a good idea to have ignore backfacing on so you don’t select something behind instead when clicking.
This is how the code works:
I used a change handler to get when the selection is changed for objects. Then I use the mouse.pos to compare if the user clicked two times on the same pixel spot and also if the mouse is on screen and within range of the selected edge. I also check with a callback for any new objects that are added to the scene and include them in change handling. That also happens when a new file is opened. You can check out the code more if you’re interested.
Download here:
http://hem.bredband.net/millman/TripleClickLoop.zip
Try it out and see how you like it.
CML
Hey Rivendale,
Nice work! I’m not used to seeing a struct used in this way. great! as an addition, you could improve the tool by making it possible to add to the selection when triple clicking and holding control, and subtracting when holding ALT. If possible.
Good work!
Josh.