ModelPart

Represents a node in the model tree, basically a group/cube/mesh in Blockbench
Each bbmodel file is itself a ModelPart,
and all of your models are contained in a global ModelPart called "models"

ModelPart.getName

The name of this model part
overload 1:
models:getName()
Method Property Fluent Description Representation
Return Value a String

ModelPart.getParent

Gets the parent part of this part
If this part has no parent,
returns nil
overload 1:
models:getParent()
Method Property Fluent Description Representation
Return Value either a ModelPart or nil

ModelPart.getType

Returns whether this part is a "GROUP", a "CUBE", or a "MESH"
overload 1:
models:getType()
Method Property Fluent Description Representation
Return Value a String

ModelPart.getChildren

Gets the children of this part, stored in a table
overload 1:
models:getChildren()
Method Property Fluent Description Representation
Return Value an array of ModelParts

ModelPart.setColor

Sets the color multiplier for this part for primary and secondary colors
Values are RGB from 0 to 1
overload 1:
models:setColor(color)
Method Property Fluent Description Representation
color accepts a Vector3
Return Value nil
overload 2:
models:setColor(r, g, b)
Method Property Fluent Description Representation
r accepts a Number
g accepts a Number
b accepts a Number
Return Value nil

ModelPart.setScale

Sets the scale factor for this part
Nil values for scale are assumed to be 1
overload 1:
models:setScale(scale)
Method Property Fluent Description Representation
scale accepts a Vector3
Return Value nil
overload 2:
models:setScale(x, y, z)
Method Property Fluent Description Representation
x accepts a Number
y accepts a Number
z accepts a Number
Return Value nil

ModelPart.addItem

figura.docs.model_part.add_item
overload 1:
models:addItem(taskName)
Method Property Fluent Description Representation
taskName accepts a String
Return Value a RenderTask

ModelPart.getAnimScale

Gets the scale multiplier provided by the currently active animation of this model part
overload 1:
models:getAnimScale()
Method Property Fluent Description Representation
Return Value a Vector3

ModelPart.setVisible

Sets this part to be visible or invisible
The default value is nil,
meaning the part copies its visibility from its parent part
overload 1:
models:setVisible(visible)
Method Property Fluent Description Representation
visible accepts a Boolean
Return Value nil

ModelPart.getVisible

Gets whether or not this model part is visible
The default value is nil,
meaning it copies the visibility of its parent part during rendering
overload 1:
models:getVisible()
Method Property Fluent Description Representation
Return Value either a Boolean or nil

ModelPart.getTask

Gets the Render Task with the given name from this part
Returns a table with all tasks if a name is not given
overload 1:
models:getTask()
Method Property Fluent Description Representation
Return Value a table mapping a String to a RenderTask
overload 2:
models:getTask(taskName)
Method Property Fluent Description Representation
taskName accepts a String
Return Value a RenderTask

ModelPart.getScale

Gets the scale of the model part, as a multiple of its Blockbench size
Only changes from {1,
1,1} when you call setScale()
overload 1:
models:getScale()
Method Property Fluent Description Representation
Return Value a Vector3

ModelPart.getPos

Gets the position of the model part, as an offset from its position in Blockbench
Only changes from {0,
0,0} when you call setPos()
overload 1:
models:getPos()
Method Property Fluent Description Representation
Return Value a Vector3

ModelPart.setPos

Sets the position offset for this part from its Blockbench position
Nil values for position are assumed to be 0
overload 1:
models:setPos(pos)
Method Property Fluent Description Representation
pos accepts a Vector3
Return Value nil
overload 2:
models:setPos(x, y, z)
Method Property Fluent Description Representation
x accepts a Number
y accepts a Number
z accepts a Number
Return Value nil

ModelPart.getOpacity

Gets the opacity multiplier of this part
Note that opacity settings will only take effect if the part has a suitable Render Type for them,
mainly TRANSLUCENT
Check out modelPart.setPrimaryRenderType() for how to do this
overload 1:
models:getOpacity()
Method Property Fluent Description Representation
Return Value a Number

ModelPart.offsetPivot

figura.docs.model_part.offset_pivot
overload 1:
models:offsetPivot(offsetPivot)
Method Property Fluent Description Representation
offsetPivot accepts a Vector3
Return Value nil
overload 2:
models:offsetPivot(x, y, z)
Method Property Fluent Description Representation
x accepts a Number
y accepts a Number
z accepts a Number
Return Value nil

ModelPart.getPivot

Gets the pivot point of the model part, including its pivot in Blockbench
For relative values,
check out the "offset" pivot functions
overload 1:
models:getPivot()
Method Property Fluent Description Representation
Return Value a Vector3

ModelPart.offsetRot

figura.docs.model_part.offset_rot
overload 1:
models:offsetRot(offsetRot)
Method Property Fluent Description Representation
offsetRot accepts a Vector3
Return Value nil
overload 2:
models:offsetRot(x, y, z)
Method Property Fluent Description Representation
x accepts a Number
y accepts a Number
z accepts a Number
Return Value nil

ModelPart.getAnimPos

