The text can be anywhere in the filename, or directory path. It gets list of all portraits, then checks against their file path for the following to shrink the list down. If any of these shrinks the list to 0, it disregards the results and uses the prior list. So like, if Sex returns 0, then it returns back the full list. That's why you don't see Female in any of them. The search is case insensitive.
- Sex - It starts off looking for female/male, which seems flawed to me. Any file with female will be matched by search for male. I think this code needs to be updated to exclude female when searching for male. I think that's why the current packs in here are female only. I could tweak this so it checks for male/futanari, and if not present, it assumes female? I think this would work better.
- Age - If age is Teen or Child, then it searches for Loli. Not however, it does not exclude Loli from adult. Could be updated to also exclude Loli from adult, or function in some more advanced way. I'm open to suggestions to tweaking my mod version of it.
- Race - Searches for race, It removes the space from Halfkin and Beastkin, so it matches on HalfkinCat BeastkinCat, etc. It treats Halfkin* and Beastkin* separately.
- Hair - Searches for hair color
Lastly, it checks if there is a matching Body image. It basically wants an identically named file in the Bodies folder, and if so, then it sets the body image to that as well.
Note since it searches the entire path, if you name multiple races, etc. then a file can match for multiple. Maybe useful if you think one applies to multiple.
Edit - Using this further and thinking about it, it really bothers me it doesn't filter by Race first. When it filters on sex/age first, the entire race section can be excluded before it gets to it, so you get a lot with the wrong race and that bothers me more than other mismatches.
In the packs in here, there's only 2 male files, so if it's a male, suddenly it'll get a dragonkin portrait/body. I almost prefer that if it can't find a male portrait for appropriate race, it doesn't set one at all. So I'm going to tweak this to specifically want male and not female in a file if it's a male, and if it can't find any, it doesn't apply. futanari will fallback to unspecified still.
Then it filters too harshly on Age i think. If it's teen/child, it suddenly limits itself greatly. I think it'll be better if it excludes Adult for Teen, and for Adult, excludes Loli. Avoids big mismatches.