Bake Action now can bake All and Selected Objects
AbandonedPublic

Authored by Carlo Andreacchio (candreacchio) on Sep 9 2017, 4:14 AM.

Details

Summary

Hi,

This patch extends the functionality of Bake Action, to include all and selected objects.

This patch also (properly) fixes T49349 .

Diff Detail

Campbell Barton (campbellbarton) requested changes to this revision.EditedSep 10 2017, 5:46 AM

Looping over each object and baking its action is going to cause a feedback loop in some cases - if one object is constrained to another for example.

This functionality should be changed so the animation plays through once, baking all data at once to avoid result depending on object order.

It's also more efficient to bake in one pass.


Thinking of how this can work without having to complicate the API by passing a list of objects & actions.

This could be done by making the bake function into a generator, psudo-code::

bake_state = []
for obj selected:
    some_action = ...
    bake_state.append(bake_action_generator(obj, ... action=some_action))

for frame in range(frame_start, frame_end + 1):
    scene.frame_set(frame)
    for s in bake_state:
        s.send(frame)

# send None as a signal to finish
for s in bake_state:
    s.send(None)

This way the bake functions can be controlled by a main time loop,
for working example code that uses a similar convention, see: https://blender.stackexchange.com/a/47669/55

This revision now requires changes to proceed.Sep 10 2017, 5:46 AM

@Campbell Barton (campbellbarton) Thanks for the new patch! much appreciated (I am pretty sure my skills arent at those levels yet!)