3
$\begingroup$

I'm trying to add selected objects to active keying set but it doesn't work (no error). This is my script:

import bpy

scene = bpy.context.scene

ks = scene.keying_sets.active

for obj in bpy.context.selected_objects:
    ksp = ks.paths.add(obj.id_data, obj.id_data.name+'.location', index=-1)

Where am I wrong ? Thanks

$\endgroup$
2
$\begingroup$

I finally found in the scene panel that the data path should just be "location", so my code sould be:

import bpy

scene = bpy.context.scene

ks = scene.keying_sets.active

for obj in bpy.context.selected_objects:
    ksp = ks.paths.add(obj.id_data, 'location', index=-1)
    ksp = ks.paths.add(obj.id_data, 'rotation_euler', index=-1)
    # "rotation_quaternion" for quaternion mode

Now it works !

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.