Overlays API

From FHU Wiki
Jump to: navigation, search

Properties[edit]

Overlays.keyboardFocusOverlay string This property allows you to set the ID of the overlay that the keyboard actively types into. It sets the keyboard focus to a specific overlay.


Methods[edit]

Overlays.addOverlay(QString,QVariant)
Overlays.cloneOverlay(OverlayID)
Overlays.deleteOverlay(OverlayID)
Overlays.editOverlay(OverlayID,QVariant)
Overlays.editOverlays(QVariant)
Overlays.findOverlays(glm::vec3,float)
Overlays.findRayIntersection(PickRay)
Overlays.findRayIntersection(PickRay,bool)
Overlays.findRayIntersection(PickRay,bool,QScriptValue)
Overlays.findRayIntersection(PickRay,bool,QScriptValue,QScriptValue)
Overlays.findRayIntersection(PickRay,bool,QScriptValue,QScriptValue,bool)
Overlays.findRayIntersection(PickRay,bool,QScriptValue,QScriptValue,bool,bool)
Overlays.getKeyboardFocusOverlay()
Overlays.getOverlayAtPoint(glm::vec2)
Overlays.getOverlayObject(OverlayID)
Overlays.getOverlayType(OverlayID)
Overlays.getPanelProperty(OverlayID,QString)
Overlays.getParentPanel(OverlayID)
Overlays.getProperty(OverlayID,QString)
Overlays.height()
Overlays.isAddedOverlay(OverlayID)
Overlays.isAddedPanel(OverlayID)
Overlays.isLoaded(OverlayID)
Overlays.setKeyboardFocusOverlay(OverlayID)
Overlays.setParentPanel(OverlayID,OverlayID)
Overlays.textSize(OverlayID,QString)
Overlays.width()

Events[edit]

Overlays.destroyed()
Overlays.destroyed(QObject*)
Overlays.hoverEnterOverlay(OverlayID,PointerEvent)
Overlays.hoverLeaveOverlay(OverlayID,PointerEvent)
Overlays.hoverOverOverlay(OverlayID,PointerEvent)
Overlays.mouseDoublePressOffOverlay()
Overlays.mouseDoublePressOnOverlay(OverlayID,PointerEvent)
Overlays.mouseMoveOnOverlay(OverlayID,PointerEvent)
Overlays.mousePressOffOverlay()
Overlays.mousePressOnOverlay(OverlayID,PointerEvent)
Overlays.mouseReleaseOnOverlay(OverlayID,PointerEvent)
Overlays.overlayDeleted(OverlayID)
Overlays.panelDeleted(OverlayID)


Overlays.addOverlay()[edit]

addOverlay creates an overlay of a specific type (depending on choice) to your interface. These overlays are for your own view and cannot be seen by anyone else. They can include 2D overlays which are "glued" to your screen or a 3D overlay rendered in world.

Functions

addOverlay(type,properties)

Arguments

type:string, the specific type of overlay that you wish to create (see overlay typespage for more information on types).

properties:json, a json list of properties for the overlay. Example: size of text, color etc.

Examples

var tmpOverlay = Overlays.addOverlay("cube", {
  position: Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, {
    x: 0,
    y: 0,
    z: -1
  })),
  isSolid: true,
  rotation: MyAvatar.orientation,
  color: {red: 255, green: 0, blue: 0},
  dimensions: {x: 0.5, y: 0.5, z: 0.5},
  alpha: 1
});

position is the position of the overlay in the world. In the example shown above, it's positioning the overlay one metre in front of the avatar.

isSolid defines the appearance of the overlay when rendered. If set to true, the overlay is displayed as a solid object. If set to false, a wireframe representation is displayed.

    If you use the reverse function isWire and set it to false, this also renders the overlay as a solid object. If set to true, the wireframe representation from isSolid is shown.

rotation is the rotation of the overlay when displayed in world. In the example above, the overlay is being set to the current avatar's rotation.

color is a json list of red, green and blue values.

dimensions is a json list of X, Y and Z size in meters.

alpha is transparency on a scale of 0 to 1. In this example, "1" is opaque; "0" would be completely transparent.

Returns

overlayID:string, the uuid of the overlay that has just been created.

Overlays.deleteOverlay()[edit]

This is a function used to delete already created overlays.

Functions

deleteOverlay(overlayID)

Arguments

overlayID:string, the uuid of the overlay to be deleted.

Example

Overlays.deleteOverlay("{cca2ac4c-2096-4ed4-bd6e-88b6aed9a94a}"); // If {cca2ac4c-2096-4ed4-bd6e-88b6aed9a94a} is a valid overlayID

// If the above example for Overlays.addOverlay has been ran in the console you can do
Overlays.deleteOverlay(tmpOverlay);
// To delete the overlay

Overlays.editOverlay()[edit]

Functions

editOverlay(overlayID,properties)

Arguments

overlayID:string, the uuid of the overlay to be edited.

properties:json, a json list of properties to be changed or added to the overlay.

Example

Overlays.editOverlay("{cca2ac4c-2096-4ed4-bd6e-88b6aed9a94a}", {color: {red: 0, green: 255, blue: 0}}); // If {cca2ac4c-2096-4ed4-bd6e-88b6aed9a94a} is a valid overlayID

// If the above example for Overlays.addOverlay has been ran in the console you can do
Overlays.editOverlay(tmpOverlay, {color: {red: 0, green: 255, blue: 0}});
// To edit the overlay's color

Returns

This function returns "true" if successful.