I fixed the 90 degree rotation bug. The big file size comes from some missing optimizations. The current implementation exports rotation, scale and location data of bones for all animations for all frames. Key frames don't get exported as they defined by the user since the m3 format supports only linear interpolations. By generating a key frame at each frame it's possible to simulate other curves. A possible opimization for the future would be to omit all key frames which can be calculated by linear interpolation. That should reduce the file size drasticly. Since this optimization is another source for wrong animations I don't want to implement them right now.
I am not sure what you mean with that animation duplicates. But the collosi has per default a lot of walk animations.
My bad with the duplication when i compared the two models the list just increased without clearing itself. So by opening the model and removing it will cause the list be become huge.
I let you know if i find any thing else.
off topic
I have another question how did you start building this plugin. Cause I want to make a plugin for Skyrim that can handle like animations add the most important the collision with is pretty hard to make in nifscope and the animations are an own file so its gonna get hard to make. but i think i can do it :D . But firs i make it simple, probably import.
I assume that you have taken a look at some other scrips and plugins.
Any tips would be appreciated.
I first started writing the m3 library and noticed that I would be better of generating them from a XML file. Then I started the importer, which I later used to verify the exporter.
I get how you did it but now I'm stuck
I successfully made the init.py and it was pretty easy.
I have tried to analyze the nif files but its hard to get its structure if you get my point.(binary)
the header was easy to figure out look like this
Gamebryo File Format, Version 20.2.0.7
Then some binary data containing version, endian type, user version = 12, number of blocks, user version 2 = 83, and a lot of other information such as strings and creator
I know the "user version" cause else creation kit freaks out and crashes. Nifscope tells me this values as well, but only when i open a skyrim model
any tips on how to get the valuable information. And how did you do?
I will check the nif.xml that comes with nifscope
What you want to do is called reverse engeneering. You could use that terms for a google search. I didn't need to reverse engeneer the m3 model format, since other people did that already. Credits for figuring out the m3 format go to the people I mention in the structures.xml file.
For questions about how to make a blender addon I suggest you search and ask in a blender related forum.
Grate work :)
I started decoding the nif file format and found it easier than I thought, Till i decoded the Vector3 look like the following (Using hex editor and nifscope)
It's kinda hard to solve when you don't find anything useful in nif.xml
I believe the last byte is some sort of constant... but i don't see a pattern in it though :( (The first two bytes)
Is there a way we can get some simple EXE application to change the textures of M3 using your M3 to XML coding then converting backto M3? Like Warcraft 3 had a simple tool called MDX Pather where you open the model and change the texture names. I mean not everone wants to install Python and let's say the solution is using the Blender zip version that supports python - this Blender is so annoyingly a mess if you're used to Milkshape/3ds max older which were similar in look, that I'm not gonna use it in a million years. 3ds max is way more easier to do anything but using a whole program to rename textures ... n/c
Anyway how do I use the script with Blender to convert to XML? What command, the same won't work? If I pasted the M3toXml code in Text Editor and Run Script it gives me an error, so from Python Console idk how to make it work as I am not sure the script is even installed although I click 'Install Add-On' for the M3 to XML and vice-versa
Not everyone is a coder who understands python and what not... hope the day will come when there will be user-made tools (applications not codes or plugins for 3dsmax/blender) because this is what makes the modelling experience so horrible compared to that of war3 - the lack of tools, you need to have 3ds max, blender, python just to do a simple texture rename within the model damn it..
I am not sure if you know it already or not: There is also a python script for converting the xml file back to the m3 format.
I am not sure what speaks against installing python 3. It's btw also very usefull as a calculator.
About a rename tool: I would help another programmer to get started making it, but I don't currently want to spend my rare free time on making a rename tool since it can easily be done trough editing the xml file.
Here is a starting point for a rename python tool, this script allows you to change the file path of the diffuse layer of the first material:
importsysfromgenerateM3LibraryimportgenerateM3LibrarygenerateM3Library()# uses the structure.xml file to generate the m3.py fileimportm3fileName=sys.argv[1]# first argument (argv[0] is the script path)model=m3.loadModel(fileName)oldPath=model.standardMaterials[0].diffuseLayer[0].imagePath;print("Diffuse of material 1 was %s"%oldPath)print("Please enter the new path:")newPath=sys.stdin.readline().strip()model.standardMaterials[0].diffuseLayer[0].imagePath=newPathm3.saveAndInvalidateModel(model,fileName)
About an exe file: Most parts of the m3 python library generator can be reused for genertors that generate an m3 library for other languages.
So if someone wants to make an m3 library for another language, feel free to contact me as well.
Ok since I have no other choice atm and for hours I couldn't do, how do I use that repositionary in Blender? If I clicked install on your two XML<->M3 scripts to install all they do is appear on the Roaming\Blender Foundation\Scripts\Addons\ folder and in Add-oNs list in blender - No such Addon in the list. Only see some Import-Export Blizzard M3 among the list of Add-Ons not any XML ones.
In Python console? What commands? I dont think am doing anything when it cannot even recognize there is such script. Also what do you mean by 'Clone the repositionary' copy+paste?
@Eimtr: Go
With clone I meant that you use git to download the files. Git is a version control system. For Windows I would recommend the TortoiseGit. After installation you can use the context menu of the explorer to clone/download the m3addon. When you select then clone in the git sub menu of the explorer you have to enter an git url. The url for the m3addon is "git://github.com/flo/m3addon.git".
You can also simply click "ZIP" on https://github.com/flo/m3addon if you want to download all files as zip archive, but I recommen using git since it allows to stay a.) up to date and b.) share your changes to the m3addon with other developers.
You can call the scripts from the normal cmd command line like this:
The first command converts the model path\To\Model.m3 into the xml file path\To\Model.m3.xml, the second command overrides the m3 file with the content from the xml file.
If you want to use the Blender addon you have to place the complete m3addon directory into the addon path of blender. On Windows it is:
The folder is there yes.. did it. XML scripts do not appear anywhere in the list of Add-Ons. The only ones in the list are Blizzard M3 Import that doesn't work anymore and the newer Import and Export that imports a model without textures. So I can't run the scrips from Blender.
Ok nevermind Blender deleted it. I installed Python 3 for X64 - I did the command from CMD like C:\UserName\Desktop\from Where The M3toXML is located>m3ToXml.m3 (the location where the M3 is aka on Desktop)
And still I don't see an XML anywhere... It created some folder in the folder where the script is:
Generally I would appreciate if someone did this 2-3 minute job for me to convert to XML and after I modify the texture names - back to M3 because I can't continue working on the model if I cannot use the textures..
If you have another Python version installed, I suggest that you uninstall it first before installing the Python version from the link above (which is for 64 bit systems which I assume you use). It would also be nice to know which python version didn't work.
I've not installed Python before and I use 3.2.3 version with win 7 Home Premium x64 bit. I noticed not only m3ToXML but also xmlToM3 shows the same error and no matter what paths and locations I use.. I would've done it ages ago if this was the case but since it will take so much time to convert 2 files to xml then to m3 after I modify them, I will have to look for other ways.
This script clearly isn't set right because I do not have problems with anything else running fine so my PC being a mess - there is no such thing
I can think of one more reason why it doesn't work. Maybe it's wrongly configured how python scripts get executed.
To bypass this you could call the script like this:
@chaos2night: Go
I fixed the 90 degree rotation bug. The big file size comes from some missing optimizations. The current implementation exports rotation, scale and location data of bones for all animations for all frames. Key frames don't get exported as they defined by the user since the m3 format supports only linear interpolations. By generating a key frame at each frame it's possible to simulate other curves. A possible opimization for the future would be to omit all key frames which can be calculated by linear interpolation. That should reduce the file size drasticly. Since this optimization is another source for wrong animations I don't want to implement them right now.
I am not sure what you mean with that animation duplicates. But the collosi has per default a lot of walk animations.
@println: Go
My bad with the duplication when i compared the two models the list just increased without clearing itself. So by opening the model and removing it will cause the list be become huge.
I let you know if i find any thing else.
off topic
I have another question how did you start building this plugin. Cause I want to make a plugin for Skyrim that can handle like animations add the most important the collision with is pretty hard to make in nifscope and the animations are an own file so its gonna get hard to make. but i think i can do it :D . But firs i make it simple, probably import.
I assume that you have taken a look at some other scrips and plugins.
Any tips would be appreciated.
@chaos2night: Go
I first started writing the m3 library and noticed that I would be better of generating them from a XML file. Then I started the importer, which I later used to verify the exporter.
I get how you did it but now I'm stuck
I successfully made the init.py and it was pretty easy.
I have tried to analyze the nif files but its hard to get its structure if you get my point.(binary)
the header was easy to figure out look like this
Gamebryo File Format, Version 20.2.0.7
Then some binary data containing version, endian type, user version = 12, number of blocks, user version 2 = 83, and a lot of other information such as strings and creator
I know the "user version" cause else creation kit freaks out and crashes. Nifscope tells me this values as well, but only when i open a skyrim model
any tips on how to get the valuable information. And how did you do?
I will check the nif.xml that comes with nifscope
@chaos2night: Go
What you want to do is called reverse engeneering. You could use that terms for a google search. I didn't need to reverse engeneer the m3 model format, since other people did that already. Credits for figuring out the m3 format go to the people I mention in the structures.xml file.
For questions about how to make a blender addon I suggest you search and ask in a blender related forum.
@println: Go
Ok I thank you for your help and i will search the net, check blender forum and so.
@chaos2night: Go
I just added an animation compression algorithm to my m3addon. Exported models should be much smaller now.
@println: Go
Grate work :)
I started decoding the nif file format and found it easier than I thought, Till i decoded the Vector3 look like the following (Using hex editor and nifscope)
hex - - - - - - - decoded (nifscope)
00 00 00 3E - - 0.1250
00 00 80 3E - - 0.2500
00 00 00 3F - - 0.5000
00 00 80 3F - - 1.0000
00 00 A0 3F - - 1.2500
00 00 C0 3F - - 1.5000
00 00 00 40 - - 2.0000
00 00 80 40 - - 4.0000
49 9D AE 40 - - 5.4567
It's kinda hard to solve when you don't find anything useful in nif.xml
I believe the last byte is some sort of constant... but i don't see a pattern in it though :( (The first two bytes)
YAY solved it :D
@println: Go
Is there a way we can get some simple EXE application to change the textures of M3 using your M3 to XML coding then converting backto M3? Like Warcraft 3 had a simple tool called MDX Pather where you open the model and change the texture names. I mean not everone wants to install Python and let's say the solution is using the Blender zip version that supports python - this Blender is so annoyingly a mess if you're used to Milkshape/3ds max older which were similar in look, that I'm not gonna use it in a million years. 3ds max is way more easier to do anything but using a whole program to rename textures ... n/c
Anyway how do I use the script with Blender to convert to XML? What command, the same won't work? If I pasted the M3toXml code in Text Editor and Run Script it gives me an error, so from Python Console idk how to make it work as I am not sure the script is even installed although I click 'Install Add-On' for the M3 to XML and vice-versa
Not everyone is a coder who understands python and what not... hope the day will come when there will be user-made tools (applications not codes or plugins for 3dsmax/blender) because this is what makes the modelling experience so horrible compared to that of war3 - the lack of tools, you need to have 3ds max, blender, python just to do a simple texture rename within the model damn it..
@Eimtr: Go
I am not sure if you know it already or not: There is also a python script for converting the xml file back to the m3 format.
I am not sure what speaks against installing python 3. It's btw also very usefull as a calculator.
About a rename tool: I would help another programmer to get started making it, but I don't currently want to spend my rare free time on making a rename tool since it can easily be done trough editing the xml file.
Here is a starting point for a rename python tool, this script allows you to change the file path of the diffuse layer of the first material:
About an exe file: Most parts of the m3 python library generator can be reused for genertors that generate an m3 library for other languages. So if someone wants to make an m3 library for another language, feel free to contact me as well.
@println: Go
Ok since I have no other choice atm and for hours I couldn't do, how do I use that repositionary in Blender? If I clicked install on your two XML<->M3 scripts to install all they do is appear on the Roaming\Blender Foundation\Scripts\Addons\ folder and in Add-oNs list in blender - No such Addon in the list. Only see some Import-Export Blizzard M3 among the list of Add-Ons not any XML ones.
In Python console? What commands? I dont think am doing anything when it cannot even recognize there is such script. Also what do you mean by 'Clone the repositionary' copy+paste?
@Eimtr: Go With clone I meant that you use git to download the files. Git is a version control system. For Windows I would recommend the TortoiseGit. After installation you can use the context menu of the explorer to clone/download the m3addon. When you select then clone in the git sub menu of the explorer you have to enter an git url. The url for the m3addon is "git://github.com/flo/m3addon.git".
You can also simply click "ZIP" on https://github.com/flo/m3addon if you want to download all files as zip archive, but I recommen using git since it allows to stay a.) up to date and b.) share your changes to the m3addon with other developers.
You can call the scripts from the normal cmd command line like this:
The first command converts the model path\To\Model.m3 into the xml file path\To\Model.m3.xml, the second command overrides the m3 file with the content from the xml file.
If you want to use the Blender addon you have to place the complete m3addon directory into the addon path of blender. On Windows it is:
@println: Go
The folder is there yes.. did it. XML scripts do not appear anywhere in the list of Add-Ons. The only ones in the list are Blizzard M3 Import that doesn't work anymore and the newer Import and Export that imports a model without textures. So I can't run the scrips from Blender.
Ok nevermind Blender deleted it. I installed Python 3 for X64 - I did the command from CMD like C:\UserName\Desktop\from Where The M3toXML is located>m3ToXml.m3 (the location where the M3 is aka on Desktop)
And still I don't see an XML anywhere... It created some folder in the folder where the script is:
_pycache_
generateM3Library.cpython-32.pyc
m3.cpython-32.pyc
ok where is the XML?
@Eimtr: Go
The conversion script tells you where it places the new files. If for example the output looks like this:
then the file is at C:\UserName\Desktop\Model.m3.xml
Since your model was on the desktop, the xml file will be on the desktop as well.
You can specify another output directory if you want to:
You can also pass a directory as argument to the script. Then all m3 files in the directory will get converted.
@println: Go
Generally I would appreciate if someone did this 2-3 minute job for me to convert to XML and after I modify the texture names - back to M3 because I can't continue working on the model if I cannot use the textures..
@Eimtr: Go
Do you use python 3.2.3? I can only think of a python bug. Leruster uses my tool successfully on Windows 7 (x64) with Python 3.2.3. http://www.python.org/ftp/python/3.2.3/python-3.2.3.amd64.msi
If you have another Python version installed, I suggest that you uninstall it first before installing the Python version from the link above (which is for 64 bit systems which I assume you use). It would also be nice to know which python version didn't work.
@println: Go
I've not installed Python before and I use 3.2.3 version with win 7 Home Premium x64 bit. I noticed not only m3ToXML but also xmlToM3 shows the same error and no matter what paths and locations I use.. I would've done it ages ago if this was the case but since it will take so much time to convert 2 files to xml then to m3 after I modify them, I will have to look for other ways.
This script clearly isn't set right because I do not have problems with anything else running fine so my PC being a mess - there is no such thing
@Eimtr: Go
I can think of one more reason why it doesn't work. Maybe it's wrongly configured how python scripts get executed. To bypass this you could call the script like this:
Where the first part is the file path to the python.exe executable. It might need to be surrounded with " since the path may contain whitespaces.
You might just be 1 minute away from successully making your change.