Module/ProjectManager

Project Manager Module

Members

isDirty :boolean

Flag to force scene redraw
Type:
  • boolean
Example
Module.ProjectManager.isDirty = true; // force scene to redraw

objectControllers :Map.<string, Object>

Object Controllers
Type:
  • Map.<string, Object>
Example
const controller = Module.ProjectManager.objectControllers.get("123456789"); // key

path :string

Project FS path
Type:
  • string

project :Object

Project JSON object
Type:
  • Object

worldController :Object

World Controller
Type:
  • Object

Methods

(inner) addObject(item, data, parent)

Add Object
Examples
// add object
let item = {
     key: "uniquekey",
     title: "My object",
     type: "object", // refer to ObjectTypes at bottom
     id: "12345677"  // asset id to 3d object
}

let data = {
     "uniquekey": {
         position: [0,0,0],
         rotate: [0,0,0],
         scale: [1,1,1],
         visible: true,
         opacity: 1,
         pivot: [0,0,0],
         data: { // this is for meshes
             "0": {  // mesh id 0
                 "use_pbr": true,
                 "albedo_ratio": [255,255,0]
             }
         },
     }
}

Module.ProjectManager.addObject(item, data); // key
// add light
let item = {
     key: "uniquekey",
     title: "My light",
     type: "light", // refer to ObjectTypes at bottom
}

let data = {
     "uniquekey": {
         position: [0,0,0],
         color: [255,255,255],
         intensity: 1,
         visible: true,
     }
}

Module.ProjectManager.addObject(item, data); // key
Parameters:
Name Type Description
item Object
data string
parent Object ProjectManager scene object

(inner) getObject(key) → {Object}

Get Object
Example
const obj = Module.ProjectManager.getObject("1234567")
Parameters:
Name Type Description
key string object key
Returns:
Type
Object

(inner) loadScene(project, launch)

Load scene from JSON object
Example
Module.ProjectManager.loadScene({data: project}, true);
Parameters:
Name Type Description
project Object json formatted project
launch boolean initialise and run

(inner) loadURL(url)

Load an experience using a web URL
Example
Module.ProjectManager.loadURL("https://engine.metavrse.com/view?i=1&download=1")
Parameters:
Name Type Description
url string web url

(inner) removeObject(key)

Remove Object
Example
// remove object
Module.ProjectManager.removeObject("123456789"); // key
Parameters:
Name Type Description
key string

(inner) render(optsopt)

Render frame in scene
Example
Module.ProjectManager.render()
Parameters:
Name Type Attributes Description
opts Object <optional>
object override {key: {options}}

(inner) reset()

Reset 3D Environment
Project will be reset
Example
Module.ProjectManager.reset()

(inner) selectScene(scene, callbackopt)

Select a different scene
Examples
Module.ProjectManager.selectScene("Scene 2")
// with callback
Module.ProjectManager.selectScene("Scene 2", ()=>{
 // scene loaded
})
Parameters:
Name Type Attributes Description
scene string scene name
callback Object <optional>
optional callback function

Type Definitions

ObjectTypes

Properties:
Name Type Description
hud string hud
light string light
object string object
"object-hud" string object-hud
"object-group" string object-group
video string video
Main module

Members

isDirty :boolean

Flag to force scene redraw
Type:
  • boolean
Example
Module.ProjectManager.isDirty = true; // force scene to redraw

objectControllers :Map.<string, Object>

Object Controllers
Type:
  • Map.<string, Object>
Example
const controller = Module.ProjectManager.objectControllers.get("123456789"); // key

path :string

Project FS path
Type:
  • string

project :Object

Project JSON object
Type:
  • Object

worldController :Object

World Controller
Type:
  • Object

Methods

(inner) addObject(item, data, parent)

Add Object
Examples
// add object
let item = {
     key: "uniquekey",
     title: "My object",
     type: "object", // refer to ObjectTypes at bottom
     id: "12345677"  // asset id to 3d object
}

let data = {
     "uniquekey": {
         position: [0,0,0],
         rotate: [0,0,0],
         scale: [1,1,1],
         visible: true,
         opacity: 1,
         pivot: [0,0,0],
         data: { // this is for meshes
             "0": {  // mesh id 0
                 "use_pbr": true,
                 "albedo_ratio": [255,255,0]
             }
         },
     }
}

Module.ProjectManager.addObject(item, data); // key
// add light
let item = {
     key: "uniquekey",
     title: "My light",
     type: "light", // refer to ObjectTypes at bottom
}

let data = {
     "uniquekey": {
         position: [0,0,0],
         color: [255,255,255],
         intensity: 1,
         visible: true,
     }
}

Module.ProjectManager.addObject(item, data); // key
Parameters:
Name Type Description
item Object
data string
parent Object ProjectManager scene object

(inner) getObject(key) → {Object}

Get Object
Example
const obj = Module.ProjectManager.getObject("1234567")
Parameters:
Name Type Description
key string object key
Returns:
Type
Object

(inner) loadScene(project, launch)

Load scene from JSON object
Example
Module.ProjectManager.loadScene({data: project}, true);
Parameters:
Name Type Description
project Object json formatted project
launch boolean initialise and run

(inner) loadURL(url)

Load an experience using a web URL
Example
Module.ProjectManager.loadURL("https://engine.metavrse.com/view?i=1&download=1")
Parameters:
Name Type Description
url string web url

(inner) removeObject(key)

Remove Object
Example
// remove object
Module.ProjectManager.removeObject("123456789"); // key
Parameters:
Name Type Description
key string

(inner) render(optsopt)

Render frame in scene
Example
Module.ProjectManager.render()
Parameters:
Name Type Attributes Description
opts Object <optional>
object override {key: {options}}

(inner) reset()

Reset 3D Environment
Project will be reset
Example
Module.ProjectManager.reset()

(inner) selectScene(scene, callbackopt)

Select a different scene
Examples
Module.ProjectManager.selectScene("Scene 2")
// with callback
Module.ProjectManager.selectScene("Scene 2", ()=>{
 // scene loaded
})
Parameters:
Name Type Attributes Description
scene string scene name
callback Object <optional>
optional callback function

Type Definitions

ObjectTypes

Properties:
Name Type Description
hud string hud
light string light
object string object
"object-hud" string object-hud
"object-group" string object-group
video string video