4
$\begingroup$

I've tried to use a workspace's Custom Property as a variable for a Driver, but it looks like the path to the Custom Property is broken. Is there anything that needs to be added to the properties path?

enter image description here

$\endgroup$
1
  • $\begingroup$ This is likely by design. I don't think you can't drive scene level data from UI or Preferences level parameters, it creates a lot of unanswerable questions. What happens when two workspaces are opened at the same time? Will the same scene display differently on windows with different Workspaces? What happens at render time where there are no workspaces? What about headless rendering? $\endgroup$ Jun 3 '20 at 13:58
3
$\begingroup$

Define the prop.

In as much as I agree with @DRF that using workspace properties as input into drivers is not a good idea...

Appears it is with custom properties, ie those defined via custom props panel or via script with

context.workspace["prop"] = 44.55

on the workspace that create the error. Trying instead the users property of the workspace it "works" (ie doesn't throw the error) as a driver variable.

If in script a property is defined via

bpy.types.WorkSpace.prop = bpy.props.FloatProperty()

in which case can address it via

context.workspace.prop

enter image description here

it will also work as a driver variable.

Since prop is stored as the custom property of same name will see the API defined message beside it.

Note: as mentioned this "works" as in it doesn't throw an error. It does however print warnings to the system console, and updating by pressing "Update dependencies" button.

Unhandled ID WSGeneral
add_relation(RNA Target -> Driver) - Could not find op_from (RnaPathKey(id: WSGeneral, prop: 'prop'))
add_relation(RNA Target -> Driver) - Failed, but op_to (OperationKey(type: PARAMETERS, component name: '', operation code: DRIVER, 'location')) was ok
$\endgroup$
2
  • $\begingroup$ Aaah nice one! Nothing like a good old Python hack batFinger style :) $\endgroup$ Jun 3 '20 at 13:51
  • $\begingroup$ I'll have to take a third and a fourth look at this. I'm not into scripting so I'm not sure on how to tackle your response. $\endgroup$ Jun 13 '20 at 11:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.