- I have assigned a script-expression driver to a field in a modifier.
- The expression is a function of properties of the object to which the modifier is assigned, extracted as Single Property variables.
I can CtrlL link the modifier to a new object. I can copy the driver from the old object's modifier, and paste it into the new object's modifier.
But, of course, the driving properties still refer to the old object, and so I have to go in and manually point the variables in the driver to the new object.
How should I use 'self', or suchlike, either in an expression, or in a driver-namespace function, so I can copy the driver between modifiers on separate objects, always referring to the object the modifier is assigned to?
EDIT:
I've just worked out that self
in an expression driving a modifier field, refers to the modifier, not the object the modifier is assigned to.
AND YET, if I create single-property variables to be used in the expression in the UI, the root is the object. For example, to reach the value of a field in the driven modifier that way, I use modifiers["name"].modifier_property
.
This makes no sense to me at all...