Object API

editor.enableEditorOnObjects(enable)
  • enable - if true, it will enable the edit mode on the objects

This function will enable editing mode on all objects. Usually used internally by the toggle editor mode.

editor.spawnObject(name, className)
  • name - the name of the object
  • className - the C++ class name of the spawned object Returns object pointer

Spawn a new object by class name.

editor.deleteObject(objectId)
  • objectId - the object id Returns true if object deleted

Delete object by its id.

editor.validateObjectName(name, newName)
  • name - current object name
  • newName - the new name Returns true if the object names ivalid

Validate object name.

editor.setFieldValue(objectId, fieldName, fieldValue)
  • objectId - the object id
  • fieldName - the field name
  • fieldValue - the field value

Set an object’s field value. For dynamic fields, use editor.setDynamicFieldValue

editor.setDynamicFieldValue(objectId, fieldName, fieldValue)
  • objectId - the object id
  • fieldName - the field name
  • fieldValue - the field value, if this is empty string, it will delete the dynamic field!

Set an object’s dynamic field value.

editor.getFieldValue(objectId, fieldName)
  • objectId - the object’s id
  • fieldName - the field name Returns the field’s value

editor.getFieldInfo(objectId, fieldName)
  • objectId - the object’s id
  • fieldName - the field name Return the field info table

editor.getFields(objectIdd)
  • objectId - the object’s id Returns the fields of the object

editor.getDynamicFields(ojebIct)
  • objectId - the object’s id Return the dynamic fields of the object

editor.deleteSelectedObjects()

Delete the current selected objects.

editor.clearObjectSelection()

Clears the current object selection.

editor.selectObjects(idArray, selectMode)
  • idArray - the array of object IDs
  • selectMode - the select mode (if nil/not present, the mode is editor.SelectMode_New):
    • editor.SelectMode_New - the old selection is discarded
    • editor.SelectMode_Add - add (uniquely) the object ids to the current selection
    • editor.SelectMode_Remove - remove the ids from the current selection (if present)
    • editor.SelectMode_Toggle - if the ids are present, remove them, if they’re absent, add them

Select object ids.

editor.selectObjectsByRectangle(rect, selectMode)
  • rect - the 2D screen viewport rectangle object
  • selectMode - the selection mode, see editor.selectObjects

Select objects by a rectangle in the current camera viewport, screen space.

editor.selectObjectByMouse(selectMode)
  • selectMode - the selection mode, see editor.selectObjects

Select objects using the current mouse position in the current camera viewport.

editor.selectObjectsByNameMask(nameMask, selectMode)
  • nameMask - a part or full name of the objects
  • selectMode - the selection mode, see editor.selectObjects

Select object by name mask.

editor.selectObjectsByType(className, selectMode)
  • className - the class name of the objects to be selected
  • selectMode - the selection mode, see editor.selectObjects

Select objects by class name.

editor.selectObjectById(id, selectMode)
  • id - the object id
  • selectMode - the selection mode, see editor.selectObjects

Select object by id, using selectMode.

editor.selectAllObjects()

Select all the objects in the level, care must be taken this might slow things down for various operations

editor.lockObjectSelection()

Lock the object selection, making objects non-movable.

editor.unlockObjectSelection()

Unlock the object selection.

editor.hideObjectSelection()

Hide the selected objects.

editor.showObjectSelection()

Show the selected objects.

editor.alignObjectSelectionByBounds(boundsAxis)
  • boundsAxis - the axis for the bounds, values allowed:
    • editor.AxisX - the X axis
    • editor.AxisY - the Y axis
    • editor.AxisZ - the Z axis

Align objects by their bounding box, on the specific axis.

editor.alignObjectSelectionByCenter(axis)
  • axis - the center axis, values allowed:
    • editor.AxisX - the X axis
    • editor.AxisY - the Y axis
    • editor.AxisZ - the Z axis

Align objects by their common averaged center, on the specific axis.

editor.resetObjectSelectionTransform()

Reset the object selection transform, sets rotation to zero and scale to 1,1,1.

editor.resetObjectSelectionRotation()

Reset the object selection’s rotation to zero.

editor.resetObjectSelectionScale()

Reset the object selection’s scale to 1,1,1.

editor.translateObjectSelection(deltaTranslate)
  • deltaTranslate - the Point3F delta value to move the selection

Translate the object selection by the delta value.

editor.rotateObjectSelection(deltaRotation, centerPoint)
  • deltaRotation - the delta quaternion object
  • centerPoint - Point3F, if not nil, will be used to scale around it, relative to it

Rotate the selected objects by the delta quaternion.

editor.scaleObjectSelection(deltaScale, centerPoint)
  • deltaScale - the Point3F delta scale value
  • centerPoint - Point3F, if not nil, will be used to scale around it, relative to it

Scale the selected objects by the delta scale.

editor.dropObjectSelection(location)
  • location - the location of the drop point, allowed values:
    • editor.DropLocation_Origin - at world 0,0,0
    • editor.DropLocation_Camera - at current camera position, no rotation
    • editor.DropLocation_CameraWithRotation - at camera position, with rotation
    • editor.DropLocation_BelowCamera - below the camera position
    • editor.DropLocation_ScreenCenter - at the center of the screen, projected from current camera into world
    • editor.DropLocation_Centroid - at the centroid of the selection
    • editor.DropLocation_ToTerrain - onto the terrain
    • editor.DropLocation_BelowSelection - below the current selection

Drop the selected objects at the specified drop point.

editor.createPrefabFromObjectSelection(newPrefabFilename)
  • newPrefabFilename - prefab destination filename

Create a new prefab from the current selection.

editor.explodeSelectedPrefab()

Explode the current selected object(s) from prefab to objects.

Last modified: 7 December 2021, at 14:30

Any further questions?

Join our discord