Storing shapes as messages (concept testing)

Problem: Storing a shape (not a transform) as a messaged connection.

Quick addendum to last week’s post. Ran into this on some rayCasting stuff (needed specific shape connection for updatable loc via stored uv data in dicts – more on that soon). My own googling and maya fiddling came up short with successfully connecting a shapes.message plug┬áto a message attribute. It always connects to the transform. So, I pulled out my old method of attribute storing and it seems to be working okay.

If I wanted to store shape3 to messageHolder on an attribute of testMessage. It would look like this.

The connection works like this: shape3.viewName —-> messageHolder.testMessage.

The logic plays out as follows in our needed functions:

  • Set message
    • When it checks for attribute, component stuff from previous post, it now also checks for shape
    • Instead of a message attribute, I use my copy_to function to copy an unassuming attribute found on shapes (‘viewName’) which then creates a new attribute on my messageHolder matching type and all so it’s connectable. That call also wires that connection
    • Extra data is then stored as before
  • Get message
    • It checks a passed message attribute name for type. If it’s a string, it checks the plug flag on list connections for our above wiring
    • Otherwise, it goes as before

Still testing but seems to be working for our purposes. We’ll see how it plays out.

Comments are closed.