Mesh
MeshFace
Extends: Face
new MeshFace( mesh, data )
Creates a new MeshFace
Arguments:
mesh
: Meshdata
: MeshFaceOptions
Property | Type | Description |
---|---|---|
texture | undefined or string or false | |
vertices | Array of string | The 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. |
mesh | Mesh | |
uv | See 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:
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:
texture_space
: boolean (Optional)start_offset
: ArrayVector2 (Optional)matrix
: OccupationMatrix (Optional)
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:
other_face
: MeshFace
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:
uv
: ArrayVector2
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:
vector
: THREE.Vector3
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:
options
: MeshOptionsuuid
: string (Optional)
Property | Type | Description |
---|---|---|
visibility | boolean | |
color | number | |
vertices | See types | |
faces | See types | |
seams | See types | |
name | string | |
uuid | string | |
export | boolean | |
locked | boolean | |
parent | Group or "root" | |
menu | Menu | |
selected | boolean | |
mesh | THREE.Object3D or Mesh |
extend( options )
Arguments:
options
: MeshOptions
Returns: Mesh
extend( data )
Arguments:
data
: MeshOptionsname
: 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:
edge
: MeshEdgevalue
: any
getSeam( edge )
Arguments:
edge
: MeshEdge
Returns: MeshSeamValue
getWorldCenter( [ignore_mesh_selection] )
Arguments:
ignore_mesh_selection
: boolean (Optional)
Returns: THREE.Vector3
addVertices( ArrayVector3 )
Arguments:
ArrayVector3
: Array of ArrayVector3
Returns: Array of string
addFaces( MeshFace )
Arguments:
MeshFace
: Array of MeshFace
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:
callback
: See types
transferOrigin( origin[, update] )
Arguments:
origin
: ArrayVector3update
: boolean (Optional)
setColor( color )
Arguments:
color
: number
roll( axis, steps[, origin] )
Arguments:
axis
: numbersteps
: numberorigin
: ArrayVector3 (Optional)
flip( axis )
Arguments:
axis
: number
moveVector( offset, axis[, update] )
Arguments:
offset
: ArrayVector3axis
: numberupdate
: boolean (Optional)
resize( val, axis, negative, allow_negative[, bidirectional] )
Arguments:
val
: numberaxis
: numbernegative
: booleanallow_negative
: booleanbidirectional
: boolean (Optional)
applyTexture( texture[, faces] )
Arguments:
texture
: Texturefaces
: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:
target
: OutlinerNode (Optional)
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:
others
: Array of OutlinerNode (Optional)
Returns: Mesh
isChildOf( group, max_levels )
Checks of the group or element is a child of
group
.
Arguments:
group
: Groupmax_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
: anykeep_uuid
: boolean (Optional)
Returns: OutlinerElement
Mesh.registerType( constructor, id )
Arguments:
constructor
: anyid
: 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