ParentType

From FiguraMC
Revision as of 02:38, 29 September 2024 by PenguinEncounter (talk | contribs) (Port content from ModelPart)
This page is a stub. You can help this wiki by expanding it

This page is not complete! I'm still working on it animations.PenguinEncounter.talk

ParentTypes dictate how Figura positions and renders parts in your model. For example, some (like Head or LeftLeg) cause the part to mimic the motions of a part of the standard Minecraft player model. Others (like LeftItemPivot) control the positioning of special parts like the player's currently held item, armor, and parrots. Finally, ParentTypes like World change the way the part is positioned entirely. Each ParentType has one or more names associated with them.

In Blockbench

In Blockbench, groups (and only groups, not cubes or meshes) can be assigned ParentTypes by starting the name of the group with one of the names below.

ⓘ Note

Keywords are case-sensitive. This means that changing the capitalization might make a keyword non-functional.

For example, all of the following group names will assign the ParentType of Head, which will cause the part to move and rotate like the vanilla player's head.

  • Head
  • HEAD
  • Head2
  • Headphones (be careful of assigning ParentTypes by accident!)

The following will not assign the ParentType of Head:

  • head ('head' isn't a ParentType name; capitalization matters)
  • BigHead (doesn't start with the ParentType)
  • HeAd ('HeAd' isn't a ParentType name)
ⓘ Warning

Watch out for English words that incidentally start with ParentType names, like Guitar, which assigns a ParentType of Hud (through its alias 'Gui'!)

Via Scripting

Calling setParentType on any ModelPart (including cubes and meshes) will override its ParentType.

Simply access the ModelPart and call setParentType on it, passing the ParentType as a string. For example:

local head = models.model.root.Head
head:setParentType("RightArm") -- make the part act like the vanilla player's right arm

To remove the ParentType from a ModelPart, use "None":

local head = models.model.root.Head
head:setParentType("None") -- remove the ParentType

ModelParts don't remember their original ParentType! If you need to reference the original ParentType of a ModelPart, get (getParentType) and store it in a variable and use it later:

local head = models.model.root.Head
local headParentType = head:getParentType() -- store the current ParentType for later
head:setParentType("None") -- clear the ParentType