Gets the position offset provided by the currently active animation of this model part
overload 1:
models:getAnimPos()
Method Property Fluent Description Representation
Return Value a Vector3

ModelPart.setMatrix

Sets the given matrix as the position matrix for this model part
The normal matrix is automatically calculated as the inverse transpose of this matrix
Calling this DOES NOT CHANGE the values of position,
rot, or scale in the model part
If you call setPos() or a similar function,
the effects of setMatrix() will be overwritten
overload 1:
models:setMatrix(matrix)
Method Property Fluent Description Representation
matrix accepts a Matrix4
Return Value nil

ModelPart.getOffsetPivot

Gets the pivot offset of the model part, offset from its pivot in Blockbench
For absolute pivot point values,
check out the non-offset pivot functions
overload 1:
models:getOffsetPivot()
Method Property Fluent Description Representation
Return Value a Vector3

ModelPart.getAnimRot

Gets the rotation offset provided by the currently active animation of this model part
overload 1:
models:getAnimRot()
Method Property Fluent Description Representation
Return Value a Vector3

ModelPart.setRot

Sets the absolute rotation for this part
Nil values for rotation are assumed to be 0
Angles are given in degrees
For relative rotation values,
check out the "offset" rot functions
overload 1:
models:setRot(rot)
Method Property Fluent Description Representation
rot accepts a Vector3
Return Value nil
overload 2:
models:setRot(x, y, z)
Method Property Fluent Description Representation
x accepts a Number
y accepts a Number
z accepts a Number
Return Value nil

ModelPart.getNormalMatrixRaw

Returns the normal matrix for this model part
The Raw version of the function is different in that it doesn't recalculate the matrix before returning it
overload 1:
models:getNormalMatrixRaw()
Method Property Fluent Description Representation
Return Value a Matrix3

ModelPart.getRot

Gets the rotation of the model part, including its rotation in Blockbench
For relative rotation values,
check out the "offset" rot functions
overload 1:
models:getRot()
Method Property Fluent Description Representation
Return Value a Vector3

ModelPart.getPositionMatrix

Recalculates the matrix for this model part, based on its current position, rotation, scale, and pivot, then returns this matrix
overload 1:
models:getPositionMatrix()
Method Property Fluent Description Representation
Return Value a Matrix4

ModelPart.getNormalMatrix

Recalculates the normal matrix for this model part, based on its current position, rotation, scale, and pivot, then returns this matrix
overload 1:
models:getNormalMatrix()
Method Property Fluent Description Representation
Return Value a Matrix3

ModelPart.setPivot

Sets the absolute pivot for this part
Nil values are assumed to be 0
For relative pivot offsets,
check out the "offset" pivot functions
overload 1:
models:setPivot(pivot)
Method Property Fluent Description Representation
pivot accepts a Vector3
Return Value nil
overload 2:
models:setPivot(x, y, z)
Method Property Fluent Description Representation
x accepts a Number
y accepts a Number
z accepts a Number
Return Value nil

ModelPart.setPrimaryTexture

Sets the primary texture override of this part
Check the TextureType types in the list docs
If using "resource",
the second parameter should indicate the path to the Minecraft texture you want to use
If using "custom",
the second parameter should indicate a texture object
overload 1:
models:setPrimaryTexture(textureType)
Method Property Fluent Description Representation
textureType accepts a String
Return Value nil
overload 2:
models:setPrimaryTexture(resource, path)
Method Property Fluent Description Representation
resource accepts a String
path accepts a String
Return Value nil

ModelPart.getOffsetRot

Gets the rotation offset of the model part, offset from its rotation in Blockbench
For absolute rotation values,
check out the non-offset rot functions
overload 1:
models:getOffsetRot()
Method Property Fluent Description Representation
Return Value a Vector3

ModelPart.setParentType

Sets the parent type of the part
See the ParentType parts in the list docs for legal types
overload 1:
models:setParentType(parentType)
Method Property Fluent Description Representation
parentType accepts a String
Return Value nil

ModelPart.setLight

Sets the light level to be used when rendering this part
Values you give are 0 to 15,
indicating the block light and sky light levels you want to use
Passing nil will reset the lighting override for this part
overload 1:
models:setLight(light)
Method Property Fluent Description Representation
light accepts a Vector2
Return Value nil
overload 2:
models:setLight(blockLight, skyLight)
Method Property Fluent Description Representation
blockLight accepts an Integer
skyLight accepts an Integer
Return Value nil

ModelPart.setUVMatrix

Sets the UV matrix of this part
This matrix is applied to all UV points during the transform,
with the UVs treated as homogeneous vectors
setUV() and setUVPixels() are just simpler ways of setting this matrix
overload 1:
models:setUVMatrix(matrix)
Method Property Fluent Description Representation
matrix accepts a Matrix3
Return Value nil

ModelPart.setOpacity

Sets the opacity multiplier of this part
Note that opacity settings will only take effect if the part has a suitable Render Type for them,
mainly TRANSLUCENT
Check out modelPart.setPrimaryRenderType() for how to do this
overload 1:
models:setOpacity(opacity)
Method Property Fluent Description Representation
opacity accepts a Number
Return Value nil

