Thanks Christopher,
I'll take a look that could be useful.

I found what was the problem with my scene. It was the parallel evaluation
turned on.
I turned it off and things seem to work much better. I also suspended the
refreshing of the viewport, now I have some decent result.

On Dec 24, 2016 06:10, "Christopher Crouzet" <christopher.crou...@gmail.com>
wrote:

> Hey Gerem!
>
> I have no idea of what might be causing this slowdown with the Python
> version but I was curious to see how a quick and dirty custom
> implementation using the Maya API would fare, so I gave it a go. Here's the
> file: https://gist.github.com/christophercrouzet/
> e4daa884d4d4e08bce24addfe820af4d
>
> It is a very naive implementation and it is the first time that I'm using
> the `OpenMaya.MDGContext` object, so chances are high that the code isn't
> optimal and could be speeded up. Also I didn't test it at all outside of
> the scene that it generates, so it might be crippled with bugs. And in all
> fairness it doesn't implement all the features covered by the `bakeResults`
> command, but still, it can be a starting point so give it a go to see if it
> helps. On my old laptop it takes 25 seconds to bake the animation on 6
> attributes (pos + rot) for 500 locators over 400 frames. Maybe it'll be
> faster on your workstation?
>
> On a side note I'm currently working on a small library to help
> benchmarking code for Maya, maybe that'll interest someone around here?
>
>
> On 24 December 2016 at 05:56, Jeremie Passerin <gerem....@gmail.com>
> wrote:
>
>> Hello Maya coders !
>>
>> I'm having a weird issue right now using the bakeresults command in Maya
>> 2016.5 (aka ext2)
>> I've built a test scene with 500 locators constrained to 500 others that
>> have a simple animation on 400 frames (Parent Constraint)
>>
>> When I bake the animation to fcurve using the MEL
>> It's done in a about 40s
>> When I do it in Python it takes almost 5 minutes
>> I had to set simulation to False in Python otherwise... it's taking even
>> longer... I wasn't able to get it to finish (I left it running for 2 hours)
>>
>> Any idea ? any tips on baking a bunch of controllers that are constrained
>> to something ?
>>
>> *MEL*
>> timer -s;
>> bakeResults -simulation true -t "1:400" -sampleBy 1
>> -disableImplicitControl true -preserveOutsideKeys true -sparseAnimCurveBake
>> false -removeBakedAttributeFromLayer false -removeBakedAnimFromLayer false
>> -bakeOnOverrideLayer false -minimizeRotation true {"slave", [...],
>> "slave500"};
>> timer -e;
>> // Result: 25.241 //
>>
>> *Python*
>> from datetime import datetime as dt
>> import maya.cmds as cmds
>> start = dt.now()
>> cmds.bakeResults("slave", [...], ["slave500"],
>> simulation=False,t=(0,400),sampleBy=1,disableImplicitControl
>> =True,preserveOutsideKeys=True,sparseAnimCurveBake=
>> False,removeBakedAttributeFromLayer=False,removeBakedAnimFromLayer=False,
>> bakeOnOverrideLayer=False,minimizeRotation=True)
>> print dt.now() - start
>> >>> 0:04:44.691000
>>
>>
>> Thanks,
>> Jeremie
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Python Programming for Autodesk Maya" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to python_inside_maya+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit https://groups.google.com/d/ms
>> gid/python_inside_maya/CAKq4km-qgWqQZpVMa9biYMuTTvSh8GiKdfM7
>> y1xmNYZ%2BeivpKQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/python_inside_maya/CAKq4km-qgWqQZpVMa9biYMuTTvSh8GiKdfM7y1xmNYZ%2BeivpKQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> Christopher Crouzet
> *https://christophercrouzet.com* <https://christophercrouzet.com>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to python_inside_maya+unsubscr...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/python_inside_maya/CANuKW50jH9F7t_2%3D3kyt27itqcK1q73ZOE4sV7KCx9z2
> L8KMNw%40mail.gmail.com
> <https://groups.google.com/d/msgid/python_inside_maya/CANuKW50jH9F7t_2%3D3kyt27itqcK1q73ZOE4sV7KCx9z2L8KMNw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAKq4km_7nX4DXFw8P5tC3X9CTQi%3DEMUTxvq2%3D7w3CTz6Q26-Zg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to