Variables For Scripted Drivers Convert Valid RNA Strings To Floats #26306

Closed
opened 2011-03-03 03:35:07 +01:00 by Atomic · 3 comments

%%%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.%%%

%%%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.%%%
Author

Changed status to: 'Open'

Changed status to: 'Open'
Member

%%%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%%%

%%%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%%%
Member

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#26306
No description provided.