Now correctly replaces NPC materials with shader materials
Now correctly assigns NPC textures to shader materials
Since NPCs don't have/use shadow ramps, shadow ramps are DISABLED (value set to 0) on setup if:
The NPC's original material names does not have Avatar in it (this is how we determine if whether it's an NPC or Playable Character)
No shadow ramp assets are found in the same directory as the other textures
📝Changes that are unrelated to NPC Support
Refactored texture importing
Add fake users to all shader materials that are imported
Added some TODOs to look into later
🛠️ 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).
📝Changes related to NPC Support
0
) on setup if:Avatar
in it (this is how we determine if whether it's an NPC or Playable Character)📝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 aGenshinAvatarTextureImporter
orGenshinNPCTextureImporter
because both of those classes inherit fromGenshinTextureImporter
, which has theimport_textures
method that is called inGI_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 ofGenshinTextureImporter
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).