engineAPI

SDK3DVerse. engineAPI

Handles entities

Namespaces

cameraAPI

Methods

attachComponentWithDependencies(entity, newComponentClassName)

Attach a component with dependencies

Parameters:
Name Type Description
entity SDK3DVerse_Entity
newComponentClassName string

canEdit() → {boolean}

Determine if the scene is editable. Will always be false if not connected to the editor.

Returns:

return true if the scene is editable

Type
boolean

(async) castScreenSpaceRay(x, y, highlight, keepOldSelection, seekExternalLinker, planeNormalopt, planeDistanceFromOriginopt) → {object}

Perform a picking request on specific coordinates.

If the picking is performed on a viewport with an orthographic projection while picking does not encounter any entity, the returned world space position are unprojected from the orthographic projection matrix.

Parameters:
Name Type Attributes Description
x number

X coordinate in screen's space

y number

Y coordinate in screen's space

highlight bool

Set to true to highlight entity

keepOldSelection bool

Set to true to keep previously selected entities

seekExternalLinker bool

Set to false to avoid selecting linkers before the picked entity

planeNormal Array.<number> <optional>

If picking does not encounter any entity, an intersection is computed on a defined plane represented in Hessian normal form by a unit length normal vector and a distance. This parameter represent the normal as an array of Number [x,y,z]. Disabled by default. Ignored on a viewport with an orthographic projection.

planeDistanceFromOrigin number <optional>

The signed distance from the origin to the plane. Default is 0. Ignored on a viewport with an orthographic projection.

Returns:

{entity, pickedPosition, pickedNormal}

Type
object

commitChanges()

Commit changes to the editor, allowing changes to be saved and broadcasted to other clients.

commitSettings(settings)

Commit setting changes, allowing changes to be saved and broadcasted to other clients. Setting properties are defined here.

Parameters:
Name Type Description
settings object

(async) createEntities(parentEntity, entityTemplates, ordinal) → {Array.<SDK3DVerse_Entity>}

Create multiple entities with the same parent.

Parameters:
Name Type Description
parentEntity SDK3DVerse_Entity

The parent entity used if the template is not referencing a parent through the lineage component. Set to null for the root.

entityTemplates Array.<object>

The entity templates to create.

ordinal Number

Default to 0, used to sort the entities in the scene graph. Will be incremented for each entity not referencing an ordinal value.

Returns:

The created entities

Type
Array.<SDK3DVerse_Entity>

(async) createEntity(parentEntity, entityTemplate, ordinal) → {SDK3DVerse_Entity}

Create an entity

Parameters:
Name Type Description
parentEntity SDK3DVerse_Entity

The parent entity, set to null for the root.

entityTemplate object
ordinal Number

Default to 0, used to sort the entities in the scene graph.

Returns:

The created entity

Type
SDK3DVerse_Entity

(async) deleteEntities(entities)

Delete entities

Parameters:
Name Type Description
entities Array.<SDK3DVerse_Entity>

detachComponentWithReferences(entity, componentNameToDetach)

Detach a component and remove their dependents components. This method will fail if the entity doesn't own the specified component.

Parameters:
Name Type Description
entity SDK3DVerse_Entity
componentNameToDetach string

discardOverriddenComponents(entities)

Discard all overridden components

Parameters:
Name Type Description
entities Array.<SDK3DVerse_Entity>

discardOverriderComponent(entities, componentClassName)

Discard an overrider from component

Parameters:
Name Type Description
entities Array.<SDK3DVerse_Entity>
componentClassName string

(async) exportEntityToScene(entity, sceneName, workspaceUUID, replaceByLinker) → {Object}

Export the entity and its branch to a new scene.

Parameters:
Name Type Description
entity SDK3DVerse_Entity

Entity to export

sceneName string

Scene name to create

workspaceUUID string

Workspace unique identifier which will contains the created scene

replaceByLinker bool

Replace the entity in parameter by a linker referencing the created scene In that case the entity should not be external.

