Sculpt

Sculpt operations are used to create and change models at runtime. Each model is a volumetric surface made of basic primitives called edits.Changing models at runtime should be done carefully, these operations are heavy on the gpu and might cause slowdowns when used frequently in a game.

clearEdits(model)

Clear all edits inside a model

Arguments
model: Entity, a pointer to a model in the world.

addEdit(model)

Create and add a new edit under a model.

Arguments
model: Entity, a pointer to a model in the world.

Return
Edit , a pointer to an Edit

addExistingEdit(model, edit, append)

Duplicate and add an existing edit from a model under another

Arguments
model: Entity, a pointer to a model in the world.
edit: Edit, a pointer to an edit.
append: bool, specify if you want the new edit to be appended at the end of the list.

Return
Edit , a pointer to an Edit.

getEdit(model, index)

Get an edit from a model at a given index. Index starts at 1.

Arguments
model: Entity, a pointer to a model in the world.
index: int, an index to an edit in the list of edits contained in a model

Return
Edit , a pointer to an Edit

getEditCount(model)

Get how many edits are contained in a model.

Arguments
model: Entity, a pointer to a model in the world.

Return
int

removeEdit(edit)

Remove edit from the model and destroy it.

Arguments
edit: Edit, a pointer to an edit.

getEditStackIndex(edit)

Get the index of an edit from the list of edits inside the parent model.

Arguments
edit: Edit, a pointer to an edit.

Return
int

updateModel(model)

Once you're done manipulating edits in a model, call this function to re-evaluate the surface and see the results.

Arguments
model: Entity, a pointer to a model in the world.

findUpdatingModels()

Queries a list of models that need to be updated or have begun updating.

Return
Table , a list of models.

getEditTransform(edit)

Get the local transform of an edit. This is a copy of the transform held by the edit, changing this will have no direct effect on the edit itself.

Arguments
edit: Edit, a pointer to an edit.

Return
Transform

setEditTransform(edit, transform)

Set the local transform of an edit.

Arguments
edit: Edit, a pointer to an edit.
transform: Transform

getEditTransformGlobal(edit)

Get the global transform of an edit. This is a copy of the transform held by the edit, changing this will have no direct effect on the edit itself (good if you care about performance).

Arguments
edit: Edit, a pointer to an edit.

Return
Transform

setEditTransformGlobal(edit, transform)

Set the global transform or an edit.

Arguments
edit: Edit, a pointer to an edit.
transform: Transform

setEditPosition(edit, position)

Set the position of an edit in its local space (move this edit relative to its parent model).

Arguments
edit: Edit, a pointer to an edit.
position: vec3

getEditPosition(edit)

Get the position of an edit in its local space.

Arguments
edit: Edit, a pointer to an edit.

Return
vec3

setEditPositionGlobal(edit, position)

Set the position of an edit in global space (disregards the parent model and move this edit anywhere in the world).

Arguments
edit: Edit, a pointer to an edit.
position: vec3

getEditPositionGlobal(edit)

Get the position of an edit in global space.

Arguments
edit: Edit, a pointer to an edit.

Return
vec3

setEditOrientation(edit, orientation)

Set the orientation of an edit in its local space (rotate this edit relative to its parent model).

Arguments
edit: Edit, a pointer to an edit.
orientation: quat

getEditOrientation(edit)

Get the orientation of an edit in local space.

Arguments
edit: Edit, a pointer to an edit.

Return
quat

setEditOrientationGlobal(edit, orientation)

Set the orientation of an edit in global space.

Arguments
edit: Edit, a pointer to an edit.
orientation: quat

getEditOrientationGlobal(edit)

Get the orientation of an edit in global space.

Arguments
edit: Edit, a pointer to an edit.

Return
quat

setEditDimensions(edit, dim)

Set the dimensions of an edit using a vec3 to define width, height and depth.

Arguments
edit: Edit, a pointer to an edit.
dim: vec3

getEditDimensions(edit)

Get the dimensions of an edit relative to the scale of its parent model.

