[0.8.9][NK] Submeshes (AnimatedGraphics/MorphGraphics)

johnycilohoklajohnycilohokla REGISTERED Posts: 283 Developer
edited December 2015 in Modding Tutorials

Defining submesh directory

Submesh directories are used to define a directories containing submesh definition, those will be loaded and injected to the AnimatedGraphics/MorphGraphics while the game loads.

Defining those directories is done by creating a SubmeshDirectories node in AnimatedGraphics or MorphGraphics component with a list of directories to load the definitions from.

SubmeshDirectories Example(AnimatedGraphics):
AnimatedGraphics
{
# ...
SubmeshDirectories
{
"Data/Gear/FP/"
}
# ...
}
Seed(Player) has those directories already defined for both 1st and 3rd person:
  • [MOD]/Data/Gear/3P/ - 3rd person submeshes
  • [MOD]/Data/Gear/FP/ - 1st person submeshes

Defining new submeshes

Example submesh file:
{
Submeshes
{
# name of the new submesh(mesh+textures)
Example_Submesh
{
# optional, fbx file to inject
model = "path/to/model.fbx"

# required, name of the mesh within the model
mesh = "MeshName_Within_FBX"

# required, textures
Textures
{
Diffuse = "path/to/texture_diff.tga"
Normal = "path/to/texture_norm.tga"
}
}
}
}
Example:
Defining 2 submeshes in 1 file
{
Submeshes
{
Geo_Helmet_Pumpkin01
{
mesh = "Geo_Helmet_Pumpkin01"
Textures
{
Diffuse = "Character/Seed/3P/0Child/Male/Textures/pumpkin_helmet_diff.tga"
Normal = "Character/Seed/3P/0Child/Male/Textures/pumpkin_helmet_norm.tga"
}
}
}
Submeshes
{
New_Pumpkin_Helmet
{
mesh = "Geo_Helmet_Pumpkin01"
Textures
{
Diffuse = "Character/Seed/3P/0Child/Male/Textures/pumpkin_helmet2_diff.tga"
Normal = "Character/Seed/3P/0Child/Male/Textures/pumpkin_helmet2_norm.tga"
}
}
}
}
Example:
Defining submesh with multiple textures
{
Submeshes
{
Geo_L_Hand_FireGauntlet01
{
mesh = "Geo_L_Hand_FireGauntlet01"
Textures
{
Diffuse
{
0 = "Character/Seed/3P/0Child/Male/Textures/fireball_neuria_Gauntlet.tga"
1 = "Character/Seed/3P/0Child/Male/Textures/bronze_glove_Plate_diff.tga"
2 = "Character/Seed/3P/0Child/Male/Textures/gauntlet_active_Stone_new_diff.tga"
3 = "Character/Seed/3P/0Child/Male/Textures/Seedling_Body_diff.tga"
}
Glow
{
2 = "Character/Seed/3P/0Child/Male/Textures/lifestone_glow.tga"
}
Normal
{
0 = "Character/Seed/3P/0Child/Male/Textures/bronze_Gauntlet_norm.tga"
1 = "Character/Seed/3P/0Child/Male/Textures/bronze_glove_Plate_norm.tga"
2 = "Character/Seed/3P/0Child/Male/Textures/gauntlet_active_Stone_new_norm.tga"
3 = "Character/Seed/3P/0Child/Male/Textures/Seedling_Body_norm.tga"
}
}
}
}
}

Swapping Meshes(Player)

Swapping meshes on players is done automatically.
Equipped objects (EquipableGear) can define AppearenceRules in Script's arguments.
This is later used to determinate which submeshes are visible.

Example:
Script
{
arguments
{
# ...
AppearenceRules
{
"Left Arm"
{
submesh = "default"
priority = 2.0
}
"Left Hand"
{
submesh = "Geo_L_Hand_FireGauntlet01"
priority = 1.0
}
}
# ...
}
}
Internally this is done in PlayerModel using NKSetSubmeshVisibility.

Swapping Meshes(Character)

Note: MorphGraphics inherits from AnimatedGraphics

Enabling submesh:
self:NKGetAnimatedGraphics():NKSetSubmeshVisibility("submesh", true)
Disabling submesh:
self:NKGetAnimatedGraphics():NKSetSubmeshVisibility("submesh", false)
My Blog
jc.png
  yt.png  t.png  
Sign In or Register to comment.