ProjectManager/Object

Object Scenegraph Component
Parameters:
Name Type Description
opt object

Members

anchor :Array

Anchor
Type:
  • Array
Example
const object = Module.ProjectManager.getObject("123456789"); // key
object.anchor = [0.5,0.5,0];

hud :boolean

Hud
Type:
  • boolean
Example
const object = Module.ProjectManager.getObject("123456789"); // key
object.hud = true;

pivot :Array

Pivot
Type:
  • Array
Example
const object = Module.ProjectManager.getObject("123456789"); // key
object.pivot = [2,1,0];

position :Array

Position
Type:
  • Array
Example
const object = Module.ProjectManager.getObject("123456789"); // key
object.position = [2,4,1];

rotate :Array

Rotate
Type:
  • Array
Example
const object = Module.ProjectManager.getObject("123456789"); // key
object.rotate = [90,0,0];

scale :Array

Scale
Type:
  • Array
Example
const object = Module.ProjectManager.getObject("123456789"); // key
object.scale = [2,2,2];

visible :boolean

Visiblity
Type:
  • boolean
Example
const object = Module.ProjectManager.getObject("123456789"); // key
object.visible = true;

Methods

(inner) addChangeListener(callback)

Add change listener
Example
const handler = (type)=> {
 console.log(type)
}
const object = Module.ProjectManager.getObject("123456789"); // key
object.addChangeListener(handler);
Parameters:
Name Type Description
callback Object callback method

(inner) clearChangeHandlers()

Clear change listeners
Example
const object = Module.ProjectManager.getObject("123456789"); // key
object.clearChangeHandlers();

(inner) mesh/get(meshid, option) → {Object}

Get mesh value
Example
const object = Module.ProjectManager.getObject("123456789"); // key
const albedo_color = object.mesh.get("1", "albedo_ratio");
Parameters:
Name Type Description
meshid string mesh id
option MeshOption option
Returns:
String/Vec3/Number
Type
Object

(inner) mesh/set(meshid, option, value)

Set mesh value
Example
const object = Module.ProjectManager.getObject("123456789"); // key
object.mesh.set("1", "albedo_ratio", [255,0,0]);
Parameters:
Name Type Description
meshid string mesh id
option MeshOption option
value Object String/Vec3/Number

(inner) remove()

Remove object
Example
// remove object
const object = Module.ProjectManager.getObject("123456789"); // key
object.remove();

(inner) removeChangeListener(callback)

Remove change listener
Example
const handler = (type)=> {
 console.log(type)
}
const object = Module.ProjectManager.getObject("123456789"); // key
object.removeChangeListener(handler);
Parameters:
Name Type Description
callback Object callback method used in add

Type Definitions

MeshOption

Properties:
Name Type Description
use_pbr boolean toggle standard shader or pbr
normal_texture string 12345679 - key to asset
normal_ratio number 1
opacity_ratio Array [255,0,0]
opacity_texture string 12345679 - key to asset
opacity_texture_channel string options ('r', 'g', 'b', 'a') - default 'a'
PBR_SPECIFIC_OPTIONS_BELOW string =========================================================
albedo_ratio Array [255,0,0]
albedo_texture string 12345679 - key to asset
albedo_video string 12345679 - key of scene video element
metalness_ratio Array [255,0,0]
metalness_texture string 12345679 - key to asset
metalness_texture_channel string options ('r', 'g', 'b', 'a')
roughness_ratio Array [255,0,0]
roughness_texture string 12345679 - key to asset
roughness_texture_channel string options ('r', 'g', 'b', 'a')
ao_ratio Array [255,0,0]
ao_texture string 12345679 - key to asset
ao_texture_channel string options ('r', 'g', 'b', 'a')
emissive_ratio Array [255,0,0]
emissive_texture string 12345679 - key to asset
diffuse_ibl_ratio Array [255,0,0]
specular_pbr_ratio Array [255,0,0]
specular_ibl_ratio Array [255,0,0]
STANDARD_SHADER_SPECIFIC_OPTIONS string =========================================================
ambient_ratio Array [255,0,0]
ambient_texture string 12345679 - key to asset
ambient_video string 12345679 - key of scene video element
diffuse_ratio Array [255,0,0]
diffuse_texture string 12345679 - key to asset
specular_ratio Array [255,0,0]
specular_texture string 12345679 - key to asset
specular_power number 32