Arguments
edit: Edit, a pointer to an edit.

Return
vec3

setEditColor(edit, color)

Set the color of an edit.

Arguments
edit: Edit, a pointer to an edit.
color: vec4

getEditColor(edit)

Get the color of an edit.

Arguments
edit: Edit, a pointer to an edit.

Return
vec4

setEditBlend(edit, value)

Set the blend factor of an edit. Note that edits will only blend with all the other edits that have a lower index in the evalution stack.

Arguments
edit: Edit, a pointer to an edit.
value: number

getEditBlend(edit)

Get the blend factor of an edit.

Arguments
edit: Edit, a pointer to an edit.

Return
float

setEditBlendMode(edit, blendMode)

Set if an edit will blend smoothly or with chamfer

Arguments
edit: Edit, a pointer to an edit.
blendMode:

getEditBlendMode(edit)

Get whether an edit will blend smoothly or with chamfer

Arguments
edit: Edit, a pointer to an edit.

Return
int

setEditOperation(edit, editOperation)

Set if an edit will act as subtractive, addtivive, paint or crop.

Arguments
edit: Edit, a pointer to an edit.
editOperation: int, available values are EDIT_OP_SUBTRACT, EDIT_OP_ADD, EDIT_OP_PAINT, EDIT_OP_CROP, EDIT_OP_ADDCH, EDIT_OP_SUBCH,

getEditOperation(edit)

Get whether an edit is acting as subtractive, additive or paint.

Arguments
edit: Edit, a pointer to an edit.

Return
int

setEditMirror(edit, state)

Set whether an edit is mirrored on the YZ plane or not.

Arguments
edit: Edit, a pointer to an edit.
state: boolean

getEditMirror(edit)

Get whether an edit is mirrored on the YZ plane or not.

Arguments
edit: Edit, a pointer to an edit.

Return
bool

setEditShapeType(edit, shapeType)

Set if an edit should be a box, sphere, curve, n-gon or cone.

Arguments
edit: Edit, a pointer to an edit.
shapeType: int, available values are EDIT_SHAPE_BOX, EDIT_SHAPE_SPHERE, EDIT_SHAPE_CURVE, EDIT_SHAPE_NGON, EDIT_SHAPE_CONE,

getEditShapeType(edit)

Get the shape type of an edit.

Arguments
edit: Edit, a pointer to an edit.

Return
int

setEditShapeParameter(edit, editParamId, value)

Set an edit shape parameter. Each edit shape type has a different set of parameters, you can check the behaviour from the editor.

Arguments
edit: Edit, a pointer to an edit.
editParamId: int, available values are EDIT_BOX_ROUNDX, EDIT_BOX_ROUNDY, EDIT_BOX_THICKNESS, EDIT_CURVE_SLIDE, EDIT_CURVE_WEIGHT, EDIT_CURVE_THICKNESS, EDIT_NGON_ROUND, EDIT_CURVE_SIDES, EDIT_CONE_ROUNDX, EDIT_CONE_ROUNDY, EDIT_CONE_POINTY,
value: number

getEditShapeParameter(edit, editParamId)

Get an edit shape parameter. Each edit shape type has a different set of parameters, you can check the behaviour from the editor.

Arguments
edit: Edit, a pointer to an edit.
editParamId: int, available values are EDIT_BOX_ROUNDX, EDIT_BOX_ROUNDY, EDIT_BOX_THICKNESS, EDIT_CURVE_SLIDE, EDIT_CURVE_WEIGHT, EDIT_CURVE_THICKNESS, EDIT_NGON_ROUND, EDIT_CURVE_SIDES, EDIT_CONE_ROUNDX, EDIT_CONE_ROUNDY, EDIT_CONE_POINTY,

Return
float

setEditMode(edit, editMode)

Set an edit to be a single shape, a repeated shape or a spline.

Arguments
edit: Edit, a pointer to an edit.
editMode: int, available values are EDIT_MODE_SHAPE, EDIT_MODE_REPEAT, EDIT_MODE_SPLINE,

