Autogen categories
This commit is contained in:
+13
-85
@@ -742,25 +742,10 @@ func augmentWithAutogeneratedHeadVisualeffects(collected []nativeCollectedDatase
|
||||
|
||||
rowID, ok := lockData[key]
|
||||
if !ok {
|
||||
var migratedLegacyKey string
|
||||
if preservedRowID, preserved := historicalLockData[key]; preserved {
|
||||
rowID = preservedRowID
|
||||
} else {
|
||||
preservedLegacyID := false
|
||||
for _, legacyKey := range headVisualeffectLegacyKeys(dataset.Dataset.Name, entry, policy) {
|
||||
if preservedRowID, preserved := historicalLockData[legacyKey]; preserved {
|
||||
rowID = preservedRowID
|
||||
preservedLegacyID = true
|
||||
migratedLegacyKey = legacyKey
|
||||
break
|
||||
}
|
||||
}
|
||||
if !preservedLegacyID {
|
||||
rowID = allocateNextID()
|
||||
}
|
||||
}
|
||||
if migratedLegacyKey != "" && migratedLegacyKey != key {
|
||||
delete(lockData, migratedLegacyKey)
|
||||
rowID = allocateNextID()
|
||||
}
|
||||
lockData[key] = rowID
|
||||
}
|
||||
@@ -796,8 +781,6 @@ type headVisualeffectsPolicy struct {
|
||||
StripModelPrefixes []string
|
||||
KeyFormat string
|
||||
LabelFormat string
|
||||
LegacyGroups map[string]string
|
||||
LegacyKeyFormat string
|
||||
ModelColumn string
|
||||
RowDefaults map[string]string
|
||||
}
|
||||
@@ -858,22 +841,6 @@ func applyHeadVisualeffectsConfig(policy *headVisualeffectsPolicy, cfg project.H
|
||||
if strings.TrimSpace(cfg.LabelFormat) != "" {
|
||||
policy.LabelFormat = strings.TrimSpace(cfg.LabelFormat)
|
||||
}
|
||||
if len(cfg.LegacyGroups) > 0 {
|
||||
if policy.LegacyGroups == nil {
|
||||
policy.LegacyGroups = map[string]string{}
|
||||
}
|
||||
for legacyGroup, group := range cfg.LegacyGroups {
|
||||
legacyGroup = strings.TrimSpace(legacyGroup)
|
||||
group = strings.TrimSpace(group)
|
||||
if legacyGroup == "" || group == "" {
|
||||
continue
|
||||
}
|
||||
policy.LegacyGroups[legacyGroup] = group
|
||||
}
|
||||
}
|
||||
if strings.TrimSpace(cfg.LegacyKeyFormat) != "" {
|
||||
policy.LegacyKeyFormat = strings.TrimSpace(cfg.LegacyKeyFormat)
|
||||
}
|
||||
if strings.TrimSpace(cfg.ModelColumn) != "" {
|
||||
policy.ModelColumn = strings.TrimSpace(cfg.ModelColumn)
|
||||
}
|
||||
@@ -883,17 +850,18 @@ func applyHeadVisualeffectsConfig(policy *headVisualeffectsPolicy, cfg project.H
|
||||
func defaultHeadVisualeffectsPolicy() headVisualeffectsPolicy {
|
||||
return headVisualeffectsPolicy{
|
||||
Groups: map[string]headVisualeffectsGroupPolicy{
|
||||
"head_accessories": {Prefix: "headaccessory"},
|
||||
"head_decorations": {Prefix: "headdecoration"},
|
||||
"head_features": {Prefix: "headfeature"},
|
||||
"chestaccessory": {},
|
||||
"headaccessory": {},
|
||||
"headdecoration": {},
|
||||
"headfeature": {},
|
||||
},
|
||||
GroupTokenSource: "prefix",
|
||||
CategoryFrom: "none",
|
||||
Delimiter: "_",
|
||||
GroupTokenSource: "folder_name",
|
||||
CategoryFrom: "immediate_parent",
|
||||
Delimiter: "/",
|
||||
Case: "preserve",
|
||||
StripModelPrefixes: []string{"hfx_", "vfx_"},
|
||||
KeyFormat: "{dataset}:{prefix}_{stem}",
|
||||
LabelFormat: "{prefix}_{stem_upper}",
|
||||
StripModelPrefixes: []string{"hfx_", "tfx_", "vfx_", "cfx_"},
|
||||
KeyFormat: "{dataset}:{group}{delimiter}{category_segment}{stem}",
|
||||
LabelFormat: "{group}{delimiter}{category_segment}{stem}",
|
||||
ModelColumn: "Imp_HeadCon_Node",
|
||||
RowDefaults: map[string]string{
|
||||
"Type_FD": "D",
|
||||
@@ -939,7 +907,7 @@ func mergeStringMap(target map[string]string, source map[string]string) {
|
||||
}
|
||||
|
||||
func headVisualeffectIdentity(dataset string, entry autogenManifestEntry, policy headVisualeffectsPolicy) (string, string, string, headVisualeffectsGroupPolicy, bool) {
|
||||
entry = normalizeHeadVisualeffectEntry(entry, policy)
|
||||
entry = normalizeHeadVisualeffectEntry(entry)
|
||||
group, ok := policy.Groups[entry.Group]
|
||||
if !ok || strings.TrimSpace(entry.ModelStem) == "" {
|
||||
return "", "", "", headVisualeffectsGroupPolicy{}, false
|
||||
@@ -975,50 +943,12 @@ func headVisualeffectIdentity(dataset string, entry autogenManifestEntry, policy
|
||||
return key, label, modelStem, group, true
|
||||
}
|
||||
|
||||
func headVisualeffectLegacyKeys(dataset string, entry autogenManifestEntry, policy headVisualeffectsPolicy) []string {
|
||||
if strings.TrimSpace(policy.LegacyKeyFormat) == "" {
|
||||
return nil
|
||||
}
|
||||
entry = normalizeHeadVisualeffectEntry(entry, policy)
|
||||
group, ok := policy.Groups[entry.Group]
|
||||
if !ok || strings.TrimSpace(entry.ModelStem) == "" {
|
||||
return nil
|
||||
}
|
||||
modelStem := strings.TrimSpace(entry.ModelStem)
|
||||
stem := strings.TrimSpace(stripHeadVisualeffectModelPrefix(modelStem, policy))
|
||||
if stem == "" {
|
||||
return nil
|
||||
}
|
||||
groupToken := headVisualeffectGroupToken(entry.Group, group, policy)
|
||||
values := map[string]string{
|
||||
"dataset": dataset,
|
||||
"group": applyHeadVisualeffectCase(groupToken, policy),
|
||||
"group_raw": entry.Group,
|
||||
"prefix": applyHeadVisualeffectCase(group.Prefix, policy),
|
||||
"stem": applyHeadVisualeffectCase(stem, policy),
|
||||
"stem_upper": strings.ToUpper(stem),
|
||||
"model_stem": modelStem,
|
||||
"delimiter": policy.Delimiter,
|
||||
}
|
||||
legacyKey := strings.TrimSpace(expandHeadVisualeffectsFormat(policy.LegacyKeyFormat, values))
|
||||
if legacyKey == "" {
|
||||
return nil
|
||||
}
|
||||
return []string{legacyKey}
|
||||
}
|
||||
|
||||
func normalizeHeadVisualeffectEntry(entry autogenManifestEntry, policy headVisualeffectsPolicy) autogenManifestEntry {
|
||||
func normalizeHeadVisualeffectEntry(entry autogenManifestEntry) autogenManifestEntry {
|
||||
entry.Group = strings.TrimSpace(entry.Group)
|
||||
if mapped, ok := policy.LegacyGroups[entry.Group]; ok && strings.TrimSpace(mapped) != "" {
|
||||
entry.Group = strings.TrimSpace(mapped)
|
||||
}
|
||||
if strings.TrimSpace(entry.Group) == "" && strings.TrimSpace(entry.Source) != "" {
|
||||
parts := strings.Split(filepath.ToSlash(entry.Source), "/")
|
||||
if len(parts) > 1 {
|
||||
entry.Group = parts[0]
|
||||
if mapped, ok := policy.LegacyGroups[entry.Group]; ok && strings.TrimSpace(mapped) != "" {
|
||||
entry.Group = strings.TrimSpace(mapped)
|
||||
}
|
||||
}
|
||||
}
|
||||
if strings.TrimSpace(entry.Subgroup) == "" && strings.TrimSpace(entry.Source) != "" {
|
||||
@@ -1176,8 +1106,6 @@ func autogenHeadVisualeffectsConfigConfigured(cfg project.HeadVisualeffectsConfi
|
||||
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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user