Mesh

MeshFace

Extends: Face

new MeshFace( mesh, data )

Creates a new MeshFace

Arguments:
  • mesh: Mesh
  • data: MeshFaceOptions
PropertyTypeDescription
textureundefined or string or false
verticesArray of stringThe vertices that make up the face, as vertex keys. The vertices go around the face counter-clockwise when looking at the front side of the face. That also means that reversing the vertex order reverses the face direction.
meshMesh
uvSee types

getTexture()

Returns: undefined or Texture

getBoundingRect()

Returns a 2D rectangle around the UV face

Returns: any

reset()

getSaveCopy( [project] )

Returns a save copy of the face, ready for serialization. Set project to true to save for a bbmodel project file

Arguments:
  • project: boolean (Optional)

Returns: any

getUndoCopy()

Get a copy for undo tracking

Returns: Face

extend( data )

Arguments:
  • data: MeshFaceOptions

getNormal( normalize[, alt_tri] )

Returns the face normal in mesh space as calculated from the vertex positions

Arguments:
  • normalize: boolean - If true, the values will be normalized.
  • alt_tri: boolean (Optional) - On quads, if true, this will return the normal of the second tri instead of the first

Returns: ArrayVector3

getOccupationMatrix( [texture_space, start_offset, matrix] )

Calculates which pixels the UV face occupies, and returns them as a map

Arguments:

Returns: OccupationMatrix

getUVIsland()

Get the keys of this face and all faces that are connected with it on the UV map

Returns: Array of string

getAngleTo( other_face )

Returns the angle between two faces in degrees

Arguments:

Returns: number

invert()

Inverts the direction of the face

isSelected()

Returns whether the face is selected

Returns: boolean

getSortedVertices()

Returns the vertices of a quad in an order that creates a convex quad shape if possible. If the face has less than 4 vertices, it just returns the vertices in original order.

Returns: Array of string

getAdjacentFace( side_index )

Get the adjacent face in the specified side

Arguments:
  • side_index: number

Returns: null or See types

getFaceKey()

Returns the face key

Returns: string

UVToLocal( uv )

Takes a UV coordinate and turns it into a 3D space coordinate in local space of the mesh. On quads, the first triangle is used for calculation, so the coordinates on warped quads may be inaccurate.

Arguments:

Returns: THREE.Vector3

localToUV( vector )

Takes a 3D coordinate in local space of the mesh, and turns it into a coordinate on the UV map using barycentric coordinates. On quads, the first triangle is used for calculation, so the coordinates on warped quads may be inaccurate.

Arguments:

Returns: ArrayVector2

getCenter()

Get the face center by weight in local space

Returns: ArrayVector3

Mesh

Extends: OutlinerElement

new Mesh( options[, uuid] )

Creates a new Mesh

Arguments:
PropertyTypeDescription
visibilityboolean
colornumber
verticesSee types
facesSee types
seamsSee types
namestring
uuidstring
exportboolean
lockedboolean
parentGroup or "root"
menuMenu
selectedboolean
meshTHREE.Object3D or Mesh

extend( options )

Arguments:

Returns: Mesh

extend( data )

Arguments:
  • data: MeshOptions
    • name: string (Optional)
    • color: number (Optional)
    • visibility: boolean (Optional)
    • rotation: ArrayVector3 (Optional)
    • origin: ArrayVector3 (Optional)
    • vertices: See types (Optional)

getSelectedVertices( can_write )

Get selected vertices as vertex keys

Arguments:
  • can_write: boolean - If true, the array can safely be modified to update the selection

Returns: Array of string

getSelectedVertices( can_write )

Get selected faces as face keys

Arguments:
  • can_write: boolean - If true, the array can safely be modified to update the selection

Returns: Array of string

getSelectedEdges( can_write )

Get selected edges as vertex key pairs

Arguments:
  • can_write: boolean - If true, the array can safely be modified to update the selection

