Notifications
Clear all

[Closed] How to extend the spinner rightclick menu

Hi.

I wonder if it is possible to extend the default 3ds Max spinner rightclick menu. It doesn’t seem to be available via customize user interface. This would be neat, but I guess I need to dig deeper.

If you click on show parameter in track view, there’s a list of things you can do with the parameter. Copying it, collecting it, publishing it etc. These are some of the buttons I would like to show up on rightclicking the spinner.
image

Do you think this could be possible to do somehow?

10 Replies

I guess spinners context menu is generated at runtime, so you can’t do appendMenu once when it shows for the first time. You’ll have to continuously monitor windows messages to know when it shows up to append your custom menu items each time it happens. The hardest part is to handle clicks on these menu items. I couldn’t make them send WM_COMMAND message on click so it is nearly impossible to know when event must be handled.

here is how I do… just add another RC menu to the spinner’s label area:

try(destroydialog rol) catch()
rollout rol "Test" width:191
(
	local spinnerRC = 
	(
		rcmenu spinnerRC 
		(
			local control = if control != undefined do control
			local dialog = if dialog != undefined do dialog
					
			local active = iskindof control SpinnerControl	
				
			menuitem reset_i "Reset To 1" enabled:active 
			separator sep0
			menuitem cancel_i "Cancel" 
			
			on reset_i picked do control.value = 1
			on cancel_i picked do ()
		)
	)
	
	spinner rc_sp "Value: "	type:#float align:#right 
	imgtag rc_im width:60 height:17 bitmap:(bitmap 1 1 color:red) fieldwidth:56 pos:(rc_sp.pos - [132,0]) transparent:red
	
	on rc_im rightclick do
	(
		spinnerRC.control = rc_sp
		popupmenu spinnerRC
	)
)
createdialog rol

thank you so much for the replies. I will try them out on monday, as I don’t have time during the weekend.

The idea of adding an invisble imgtag with a popupmenu is hacky. I like it

Unfortunately, I don’t own the spinner. I want to access the spinner of any objects modifier. But adding a custum popupmenu is a nice idea…

Perhaps I could use the UIAccesor and get the handle of the spinner that is at the mouse position and add a second popupmenu? I guess this should work.

But is there a way to access the underlying data of the spinner? how do I know if this spinner controls the length, the width or the height of a Box? Or the chamfer amount in a modifier?

it was discussed earlier, but seems like there’s no solution to this

1 Reply
(@wheiraucher)
Joined: 10 months ago

Posts: 0

Oh no .But perhaps one could modify the value of the spinner (just quickly back and forth to some value) using UIAccessor and register the parameter change with a callback?

do you think it will work for turbosmooth iterations spinner?

I played around a little yesterday…and it’s overkill to do.

This is what I tried:

  1. Use mouse hooks to detect clicks outside of the viewport, as mouse.buttonstates only register in viewports. This kinda works but sometimes crashed (Mouse button hold timer)
  2. Use some dotnet stuff to register the window handle at mouse pos http://www.scriptspot.com/3ds-max/scripts/simple-hwnd-viewer
  3. change value back and forth (indeed difficult for mods like turbosmooth!)
  4. capture the last line from the macro recorder with absolute names (this works great actually).
  5. generate popupmenu

The process feels way too hacky. I will abandon the whole idea for now, and let it grow in the back of my head instead. Maybe I will have an epiphany someday.

1 Reply
(@denist)
Joined: 10 months ago

Posts: 0

Are you looking for an MXS-only solution or is the SDK also OK?

Sadly, I have no experience with the SDK yet. I would love to get into it, though. Perhaps a real programmer at our company could give me a quickstart and set up the work-environment. So, if you think it will be possible to do with the SDK, please tell my your ideas.