Discussion:
[Maya-Python] bakeResults issues
yann19
2018-08-16 19:10:39 UTC
Permalink
I have an object that has constrained channels (translateXYZ and
rotateXYZ), I set the blendParent to a value of 1 at a specified frame,
while setting it to 0 for its first key of animation. Between these 2
blendParents, I have set them into 'step' mode.
This is so that, I can extend the animation, eg. from RigB to RigA.

Intitially, I tried using a quick bake script to do the channels baking, in
which you select the channels in the channel box > run the script in which
it will bake and set keyframe onto each frame. The curves looks smooth, no
big jump in any of the translation/ rotation channels found.
And so I tried to use the same code portion and implemented into my tool.

However, for some reasons, I am not achieving the same result.
1. It is not setting any keyframes (the channels are still highlighted in
green).
2. There is a big jump in the curves of 1-2 channels at the frame where I
set `blendParent` and the next.

Here is the code - https://pastebin.com/p9n120bx

Could anyone kindly take a look?
--
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+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/b780bdd7-ca06-43ac-b8fc-51e01d4f1cd6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
yann19
2018-08-16 19:52:38 UTC
Permalink
Adding on, sometimes I get a 'hit-or-miss' where the value of the
`blendParent` attribute gets set back to 0 even thought I did not code in
anything that makes it does that...
--
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+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/cee881cd-4054-4076-ab51-d3d843ee44fc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
yann19
2018-08-16 23:06:35 UTC
Permalink
If I use the following MEL command:

global proc bakeAnimation()
{
for ($bone in `ls -sl`)
{
bakeResults -t (`playbackOptions -q -min` + ":" + `playbackOptions
-q -max`) -sm true -hi both -at t -at r $bone ;
}
}
bakeAnimation()


It is able to bake in the channels at each frame and at the same time,
changing those 'green' channels into 'red'. However the process does takes
quite some time for it to finish iterating over it.

Even so, when using the same command but converted into Python, I am not
getting the same results as compared to the MEL commands at all. 'Green'
channels still remains as 'green'..
--
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+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/4489a9e1-25f3-4813-9fe0-ed6833137434%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
yann19
2018-08-17 00:03:57 UTC
Permalink
I have created a test case:

names = ['A01', 'A02', 'B01', 'B02']


def test_bakeResults(test_grp):
if test_grp == 'A':
loc01_name = names[0]
loc02_name = names[1]
else:
loc01_name = names[2]
loc02_name = names[3]

loc01 = cmds.spaceLocator(name=loc01_name)
cmds.setKeyframe(loc01)

loc02 = cmds.spaceLocator(name=loc02_name)
cmds.parentConstraint(loc02, loc01)
cmds.currentTime(1)
cmds.setKeyframe('{0}.translateZ'.format(loc02_name))
cmds.currentTime(10)
cmds.move(5, z=True)
cmds.setKeyframe('{0}.translateZ'.format(loc02_name))

if test_grp == 'A':
cmds.bakeResults(
'|{0}'.format(loc01_name),
simulation=True,
time=(3, 5),
preserveOutsideKeys=True
)
cmds.group(loc02_name, loc01_name, name='python')
else:
from maya import mel
mel.eval('bakeResults -t (3+ ":" + 5) -sm true -hi both -at tz {0}'.
format(loc01_name))
cmds.group(loc02_name, loc01_name, name='mel')


test_bakeResults('A')
test_bakeResults('B')

In the above test case, check out both `A01` and `B01` and I am trying to
get `B01` scenario.
--
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+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/3771970a-ad20-44c5-b111-4961f777c884%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...