Scenic.Primitive.SceneRef (Scenic v0.10.3) View Source

A reference to another graph or component.

When rendering a graph, the SceneRef primmitive causes the render to stop what it is doing, render another graph, then continue on where it left off.

The SceneRef primitive is usually added for you when you use a Component via the Primitive.Components helpers.

However, it can also be useful directly if you want to declare multiple graphs in a single scene and reference them from each other. This is done when you want to limit the data scanned and sent when just a portion of your graph is changing.

Be careful not to create circular references!

Data

The data for a SceneRef can take one of several forms.

  • scene_name - an atom naming a scene you are managing yourself
  • {scene_name, sub_id} - an atom naming a scene you are managing yourself and a sub-id
  • pid - the pid of a running scene (rarely used)
  • {pid, sub_id} - the pid of a running scene and a sub_id (rarely used)
  • {:graph, scene, sub_id} - a full graph key - must already be in ViewPort.Tables
  • {{module, data}, sub_id} - init data for a dynamic scene (very common)

Styles

The SceneRef is special in that it accepts all styles and transforms, even if they are non-standard. These are then inherited by any dynamic scenes that get created.

Usage

You should add/modify primitives via the helper functions in Scenic.Primitives

Link to this section Summary

Functions

Returns a list of styles recognized by this primitive.

Link to this section Functions

Specs

valid_styles() :: [:all, ...]

Returns a list of styles recognized by this primitive.