Closed Serpenthalis closed 1 month ago
First of all thank you very much for this good report, I really appreciate it!
However I think your fix is caused by a small misunderstanding on how the faces layout works in CEM v2 and the result you are getting ends up with an incorrect import.
What should actually fix this issue is to disable the validate vertex option in the import settings:
The problem is that the original CEM files are using floats which Blender deems "invalid" and they get removed by the validator. That causes the vertex index array to get shifted which then messes everything up.
EDIT: yes you are right that there have not been updates in a long time, but this plugin is mostly "done" and working. Yes there could be some improvements made, which we will do in the future.
Also the code is not great, it is quite a hackjob.
Hi! :) I think I spotted a bug in the CEM-tool plugin for Blender in version 0.25 regarding UV maps and can even provide a fix for it: If you import Empire Earth cem-files into Blender using the CEM-tool plugin in version 0.25 you get mostly good results in regards to the UV maps, but not every time. Mostly cavalry units are prone to having messed up UVs after importing. I think I was able to track down the bug:
Somewhere after line 460 of the CEMimporter.py you have the following section:
I don't fully understand what the plugin does, but I will do my best to explain the bug. The bug seems to be in the last line when we access "faces[p][i]". I think the current code assumes that the content of "faces" (a list of coordinates basically) is equal to the list of vertices of the polygons in main_mesh. Which is mostly the case, but not quite in case of some units like cavalry! I tested it with the Sargon of Akkad hero unit and there are two entries missing in the "faces" list. This throws off the script as soon as it reaches the point when the lists diverge. Again, without understanding what the script actually does, my fix was to not use the "faces" list at all and simply access the vertices directly by saving them into their own list and accessing that list in the loop instead of "faces":
After implementing this little trick the UVs of Sargon of Akkad are no longer messed up and from what I've seen it should have fixed the issues for the other units as well. I know it's been like three years since the last commit to this, but still, I wanted to make you aware of the bug and provide a possible solution. Thanks for this tool, it has been really helpful!