Hi James, >>> D.materials['Material'].path_from_id()
The path_from_id function is intended to get the path from a property to the ID it comes from. This fails in the example above because the material is it's self an ID. An example of where you could use this function: >>> D.materials[0].raytrace_mirror.path_from_id() 'raytrace_mirror' This doesn't seem so useful, however if you have a constraint or a modifier, the path isn't simply the property name. Also note, that you can use Python's repr command to get the full path, eg: >>> text = repr(C.object.modifiers[0]) >>> print(text) bpy.data.objects['Cube'].modifiers["Subsurf"] On Wed, Jun 8, 2016 at 5:34 PM, James Crowther <[email protected]> wrote: > Hi there, I am experimenting with using RNA paths, I would really like a way > to access the bps.ops.ui.copy_data-_path_button() from python. however it > doesn't look like this is possible. I have also tried using the method > path_from_id() with no argument on a number of id blocks but I don't think I > understand what this is really used for since it keeps on giving me the > following error: > >>>> D.materials['Material'].path_from_id() > Traceback (most recent call last): > File "<blender_console>", line 1, in <module> > ValueError: Material.path_from_id() does not support path creation for this > type > > I have tried this with other ID blocks but keep getting the same error. > > Currently running 2.76 on windows 7 can do a system info dump if that would > help. > > My current goal is to be able to generate a path to the active object > dynamically in python so something like bpy.data.objects['Cube'] > > Thanks > > _______________________________________________ > Bf-python mailing list > [email protected] > https://lists.blender.org/mailman/listinfo/bf-python > -- - Campbell _______________________________________________ Bf-python mailing list [email protected] https://lists.blender.org/mailman/listinfo/bf-python
