maybites / NodeOSC

blender OSC addon to be used with nodes
GNU General Public License v3.0
123 stars 18 forks source link

Suggestion: send python commands as strings through OSC #4

Closed baronlanteigne closed 3 years ago

baronlanteigne commented 4 years ago

A specific OSC address could interpret the received strings as python commands as they are shown in the Info Editor.

This would allow the mapping of some more global parameters (ie Render Engine) without having to map them twice (once in the software you control blender with and once more in NodeOSC.)

I'm not certain what the proper terminology is so I'll explain what I mean with an example that I would actually use today.

Sending: /blender/script "bpy.context.space_data.lock_camera = True" Would enable Lock Camera to View in blender.

Thank you.

maybites commented 4 years ago

nice idea. certainly doable. maybe you could come up with a python script that does exactly this? (parsing the string and executes the script) maybe find a solution that also can deal with other data that might be interesting (bool, int, float, vectors, lists etc.) . once I have that code I can implement it quite easily.

baronlanteigne commented 4 years ago

Thank you for your motivation. I think I can figure it out and I would love to contribute. I'll give it a try. I've never worked on an addon or even scripts in blender but i'll take a look at your scripts to get started.

maybites commented 3 years ago

I just realized that this feature is a very low hanging fruit with V2, So I implemented it and it is live with V2.0.2:

now you can send the following string:

/blender/script "bpy.data.scenes['Scene'].tool_settings.transform_pivot_point = 'CURSOR'"

and setting the handler thus

Statementhandler

will execute your statement