maybites/NodeOSC

Auto-Keying

Closed this issue · 12 comments

Hi, I found this add-on as an alternative to AddRoutes, which I had no success with in routing incoming value arrays to object indices. This add-on works as expected, so thank you for that.

I'm developing a real-time recording workflow whereby I can use an external controller like TouchOSC to send transformations to Blender objects. These transformations would be keyframed live by playing the timeline with Auto-Keying on.

This process of recording keyframes in real-time works using the native Blender transformation tools, as those changes in values are recorded as new keys. Messages routed to objects via the NodeOSC server, however, do not set keyframes when the values change, even though the transformations are applied successfully.

Would I have to go into animation nodes to enable this type of function? Or is there a message handler setting that I am overlooking somewhere?

Just saw this in the wiki. Will give it a try!
https://github.com/maybites/blender.NodeOSC/wiki/Record-Messages

let me know if you are successful and if yes and your solution looks different than in the wiki, please post it here.

I did get the second method to work, but not exactly as described in the wiki:

  • The message handler with the keyframe_insert datapath had to be set to output (send). Nothing happened when it was set to input (recieve) as the OP described.
  • The second message handler (for router incoming message) as written is the default value when creating a new one. I presume this is meant to be a placeholder, and you will need to configure it with the address that you are receiving messages from, but the OP makes no mention of this.
  • The order in which the two message handlers is set (route incoming message, insert keyframe) does not seem to make any difference.

A few caveats:

  • Once the server is running, the keyframing is always on and much more sensitive than Blender's native auto-keying. In fact, the Auto-Key setting does not need to be enabled. Any change to the timeline playhead will create new keyframes, regardless of whether the timeline is in playback mode or not. Scrubbing the timeline to find a frame or return to the start will create keyframes on the timeline as long as the server is running, so be careful.
  • I had cleaner transformations when filtering was enabled in the Server Settings.
  • I only tested this briefly with controlling x/y positiion of a cube with TouchOSC, but the results were acceptable.

Here is how I had it configured. The red circles are settings to pay close attention to.
Screen Shot 2021-08-24 at 2 50 56 PM

I also tried method #1 of adding a record animation node, but am not familiar enough with the node structure to understand how to set it up for this use.

The message handler with the keyframe_insert datapath had to be set to output (send). Nothing happened when it was set to input (recieve) as the OP described.

this is strange. I will investigate..

Once the server is running, the keyframing is always on and much more sensitive than Blender's native auto-keying. In fact, the Auto-Key setting does not need to be enabled. Any change to the timeline playhead will create new keyframes, regardless of whether the timeline is in playback mode or not. Scrubbing the timeline to find a frame or return to the start will create keyframes on the timeline as long as the server is running, so be careful.

this is expected, since blender will try to send an osc message on each update, and this will basically execute the 'keyframe_insert' command constantly.

this is expected, since blender will try to send an osc message on each update, and this will basically execute the 'keyframe_insert' command constantly.

Yes, the behavior works the same way in the AddRoutes add-on, but recording needs to be toggled manually for every message handler. I prefer the NodeOSC approach of just starting and stopping the server.

Success report!

So I follow the above post, and I success! but changed TX/RX direction is not necessary, because object.keyframe_insert will make the keyframe automatically recorded. Bellow image is provided for your reference.

For the control side

First, change "address" to the same as your other software output variable name, I recommend you use TouchDesigner, it automatically set up variables name for you, in my case you can see TouchDesigner send "chan1" with 0.1802 as float into Blender NodeOSC plugins.

Second, the datapath needs to point to the parameter you want to control.
In my case I want to control Displacement modifier's strength bpy.data.objects["Cube"].modifiers["Displace"].strength
You done! If you don't see any change, just restart TD "OSC Out" node and Blender NodeOSC plugin.

For the record keyframe side

No need to change "address".
Simply add .keyframe_insert(' ')
In my case bpy.data.objects['Cube'].keyframe_insert('modifiers["Displace"].strength')

And you did it! Now you can control Blender in real time!
For example, Ableton audio reactive, Microsoft Kinect, Leap Motion, etc.
But something you need to be aware, some parameters in Blender only accept integer, but TD can only transfer all data either integer or float.

NodeOSC錄Keyframe設定

So in my case, I transfer all data as float to Blender, then use "Custom Properties" as a new variable to control subdivision level amount, then in "Subdivision Level" , paste "Custom Properties" as a new driver to "Subdivision Level", edit driver, change Type to Scripted Expressions, and simply add int(prop) press enter, then back to "Custom Properties", right-click "create node osc handler", follow above instructions to transfer TD data.

For custom properties as driver, you can follow this great video.

Some reference:
Insert keyframe on an object's custom property with Python

Sorry for bad English and bad editing.

I am glad to hear. Thank you for your report and good luck with your project!

I am glad to hear. Thank you for your report and good luck with your project!

Thx for reply~ I update the post, I think it would be more helpful to write the process carefully~

which process are you referring to?

if you want to, I can give you access to add a wiki page here: https://github.com/maybites/blender.NodeOSC/wiki where you can elaborate your specific use case..

It's my pleasure.