VFX Category Label Generation
This commit is contained in:
@@ -2178,10 +2178,10 @@ func TestPlanHAKsWritesManifestWithoutArchives(t *testing.T) {
|
||||
func TestBuildHAKsWritesConfiguredHeadVisualeffectsAutogenManifest(t *testing.T) {
|
||||
root := t.TempDir()
|
||||
mustMkdir(t, filepath.Join(root, "src"))
|
||||
mustMkdir(t, filepath.Join(root, "assets", "vfxs", "chest_accessories"))
|
||||
mustMkdir(t, filepath.Join(root, "assets", "vfxs", "head_accessories"))
|
||||
mustMkdir(t, filepath.Join(root, "assets", "vfxs", "head_decorations"))
|
||||
mustMkdir(t, filepath.Join(root, "assets", "vfxs", "head_features", "hair"))
|
||||
mustMkdir(t, filepath.Join(root, "assets", "vfxs", "chestaccessory"))
|
||||
mustMkdir(t, filepath.Join(root, "assets", "vfxs", "headaccessory"))
|
||||
mustMkdir(t, filepath.Join(root, "assets", "vfxs", "headdecoration"))
|
||||
mustMkdir(t, filepath.Join(root, "assets", "vfxs", "headfeature", "hair"))
|
||||
mustMkdir(t, filepath.Join(root, "build"))
|
||||
|
||||
mustWriteFile(t, filepath.Join(root, "nwn-tool.json"), `{
|
||||
@@ -2200,7 +2200,7 @@ func TestBuildHAKsWritesConfiguredHeadVisualeffectsAutogenManifest(t *testing.T)
|
||||
{
|
||||
"id": "head_visualeffects",
|
||||
"root": "vfxs",
|
||||
"include": ["chest_accessories/**/*.mdl", "head_accessories/**/*.mdl", "head_decorations/**/*.mdl", "head_features/**/*.mdl"],
|
||||
"include": ["chestaccessory/**/*.mdl", "headaccessory/**/*.mdl", "headdecoration/**/*.mdl", "headfeature/**/*.mdl"],
|
||||
"derive": {
|
||||
"kind": "model_stem",
|
||||
"group_from": "first_path_segment"
|
||||
@@ -2212,7 +2212,7 @@ func TestBuildHAKsWritesConfiguredHeadVisualeffectsAutogenManifest(t *testing.T)
|
||||
},
|
||||
"head_visualeffects": {
|
||||
"groups": {
|
||||
"head_accessories": {
|
||||
"headaccessory": {
|
||||
"prefix": "headaccessory",
|
||||
"model_columns": ["Imp_HeadCon_Node", "Imp_Root_H_Node"]
|
||||
}
|
||||
@@ -2233,10 +2233,10 @@ func TestBuildHAKsWritesConfiguredHeadVisualeffectsAutogenManifest(t *testing.T)
|
||||
}
|
||||
`)
|
||||
|
||||
mustWriteFile(t, filepath.Join(root, "assets", "vfxs", "chest_accessories", "tfx_sash.mdl"), "sash")
|
||||
mustWriteFile(t, filepath.Join(root, "assets", "vfxs", "head_accessories", "hfx_bandana.mdl"), "bandana")
|
||||
mustWriteFile(t, filepath.Join(root, "assets", "vfxs", "head_decorations", "hfx_laurel.mdl"), "laurel")
|
||||
mustWriteFile(t, filepath.Join(root, "assets", "vfxs", "head_features", "hair", "hfx_hair_bangs.mdl"), "hair")
|
||||
mustWriteFile(t, filepath.Join(root, "assets", "vfxs", "chestaccessory", "tfx_sash.mdl"), "sash")
|
||||
mustWriteFile(t, filepath.Join(root, "assets", "vfxs", "headaccessory", "hfx_bandana.mdl"), "bandana")
|
||||
mustWriteFile(t, filepath.Join(root, "assets", "vfxs", "headdecoration", "hfx_laurel.mdl"), "laurel")
|
||||
mustWriteFile(t, filepath.Join(root, "assets", "vfxs", "headfeature", "hair", "hfx_hair_bangs.mdl"), "hair")
|
||||
|
||||
p, err := project.Load(root)
|
||||
if err != nil {
|
||||
@@ -2267,16 +2267,16 @@ func TestBuildHAKsWritesConfiguredHeadVisualeffectsAutogenManifest(t *testing.T)
|
||||
text := string(headRaw)
|
||||
for _, want := range []string{
|
||||
`"id": "head_visualeffects"`,
|
||||
`"group": "chest_accessories"`,
|
||||
`"group": "chestaccessory"`,
|
||||
`"model_stem": "tfx_sash"`,
|
||||
`"group": "head_accessories"`,
|
||||
`"group": "headaccessory"`,
|
||||
`"model_stem": "hfx_bandana"`,
|
||||
`"head_visualeffects": {`,
|
||||
`"model_columns": [`,
|
||||
`"Imp_Root_H_Node"`,
|
||||
`"group": "head_decorations"`,
|
||||
`"group": "headdecoration"`,
|
||||
`"model_stem": "hfx_laurel"`,
|
||||
`"group": "head_features"`,
|
||||
`"group": "headfeature"`,
|
||||
`"model_stem": "hfx_hair_bangs"`,
|
||||
} {
|
||||
if !strings.Contains(text, want) {
|
||||
@@ -2285,6 +2285,103 @@ func TestBuildHAKsWritesConfiguredHeadVisualeffectsAutogenManifest(t *testing.T)
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuildHAKsWritesFolderCategoryInHeadVisualeffectsAutogenManifest(t *testing.T) {
|
||||
root := t.TempDir()
|
||||
mustMkdir(t, filepath.Join(root, "src"))
|
||||
mustMkdir(t, filepath.Join(root, "assets", "vfxs", "headfeature", "sinfar", "ears_plt"))
|
||||
mustMkdir(t, filepath.Join(root, "build"))
|
||||
|
||||
mustWriteFile(t, filepath.Join(root, "nwn-tool.json"), `{
|
||||
"module": {
|
||||
"name": "Test Module",
|
||||
"resref": "testmod",
|
||||
"hak_order": ["group:core"]
|
||||
},
|
||||
"paths": {
|
||||
"source": "src",
|
||||
"assets": "assets",
|
||||
"build": "build"
|
||||
},
|
||||
"autogen": {
|
||||
"producers": [
|
||||
{
|
||||
"id": "head_visualeffects",
|
||||
"root": "vfxs",
|
||||
"include": ["headfeature/**/*.mdl"],
|
||||
"derive": {
|
||||
"kind": "model_stem",
|
||||
"group_from": "first_path_segment"
|
||||
},
|
||||
"manifest": {
|
||||
"release_tag": "head-vfx-manifest-current",
|
||||
"asset_name": "sow-head-vfx-manifest.json",
|
||||
"cache_name": "sow-head-vfx-manifest.json"
|
||||
},
|
||||
"head_visualeffects": {
|
||||
"groups": {
|
||||
"headfeature": {
|
||||
"model_columns": ["Imp_HeadCon_Node", "Imp_Root_H_Node"]
|
||||
}
|
||||
},
|
||||
"group_token_source": "folder_name",
|
||||
"category_from": "immediate_parent",
|
||||
"delimiter": "/",
|
||||
"case": "preserve",
|
||||
"strip_model_prefixes": ["hfx_"],
|
||||
"key_format": "{dataset}:{group}{delimiter}{category_segment}{stem}",
|
||||
"label_format": "{group}{delimiter}{category_segment}{stem}"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"haks": [
|
||||
{
|
||||
"name": "core",
|
||||
"priority": 1,
|
||||
"max_bytes": 0,
|
||||
"split": false,
|
||||
"include": ["vfxs/**"]
|
||||
}
|
||||
]
|
||||
}
|
||||
`)
|
||||
|
||||
mustWriteFile(t, filepath.Join(root, "assets", "vfxs", "headfeature", "sinfar", "ears_plt", "hfx_Ear_EL_L.mdl"), "ear")
|
||||
|
||||
p, err := project.Load(root)
|
||||
if err != nil {
|
||||
t.Fatalf("load project: %v", err)
|
||||
}
|
||||
if err := p.ValidateLayout(); err != nil {
|
||||
t.Fatalf("validate layout: %v", err)
|
||||
}
|
||||
if err := p.Scan(); err != nil {
|
||||
t.Fatalf("scan: %v", err)
|
||||
}
|
||||
|
||||
if _, err := BuildHAKs(p); err != nil {
|
||||
t.Fatalf("build haks: %v", err)
|
||||
}
|
||||
headRaw, err := os.ReadFile(filepath.Join(root, "build", "sow-head-vfx-manifest.json"))
|
||||
if err != nil {
|
||||
t.Fatalf("read head visualeffects manifest: %v", err)
|
||||
}
|
||||
text := string(headRaw)
|
||||
for _, want := range []string{
|
||||
`"group": "headfeature"`,
|
||||
`"subgroup": "sinfar/ears_plt"`,
|
||||
`"category": "ears_plt"`,
|
||||
`"model_stem": "hfx_Ear_EL_L"`,
|
||||
`"source": "headfeature/sinfar/ears_plt/hfx_Ear_EL_L.mdl"`,
|
||||
`"group_token_source": "folder_name"`,
|
||||
`"category_from": "immediate_parent"`,
|
||||
} {
|
||||
if !strings.Contains(text, want) {
|
||||
t.Fatalf("expected head visualeffects manifest to contain %q, got:\n%s", want, text)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuildHAKsGeneratesParts2DAAssetsFromLocalModels(t *testing.T) {
|
||||
root := t.TempDir()
|
||||
mustMkdir(t, filepath.Join(root, "src"))
|
||||
|
||||
Reference in New Issue
Block a user