Autogen categories
This commit is contained in:
@@ -395,8 +395,6 @@ type HeadVisualeffectsConfig struct {
|
||||
StripModelPrefixes []string `json:"strip_model_prefixes,omitempty" yaml:"strip_model_prefixes"`
|
||||
KeyFormat string `json:"key_format,omitempty" yaml:"key_format"`
|
||||
LabelFormat string `json:"label_format,omitempty" yaml:"label_format"`
|
||||
LegacyGroups map[string]string `json:"legacy_groups,omitempty" yaml:"legacy_groups"`
|
||||
LegacyKeyFormat string `json:"legacy_key_format,omitempty" yaml:"legacy_key_format"`
|
||||
ModelColumn string `json:"model_column,omitempty" yaml:"model_column"`
|
||||
RowDefaults map[string]string `json:"row_defaults,omitempty" yaml:"row_defaults"`
|
||||
}
|
||||
@@ -1820,8 +1818,6 @@ func headVisualeffectsConfigConfigured(cfg HeadVisualeffectsConfig) bool {
|
||||
len(cfg.StripModelPrefixes) > 0 ||
|
||||
strings.TrimSpace(cfg.KeyFormat) != "" ||
|
||||
strings.TrimSpace(cfg.LabelFormat) != "" ||
|
||||
len(cfg.LegacyGroups) > 0 ||
|
||||
strings.TrimSpace(cfg.LegacyKeyFormat) != "" ||
|
||||
strings.TrimSpace(cfg.ModelColumn) != "" ||
|
||||
len(cfg.RowDefaults) > 0
|
||||
}
|
||||
@@ -1888,21 +1884,6 @@ func validateHeadVisualeffectsConfig(fieldPrefix string, cfg HeadVisualeffectsCo
|
||||
}
|
||||
}
|
||||
}
|
||||
for legacyGroup, group := range cfg.LegacyGroups {
|
||||
legacyGroup = strings.TrimSpace(legacyGroup)
|
||||
group = strings.TrimSpace(group)
|
||||
if legacyGroup == "" {
|
||||
failures = append(failures, fmt.Errorf("%s.legacy_groups contains an empty legacy group key", fieldPrefix))
|
||||
continue
|
||||
}
|
||||
if group == "" {
|
||||
failures = append(failures, fmt.Errorf("%s.legacy_groups[%s] must not be empty", fieldPrefix, legacyGroup))
|
||||
}
|
||||
failures = append(failures, validateTreeRootPath(fieldPrefix+".legacy_groups["+legacyGroup+"]", legacyGroup)...)
|
||||
if group != "" {
|
||||
failures = append(failures, validateTreeRootPath(fieldPrefix+".legacy_groups["+legacyGroup+"]", group)...)
|
||||
}
|
||||
}
|
||||
for index, prefix := range cfg.StripModelPrefixes {
|
||||
if strings.TrimSpace(prefix) == "" {
|
||||
failures = append(failures, fmt.Errorf("%s.strip_model_prefixes[%d] must not be empty", fieldPrefix, index))
|
||||
|
||||
@@ -1449,9 +1449,6 @@ func TestValidateLayoutRejectsInvalidHeadVisualeffectsNamingConfig(t *testing.T)
|
||||
CategoryFrom: "unsupported",
|
||||
Delimiter: " ",
|
||||
Case: "unsupported",
|
||||
LegacyGroups: map[string]string{
|
||||
"head_features": "",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -1468,7 +1465,6 @@ func TestValidateLayoutRejectsInvalidHeadVisualeffectsNamingConfig(t *testing.T)
|
||||
"autogen.consumers[0].head_visualeffects.category_from",
|
||||
"autogen.consumers[0].head_visualeffects.delimiter",
|
||||
"autogen.consumers[0].head_visualeffects.case",
|
||||
"autogen.consumers[0].head_visualeffects.legacy_groups[head_features]",
|
||||
} {
|
||||
if !strings.Contains(err.Error(), needle) {
|
||||
t.Fatalf("expected validation error to mention %s, got %v", needle, err)
|
||||
@@ -1476,6 +1472,47 @@ func TestValidateLayoutRejectsInvalidHeadVisualeffectsNamingConfig(t *testing.T)
|
||||
}
|
||||
}
|
||||
|
||||
func TestLoadRejectsLegacyHeadVisualeffectsNamingFields(t *testing.T) {
|
||||
root := t.TempDir()
|
||||
writeProjectFile(t, filepath.Join(root, ConfigFile), `
|
||||
module:
|
||||
name: Test Module
|
||||
resref: testmod
|
||||
paths:
|
||||
source: src
|
||||
autogen:
|
||||
consumers:
|
||||
- id: head_visualeffects
|
||||
producer: head_visualeffects
|
||||
dataset: visualeffects
|
||||
mode: head_visualeffects
|
||||
root: vfxs
|
||||
include:
|
||||
- headfeature/**/*.mdl
|
||||
derive:
|
||||
kind: model_stem
|
||||
group_from: first_path_segment
|
||||
head_visualeffects:
|
||||
groups:
|
||||
headfeature:
|
||||
model_columns:
|
||||
- Imp_HeadCon_Node
|
||||
group_token_source: folder_name
|
||||
category_from: immediate_parent
|
||||
legacy_groups:
|
||||
head_features: headfeature
|
||||
legacy_key_format: "{dataset}:{group}_{stem}"
|
||||
`)
|
||||
|
||||
_, err := Load(root)
|
||||
if err == nil {
|
||||
t.Fatal("expected legacy head visualeffects naming fields to be rejected")
|
||||
}
|
||||
if !strings.Contains(err.Error(), "legacy_groups") {
|
||||
t.Fatalf("expected legacy_groups unknown field error, got %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateLayoutAcceptsGeneratedTopData2DAConfig(t *testing.T) {
|
||||
root := t.TempDir()
|
||||
mkdirAll(t, filepath.Join(root, "assets"))
|
||||
|
||||
Reference in New Issue
Block a user