Notifications
Clear all

[Closed] Undo of skinOps.addCrossSection crashes Max

I’m not sure what’s going on, but any time I use this method, and then try to undo it, Max crashes. This doesn’t happen when I undo adding a cross section manually through the skin parameters UI, only when run as part of a script.

I’ve tried setting this situation up from a clean start of Max with no startup scripts loaded, and it still happens, so it does not appear to be a conflict with anything else. This seems to be happening both in r2012 and r2014.

Can anyone else please test this out and let me know if they get the same results?

11 Replies

Can anyone help me figure out a way to do this without crashing the program?

(
	delete objects
	global c = convertToMesh (cylinder())
	b = boneSys.createBone [0,0,0] [0,0,25] [0,0,1]

	select c
	addModifier c (skin())
	setCommandPanelTaskMode #modify

	skinOps.addBone c.skin b 1
)

skinOps.addCrossSection c.skin 1 0.5 1 1
--max undo
-- (Uncomment the above line, or undo manually from the edit menu; it appears either one will crash Max)

do it with undo off:

with undo off skinOps.addCrossSection c.skin 1 0.5 1 1  

addbone is undoable operation as i remember. and higher level. so by doing something undoable before addcrosssection you can make combined action undoable

1 Reply
(@malkalypse)
Joined: 11 months ago

Posts: 0

Trying to figure out how I can use this without actually adding another bone to the skin. I tried adding and removing a bone in sequence but that ALSO appears to crash Max on undo 9_9

it’s very useful trick… for example most of slineops functions are not-undoable… so do something of higher level.

convertToSplineShape()

Hm, the skinOps.invalidate method seems to work for this as well, and doesn’t actually jigger around with the scene at all. Can you think of any reason not to use it?


EDIT:

Okay, so never mind. I thought it was working, but then when I restarted Max it didn’t anymore, and I realized that I was misinterpreting the results I had been getting. So… anything I can do here that does NOT involve making unwanted changes to the skin modifier?


EDIT AGAIN:

I’m clearly missing something. This does not work:

with undo on(
	delete objects
	global c = convertToMesh (cylinder())
	global b = boneSys.createBone [0,0,0] [0,0,25] [0,0,1]

	select c
	addModifier c (skin())
	setCommandPanelTaskMode #modify

	skinOps.addBone c.skin b 1
)

with undo on (
	skinOps.addBone c.skin b 1
	with undo off (skinOps.addCrossSection c.skin 1 .5 1 1)
)
max undo

Max appears to completely ignore the undo. And if I remove “with undo off” from the last line of the second code segment, it crashes the program.

finally… do you want to make addcrosssection undoable? or you don’t care, and just want to have it not crashing the max on undo?

I would prefer it to be undoable, assuming it’s possible.

I can’t repro with your original code, I’ve also made some changes but still no crash on 2014.


(
	clearUndoBuffer()
	undo "Apply Skin" on (
		with redraw off (
			delete objects
			c = convertToMesh (cylinder())
			b = boneSys.createBone [0,0,0] [0,0,25] [0,0,1]

			select c
			addModifier c (skin())
			setCommandPanelTaskMode #modify

			skinOps.addBone c.skin b 1
			skinOps.addCrossSection c.skin 1 .5 1 1
		)
	)
)

That doesn’t crash for me either, but I need the undo to take it to the point just prior to adding the cross section. Everything before that is simply “setting the scene”.

Still wondering about this, especially since I’m looking to replace a chunk of existing code as well as create a new one, and both will require knowing how this works.

Page 1 / 2