Quick Question (check how well you know 3DS MAX)


#21

have you tried running a Notify on NOTIFY_MODPANEL_SEL_CHANGED ?


#22

i thought about this… but what can it give us?


#23

if I listen to all notifications, then in theory I will know what happens on the stack … but this is far from a fact, and it is not clear when I need to “start listening”

All this time I lived without knowing what is on the stack and it was OK. But recently I realized that I can’t say for sure that a certain modifier is at a certain moment on the stack. And It got me hooked


#24

Interface::GetModContexts and Interface::GetCurEditObject ?


#25

tried and learned them all… :slight_smile:

i use it in a lot of my methods…


#26

STOP! that sounds like an answer… let me check…


#27

i can get all nodes in stack… all modcontexts… in theory i can find a modifier by node and context


#28

i can’t get a list of current modifiers in stack, but at least i can know now the node (or nodes) which context is currently in the list. It’s a BIG progress!

the good thing is that the nodes might be UNSELECTED (the ‘pinned’ stack case)


#29

now i know what is to enumerate… if we have multiple nodes with some logic i can find ‘shared’ modifiers… it sounds promising


#30

I still don’t see how to get this stak:

(
	delete objects
	
	max modify mode
	
	md1 = noisemodifier()
	md2 = edit_poly()
	md3 = bend()
	md4 = smooth()
	md5 = uvwmap()
	
	obj1 = box pos:[0,0,0]
	obj2 = box pos:[50,0,0]
	
	addmodifier obj1 md1
	addmodifier obj1 md2
	addmodifier obj1 md3
	
	addmodifier obj2 md2
	addmodifier obj2 md4
	addmodifier obj2 md5

	select obj1
	
	modpanel.setcurrentobject md2
	modpanel.setpinstack on
	
	deselect obj1
)

#31

This seems to work for my previous example, but it is very ugly.

(
	currentMod = modpanel.getcurrentobject()
	nodes = refs.dependentNodes currentMod
	
	nodesModifiers = for j in nodes collect #(j, j.modifiers.count)
	
	dummyMod = emptymodifier()
	
	select nodes
	
	modpanel.addmodtoselection dummyMod
	
	mainNode = undefined
	
	for j = 1 to nodesModifiers.count do
	(
		if nodesModifiers[j][2] != nodesModifiers[j][1].modifiers.count do
		(
			mainNode = nodesModifiers[j][1]
			deletemodifier mainNode dummyMod
		)
	)
	
	select mainNode
	
	modpanel.setcurrentobject currentMod
	
	modpanel.setpinstack on
	
	max select none
	
	print mainNode.modifiers
)