Home Technical Talk

[MAXScript] How to go to subobject mode on instances?

polycounter
Offline / Send Message
Justo polycounter
Hey all, I use these scripts to toggle subobject modes in Max. If no EditableP/EditP is selected atm, it goes there, unless some mods are selected (in this example, Symmetry).  
(
	fn goToBottom=
	(
		local obj = selection[1]
		if obj != undefined then
		(
			if subobjectLevel == undefined then
				Max Modify Mode
			if (modPanel.getCurrentObject() as string != ("Edit Poly")) then
				modPanel.setCurrentObject obj.baseObject
			subobjectLevel = 1
		)	
	)
	curObj = modPanel.getCurrentObject()
	Case (classof curObj) of
	(				
		Symmetry:
		(
				--if snaps are deactivated, activate them
				if getSnapState() == false then
				(	actionMan.executeAction 0 "40072")  -- Snaps: Snaps Toggle
				macros.run "Modifier Stack" "SubObject_1"
		)
		Chamfer: 	goToBottom()
		TurboSmooth: 	goToBottom()
		Shell: 		goToBottom()
		default:	macros.run "Modifier Stack" "SubObject_1"
	)
)
<br>

And it works great, except for one thing. I don't know why the goToBottom fn doesn't work properly with instances. If it runs on an instanced mod (create multiple instances, apply a bunch of modifiers on top), it'll go to vertex mode all right -- but on the original instanced object. Which doesn't make this useless, but is very annoying and isn't as fast as it could be.

Is there a way to reference the specific instanced mod that is selected, and go to that subobject mdoe instead? 

Replies

Sign In or Register to comment.