Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

ParentType: Difference between revisions

From FiguraMC
PenguinEncounter (talk | contribs)
Create page
 
PenguinEncounter (talk | contribs)
Non-stub
Tag: 2017 source edit
 
(10 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{Stub}}{{Notice
'''ParentType'''s 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.
| content = This page is not complete! I'm still working on it <span style="font-family:monospace;"><span style="opacity:50%;font-size:.8em;">animations.</span>[[User:PenguinEncounter|PenguinEncounter]]<span style="font-size:.8em;">.[[User talk:PenguinEncounter|talk]]</span></span>
 
== 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|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'!)
}}
}}


'''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.
== 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>
 
== List of ParentTypes ==
 
=== Vanilla model mimicry ===
==== None ====
----
{{aliases|NONE|Model|MODEL}}
 
No special properties{{tag|verify}}. The default behavior.
 
==== Head ====
----
{{aliases|HEAD}}
 
Mimics the transformations of the vanilla player's head. Additionally, if there are no [[#Skull|Skull]] {{type|ModelParts}}, Head {{type|ModelParts}} will be used to replace the vanilla skull{{tag|verify}}.
 
==== Body ====
----
{{aliases|BODY}}
 
Mimics the transformations of the vanilla player's body (torso.)
 
==== RightArm ====
----
{{aliases|RIGHT_ARM}}
 
Mimics the transformations of the vanilla player's right arm. Parts with this ParentType will be rendered in first-person view if the vanilla player's right arm would be visible (e.g. not holding any item.)
 
==== LeftArm ====
----
{{aliases|LEFT_ARM}}
 
Mimics the transformations of the vanilla player's right arm. Parts with this ParentType will be rendered in first-person view if the vanilla player's left arm would be visible (e.g. not holding any item, and left-handed.)
 
==== RightLeg ====
----
{{aliases|RIGHT_LEG}}
 
Mimics the transformations of the vanilla player's right leg.
 
==== LeftLeg ====
----
{{aliases|LEFT_LEG}}
 
Mimics the transformations of the vanilla player's left leg.
 
==== RightElytra ====
----
{{aliases|RIGHT_ELYTRA|RightElytron|RIGHT_ELYTRON}}
 
Mimics the transformations of the vanilla player's right Elytra wing. Only rendered when the player has an Elytra equipped.
 
==== LeftElytra ====
----
{{aliases|LEFT_ELYTRA|LeftElytron|LEFT_ELYTRON}}
 
Mimics the transformations of the vanilla player's left Elytra wing. Only rendered when the player has an Elytra equipped.
 
==== Cape ====
----
{{aliases|CAPE}}
 
Mimics the transformations of the vanilla player's cape, even if the player doesn't own a cape{{tag|verify}}.
 
=== Special rendering modes ===
These ParentTypes provide access to rendering functionality that might not be otherwise possible.


== In Blockbench ==
==== World ====
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.
----
{{aliases|WORLD}}
 
The ModelPart will be attached to the world, instead of your player.
 
World parts' [[ModelPart#getPos|position]] reflect their X/Y/Z coordinates in the world, relative to (0, 0, 0). 1 block is equivalent to 16 ModelPart units; to convert between world coordinates and ModelPart coordinates, scale each axis by a factor of 16 (or {{fr|1|16}}.)
 
A World ModelPart with [[ModelPart#getRot|rotation]] (0, 0, 0) faces ''south'' in the world, which is the opposite of Blockbench's North indicator.
 
World ModelParts are always visible in first-person view.
 
==== Hud ====
----
{{aliases|HUD|HeadsUpDisplay|Gui|GUI|GraphicalUserInterface|JraficalUserInterface}}
 
The ModelPart will be rendered on your HUD, instead of in the world or attached to your model. Only the avatar owner and players spectating the owner, will be able to see the HUD ModelParts.
 
The top-left of the screen is (0, 0, 0); 1 ModelPart unit is equivalent to 1 GUI unit, which scales with the GUI Scale Minecraft option.
 
Decreasing the X coordinate (-X) will move the ModelPart to the right, and decreasing the Y coordinate (-Y) will move the ModelPart down. The Z axis determines the rendering order of parts, with lower Z values (including negative) rendering closer to the screen.
 
==== Camera ====
----
{{aliases|CAMERA|Billboard|BILLBOARD}}
 
The ModelPart will always face the camera, like nameplates or particles in vanilla. This rendering mode is also called 'Billboard rendering.'
 
==== Skull ====
----
{{aliases|SKULL|☠}} <!-- why -->
 
The ModelPart will replace the vanilla Skull (placed player head blocks.)
 
==== Portrait ====
----
{{aliases|PORTRAIT}}
 
The ModelPart will be used to render the player icon in the player list (also called the TAB list.)
 
(0, 0, 0) is the bottom center point on the icon, and the rendering area extends 4 units on the X axis in each direction (-4 to +4) and 8 units on the Y axis (0 to 8.)
 
==== Arrow ====
----
{{aliases|ARROW}}
 
The ModelPart will be used to replace arrows that are fired by the avatar owner. The ModelPart's pivot point has no effect on this ParentType. (0, 0, 0) is the point on the vanilla arrow's shaft just before the head of the arrow.
 
==== Trident ====
----
{{aliases|TRIDENT}}
 
The ModelPart will be used to replace tridents that are thrown by the avatar owner. The ModelPart's pivot point has no effect on this ParentType. <!-- do we have a reference point for this? -->
 
==== Item ====
----
{{aliases|ITEM}}
 
This ParentType designates a custom item model that can be used with the [[Events/ITEM RENDER|<code>ITEM_RENDER</code> event]] to display a custom item.


{{Note|Keywords are '''case-sensitive'''. This means that changing the capitalization might make a keyword non-functional.
{{Notice
| content = This page is not complete! TODO: add pivots
}}
}}

Latest revision as of 05:24, 27 October 2024

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

List of ParentTypes

Vanilla model mimicry

None


Aliases: NONE, Model, MODEL

No special properties[verify]. The default behavior.

Head


Aliases: HEAD

Mimics the transformations of the vanilla player's head. Additionally, if there are no Skull ModelParts, Head ModelParts will be used to replace the vanilla skull[verify].

Body


Aliases: BODY

Mimics the transformations of the vanilla player's body (torso.)

RightArm


Aliases: RIGHT_ARM

Mimics the transformations of the vanilla player's right arm. Parts with this ParentType will be rendered in first-person view if the vanilla player's right arm would be visible (e.g. not holding any item.)

LeftArm


Aliases: LEFT_ARM

Mimics the transformations of the vanilla player's right arm. Parts with this ParentType will be rendered in first-person view if the vanilla player's left arm would be visible (e.g. not holding any item, and left-handed.)

RightLeg


Aliases: RIGHT_LEG

Mimics the transformations of the vanilla player's right leg.

LeftLeg


Aliases: LEFT_LEG

Mimics the transformations of the vanilla player's left leg.

RightElytra


Aliases: RIGHT_ELYTRA, RightElytron, RIGHT_ELYTRON

Mimics the transformations of the vanilla player's right Elytra wing. Only rendered when the player has an Elytra equipped.

LeftElytra


Aliases: LEFT_ELYTRA, LeftElytron, LEFT_ELYTRON

Mimics the transformations of the vanilla player's left Elytra wing. Only rendered when the player has an Elytra equipped.

Cape


Aliases: CAPE

Mimics the transformations of the vanilla player's cape, even if the player doesn't own a cape[verify].

Special rendering modes

These ParentTypes provide access to rendering functionality that might not be otherwise possible.

World


Aliases: WORLD

The ModelPart will be attached to the world, instead of your player.

World parts' position reflect their X/Y/Z coordinates in the world, relative to (0, 0, 0). 1 block is equivalent to 16 ModelPart units; to convert between world coordinates and ModelPart coordinates, scale each axis by a factor of 16 (or 1⁄16.)

A World ModelPart with rotation (0, 0, 0) faces south in the world, which is the opposite of Blockbench's North indicator.

World ModelParts are always visible in first-person view.

Hud


Aliases: HUD, HeadsUpDisplay, Gui, GUI, GraphicalUserInterface, JraficalUserInterface

The ModelPart will be rendered on your HUD, instead of in the world or attached to your model. Only the avatar owner and players spectating the owner, will be able to see the HUD ModelParts.

The top-left of the screen is (0, 0, 0); 1 ModelPart unit is equivalent to 1 GUI unit, which scales with the GUI Scale Minecraft option.

Decreasing the X coordinate (-X) will move the ModelPart to the right, and decreasing the Y coordinate (-Y) will move the ModelPart down. The Z axis determines the rendering order of parts, with lower Z values (including negative) rendering closer to the screen.

Camera


Aliases: CAMERA, Billboard, BILLBOARD

The ModelPart will always face the camera, like nameplates or particles in vanilla. This rendering mode is also called 'Billboard rendering.'

Skull


Aliases: SKULL,

The ModelPart will replace the vanilla Skull (placed player head blocks.)

Portrait


Aliases: PORTRAIT

The ModelPart will be used to render the player icon in the player list (also called the TAB list.)

(0, 0, 0) is the bottom center point on the icon, and the rendering area extends 4 units on the X axis in each direction (-4 to +4) and 8 units on the Y axis (0 to 8.)

Arrow


Aliases: ARROW

The ModelPart will be used to replace arrows that are fired by the avatar owner. The ModelPart's pivot point has no effect on this ParentType. (0, 0, 0) is the point on the vanilla arrow's shaft just before the head of the arrow.

Trident


Aliases: TRIDENT

The ModelPart will be used to replace tridents that are thrown by the avatar owner. The ModelPart's pivot point has no effect on this ParentType.

Item


Aliases: ITEM

This ParentType designates a custom item model that can be used with the ITEM_RENDER event to display a custom item.

This page is not complete! TODO: add pivots