Returns: Array of Array

setSeam( edge, value )

Arguments:

getSeam( edge )

Arguments:

Returns: MeshSeamValue

getWorldCenter( [ignore_mesh_selection] )

Arguments:
  • ignore_mesh_selection: boolean (Optional)

Returns: THREE.Vector3

addVertices( ArrayVector3 )

Arguments:

Returns: Array of string

addFaces( MeshFace )

Arguments:

Returns: Array of string

getUndoCopy( [aspects] )

Arguments:
  • aspects: any (Optional)

Returns: any

getSelectionRotation()

Returns: THREE.Euler

getCenter( global )

Arguments:
  • global: boolean

Returns: THREE.Vector3

forAllFaces( callback )

Arguments:

transferOrigin( origin[, update] )

Arguments:

setColor( color )

Arguments:
  • color: number

roll( axis, steps[, origin] )

Arguments:
  • axis: number
  • steps: number
  • origin: ArrayVector3 (Optional)

flip( axis )

Arguments:
  • axis: number

moveVector( offset, axis[, update] )

Arguments:
  • offset: ArrayVector3
  • axis: number
  • update: boolean (Optional)

resize( val, axis, negative, allow_negative[, bidirectional] )

Arguments:
  • val: number
  • axis: number
  • negative: boolean
  • allow_negative: boolean
  • bidirectional: boolean (Optional)

applyTexture( texture[, faces] )

Arguments:
  • texture: Texture
  • faces: true or Array of string (Optional)

init()

Initializes the node. This should always be called when creating nodes that will be used in the outliner.

Returns: Mesh

addTo( [target] )

Arguments:

Returns: Mesh

sortInBefore( [target, index_modifier] )

Arguments:
  • target: OutlinerNode (Optional)
  • index_modifier: number (Optional)

Returns: Mesh

getParentArray()

Returns: Array of OutlinerNode

showInOutliner()

Unfolds the outliner and scrolls up or down if necessary to show the group or element.

Returns: Mesh

updateElement()

Updates the Vue node of the element. This is only necessary in some rare situations

Returns: Mesh

remove()

Removes the element.

Returns: Mesh

rename()

Marks the name of the group or element in the outliner for renaming.

Returns: Mesh

saveName( [save] )

Saves the changed name of the element by creating an undo point and making the name unique if necessary.

Arguments:
  • save: boolean (Optional)

Returns: Mesh

createUniqueName( [others] )

Create a unique name for the group or element by adding a number at the end or increasing it.

Arguments:

Returns: Mesh

isChildOf( group, max_levels )

Checks of the group or element is a child of

group

.

Arguments:
  • group: Group
  • max_levels: number - The maximum number of generations that can be between the element and the group

Returns: boolean

showContexnu( event )

Displays the context menu of the element

Arguments:
  • event: HTMLElement or Event - Mouse event, determines where the context menu spawns.

Returns: Mesh

getSaveCopy( args )

Arguments:
  • args: Array of any

Returns: Record

sanitizeName()

Returns: string

Mesh.fromSave( data[, keep_uuid] )

Arguments:
  • data: any
  • keep_uuid: boolean (Optional)

Returns: OutlinerElement

Mesh.registerType( constructor, id )

Arguments:
  • constructor: any
  • id: string

select( [event, isOutlinerClick] )

Arguments:
  • event: any (Optional)
  • isOutlinerClick: boolean (Optional)

Returns: void or Mesh

unselect( args )

Arguments:
  • args: Array of any

Returns: void or Mesh

all

Static Property

Type: Array of Mesh

selected

Static Property

Type: Array of Mesh

hasAny

Static Property

Type: See types

hasSelected

Static Property

Type: See types

properties

Static Property

Type: Record

uuids

Static Property

Type: See types

animator

Static Property

Type: BoneAnimator

isParent

Static Property

Type: false

types

Static Property

Type: Record