Notifications
Clear all

[Closed] CAT – collapse layer behavior different in ui vs script

Hey all,
I am trying to speed up CAT’s collapse layers a bit. It’s a simple change in theory – I just want to add a disable/enable scene redraw before the collapse step as it takes forever to bake down long animations because of the viewport redraws every frame. CAT has a maxscript command $catparent.CollapseTimeRangeToLayer that can handle all of the parameters that the Layer Manager UI version of the collapse tool passes, so I just figured I would circumvent and write my own collapse tool that looks the same but runs faster. However, baking animation does not behave the same in script as it seems to in the UI. It’s not the scene redraws, I have disabled those for sanity’s sake, but I still can’t get a scripted bake to produce the same results as the UI version. I’d rather not have to do tap into detecting where mouseclicks are going and hijacking the button that way if I can help it but I haven’t found any good tips as to why the mxs collapse is weird. Any ideas are appreciated.

12 Replies
 lo1

Could you give more detail about exactly what issue you’re having with the maxscript collapse, and also show the code of how you’re calling it.

… and give a test scene to play with, please.

I was actually able to speed it up by hiding layers instead of disable/enable scene redraw. I’ve always had kind of mixed results with scene redraw… it seems pretty unpredictable at times. I think I’ll just try to avoid it from now on.

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

I’m glad that you found a workaround. However if you make a simple scene that shows difference between manual and script CAD layers collapsing, I will appreciate it very much. I don’t like any unsolved problem… Thanks

Ok I put together a super simple test but it is repro-able.

The CAT “Collapse Layers” button seems to do a couple of things – it appends a new layer called “Collapsed Layer” and then collapses based on user settings. In my script I’m just hard coding some settings.

Open the scene and do CAT’s Collapse Layer, you will see a new layer and the animation will be correctly baked down onto that layer. Delete that collapsed layer and run the script – you will see the collapsed layer is just a baked single pose. Every frame has keys, so the bake happened, but disableSceneRedraw apparently breaks the collapse functionality. Delete the layer and then run the script again but comment out the disable/enable scene redraws. It will work the same as the button functionality.

thanks. it will be very interesting to play with it.

Yeah i’d be interested to hear what you come up with…

It seems to me like the collapse layers function turns on Autokey and then just copies transforms per frame onto a new layer (using the regular plot option). But if it’s just copying transforms, I’m not sure why scene redraw would affect that, unless scene redraw also turns off transform updates of objects when being queried or something.

Hmm… I’ve played with the scene and ms. The script collapsing works for me exactly the same as manual. It works for both view redraw modes (ON or OFF). Without redraw the collapsing is much faster.
But if I do the collapsing with Plot Optimal Keys, the result of manual collapsing is different than the scripted one. And it doesn’t depend on the mode of view redraw.

That’s interesting… I wonder what could be different. I’m running Max 2010 sp1… what did you test with?

I’m not sure what “plot optimal keys” does yet but I know that everyone here avoids it as it actually seems to be non-optimal and innacurate, and animators would rather have an accurate bake with samples on every frame. If you watch the timeline as it samples it seems to bounce around frames quite a bit.

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

I used MAX 2012… I don’t have CAT in my 2010.

Absolutely agreed. I did “plot optimal keys” test just to see any possible difference.

Still occurs for me in 2011, I don’t have 2012 here to test with. I wonder if it’s a video card or windows-related issue… Do you know anything about what exactly enableSceneRedraw does under the hood Denis?

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

enable/disable redraw do as they say. They say to system about do or do not redraw the viewport. But some controllers/tools/modifiers are using redraw message to update some internal data. Which is not right but… Technically disabled redraw might cause the not updating of some controllers.