This Plugin allows you to add global variables to your Library, that can be used to set property values centrally or can act as temporary values to further assign values to other properties.



1. Installing the Expression Wire plugin

1. Switching PolypopLive to Developer Mode

To be able to see and install the Global Variables Plugin, you will need to switch to developer mode. This special mode allows you to access advanced features and make customizations that may not be available in the standard user mode.

  1. Click on the menu icon at to top of the user interface.

  2. Choose the Preferences option from the dropdown menu.

  3. Select the User Interface option and enable the Developer Mode option.

2. Installing the Global Variables Plugin

Plugins allow users to customize PolypopLive to their specific needs by installing only the features they require.

One of the features included in the Candy Pack add-on is the Global Variables source. To download the Global Variables plugin, you must first subscribe to the Candy Pack add-on. By purchasing this add-on, you not only support the continued development of the app but also unlock a range of exciting new features. With access to all the plugins and tools included in the Candy Pack, you can enhance your livestream interactivity with unique elements.

To learn more about the Candy Pack add-on and all the plugins that are included with it click here.

  1. Click on the Plugins button located at the top of the UI.

  2. Select the “Candy Pack” category from the menu.

  3. Click the "Install" button next to Global Variables Plugin.

  4. You can add a Global Variables source to your Library panel.

If the plugin is already installed it means you already have it. You do not need to install it again.

2. Using the Global Variables Source

Let’s add a Global Variables source to our Library to see how it works.

1. Adding the Global Variables Source to your Library panel

  1. First, open the Library panel by clicking the + button on the bottom left side of the screen.

     

  2. To pin the Library panel to the UI, click on the pin icon located at the top-right corner of the panel.

    (While this step can make the subsequent stages more convenient, it is not mandatory).

  3. Click the + button on the bottom right of the Library panel.

     

  4. Next, from the menu that appears, click the Global Variables item.

  5. A new “Global Variables” layer was added to your Library Panel.

  6. Selecting the “Global Variables” layer will show you its properties in the Library panel.

2. Using the Global Variables Source

  1. On the Global Variables properties, click the “+” button.

  2. A menu of available property types is listed.

    Let’s look at each property type:

    1. Bool: This represents a boolean property. It’s equivalent to an on/off switch.

    2. Color: A 4-element color property that lets you choose a color.

    3. Int: A simple numeric integer property, without a decimal point.

    4. Real: A numeric property that can include a decimal point and a fractional portion.

    5. Reference: A property that can hold a reference to an object or element (by dragging and dropping an elements thumbnail onto it)

    6. Text: A property that contains a text value.

    7. Vector 2/3/4: Properties that hold 2, 3, or 4 simultaneous values. For instance, a 3D transform position is a Vector3 since it is represented by 3 values.

  3. Let’s continue our example: click the “Color” item to create a Color property.

  4. Expand the newly added Color property.

As you can see, it's a simple property that lets us select a color. There’s also an alert called “on Update” that will fire whenever the property value changes. Every type of global property you create has this alert. The alert contains a data field called <value> that contains the current value of the property. Let’s give our new Color property a unique name.

  1. Hover over the “Color” group and click the rename icon.

  2. Enter the name “Text Color” and press enter.


Now, let’s apply this color to two different elements in the canvas to set them centrally.

Since this example requires the Expression Wire, please install the Candy Pack / Expression Wire from the plugin browser if you haven’t already done so.

Let’s add two different elements to the canvas.

  1. Click the “+” button on the Scene Layout panel.

  2. Select the 3D category.

  3. Add a 3D Text to the scene.

  4. A 3D Text element should be on your scene. Now duplicate the element by copying and pasting it or holding down the Alt key while clicking and dragging it.

  5. You should now have 2 3D Text elements in your scene.

Now let’s connect our Text Color global variable to each 3D Text’s color property.

  1. Select the first 3D Text item.

  2. On the Text Color Global Variable properties, left-click the red socket next to “on Update” and drag a wire and connect it to the Color property of the 3D Text.

  3. Select “Set With Expression” from the menu that appears.

The default Expression “<value>” means it will assign the global variable’s <value> field directly to the Color property. Now let’s repeat the prior 3 steps to connect the Text Color Global Variable to the other 3D Text Color property.

  1. Close the Wire properties by clicking anywhere outside the popup.

  2. Select the other 3D Text.

  3. Connect a wire from the Text Color Global Variable to the 3D Text Color property.

  4. Select the “Set With Expression” item from the menu that appears.

Now, when we change the value of our Text Color from the Global Variables property, it should update both text Colors at the same time.

3. Global Variables in Expressions

Global variables can also be used directly inside any Expression Wire’s Expression. By clicking the variable list button (small arrow button on the right of the Expression line), it will include any global variables present. We can then use these variables in expression formulas.

For instance, in the above example, we could use the global variable we created called “Percent Reduction” to reduce a target value by a percent whenever the alert fires. Here would be the Expression:

<target> * <Global Variables.Percent Reduction>
CODE

We could then easily adjust our percent through the Global Variables properties to affect any Expression that uses it.