Layer System

From Virtual World Web Wiki
Jump to: navigation, search

The layer system is the basis for building 3D scenes. A layer is essentially an Object Type that can be connected to one or more scenes. It also describes the spacial bounds within which objects can be placed and who has permission to edit and configure the layer.

An Object Type is a storage container for a snippet (or sub-tree) of a 3D document (see: Document Object Model (DOM)). When an Instance of a Scene is created on an Instance Host a DOM document is initialized with a root node representing the instance itself, and as children of this root node, a scene node that represents the scene's configuration and a participants node that acts as a container for connected users' avatar documents. Layers attached on the scene then bring snippets of document into the scene as child nodes of the scene document.

Layer system DOM example.png

Layers are created in, and owned by, a single scene. Once created, they can be linked to other scenes or Worldspace. This is a very powerful feature as it allows you to share layout between scenes or to place shared objects or global scripts into a layer and then attach it at the world level so all scenes include the layer.

Layers inherit permissions from the scene they are created in (their owner). There are two layer-related permissions. When a user has the Layer Config permission on a scene they can create and delete layers on a scene as well as configure the spacial bounds of existing a layers, and set permissions on the layer, potentially granting edit rights to other users. When a user has the Layer Edit permission on a layer they can take the layer into edit mode and make changes to it. This works similar to "Scene Editing" in the past.

Layers also have versions. Only one version of a layer can be active at a time. You can edit any version of a layer and if you edit a version which is not currently active, other users won't see your changes until you make that version the active one.

Usage Examples

Hotel Rooms

Imagine you wanted to prop out 50 hotel rooms and you wanted them to be almost the same, with a few unique bits in each one. You could create a layer on the first hotel room, prop in all your shared objects like sinks, toilets, beds, showers, doors, etc. Then, link that layer to all of the other hotel rooms. Each scene also comes with a default layer when it's created, you could edit this layer in each scene to add your "special touches" to each hotel room.

Apartments With Base Objects

Imaging you wanted to have a user apartment that comes with some objects "built in" to the scene that they cannot edit. For example, you want to have scripted light switches that turn on built-in lighting, a working TV that streams content you provide, or working bathroom and kitchen fixtures that aren't meant to be removed or customized. This is easy with layers. Simply create your showroom property and put it up for sale in the property mall as you always would. Then create a layer on the showroom scene and prop in the shared objects. Finally, in the admin, set the "Action On Sale" for the layer to "Link". This way, when a new scene is created for a user on purchase, the layer will be linked to their new property, but they won't have edit rights on it, since it's owned by the showroom. A nice side-effect of this is that you can fix problems with this layer any time after the user purchases the property and they'll see the improvements immediately.

Convention Hall

Imagine you have a giant convention hall and you want to make it possible users to edit their own booths. Giving edit permission to the entire hall to all of the exhibitors would not be practical or safe. This is where bounded layers come in. Simply create your big empty convention hall scene, and prop out shared objects on the default layer (carpets, plants, lighting, ads, signs, etc.). Then, for each booth, create a new bounded layer. This can be done in Curiosity using visual tools to help you position and size the bounding box within which each booth owner can edit. Finally assign permissions to each layer so that the appropriate user can edit it. Later, the user can come to the convention hall, and they will only have Layer Edit permission on the one layer you assigned to them. They won't have Layer Config permission at all (since it's not their scene). When they edit their layer, they will only be able to place object inside the bounds you set for their booth.

Creating a layer

In the admin

Look up the scene in which you want to create the a new layer by either:

  • Worldspace Menu -> Worlds Menu -> Select a world -> click the Scenes tab of your world -> select your scene from the list
  • paste the VWW URL of your scene into the Global Search box at the top of the admin left nav / menu bar.

On the Layers tab of your scene you can see all the layers owned by this scene as well as any layers linked to this scene from somewhere else.

Simply press the Create Layer button and give the new layer a name. That's it! You have a new layer on your scene and if you're in Curiosity in the scene at the time, you should see the new runtime layer document appear in the room immediately. You can now click on the new layer and start an edit session on the layer

In Curiosity

Navigate to the scene in which you want to create a new layer. Then, on the Layers toolbar enter a name for the new layer in the text box next to "New Layer" and press the Create button. You will have the option to create a bounded layer as well.

In Curio

Navigate to the scene in which you want to create a new layer. Press the pencil icon on the main toolbar. If you have Layer Config permission the Layer Manager window will open. Press the Create A New Layer button. Enter the name of the new layer and press the Create button. Your new layer is ready to edit.

When creating the layer you can also specify that you want the layer to have bounds. Once created, you will see a bounding box appear in the scene. When your layer is selected in the Layer Manager window, the associated layer bounding box will be highlighted as well. You can use the layer bounds editing tools to move, scale and rotate the bounding box so that it marks off the acceptable editing area for any user editing the layer. When you're happy with your changes, press the Apply button on the Layer Manager window to save your changes.

Layer Modes

Layers have two modes:

Run-time mode: In any given instance of a scene, a given layer will appear exactly once in run-time mode, and it will appear in its currently active version. The document for the run-time mode of a layer is visible to all users in the room who are not editing some version of that layer. All scripts run normally in run-time layer documents but cannot communicate with other scripts or DOM nodes inside edit-mode documents.

Edit mode: In any given instance of a scene, for any given layer, there can be one edit mode document for each version of the layer. The edit mode documents are visible only to users currently engaged in an edit session on them. A given user can only be in one edit session at a time. Only scripts marked "DesignModeEnabled" will be allowed to run in an edit-mode. They also cannot communicate with other scripts or DOM nodes outside of their layer document.

A given user can only see one document representing a layer at any given time. Once you're editing a version of a layer, you see only the edit mode document for that version and cannot see any other edit mode or run-time mode documents for the same layer.

Editing a layer

In Curiosity

In Curio

Working with versions

Linking layers