getEditMode(edit)

Get whether an edit is a single shape, a repeated shape or a spline.

Arguments
edit: Edit, a pointer to an edit.

Return
int

setRepeatOffset(edit, offsetTransform)

Set an offset transform for a repeat edit. This transform determines how the edits are repeated.

Arguments
edit: Edit, a pointer to an edit.
offsetTransform:

getRepeatOffset(edit)

Get an offset transform for a repeat edit.

Arguments
edit: Edit, a pointer to an edit.

Return
Transform

setRepeatCount(edit, count)

Set how many times an edit is repeated when is set to repeat mode.

Arguments
edit: Edit, a pointer to an edit.
count: int

getRepeatCount(edit)

Get how many times an edit is repeated when is set to repeat mode.

Arguments
edit: Edit, a pointer to an edit.

Return
int

addSplinePoint(edit, pointId)

Create and add a control point to an edit spline. Use setSplinePointTransform to edit the transform created.

Arguments
edit: Edit, a pointer to an edit.
pointId: int, specify an existing pointId in the spline after which the new point will be inserted.

removeSplinePoint(edit, pointId)

Remove and destroy a control point in an edit spline.

Arguments
edit: Edit, a pointer to an edit.
pointId: int

getSplinePointCount(edit)

Get how many control points there are in an edit spline.

Arguments
edit: Edit, a pointer to an edit.

Return
int

setSplinePointTransform(edit, pointId, transform)

Set a transform to move, rotate and scale an edit spline control point.

Arguments
edit: Edit, a pointer to an edit.
pointId: int
transform: Transform

getSplinePointTransform(edit, pointId)

Get an edit spline control point.

Arguments
edit: Edit, a pointer to an edit.
pointId: int

Return
Transform

setSplinePointShapeParameter(edit, pointId, editParamId, value)

Set a shape parameter of an edit spline control point.

Arguments
edit: Edit, a pointer to an edit.
pointId: int
editParamId: int, available values are EDIT_BOX_ROUNDX, EDIT_BOX_ROUNDY, EDIT_BOX_THICKNESS, EDIT_CURVE_SLIDE, EDIT_CURVE_WEIGHT, EDIT_CURVE_THICKNESS, EDIT_NGON_ROUND, EDIT_CURVE_SIDES, EDIT_CONE_ROUNDX, EDIT_CONE_ROUNDY, EDIT_CONE_POINTY,
value: number

getSplinePointShapeParameter(edit, pointId, editParamId)

Get a shape parameter of an edit spline control point.

Arguments
edit: Edit, a pointer to an edit.
pointId:
editParamId: int, available values are EDIT_BOX_ROUNDX, EDIT_BOX_ROUNDY, EDIT_BOX_THICKNESS, EDIT_CURVE_SLIDE, EDIT_CURVE_WEIGHT, EDIT_CURVE_THICKNESS, EDIT_NGON_ROUND, EDIT_CURVE_SIDES, EDIT_CONE_ROUNDX, EDIT_CONE_ROUNDY, EDIT_CONE_POINTY,

Return
float

setSplinePointDimensions(edit, pointId, dim)

Set the dimensions of an edit spline control point.

Arguments
edit: Edit, a pointer to an edit.
pointId: int
dim:

getSplinePointDimensions(edit, pointId)

Get the dimensions of an edit spline control point.

Arguments
edit: Edit, a pointer to an edit.
pointId: int

Return
vec3

setSplinePointColor(edit, pointId, color)

Set the color of an edit spline control point.

Arguments
edit: Edit, a pointer to an edit.
pointId: int
color: vec4

getSplinePointColor(edit, pointId)

Get the color of an edit spline control point.

Arguments
edit: Edit, a pointer to an edit.
pointId: int

Return
vec4

setSplineScale(edit, value)

Set the scale of an edit spline.

Arguments
edit: Edit, a pointer to an edit.
value: number

getSplineScale(edit)

Get the scale of an edit spline.

Arguments
edit: Edit, a pointer to an edit.

Return
float