2
$\begingroup$

Having Settings > Python tooltips enabled, I can copy a setting's Data path or Full data path.

e.g. Fluid domain's cache folder:

Full data path: bpy.data.objects["Dust Smoke Domain"].modifiers["Fluid"].domain_settings.cache_directory Data path: modifiers["Fluid"].domain_settings.cache_directory

Now pasting the Full data path into the python console returns it's value while the Data path returns name 'modifiers' is not defined

What's their difference or when to use one over the other?

$\endgroup$

1 Answer 1

3
$\begingroup$

As you noticed, Full Data Path just works. You could make an analogy to system paths, where it would be equivalent to an absolute path.

Data Path is always a fragment of Full Data Path, and so is just there for added convenience (actually both features are there just for convenience). Often you don't need the full path, rather just the part that stays the same, while the rest can change. In case of relative paths in system, you can move a folder to a different place, and the usage of relative paths will keep everything working. In case of Blender, you may want to apply some code to multiple objects:

Copy data path of Viewport Visibility: hide_viewport and write a loop in console to hide everything:

>>> for o in D.objects:
...     o.hide_viewport = True
...     

Everything got hidden indeed. Now try to use full data path bpy.data.objects["Cube"].hide_viewport to unhide everything:

>>> for o in D.objects:
...     bpy.data.objects["Cube"].hide_viewport = False
...     

Only the cube, from which you extracted the full data path, gets revealed.

When you add a driver and add a variable to it, you specify the block type, block name, and then the Data Path (not Full Data Path) in the field marked red:

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .