michael-gh1 / Addons-And-Tools-For-Blender-miHoYo-Shaders

Blender Addons and Tools for streamlining the character model setup when using HoYoverse Shaders.
GNU General Public License v3.0
197 stars 11 forks source link

feat: initial Setup Wizard NPC support #34

Closed michael-gh1 closed 1 year ago

michael-gh1 commented 1 year ago

📝Changes related to NPC Support

📝Changes that are unrelated to NPC Support

🛠️ Misc. Nerdy Notes

NPC textures are named differently then Avatar (playable characters) textures and so there is a class for each. The factory pattern is leveraged to create a GenshinTextureImporter. It doesn't matter whether it returns a GenshinAvatarTextureImporter or GenshinNPCTextureImporter because both of those classes inherit from GenshinTextureImporter, which has the import_textures method that is called in GI_OT_GenshinImportTextures.execute().

This will allow us to keep the classes open to extension should we need to add another type of texture importing (such as importing textures for Monsters). In simpler terms, we can make a GenshinMonsterTextureImporter later on down the line.

These classes could be condensed into one class where we pass the texture identifiers (such as in GenshinNPCTextureImporter), but for now, I think it's fine to leave it as is. The trade-off is having the ability to have custom logic for each type of GenshinTextureImporter vs. the ability to not have to write "new" code when adding a new type (we could just pass in a dictionary of texture identifiers for each type).

texture_identifiers = {
  "Hair_Diffuse": ["Hair", "Diffuse"],
  "Hair_Lightmap": ["Hair", "Lightmap"]
}