Expose Attributes

Common attributes can be defined in the project using the Attributes node and these common attributes can be used in other nodes by exposing their attributes as input and connecting the node values returned by the Attributes node as inputs.

In this tutorial, you will learn how to create common attributes for the project and how to expose the attributes of nodes and connect common attributes to these nodes.

Start Project

  1. Open the project Expose_Attributes.pxf.

    Start Nodes

    This project has 2 ellipsoids and a cylinder that are composed by a Value Maximum node to generate.

    Start Nodes

  2. In the top Ellipsoid node change attribute Center to [50, 150].

    Start Nodes

    As you can see left ellipsoid is moved but the cylinder doesn't follow it.

We'll modify this project to keep the 3 objects together as a single entity where we can control the position of the two end points and the radius of the ellipsoids and the cylinder.

Expose Attributes

  1. Set the top ellipsoid node as the Active Node.

  2. In the attributes panel right click the Center attribute to display the context menu.

  3. Click the Expose Attribute item.

    Expose

  4. In the Node Graph viewport right click the top ellipsoid to display the Expose Node Attributes window.

  5. Check the radiusx, radiusy and radius_z attributes.

    Expose

  6. Expose the center, radiusx, radiusy and radius_z attributes of the bottom ellipsoid node.

  7. Expose the pointa, pointb, radius and radius_z attributes of the cylinder node.

    Expose

Now that all attributes are exposed you will create an Attributes node that will keep all the attributes of the project.

Common Attributes

  1. Create an Attributes node Project Arrow Image IO.

  2. Click the Add Attribute button and create a new point_a attribute of type Point.

    Expose

  3. In the Attributes panel right click the point_a attribute and in the displayed context menu click Duplicate Attribute.

    Expose

  4. Set the name of the new attribute to point_b.

  5. Add a new r_ellipsoid attribute of type Number.

    Expose

  6. Duplicate rellispoid as a new rcylinder attribute.

    Expose

Connect the Attributes

  1. Connect [Attributes › pointa] to top [center › Ellipsoid]. Connect [Attributes › pointa] to [point_a › Cylinder].

  2. Connect [Attributes › pointb] to bottom [center › Ellipsoid]. Connect [Attributes › pointb] to [point_b › Cylinder].

  3. Connect [Attributes rellipsoid] to top [radiusx › Ellipsoid]. Connect [Attributes rellipsoid] to top [radiusy › Ellipsoid]. Connect [Attributes rellipsoid] to top [radiusz › Ellipsoid].

  4. Connect [Attributes rellipsoid] to bottom [radiusx › Ellipsoid]. Connect [Attributes rellipsoid] to bottom [radiusy › Ellipsoid]. Connect [Attributes rellipsoid] to bottom [radiusz › Ellipsoid].

  5. Connect [Attributes rcylinder] to [radius › Cylinder]. Connect [Attributes rcylinder] to [radius_z › Cylinder].

    Expose

Edit the Attributes

Now that the attributes are connected you can edit the common attributes in the Attributes control panel.

  1. Select the Value Maximum node and press the D key to make it the Display Node.

  2. Select the Attributes node and press the A key to make it the Active Node.

  3. Set attribute point_a to [30, 120].

  4. Set attribute point_b to [250, 40].

  5. Set attribute r_ellipsoid to 30.

  6. Set attribute r_cylinder to 20.

    Expose

Conclusion

In this tutorial you learned how to create common attributes for the project and how to expose attributes to keep your project elements always in context.