ModelPart.partToWorldMatrix

Gets a matrix which transforms a point from this part's position to a world location
Recommended to use this in POST_RENDER,
as by then the matrix is updated
In RENDER it will be 1 frame behind the part's visual position for that frame
Also,
if the model is not rendered in-world, the part's matrix will not be updated
Paperdoll rendering and other UI renderings will not affect this matrix
overload 1:
models:partToWorldMatrix()
Method Property Fluent Description Representation
Return Value a Matrix4

ModelPart.setUVPixels

Sets the UV of this part in pixels
Automatically divides by the results of getTextureSize(),
so you can just input the number of pixels you want the UV to scroll by
Errors if the part has multiple different-sized textures
If this part is a Group,
it will attempt to setUVPixels on its children
overload 1:
models:setUVPixels(uv)
Method Property Fluent Description Representation
uv accepts a Vector2
Return Value nil
overload 2:
models:setUVPixels(u, v)
Method Property Fluent Description Representation
u accepts a Number
v accepts a Number
Return Value nil

ModelPart.setUV

Sets the UV of this part
This function is normalized,
meaning it works with values 0 to 1
If you say setUV(0.5,
0.25), for example, it will scroll by half of your texture width to the right, and one-fourth of the texture width downwards
overload 1:
models:setUV(uv)
Method Property Fluent Description Representation
uv accepts a Vector2
Return Value nil
overload 2:
models:setUV(u, v)
Method Property Fluent Description Representation
u accepts a Number
v accepts a Number
Return Value nil

ModelPart.getLight

Gets the light level you set earlier to this part
Does not interact with Minecraft's lighting system,
only retrieving values you set earlier with setLight()
overload 1:
models:getLight()
Method Property Fluent Description Representation
Return Value a Vector2

ModelPart.getTextureSize

Gets the width, height of this part's texture in pixels
Throws an error if this part has multiple different-sized textures on it,
or if the part is a Group
overload 1:
models:getTextureSize()
Method Property Fluent Description Representation
Return Value a Vector2

ModelPart.addText

figura.docs.model_part.add_text
overload 1:
models:addText(taskName)
Method Property Fluent Description Representation
taskName accepts a String
Return Value a RenderTask

ModelPart.getParentType

Returns the current parent type of the part
overload 1:
models:getParentType()
Method Property Fluent Description Representation
Return Value a String

ModelPart.addBlock

figura.docs.model_part.add_block
overload 1:
models:addBlock(taskName)
Method Property Fluent Description Representation
taskName accepts a String
Return Value a RenderTask

ModelPart.removeTask

Removes the Task with the given name from this part
Removes ALL tasks if a name is not given
overload 1:
models:removeTask(taskName)
Method Property Fluent Description Representation
taskName accepts a String
Return Value nil

ModelPart.getPositionMatrixRaw

Returns the position matrix for this model part
The Raw version of the function is different in that it doesn't recalculate the matrix before getting it
overload 1:
models:getPositionMatrixRaw()
Method Property Fluent Description Representation
Return Value a Matrix4

ModelPart.getSecondaryRenderType

Gets the current secondary render type of this model part
Nil by default,
meaning the part copies the secondary render type of its parent
overload 1:
models:getSecondaryRenderType()
Method Property Fluent Description Representation
Return Value either a RenderTypes or nil

ModelPart.setPrimaryRenderType

Sets the current primary render type of this model part
Nil by default,
meaning the part copies the primary render type of its parent during rendering
Check the docs enum command for all render types
overload 1:
models:setPrimaryRenderType(renderType)
Method Property Fluent Description Representation
renderType accepts a String
Return Value nil

ModelPart.setSecondaryRenderType

Sets the current secondary render type of this model part
Nil by default,
meaning the part copies the secondary render type of its parent during rendering
Check the docs enum command for all render types
overload 1:
models:setSecondaryRenderType(renderType)
Method Property Fluent Description Representation
renderType accepts a String
Return Value nil

ModelPart.getPrimaryRenderType

Gets the current primary render type of this model part
Nil by default,
meaning the part copies the primary render type of its parent
overload 1:
models:getPrimaryRenderType()
Method Property Fluent Description Representation
Return Value either a RenderTypes or nil

ModelPart.setSecondaryTexture

Sets the secondary texture override of this part
Check the TextureType types in the list docs
If using "resource",
the second parameter should indicate the path to the Minecraft texture you want to use
If using "custom",
the second parameter should indicate a texture object
overload 1:
models:setSecondaryTexture(textureType)
Method Property Fluent Description Representation
textureType accepts a String
Return Value nil
overload 2:
models:setSecondaryTexture(resource, path)
Method Property Fluent Description Representation
resource accepts a String
path accepts a String
Return Value nil

ModelPart.getColor

Returns the average set color from this part, as adding the primary color with the secondary, then dividing them
Values are RGB from 0 to 1
overload 1:
models:getColor()
Method Property Fluent Description Representation
Return Value a Vector3
a a