Returns:

An object define as follow { sceneUUID : string, linker : SDK3DVerse_Entity }

  • sceneUUID : The created scene unique identifier
  • linker : The created linker if replaceByLinker parameter is true
Type
Object

(async) filterEntities(filterObject) → {Array.<SDK3DVerse_Entity>}

Retrieve list of entities having the specified component class

Parameters:
Name Type Description
filterObject object

mandatoryComponents : ['component_class'], forbiddenComponents : ['component_class']

Returns:

An array of filtered entities

Type
Array.<SDK3DVerse_Entity>

(async) findEntitiesByEUID(euid) → {Array.<SDK3DVerse_Entity>}

Find entities by their euid

Parameters:
Name Type Description
euid string

Entity unique identifier

Returns:

entities

Type
Array.<SDK3DVerse_Entity>

(async) findEntitiesByNames(…entityNames) → {Array.<SDK3DVerse_Entity>}

Find entities by their name

Parameters:
Name Type Attributes Description
entityNames string <repeatable>

Entity names

Returns:

entities

Type
Array.<SDK3DVerse_Entity>

fireEvent(eventMapUUID, eventName, entities, dataObject)

Trigger an event in the simulation process.

Parameters:
Name Type Description
eventMapUUID string

The eventMap asset UUID

eventName string

The event name from the eventMap

entities array.<SDK3DVerse_Entity>

Optional, trigger event only on specified entities

dataObject Object

Optional, trigger event input data

getComponentClassNames()

Get existing component class names

Returns:

list of component class names

getComponentDefaultValue(componentClassName) → {object}

Get component default value

Parameters:
Name Type Description
componentClassName string
Returns:

default value for component

Type
object

getComponentDependencies(componentClassName) → {Array.<string>}

Resolve deep dependencies of a component.

Parameters:
Name Type Description
componentClassName string
Returns:

List of component class name

Type
Array.<string>

getComponentDescription(componentClassName)

Get components description

Parameters:
Name Type Description
componentClassName string
Returns:

description of component class

getEntity(entityRTID) → {SDK3DVerse_Entity}

Retrieve a given entity

Parameters:
Name Type Description
entityRTID string

Entity unique identifier

Returns:

entity

Type
SDK3DVerse_Entity

(async) getEntityChildren(entity) → {Array.<SDK3DVerse_Entity>}

Retrieve children of an entity

Parameters:
Name Type Description
entity SDK3DVerse_Entity

Entity

Returns:

children

Type
Array.<SDK3DVerse_Entity>

(async) getRootEntities() → {SDK3DVerse_Entity}

Retrieve root entities

Returns:

entities

Type
SDK3DVerse_Entity

getSceneSetting(settingClassName)

Get scene settings. Setting properties are defined here.

Parameters:
Name Type Description
settingClassName string

getSceneStats() → {Object}

Retrieve scene statistics

Returns:

statistics

Type
Object

getSelectedEntities() → {Array.<SDK3DVerse_Entity>}

Return all currently selected entities

Returns:

selected entities

Type
Array.<SDK3DVerse_Entity>

getSettingDefaultValue(settingClassName) → {object}

Get setting default values. This values are frozen and cannot be changed.

Parameters:
Name Type Description
settingClassName string
Returns:

default value for setting

Type
object

(async) linkScene(parentEntity, entityName, sceneUUID) → {SDK3DVerse_Entity}

Create an entity that will link the specified scene.

Parameters:
Name Type Description
parentEntity SDK3DVerse_Entity

The parent entity, set to null for the root.

entityName string

Entity name

sceneUUID string

The unique scene identifier.

Returns:

The created entity

Type
SDK3DVerse_Entity

(async) markAsDeleted(entities)

Mark an external entity as deleted

Parameters:
Name Type Description
entities Array.<SDK3DVerse_Entity>

(async) markComponentAsDetached(entities, componentClassName)

Detach a component of an external entity.

