Skip to content

Filter Custom Messages

maybites edited this page Jun 12, 2021 · 1 revision

Lets have a look at a more advanced usecase: We only want to react to an osc message with a specific value in the arguments.

A OSC message may look like this:

/custom/osc/message 4 myTexVvalue 5.63 1

with the structure

address args

where in the above example the args is a tuple with 4 values

  • address = /custom/osc/message
  • arg0 = 4
  • arg1 = 'myTextValue'
  • arg2 = 5.63
  • arg3 = 1

In the following examples the osc message would look something like this:

/objects/filtered/Cube 11 10.0 15.2 -5.3

Like with the previous example, We can see we receive the message on /objects/filtered/Cube. We want to apply the arguments on the data-path bpy.data.objects['Cube'].location, but since the message contains 4 arguments and the positional information are on the indices 1, 2 and 3, args[idx] is set to (1, 2, 3)

But now we also want to filter agains the first argument, args[0]. So we enable the filter and enter the condition args[0] == 11.

Now only messages with the address /objects/filtered/Cube and the value 11 for the first argument are evaluated and applied to the datapath.

but we can do even better -> Format-Custom-Messages