I learned to use


to obtain the path for my fcurves. But when I did this:

output: 'rotation_euler'

I started to wonder

on other properties I tested it behaved exactly the same
so, why should I even bother with this method?


It's useful for more complex situations than this. Let's say you have an object with a subsurf modifier, and you pass a reference to that modifier to some function:

mod = bpy.context.object.modifiers['Subsurf'] somefunc(mod)

That function can now figure out the path of a property of the subdivision surface, like this:

def somefunc(mod): print(mod.path_from_id('name')) # this outputs 'modifiers["Subsurf"].name'

Here is another practical example I just encountered. I want to create a driver for a specific property on the active sequencer strip. The driver needs to be defined on the scene itself, and I need to get the path for the property to drive:

se = C.scene.sequence_editor se.active_strip.transform.path_from_id('offset_x')

This outputs 'sequence_editor.sequences_all["2017-07-06T11-04-11+0200.webcam"].transform.offset_x', which is what is needed for the driver.


Your Answer

