KK-Blender-Porter-Pack
KK-Blender-Porter-Pack copied to clipboard
Duplicate materials are exported despite having the same properties and colors.
I Made my own plugin to export all the materials from the game as .mat since i found the shaders that koikatsu uses
The way your plugin works with materials is a bit annoying, if theres two objects that have the same material name and the same data, the plugin still makes two separate materials. I fixed this in my code by using the following
if (File.Exists(($"{InputDirMain}{CharacterName}\\{MatName} Assigned.mat")))
{
Logger.LogMessage($"{MatName} Already Exists! Checking if we should skip or make a new one");
if (Text == File.ReadAllText(($"{InputDirMain}{CharacterName}\\{MatName} Assigned.mat")))
{
Logger.LogMessage($"{MatName} Has the same data as the material we are checking, Skipping!");
continue;
}
Logger.LogMessage($"{MatName} Does not have the same data as the material we are checking, Writing a new one!");
File.WriteAllText($"{InputDirMain}{CharacterName}\\{MatName}_{MM.GetInstanceID()} Assigned.mat", Text);
continue;
}
//first instance
File.WriteAllText($"{InputDirMain}{CharacterName}\\{MatName} Assigned.mat", Text);````
Text is the entire .mat file as a string, its comparing the newest one with the same name to the one that is already saved. if its the same, it skips it, if not, it creates a new one. Also a discord from either of you would be greatly appreciated, submitting small issues like this is really tedious tbh.
This is a good idea because I imagine putting the same values in each material must be tedious, but to add this code to the exporter would break some existing logic. I think it might be possible to add this functionality to the KKBP blender plugin.
For example:
Check if the material name is the same (Excluding ID) in the MaterialData.json
then check if the string is the same for that material entry, if same then merge and rename mat, etc...
@MediaMoots Could you add me on discord by any chance? i have alot more of these smaller issues and i dont want to keep making issues xD, i'm ApretureLabs001#3562
This is a good idea because I imagine putting the same values in each material must be tedious, but to add this code to the exporter would break some existing logic. I think it might be possible to add this functionality to the KKBP blender plugin.
For example: Check if the material name is the same (Excluding ID) in the
MaterialData.json
then check if the string is the same for that material entry, if same then merge and rename mat, etc...
Or alternately, do the check in game by seeing if the materials are actually different, and if it is, Rename the actual material. I will implement this into my code to see if it works or if it messes anything up since the way I have for checking if materials are the same is pretty good so far.
Only problem is to implement the actual changes, I would need the source code for the actual exporter plugin, which is not included, is there any way I can get ahold of it?
This is a good idea because I imagine putting the same values in each material must be tedious, but to add this code to the exporter would break some existing logic. I think it might be possible to add this functionality to the KKBP blender plugin. For example: Check if the material name is the same (Excluding ID) in the
MaterialData.json
then check if the string is the same for that material entry, if same then merge and rename mat, etc...Or alternately, do the check in game by seeing if the materials are actually different, and if it is, Rename the actual material. I will implement this into my code to see if it works or if it messes anything up since the way I have for checking if materials are the same is pretty good so far.
Only problem is to implement the actual changes, I would need the source code for the actual exporter plugin, which is not included, is there any way I can get ahold of it?
actually that wont work, i guess checking the json is the best option