Notifications
Clear all

[Closed] Modifer stack navigation?

 PEN

I’m just writing a little util for aiding in the navigation of the modifier panel a little quicker. Using setCurrentObject I can set the modifier in the stack that you want to have active. How ever if a modifier is instanced and you have both objects selected it deselects all but the first object in the selection. So, is there a way to navigate the modifier panel without loosing the current selection?

9 Replies
1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

first – you have to collect the list of shared modifiers for selected objects (you have to know number and order)
select selection to set modifier stack on top or just find the current modifier in your list
use max prev mod (or max next mod) to navigate the stack
use subobjectlevel to change the level

 JHN

Can’t you make a callback to automaticly reselect after the modpanel operation?
Or simply:


s = selection as array
modPanel.setCurrentObject s[1].baseObject
select s

Or will that not suffice?

-Johan

I think what PEN is pondering is this…


 a = sphere()
 $Sphere:Sphere01 @ [0.000000,0.000000,0.000000]
 b = sphere()
 $Sphere:Sphere02 @ [0.000000,0.000000,0.000000]
 myObjs = #(a,b)
 #($Sphere:Sphere01 @ [0.000000,0.000000,0.000000], $Sphere:Sphere02 @ [0.000000,0.000000,0.000000])
 c = bend()
 Bend:Bend
 d = spherify()
 Spherify:Spherify
 addModifier myObjs c
 OK
 addModifier myObjs d
 OK
 select myObjs
 OK
 -- note that both objects are selected
  -- the modifier stack selection is the top-most modifier, Spherify
 
 -- let's try to select the Bend modifier instead
 modPanel.setCurrentObject c
 OK
 -- well, the Bend modifier is now selected in the modifier stack..
 -- ..but we've lost our object selection - only 1 of the 2 spheres is selected

 -- select both again...
select myObjs
 OK
 -- and of course we've lost our Bend modifier stack selection

 JHN

I see, the listener isn’t very helpfull either, returning setCurrentObject… :curious:
We should need a modPanel.setModifierIndex that just walks the stack… but there isn’t…

 PEN

Ya the modifier index sort of thing is what I was hoping for. Darn, well if any one comes across anything I would love to hear about it.

2 Replies
(@johnswafford)
Joined: 11 months ago

Posts: 0

I just stumbled across the max prev mod and max next mod commands on the max Commands topic in the help.

They seem old and pretty crude, but they appear to be the only other methods related to navigating up and down the stack. They also don’t come up in any forum searches at all, so I thought maybe nobody knew about them…

(@davewortley)
Joined: 11 months ago

Posts: 0

I have these assigned to hot keys along with ‘Show End Results’ toggle, makes modelling so much quicker if u can do this all without moving your mouse over to it.

well shoot… the darn thing doesn’t respond to LB_SETCURSEL. Or, rather, it does – but with an error response >_<

Pressing the down key a few times it is, then.


fn selectNthModFromTop N = (
	select selection
	local VK_DOWN = 0x28
	local WM_KEYDOWN = 0x0100
	local WM_KEYUP = 0x0101
	local LB_SETCURSEL = 0x0186

	local foundTab = false
	local maxHWND = windows.getMaxHWND()
	local maxChildren = windows.getChildrenHWND maxHWND
	for child in maxChildren do (
		if (child[4] == "ModifyTask") then (
			foundTab = true
		)
		if (foundTab) then (
			if ((child[4] == "ListBox") AND ((UIAccessor.GetWindowResourceID child[1]) == 1689)) then (
				zort = child[1]
				for i = 1 to (N - 1) do (
					UIAccessor.sendMessage child[1] WM_KEYDOWN VK_DOWN 0
					UIAccessor.sendMessage child[1] WM_KEYUP VK_DOWN 0
				)
				return OK
			)
		)
	)
)

Precautions to take: make sure that the number of shared modifiers is equal to or greater than the number you feed this function. There’s no giant harm in specifying a larger number – if the bottom-most modifier has a sub-object level, it will just end up going into that sub-object level for no good reason, then exits it if you go down one more, enters it again – etc. Same as if you would press the up/down arrow keys in the max UI (but without invoking that walkthrough mode thing).

 PEN

Thanks Richard, I didn’t think of even going down that road. I’ll poke at it next week and post what I get working… if it works out.