ParentType: Difference between revisions

From FiguraMC
PenguinEncounter (talk | contribs)
Create page
 
PenguinEncounter (talk | contribs)
Port content from ModelPart
Tag: 2017 source edit
Line 3: Line 3:
}}
}}


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


== In Blockbench ==
== 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 keywords below.
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.
{{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|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 ('head' isn't a ParentType name; capitalization matters)
* BigHead (doesn't start with the ParentType)
* HeAd ('HeAd' isn't a ParentType name)
{{Note
|color=#f2a03c
|tag=Warning
|Watch out for English words that incidentally start with ParentType names, like '''Gui'''tar, which assigns a ParentType of [[#Hud|Hud]] (through its alias 'Gui'!)
}}
== Via Scripting ==
Calling [[ModelPart#setParentType|setParentType]] on any {{type|ModelPart}} (including cubes and meshes) will override its ParentType.
Simply [[ModelPart#Accessing ModelParts|access]] the ModelPart and call [[ModelPart#setParentType|setParentType]] on it, passing the ParentType as a {{type|string}}. For example:
<syntaxhighlight lang="lua">
local head = models.model.root.Head
head:setParentType("RightArm") -- make the part act like the vanilla player's right arm
</syntaxhighlight>
To remove the ParentType from a ModelPart, use <code>"None"</code>:
<syntaxhighlight lang="lua">
local head = models.model.root.Head
head:setParentType("None") -- remove the ParentType
</syntaxhighlight>
ModelParts don't remember their original ParentType! If you need to reference the original ParentType of a ModelPart, get ([[ModelPart#getParentType|getParentType]]) and store it in a variable and use it later:
<syntaxhighlight lang="lua">
local head = models.model.root.Head
local headParentType = head:getParentType() -- store the current ParentType for later
head:setParentType("None") -- clear the ParentType
</syntaxhighlight>

Revision as of 02:38, 29 September 2024

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