← All ideas
  • Published 17 Jul 2025

instead of "self" provide the name of the "self" object so that you can use it in driver functions

Self is "nice", but not sufficient. Everyone who ever wrote more than 3 driver functions himself - not just expressions - needs to access the object with the driver on. You cannot achieve this (AFAIK) with self. With the name given you could easily access it by yourself with bpy.data.objects[name] and access any modifier/data/custom property you need. Without it - you are really restricted to some very very basic functions. And no - no driver use wants to add that name to each (same) driver he uses for probably over 100 objects.

0%

Development Status: Open

Upvote 0 Downvote 1
blenderfun
17 Jul 2025

2 Comments

Lauloque

If I had to make over a hundred drivers, I would use Python instead of the GUI x)

That being said, the issue here isn't that self doesn't access the owner, it's that:

  • The properties which self can access are limited for performances and security reasons

  • It's clunky (You'd think that the prompt asking you if you want to enable python execution to make it work, would actually make it work. But no, for some expressions to work, you will still need to manually enable Autorun Python Script , and it won't tell you which ones require it);

  • The python paths are not the same as bpy's and there's, e.g. for an object's x location:

    • bpy: location[0]
    • Simple expressions: location.x
  • What self points to isn't always obvious depending on where the driver is set:

    • on the default Cube's translate x: self is the Cube object ✅
    • on the pose bone's translate x: self is the pose bone ✅
    • on the Principled BSDF node's metallic value: self is the metallic property⁉️
  • I don't think there's any documentation or GUI hints for any of that.

I've found this BSE post that explains how you can print the available properties of a given owner in the console.

My version of that would be to use the expression:

0 if [print(f"### Properties of '{self.name}':")] + [print(x) for x in sorted(self.__dir__())] else 1

Which gives something like this:

### Properties of 'Cube':
__doc__
__module__
__slots__
active_material
active_material_index
active_selection_set
active_shape_key
active_shape_key_index
add_rest_position_attribute
animation_data
animation_data_clear
animation_data_create
animation_visualization
asset_clear
asset_data
... so on ....

And use 0 if print(self.name) else 1 to print the name of the owner.

But considering that simple expressions with self are slower to execute than using variables, that it requires lowering your security, and the trial and error it is to even setup something functional with self , and that you should automate driver creation via scripting anyway if you need bigger scale, then you might as well never use self outside quick testing when you already know how access specific properties with it.

1
wilburjaywright

I’ve never heard of “driver functions” as opposed to a scripted expressions . Would you provide a documentation link to explain?