This tutorial will show you how to convert a .m3 file exported from SC2Editor to .xml and edit it. Since the reason why I made it is that somebody asked me how to change an effect color, I'm also highlighting the relevant fields for that task used by effect models (particles, materials and lights - And now I've realized that I've missed the ribbons -).
I've splitted it in 17 steps, but the relevants are the last 7. At the end of the post you'll find an image that might help you if you're stuck in a step.
step 1: Get blender (I use 2.69 , but I believe that println's addon works with any version).
step 6: Copy m3addon-master folder from the addon to blender folder under (version)/scripts/addons. Keep another copy of the folder at hand, you'll need it.
step 7: Open blender and go to file -> user preferences. Write m3 in the search bar, and mark Import-Export: Importer and exporter for Blizzard's Starcraft 2 model files (*.m3).
step 8: Go to file and click on save startup file (to avoid having to configure the addon every time you open blender).
step 9: Go to file -> import -> starcraft 2 Model (.m3) and search for your model.
step 10: Search for the scene icon on the bar at the right. You should find the sections M3 Particle Systems, M3 Materials layers (this one changes when the materials are selected in the M3 Materials section) and M3 lights. Those are the ones that generally have fixed colors.
Well, you thought that you only have to change the materials and export the models back? Well, not. blender messes with the particle systems when reexported. You'll have to edit an xml file.
step 11: Run cmd and enter into the folder you've saved in step 6. The only files needed are the ones in the screenshot. With those you're ok.
step 12: Run m3toxml.py (name of the model). It will convert it to xml
step 13: Open the xml and search for the texts:
For Lights: lightColor
For particles: InitialColor1 InitialColor2 MiddleColor1 MiddleColor2 FinalColor1 FinalColor2. The particles are in the same order that they appear in blender, so follow it and you'll know what to edit.
For materials: search for the name of the material with the colored layer, and under it for the corresponding layer.
step 14: Replace the colors for the ones you like. To find out which is the color code, modify the model with blender, export it with other name, convert it to xml and copy the code that appears where you made the modification.
step 15: Save.
step 16: run xmltom3.py (name of the model.xml) over the xml file.
Thanks for the tutorial! It's very helpful for swapping textures of existing models (export, re-name file, change texture paths to custom ones, re-import, profit!) Beats Select Texture by ID anyday!
Fair warning, though: not all models work with this method. Sometimes you can't open it in Blender, but at least converting it to xml works (or vice versa). Sometimes nothing works.
As a rule of thumb, anything made since Legacy of the Void isn't always compatible.
Still, if you don't have 3DS Max and the official plug-in, this is the best way of editing models.
Another subject, in the model Robotics Facility do u know how to fix the deformation textures in the run scene?
If u did will be nice to u give us a tip. (I’m trying to make a robotics facility Dark and Warp Robotics facility Dark.) I will try to get the gateway sphere and replace it for the pentagon’s sphere in Robotics Facility.
I can not show u a picture becouse (An error has occurred while trying to save the file you uploaded: You have exceeded your maximum upload limit of 4.77 MB. This limit is based on your highest role on the site.)
But hope u be aware of the textures deformation after exported.
After roboticsFacility.m3 is imported in Blender 2.69 using the last updated scripts. The model is presenting some discrepancies in the scene execution.
Scene>m3 animation sequences> stand. And the sequences below.
For this matter I hide the other objects to see the clean body of the model. After u do that,, u will find out what I mean.
And the reason I ask you, because probable u found already how to fix this before.
If not is ok, I will keep trying. To fix this Issue.
I did in Protoss Birth. But here is different.
The import script works fine, of course not 100% perfect but is the best option at the moment.
My question is,,, if you are familiar to this specific model (roboticsFacility.m3 ) problem.
I’m new in Blender and I been doing good progress in Blender but I just cannot go this far.
As a civil engineer and I´m really familiar to AutoCAD and 3D Max but never really modelling.
We just dress walls and decorate things in our projects.
Oh, that's what I was saying in the first post. Blender messes with the particle systems. If you have experience with 3dMax, I recommend you to use it, since is the official modelling program.
I see that the mesh deforms too, that's because there are a couple of vertexes incorrectly glued.
Check out the vertex groups in edit mode. Select only Bldg_Protoss_RoboticsFacility_09_L and Bldg_Protoss_RoboticsFacility_08_L and duplicate them (ctrl +d). Then replace the originals with the duplicates. They should not be glued anymore.
Ok, Left arm ready and Hex ready was a nightmare of work to fix each Hex, took me almost 4 Hrs.
I must keep going now with some attached Vertex in pulse. If u know what and where is the problem let me know, for now I’m searching. And after that will be ready.
Another problem to be fixed is the Decal in Robotics Facility Support Bay and in the Pylon Xp Reward. I’m using Blender. Hope u know too how to work this out.
All this is for my A.I. Mode 6 years working slowly on it.
And all this is because the decal and textures Units, Effects, Buttons. All have to be done in the best quality I can. AI Zerg’s change on depending using player race, Protoss,,,, and Terran can be black ops as well. On time to time playing all original SC2 units existing will be on the game screen of curse just for AI. And do not any Dependencies attached just the basics.
A.I will be always the bad girl, and user the hero. User With his basic units have not time to play and research all, in multiplayer u are done in from 15 to 20 minutes.
My Mode Include a menu options before start and can be played in 3 ways Liberty and all will be Liberty. Swarm and all will be updated, And Void as well. All controlled by Requirements, a lot of work. [Or can be removed by Galaxy and it go straight in to Void.]
I been working in Galaxy Editor, Galaxy Libs, Galaxy Scripting, All units are not using AI Think, are using XML Tactical, is more effective and fast.
Mod Status Custom Data [5456] Plus Galaxy Libs [4675] Lines in Booleans and functions.
Not any modifications to the Original, Just Interacting, and following the scripts game.
Example if 2 Carriers, then build a Carrier Boss.
If 6 Siege Tanks; call down 2 Shock Division siege tanks.
If second town create a Nydus Worm Canal, If in Battle and WarpPrism open, use it for warp the units. Ect.
My last thing doing alone is the Models, puff I´m really bad for that, and with the textures, I’m worse. But slowly, slowly; I´m almost ready.
My plan is to player have another alternative and not just [Allied Commanders Mode]
All is there and used by my A.I. Left 2 Die Zerg’s, Black Ops Terran, and much more.
And of curse following all SC2 as Original be possible.
Shame I have no clue on how to embed images in this new setup (and it won't allow me to upload anything :D)
So yea, super useful, thanks again!
EDIT: This said, looks like I can't convert hybrid nemesis death model from xml back to m3. :/
"File "F:\m3\xmlToM3.py", line 218, in <module> convertFile(filePath, outputDirectory) File "F:\m3\xmlToM3.py", line 166, in convertFile doc = xml.dom.minidom.parse(inputFilePath) File "C:\Users\PC\AppData\Local\Programs\Python\Python36\lib\xml\dom\minidom.py", line 1958, in parse return expatbuilder.parse(file) File "C:\Users\PC\AppData\Local\Programs\Python\Python36\lib\xml\dom\expatbuilder.py", line 911, in parse result = builder.parseFile(fp) File "C:\Users\PC\AppData\Local\Programs\Python\Python36\lib\xml\dom\expatbuilder.py", line 207, in parseFile parser.Parse(buffer, 0) xml.parsers.expat.ExpatError: not well-formed (invalid token): line 156336, column 31"
That's easy to solve. It happens because the names of the materials sometimes have some issues.
"xml.parsers.expat.ExpatError: not well-formed (invalid token): line 156336, column 31" means that the converter didn't understand the character 31 in the line 156.336. You can just remove it or replace it with another.
EDIT: I'm giving this tutorial some love
This tutorial will show you how to convert a .m3 file exported from SC2Editor to .xml and edit it. Since the reason why I made it is that somebody asked me how to change an effect color, I'm also highlighting the relevant fields for that task used by effect models (particles, materials and lights - And now I've realized that I've missed the ribbons -).
I've splitted it in 17 steps, but the relevants are the last 7. At the end of the post you'll find an image that might help you if you're stuck in a step.
step 1: Get blender (I use 2.69 , but I believe that println's addon works with any version).
step 2: Get println's addon.
step 3: Get python.
step 4: Install blender.
step 5: Install python.
step 6: Copy m3addon-master folder from the addon to blender folder under (version)/scripts/addons. Keep another copy of the folder at hand, you'll need it.
step 7: Open blender and go to file -> user preferences. Write m3 in the search bar, and mark Import-Export: Importer and exporter for Blizzard's Starcraft 2 model files (*.m3).
step 8: Go to file and click on save startup file (to avoid having to configure the addon every time you open blender).
step 9: Go to file -> import -> starcraft 2 Model (.m3) and search for your model.
step 10: Search for the scene icon on the bar at the right. You should find the sections M3 Particle Systems, M3 Materials layers (this one changes when the materials are selected in the M3 Materials section) and M3 lights. Those are the ones that generally have fixed colors.
Well, you thought that you only have to change the materials and export the models back? Well, not. blender messes with the particle systems when reexported. You'll have to edit an xml file.
step 11: Run cmd and enter into the folder you've saved in step 6. The only files needed are the ones in the screenshot. With those you're ok.
step 12: Run m3toxml.py (name of the model). It will convert it to xml
step 13: Open the xml and search for the texts:
For Lights: lightColor
For particles: InitialColor1 InitialColor2 MiddleColor1 MiddleColor2 FinalColor1 FinalColor2. The particles are in the same order that they appear in blender, so follow it and you'll know what to edit.
For materials: search for the name of the material with the colored layer, and under it for the corresponding layer.
step 14: Replace the colors for the ones you like. To find out which is the color code, modify the model with blender, export it with other name, convert it to xml and copy the code that appears where you made the modification.
step 15: Save.
step 16: run xmltom3.py (name of the model.xml) over the xml file.
step 17: profit.
Check out my kitbashes! Custom Campaign Initiative: Lots of great Custom Campaigns!! Check out and Support!!
Thank you! I've been trying to figure this out for a while now.
Custom Campaign Initiative | Mapster Community Project: Data Wizards
Starcraft II: Unsung Rebels, a custom campaign for Starcraft II
SC2Saver, a way to create saved games via trigger
Frustrated with the editor and would like answers in real time? Join the SC2Mapster Discord!
Thanks for the tutorial! It's very helpful for swapping textures of existing models (export, re-name file, change texture paths to custom ones, re-import, profit!) Beats Select Texture by ID anyday!
Fair warning, though: not all models work with this method. Sometimes you can't open it in Blender, but at least converting it to xml works (or vice versa). Sometimes nothing works.
As a rule of thumb, anything made since Legacy of the Void isn't always compatible.
Still, if you don't have 3DS Max and the official plug-in, this is the best way of editing models.
You're both welcome.
I forgot to add the structures.xml file that i've edited. It supports several new models. I'll do it tomorrow.
Also, if the converter throws an error, share it here. It's not very possible, but I might know how to fix it.
Edit: Link to structures.xml
Check out my kitbashes! Custom Campaign Initiative: Lots of great Custom Campaigns!! Check out and Support!!
Link doesn't work for me, can you try to upload it somewhere else please?
It was waiting for aproval. It should work now.
Check out my kitbashes! Custom Campaign Initiative: Lots of great Custom Campaigns!! Check out and Support!!
Custom Campaign Initiative | Mapster Community Project: Data Wizards
Starcraft II: Unsung Rebels, a custom campaign for Starcraft II
SC2Saver, a way to create saved games via trigger
Frustrated with the editor and would like answers in real time? Join the SC2Mapster Discord!
Is there also a file like this that adds more units for importing?
I still am unable to import a Warp Prism correctly, and I've seen remakes of it on this site.
Custom Campaign Initiative
I've just tested importing WarpPrism.m3 with the uploaded structures.xml file and it worked fine.
Check out my kitbashes! Custom Campaign Initiative: Lots of great Custom Campaigns!! Check out and Support!!
Thank u for your tutorial.
Really helpful, and great tool.
Another subject, in the model Robotics Facility do u know how to fix the deformation textures in the run scene?
If u did will be nice to u give us a tip. (I’m trying to make a robotics facility Dark and Warp Robotics facility Dark.) I will try to get the gateway sphere and replace it for the pentagon’s sphere in Robotics Facility.
I can not show u a picture becouse (An error has occurred while trying to save the file you uploaded: You have exceeded your maximum upload limit of 4.77 MB. This limit is based on your highest role on the site.)
But hope u be aware of the textures deformation after exported.
I don't understand the problem
Check out my kitbashes! Custom Campaign Initiative: Lots of great Custom Campaigns!! Check out and Support!!
OK, more specific.
After roboticsFacility.m3 is imported in Blender 2.69 using the last updated scripts. The model is presenting some discrepancies in the scene execution.
Scene>m3 animation sequences> stand. And the sequences below.
For this matter I hide the other objects to see the clean body of the model. After u do that,, u will find out what I mean.
And the reason I ask you, because probable u found already how to fix this before.
If not is ok, I will keep trying. To fix this Issue.
I did in Protoss Birth. But here is different.
The import script works fine, of course not 100% perfect but is the best option at the moment.
My question is,,, if you are familiar to this specific model (roboticsFacility.m3 ) problem.
I’m new in Blender and I been doing good progress in Blender but I just cannot go this far.
As a civil engineer and I´m really familiar to AutoCAD and 3D Max but never really modelling.
We just dress walls and decorate things in our projects.
Gracias.
Oh, that's what I was saying in the first post. Blender messes with the particle systems. If you have experience with 3dMax, I recommend you to use it, since is the official modelling program.
I see that the mesh deforms too, that's because there are a couple of vertexes incorrectly glued.
Check out the vertex groups in edit mode. Select only Bldg_Protoss_RoboticsFacility_09_L and Bldg_Protoss_RoboticsFacility_08_L and duplicate them (ctrl +d). Then replace the originals with the duplicates. They should not be glued anymore.
Check out my kitbashes! Custom Campaign Initiative: Lots of great Custom Campaigns!! Check out and Support!!
Ok, I will try, with blender.
The problem with 3d Max is; the updated scripts are too far to reach the performance importing with Blend.
It do not even give me the scenes. All is missing. But again I will try with Blender.
After fixe that. I will try to exchange the sphere of Gateway. And put inside of the Robotics facility and create a new FacilityWarp.
Thanks
Looks like I will need more hours in Blender. I just can not make it. / :
I tried but the duplicated come with the same error.
Or probable ( Not,,, Not probable. I,m doing something wrong.)
Plus I see that the mesh of the sphere deforms too. So I will keep trying and let u know.
But thank u, at list I know where the solution of the problem is.
Ok, Left arm ready and Hex ready was a nightmare of work to fix each Hex, took me almost 4 Hrs.
I must keep going now with some attached Vertex in pulse. If u know what and where is the problem let me know, for now I’m searching. And after that will be ready.
Another problem to be fixed is the Decal in Robotics Facility Support Bay and in the Pylon Xp Reward. I’m using Blender. Hope u know too how to work this out.
All this is for my A.I. Mode 6 years working slowly on it.
And all this is because the decal and textures Units, Effects, Buttons. All have to be done in the best quality I can. AI Zerg’s change on depending using player race, Protoss,,,, and Terran can be black ops as well. On time to time playing all original SC2 units existing will be on the game screen of curse just for AI. And do not any Dependencies attached just the basics.
A.I will be always the bad girl, and user the hero. User With his basic units have not time to play and research all, in multiplayer u are done in from 15 to 20 minutes.
My Mode Include a menu options before start and can be played in 3 ways Liberty and all will be Liberty. Swarm and all will be updated, And Void as well. All controlled by Requirements, a lot of work. [Or can be removed by Galaxy and it go straight in to Void.]
I been working in Galaxy Editor, Galaxy Libs, Galaxy Scripting, All units are not using AI Think, are using XML Tactical, is more effective and fast.
Mod Status Custom Data [5456] Plus Galaxy Libs [4675] Lines in Booleans and functions.
Not any modifications to the Original, Just Interacting, and following the scripts game.
Example if 2 Carriers, then build a Carrier Boss.
If 6 Siege Tanks; call down 2 Shock Division siege tanks.
If second town create a Nydus Worm Canal, If in Battle and WarpPrism open, use it for warp the units. Ect.
My last thing doing alone is the Models, puff I´m really bad for that, and with the textures, I’m worse. But slowly, slowly; I´m almost ready.
My plan is to player have another alternative and not just [Allied Commanders Mode]
All is there and used by my A.I. Left 2 Die Zerg’s, Black Ops Terran, and much more.
And of curse following all SC2 as Original be possible.
Now u know what I´m doing.
Upss, and forgot to say thank u for ur last info u gave me.
Heya there. I just wanted to drop by and say that this is godsend. Time and time again I come back to use this method to retexture things.
This is my latest adventure -> https://ibb.co/hV6GkF
Shame I have no clue on how to embed images in this new setup (and it won't allow me to upload anything :D)
So yea, super useful, thanks again!
EDIT: This said, looks like I can't convert hybrid nemesis death model from xml back to m3. :/
"File "F:\m3\xmlToM3.py", line 218, in <module> convertFile(filePath, outputDirectory)
File "F:\m3\xmlToM3.py", line 166, in convertFile doc = xml.dom.minidom.parse(inputFilePath)
File "C:\Users\PC\AppData\Local\Programs\Python\Python36\lib\xml\dom\minidom.py", line 1958, in parse
return expatbuilder.parse(file)
File "C:\Users\PC\AppData\Local\Programs\Python\Python36\lib\xml\dom\expatbuilder.py", line 911, in parse
result = builder.parseFile(fp)
File "C:\Users\PC\AppData\Local\Programs\Python\Python36\lib\xml\dom\expatbuilder.py", line 207, in parseFile
parser.Parse(buffer, 0)
xml.parsers.expat.ExpatError: not well-formed (invalid token): line 156336, column 31"
That's easy to solve. It happens because the names of the materials sometimes have some issues.
"xml.parsers.expat.ExpatError: not well-formed (invalid token): line 156336, column 31" means that the converter didn't understand the character 31 in the line 156.336. You can just remove it or replace it with another.
Check out my kitbashes! Custom Campaign Initiative: Lots of great Custom Campaigns!! Check out and Support!!
Worked perfectly, tyvm!