Scene Rules, Actions, and Functions are Snap code blocks which control the appearance of the 3D Scene, and allow you to make the scene dynamic.
Unlike most other rules of the rule cycle which are found in the Configurator, scene rules are found in the scene itself. Since one configurator can display one of many different scenes, based on the business rules at hand, it makes sense to have the scene visual components and logical components stored and managed together in the scene.
Scene logic is stored in rules: from the logic for hiding and showing the meshes of product options, to the logic of reacting to user keyboard clicks while the scene is in focus. When the scene is linked to a configurator, the configurator’s rule cycle extends into the scene, running the scene rules after every edit the user makes to the configurator.
These scene rules are managed in workspaces. Rules in these workspaces are either run automatically as part of the rule cycle, or in reaction to events.
If you want... | Then create a... | Example |
---|---|---|
To store a reusable block of code in your scene so it can be used many times. |
Global rule |
|
The scene to respond to a change made in the configurator. |
Scene rule |
|
To perform a task only once, just before the scene opens on-screen for the first time. |
Scene Loaded Event |
|
To react to a keypress the user makes while the scene is in focus. |
Keyboard Event |
|
To perform a task when the user enters xR Mode: this replaces the current environment with live video from the user’s camera. It allows them to see scene objects in virtual reality or augmented reality. |
XR Enter Event |
WebXR is a new standard. Device vendors like Apple can choose to not support WebXR in web browsers. Some scene features in XR may not be compatible with some devices. Learn more about Epicor CPQ system requirements. |
To perform a task when the user leaves xR Mode: this stops the live video from their camera, so they return to seeing the default environment. |
XR Exit Event |
|
To show a button next to the scene that’s always visible. |
Action |
|
To perform a calculation based on scene geometry calculated automatically by the scene itself, and expose that calculation to another system, like the related configurator. |
Function |
|
To show 2D content floating over the 3D scene. |
Hotspot |
|
To add some fields or other UI elements to your stand-alone scene. |
Page |
Show a slider control for reflectivity of a material, so your testers can run the scene, easily adjust the reflectivity of a material, and inform you which setting looks the best. The pages element appears in the design tree only if this scene is set to “standalone” in its properties. When associated with a configurator, the pages from that configurator UI is used. |
Understanding Scene Rules
Regardless of which of these scene rule workspaces you use for some logic, keep the following in mind:
-
Scenes read data from configurators, but don’t write data back.
When it comes to the friendly relationship between a configurator and a scene, the configurator is in charge. The configurator is both the source of data that describes the custom product (stored in fields) and the business logic which controls its configuration (stored in configurator rules). The scene, on the other hand, follows the configurator. The scene can get field data from a configurator, and scene rules can organize scene elements to give a visual representation of the configurator, but not write information back to a configurator.If you want to send information from a scene back to the configurator – such as the new position of a mesh which has been dragged or a key that was pressed – use a message rule, or call a scene function.