Parameters:
Name Type Description
entities Array.<SDK3DVerse_Entity>
componentClassName string

(async) overrideComponent(entities, componentName)

Override a component

Parameters:
Name Type Description
entities Array.<SDK3DVerse_Entity>
componentName string

propagateChanges()

Propagate changes to the renderer, allowing changes to be updated at runtime.

propagateSettings(settings)

Propagate setting changes, allowing changes to be updated at runtime. Setting properties are defined here.

Parameters:
Name Type Description
settings object

redo()

Redo last edition action

registerToEvent(eventMapUUID, eventName, listener)

Adds the listener function to the event named eventName of the specified eventMap eventMapUUID emitted by a script instance.

Parameters:
Name Type Description
eventMapUUID string

The eventMap asset UUID

eventName string

The name of the event.

listener function

The callback function

(async) reparentEntities(entityRTID, newParentRTID, keepGlobalTransform)

Reparent multiple entities to a given parent

Parameters:
Name Type Description
entityRTID Array.<string>

Array of entity unique identifier

newParentRTID string

Unique identifier of the new parent

keepGlobalTransform boolean

Restore global transform after reparenting, this will commit changes

(async) reparentEntity(entityRTID, newParentRTID, keepGlobalTransform)

Change parent of a given entity (scene graph)

Parameters:
Name Type Description
entityRTID string

Entity unique identifier

newParentRTID string

Unique identifier of the new parent

keepGlobalTransform boolean

Restore global transform after reparenting, this will commit changes

(async) restoreComponent(entities, componentClassName)

Restore a component that has been marked as detached of an external entity.

Parameters:
Name Type Description
entities Array.<SDK3DVerse_Entity>
componentClassName string

restoreEntities(entities)

Restore external entities mark as deleted

Parameters:
Name Type Description
entities Array.<SDK3DVerse_Entity>

(async) searchEntities(filterObject) → {object}

Retrieve list of entities matching the filter object conditions

Parameters:
Name Type Description
filterObject object

searchString : 'entity name or uuid', mandatoryComponents : ['component_class'], forbiddenComponents : ['component_class']

Returns:
  • { rtids : [], count : 0 }
Type
object

selectEntities(entities, keepOldSelection, triggeredBy)

Select multiple entities

Parameters:
Name Type Description
entities Array.<SDK3DVerse_Entity>

List of entities to select

keepOldSelection boolean

Set to true if currently selected items should still be selected

triggeredBy

Name of the module requesting the selection

selectEntity(entity, keepOldSelection, triggeredBy)

Select a single entity

Parameters:
Name Type Description
entity SDK3DVerse_Entity

Entity

keepOldSelection boolean

Set to true if currently selected items should still be selected

triggeredBy

Name of the module requesting the selection

(async) setEntityVisibility(entity, isVisible)

Set the visbility of an entity

Parameters:
Name Type Description
entity SDK3DVerse_Entity

Entity

isVisible boolean

Set to false if entity should be hidden, true otherwise.

simplifyHierarchy(targetEntity)

Simplify hierarchy between a child and its ancestor (scene graph)

Parameters:
Name Type Description
targetEntity SDK3DVerse_Entity

Entity

(async) spawnEntity(parentEntity, entityTemplate) → {SDK3DVerse_Entity}

Spawn entity

Parameters:
Name Type Description
parentEntity SDK3DVerse_Entity

The parent entity, set to null for the root.

entityTemplate object
Returns:

The spawned entity

Type
SDK3DVerse_Entity

undo()

Undo last edition action

unregisterFromEvent(eventMapUUID, eventName, listener)

Removes the specified listener function to the event named eventName of the specified eventMap eventMapUUID emitted by a script instance.

Parameters:
Name Type Description
eventMapUUID string

The eventMap asset UUID

eventName string

The name of the event.

listener function

The callback function

unselectAllEntities(triggeredBy)

Unselect all entities

Parameters:
Name Type Description
triggeredBy string

Name of the module requesting the selection