CNMAT's OSC-route with Variable Arguments in a Sub-Patch

Jun 29, 2011 at 2:32pm

CNMAT's OSC-route with Variable Arguments in a Sub-Patch

Hello Max users!

I'm working on getting Max to communicate with Blender, and vice-versa. To do this, I'm creating two Sub-Patches: BlenderIN and BlenderOUT, both of which take one argument (the name of the object in Blender that is to be observed). BlenderIN is responsible for receiving messages from Blender as OSC messages, decoding them, and sending the information about the observed object via outlets. BlenderOUT is responsible for accepting parameters, such as xPosition; yPosition; scale; colour, and converting them into OSC messages before sending them back to Blender via UDP.

The only issue I have is that I cannot figure out how to set up my sub-patch in order to accept arguments as described in the attached image, (BlenderIN myCube), nor can I figure out how to take this argument and pass it into the CNMAT OSC-route object as an argument.

You can see my attempts in the attached image.

I'd be grateful if anyone could point me in the right direction.

[attachment=165375,2401]

Attachments:
  1. problem.png
#57818
Jun 29, 2011 at 5:01pm

From what I understand of your problem and unless I have missed something it would go something like the attached (compressed) patch. If that IS what you were after, the question arises: do you plan to instantiate a BlenderIN abstraction for each element in the scene? Or…

In any case, as a some time Blender user I look forward to your results.

`

– Pasted Max Patch, click to expand. –
#207444
Jun 29, 2011 at 8:16pm

Thanks for the quick reply, Spectro. This approach was my first though, but these OSC addresses ideally shouldn’t be static, they should be able to be passed into the BlenderIN sub-patch, so that Max users shouldn’t have worry about knowing how OSC works.

With the support from sandbags and mattly, from the freenode #maxmsp channel, I’ve managed to solve my problem. I should finish in a few weeks, after which I can hopefully release my Blender scripts and Max sub-patches.

For what it’s worth (i.e. for anyone looking to set up their sub-patch to using arguments), here is a patch that demonstrates how to approach my issue:

The following patch is a sub-patch, and will accept a named argument in the form of a port number, which this patch will send on to a udpreceive object.

E.g. if you saved this patch as argumenttest, you could pass the port into it like so: [argumenttest 1234] (this requires that you add the location of this patch on your drive to the Max folder list.)

– Pasted Max Patch, click to expand. –
#207445

You must be logged in to reply to this topic.