[Closed] UnknownSystemException: CAT, rollouts, and instancing trouble
I’ve been trying to track down an unknown system exception for a while. :banghead: I have it paired down to the code below and was wondering if anyone could lend some hints as to what I may be doing wrong or what workarounds there may be. I am running this from a blank scene with a default “baseHuman” CATRig created (which is why it gets node by name) In the full version of the script I have all the testing to see if it is in rig/animate mode or how many layers it has, etc, again this is just the basic version I am testing with and still getting the crash when the layer is added.
rollout mytest "test" (
button thebutton "Click"
global catObj1
global catObj2
global theNodes
global theNewbies
on thebutton pressed do (
max modify mode
catObj1 = getNodeByName "Base Human"
theNodes = catObj1.CATRigNodes
maxOps.cloneNodes theNodes newNodes:&theNewbies
catObj2 = theNewbies[1]
catObj2.transform.controller.Layers.controller.AppendLayer "CATMotion Layer1" #CATMotion
catObj2.CATMode = 1
)
)
createDialog mytest
The problem seems to be running the code within a rollout that causes the exception. If I run the code that is inside the on pressed do brackets, I don’t get an exception. After some searching i saw comments about max modify mode and global variable scope, so that’s why those lines are in there, but it still causes the issue.
Please, report this as a bug to Autodesk, probably it is and there is nothing you can do if they don’t fix it. (i’m not sure, but it is really possible).
Cheers.
Since the unknown exception was happening when I add a motion layer to the cloned rig, and does not happen when I run the script on a CATRig that already has a motion layer, I thought I’d try adding the MotionLayer prior to cloning the original rig. Now I don’t get a Maxscript exception, it just crashes Max completely.
Looks like I’ll send it in, but if anyone has other ideas for a workaround in the meantime, I’d love to hear it!