ee-modders / cem-tool Goto Github PK
View Code? Open in Web Editor NEWTools for converting and modding Empire Earth 1 CEM files
License: GNU General Public License v3.0
Tools for converting and modding Empire Earth 1 CEM files
License: GNU General Public License v3.0
I'm interested in how the .cem format works, perhaps trying to decode animations (which are not covered at the moment, if I understand correctly). Is the format documented somewhere?
The error message when the object numbers are not sequential / otherwise incorrect is not very descriptive. If possible, please add a line to the error message that helps the user to make the necessary changes.
for example, ‘Object numbers must be sequential, starting with 1 and with no gaps’
Is it possible to add an error message when ‘accept all transformations’ has not been applied to all of the objects?
One way to implement it would be to look at the origin position and scale of each object and make sure they all say 0.
If not possible, never mind.
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:
### add UV coords
for p, polygon in enumerate(main_mesh.polygons):
for i, index in enumerate(polygon.loop_indices):
#print("FACE:", faces[p][i])
#print("TEXTURE UV:", texture_uvs[faces[p][i]] )
#print("INDEX:", index)
main_mesh.uv_layers[0].data[index].uv = texture_uvs[mat_vertex_offset : mat_vertex_offset + mat_vertex_count][faces[p][i]]
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":
### add UV coords
vertex_list = [polygon.vertices for polygon in main_mesh.polygons]
for p, polygon in enumerate(main_mesh.polygons):
for i, index in enumerate(polygon.loop_indices):
#print("FACE:", faces[p][i])
#print("TEXTURE UV:", texture_uvs[faces[p][i]] )
#print("INDEX:", index)
main_mesh.uv_layers[0].data[index].uv = texture_uvs[mat_vertex_offset : mat_vertex_offset + mat_vertex_count][vertex_list[p][i]]
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!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.