Property Nodes?

john's Avatar


12 Feb, 2015 03:10 AM

This is either a noob question or a feature request...

I find myself creating lots of colorized rectangles with carefully calculated properties (height, width, position, fill color, etc.) that change over the course of an animation. Other nodes often need access to those properties.

Of course I can just hook those other nodes to whatever node originally created each property. But this tends to create a big pile of spaghetti with all these other nodes reaching into the bowels of the original set of nodes. And this in turn makes it much more difficult to compartmentalize my node sets into subnetworks.

One workaround is to create lots of zip maps. Instead of creating the rectangles directly, I can create subnetworks that build zip maps with all the properties needed. To display the rectangles I can then do lookups for each property and feed those into the rectangle and colorize nodes. Other nodes needing these properties can do the same thing.

This reduces the spaghetti but forces me to add extra nodes to build each zip map and then more nodes to take it apart again.

What I wish I could do instead would be to make a single subnetwork that just spits out colored shapes. Any other node needing the properties could just swallow the finished shapes and interrogate them to recover whatever properties it needs.

The problem is that there doesn't seem to be such a thing as a "property node" that takes in an object and spits out a single property (height, width, position, color, etc.). Actually, I can use centroid to recover the position, but width, height, and color would be particularly useful. One general purpose solution would be to allow the lookup node to do this, using any property as a key value.

So my noob question is: "Is there already some way of doing this that I haven't figured out?"

And if not, that would be my next feature request.



  1. Support Staff 1 Posted by Stefan Gabriels on 12 Feb, 2015 06:58 AM

    Stefan Gabriels's Avatar

    Yes, it's possible to use the lookup node for this.
    for height: bounds.height
    for width: bounds.width
    for x: bounds.x (this is the outer left coordinate: centroid.x - width / 2)
    for y: bounds.y (this is the outer top coordinate: centroid.y - height / 2)
    for the fill color: fill
    for the stroke color: stroke
    for the stroke width: strokeWidth
    for the length of the path: length

    you can also lookup the bounds of a shape, and then use lookups on x, y, width, height for that.

    fill and stroke are a bit tricky here, if one of them is without a value (null) you won't get anything out of the lookup (so not even null). I currently don't know how to best handle this case, so it's best to be mindful about this for the time being.

  2. Stefan Gabriels closed this discussion on 12 Feb, 2015 06:58 AM.

  3. john re-opened this discussion on 13 Feb, 2015 08:42 PM

  4. Support Staff 2 Posted by john on 13 Feb, 2015 08:45 PM

    john's Avatar


    You left out one thing, though. How do I lookup the roundness of a rect (roundness x and roundness y)?

    This is important for a project I am working on at the moment. I tried every incantation I could think of and browsed through the rect API in your documentation but came up empty.

  5. Support Staff 3 Posted by Stefan Gabriels on 14 Feb, 2015 06:31 PM

    Stefan Gabriels's Avatar

    This is not possible I'm afraid, the resulting shapes don't retain any of the parameters they were constructed with, they only consist of drawing commands like lineto, curveto, ...The Rect API is not the same as rectangle shapes btw, it's only used for bounding boxes or calculating intersections of rectangles. Every shape is expressed either in terms of the Path API or the Geometry API (which is a collection of multiple paths).

    If you want to reuse the roundness it's best to make a separate number node for this and connect it to the roundness parameter of the rect node.

  6. john closed this discussion on 25 Feb, 2015 07:57 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

17 Jun, 2024 02:26 PM
15 Jun, 2024 01:44 PM
08 Jun, 2024 09:05 AM
08 Jun, 2024 09:00 AM
04 Jun, 2024 04:37 AM