Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

Right Click Menu (Alternative to Quad)

Right Click Menu (Alternative to Quad)

andrew.speed
Explorer Explorer
802 Views
7 Replies
Message 1 of 8

Right Click Menu (Alternative to Quad)

andrew.speed
Explorer
Explorer

I've currently got a script that runs on start up and constantly checks if the right mouse is pressed or not.
If true then it will open a custom marker menu. I ultimately want to be able to use octopus 2 or radially for the menu.

I wanted some advice on optimising this script? I'm also not sure of how to close the menu once the right mouse button is released. any help would be most appreciated

 

MenuActive = false

fn SetMenuActive =
	(
	MenuActive = True
	)

   fn SetMenuInActive =
	(
	MenuActive = false
	)

	theTimer = dotNetObject "System.Windows.Forms.Timer"

   fn checkRightMouseButton =
	(
	print MenuActive
	if mouse.buttonStates[3] == true then
		(
		if MenuActive == true then
			(
			)
			else
			(
			SetMenuActive()
				(
					if Selection.count == 0 then
					(
					OctopusInterface.StartOctopus "RCNoObject"
					)
					else
					(
					OctopusInterface.StartOctopus "RCObjectMode"
					)
				)
			)
		)
		else
		(
		SetMenuInActive()
		)
	)

   dotnet.addEventHandler theTimer "tick" checkRightMouseButton
   theTimer.interval = 100
   theTimer.start()
0 Likes
803 Views
7 Replies
Replies (7)
Message 2 of 8

denisT.MaxDoctor
Advisor
Advisor

In 3DS MAX, the right mouse button is very active in many different operations. Using pure Right Click (Press) event to activate some custom interface solution is completely wrong approach.

It's hard to believe, given how much work has been put into Octopus, that it doesn't offer a convenient mechanism for activating it.

0 Likes
Message 3 of 8

istan
Advisor
Advisor

Polling mouse click events is for sure the wrong approach.

 

I see only one professional solution:  Maybe AD is already using QT menus in C++, which could probably be overwritten by a different visualization method. Otherwise you would have to rebuild all integrated Max RMB menus. Additionally you would lose all RMB menus from 3rd party plugins.

0 Likes
Message 4 of 8

andrew.speed
Explorer
Explorer

Thanks for the reply.

Don't get me wrong Octopus can be launched by any hotkey. I just would have preferred to use mouse click.

My knowledge of Maxscript is rather limited as im sure you can tell.

I understand that this solution was rather problematic the one benefit I found to using mouse.buttonstates is it only checks when in viewport. so right clicking the rest of the ui was unaffected which is what I wanted.

on Right Click I set it to run this script. maybe this would have been better suited to be in the main script

if Selection.count != 0 and classof selection[1].baseobject == Editable_Poly then
(
ObjectMode = SubObjectLevel
case ObjectMode of
(
0: OctopusInterface.StartOctopus "RCObjectEdit"
1: OctopusInterface.StartOctopus "RCVertexEdit"
2: OctopusInterface.StartOctopus "RCEdgeEdit"
3: OctopusInterface.StartOctopus "RCBorderEdit"
4: OctopusInterface.StartOctopus "RCFaceEdit"
5: OctopusInterface.StartOctopus "RCElementEdit"
)
)

else

(
OctopusInterface.StartOctopus "RCCreate"
)

 

0 Likes
Message 5 of 8

andrew.speed
Explorer
Explorer

That sounds like a great solution. Though I would have no idea how to do it. My coding skills are basic in maxscript and non existent in C++.

Thanks for the reply.

0 Likes
Message 6 of 8

Serejah
Advocate
Advocate

Not sure about the latest ones but in older max versions you could subclass viewpanel or any other window and listen to WM_RBUTTONUP message. But I don't know how are you going to detect whether right click was used to cancel some operation or used to open the quad menu.

 

subclassing example

0 Likes
Message 7 of 8

andrew.speed
Explorer
Explorer

Hey, that sounds interesting.

I'll take a look.

 

Not being able to cancel would be an issue. however other quad menus should in theory be unaffected. The only way I have managed to make this work so far is by removing all items in the default quad menu.
so snapping quad menu etc should still work fine. 

Thanks for the reply



Thanks for reply.


0 Likes
Message 8 of 8

denisT.MaxDoctor
Advisor
Advisor

@andrew.speed wrote:

Hey, that sounds interesting.

The only way I have managed to make this work so far is by removing all items in the default quad menu.


Super!

0 Likes