Page MenuHome

Variables For Scripted Drivers Convert Valid RNA Strings To Floats
Closed, ArchivedPublic

Description

Hi All,

I am trying to pass the name of the scene as a variable to a function in a scripted expression.

I have created a driver channel.
I have added a new variable named 'scene_name'.
The Prop is the Scene context.
I have chosen the current scene.
The Path is 'name'

This effectively gives a RNA path like bpy.context.scene.name which is a valid string.

However, all that gets passed to the Scripted Expression is a float value of 0.0.

Shouldn't the type of the RNA path be examined and the correct string value be passed to the scripted expression?

If you open up the attached BLEND file and re-activate the scripted expression you will see in the console that the value 0.0 is printed for the scene name (before it errors out). It should have printed "Scene".

Yes, I do realize that the print statement does not return a float value and that is why the Type Error occurs.

Details

Type
To Do

Event Timeline

This is more of a Todo item that is quite low priority

Nowhere in the rest of the animation system are types that cannot be reasonably and reliably represented numerically used yet. That is, pointers and strings (in particular) cannot be used, as you cannot accurately compress all their information into a numerical value which can later be retrieved and able to be used in many places.

In this particular case, it is possible to add a hack to allow strings/pointers to be passed into scripted expressions, though it would be a bit ugly (though not as ugly as some of the options for hacking support for the other types mentioned above for standard animation).

I believe that this is not something that will really be attempted that much apart from a few specialty cases, so IMO we can postpone adding a hack for this till a later date

Joshua Leung (aligorith) closed this task as Archived.Mar 3 2011, 12:16 PM