Extract GR2 to Blender with mesh AND skeleton and re-export to GR2

but I tried again but this time saved the *.gr2 file first then exported to *.nb2 and it worked.
I saved too. And got an error and nb2 file with 0 bytes.
 
I saved too. And got an error and nb2 file with 0 bytes.

Ok, I think I found the problem. It was trying to parse the floating point numbers in the .msh file, but because your language uses commas in decimals instead of dots (e.g. 0,53467 instead of 0.53467) it was failing. I have updated the code to use InvariantCulture when parsing floats which should make it work internationally.

Try this new version - beta 5a.
 
I tried to import u_greek_hoplite.nb2.
Here is the result:
 
I tried to import u_greek_hoplite.nb2.
Here is the result:

It could be another internationalization problem. Does your .nb2 file have commas for decimal points?
 
@Novator: As I thought your .nb2 has commas instead of dots for decimals. I will upload a new version of Nexus Buddy 2 at the weekend to fix this. For now, just use a text editor to find and replace "," with "." in your nb2 file and that should allow you to load it into Blender.

In other news, now that I have all the code to get the data from GR2 into Blender, I am moving on to write new code to go the other way, from Blender to GR2, without having to use the hopeless GrannyExporterFBX.ExportFBXFile function or even the FBX format at all. A challenging task, but I think it's possible and it's the only way we're likely to get a reliable import to GR2. Could take me a while... :)
 
In other news, now that I have all the code to get the data from GR2 into Blender, I am moving on to write new code to go the other way, from Blender to GR2, without having to use the hopeless GrannyExporterFBX.ExportFBXFile function or even the FBX format at all. A challenging task, but I think it's possible and it's the only way we're likely to get a reliable import to GR2. Could take me a while... :)

I think the multiple skeleton work would be more beneficial. Also I think that the error we get in the fbx->gr2 generation is there because of some license limitations Firaxis had in providing an export tool (possibly radgametools didn't want that full capability provided). If you check this thread it looks like its no easy task messing with that format.
 
I think the multiple skeleton work would be more beneficial.

I'll do both. Every single GR2 we make has to go through the FBX->GR2 vortex whereas only some have multiple models and skeletons. Most of this dev effort is to address my own frustrations with graphics modding in Civ 5 and FBX->GR2 now tops the list. The multi-skeletons support is straight-forward to do so I'm tackling the biggest unknown first.

Ekmek said:
Also I think that the error we get in the fbx->gr2 generation is there because of some license limitations Firaxis had in providing an export tool (possibly radgametools didn't want that full capability provided).

No-one would write code that yields different results for the same input intentionally. I think Firaxis didn't bother fixing the FBX->GR2 function for the same reason they didn't bother finishing Nexus - there are always more lucrative things to be working on. My point would be that supporting the creation of top quality mods would ensure long terms sales, but that doesn't seem to be the view at Firaxis. I'm not bashing them - I work in software myself so I know what the pressures are like. The fact that Rad Game Tools don't want to make it easy for people to create GR2s (because their development kit and plugins sell for $12,500) is another disincentive to providing a fully functioning importer.

Ekmek said:
If you check this thread it looks like its no easy task messing with that format.

I've now re-written the NB2 export that was in C++ code entirely in C# code. This means I know exactly where each byte of data has to go in the GR2. Now it's just a question of writing the right data to the right place. I've done some simple tests renaming things and updating things inside the GR2 from my code so I think it's quite likely I'll be able to get my own import code working.
 
Maybe I can get Granny 3D SDK.
But:
Man who has SDK said:
the SDK doesnt contain an importer. It just contains exporters to export the files FROM 3ds max.
So you can export into gr2. But can't import gr2 into another programm.
 
So you can export into gr2. But can't import gr2 into anther programm.

Now you can with Nexus Buddy 2 and the .nb2 format. :)

I'll fix your .nb2 comma decimal point issue at the weekend.
 


After exporting unit u_greek_hoplite.gr2
 
Found it. Smth wrong with new fbx export script. The default fbx script is ok.
 
And smth wrong with fbx -> gr2 script too.
 
And smth wrong with fbx -> gr2 script too.

Yes, there is something very wrong with it. From previously in this thread:

Deliverator said:
The function GrannyExporterFBX.ExportFBXFile called by Nexus Buddy is incredibly unstable - it seems to have some low level memory type problem. A program that produces different output for the same input is not much fun to work with! See how the bytes vary while repeating the same thing here:
Spoiler :
Copying C:\Civ5Mod\UnitWork_WarChariot\warchariot_horns.fbx to C:\Users\245\AppData\Local\Temp\tempopen83463730.fbx
Exporting FBX from C:\Users\245\AppData\Local\Temp\tempopen83463730.fbx to C:\Civ5Mod\UnitWork_WarChariot\warchariot_horns_0.gr2
Exported GR2 C:\Civ5Mod\UnitWork_WarChariot\warchariot_horns_0.gr2 has 84688 bytes
Copying C:\Civ5Mod\UnitWork_WarChariot\warchariot_horns.fbx to C:\Users\245\AppData\Local\Temp\tempopen7829540351.fbx
Exporting FBX from C:\Users\245\AppData\Local\Temp\tempopen7829540351.fbx to C:\Civ5Mod\UnitWork_WarChariot\warchariot_horns_1.gr2
Exported GR2 C:\Civ5Mod\UnitWork_WarChariot\warchariot_horns_1.gr2 has 88504 bytes
Copying C:\Civ5Mod\UnitWork_WarChariot\warchariot_horns.fbx to C:\Users\245\AppData\Local\Temp\tempopen3270488652.fbx
Exporting FBX from C:\Users\245\AppData\Local\Temp\tempopen3270488652.fbx to C:\Civ5Mod\UnitWork_WarChariot\warchariot_horns_2.gr2
Exported GR2 C:\Civ5Mod\UnitWork_WarChariot\warchariot_horns_2.gr2 has 80780 bytes
Copying C:\Civ5Mod\UnitWork_WarChariot\warchariot_horns.fbx to C:\Users\245\AppData\Local\Temp\tempopen5234987953.fbx
Exporting FBX from C:\Users\245\AppData\Local\Temp\tempopen5234987953.fbx to C:\Civ5Mod\UnitWork_WarChariot\warchariot_horns_3.gr2
Exported GR2 C:\Civ5Mod\UnitWork_WarChariot\warchariot_horns_3.gr2 has 91244 bytes
Copying C:\Civ5Mod\UnitWork_WarChariot\warchariot_horns.fbx to C:\Users\245\AppData\Local\Temp\tempopen4932878854.fbx
Exporting FBX from C:\Users\245\AppData\Local\Temp\tempopen4932878854.fbx to C:\Civ5Mod\UnitWork_WarChariot\warchariot_horns_4.gr2
Exported GR2 C:\Civ5Mod\UnitWork_WarChariot\warchariot_horns_4.gr2 has 88948 bytes
Copying C:\Civ5Mod\UnitWork_WarChariot\warchariot_horns.fbx to C:\Users\245\AppData\Local\Temp\tempopen794712055.fbx
Exporting FBX from C:\Users\245\AppData\Local\Temp\tempopen794712055.fbx to C:\Civ5Mod\UnitWork_WarChariot\warchariot_horns_5.gr2
Exported GR2 C:\Civ5Mod\UnitWork_WarChariot\warchariot_horns_5.gr2 has 85224 bytes
Copying C:\Civ5Mod\UnitWork_WarChariot\warchariot_horns.fbx to C:\Users\245\AppData\Local\Temp\tempopen436630776.fbx
Exporting FBX from C:\Users\245\AppData\Local\Temp\tempopen436630776.fbx to C:\Civ5Mod\UnitWork_WarChariot\warchariot_horns_6.gr2
Exported GR2 C:\Civ5Mod\UnitWork_WarChariot\warchariot_horns_6.gr2 has 81376 bytes
Copying C:\Civ5Mod\UnitWork_WarChariot\warchariot_horns.fbx to C:\Users\245\AppData\Local\Temp\tempopen8780641757.fbx
Exporting FBX from C:\Users\245\AppData\Local\Temp\tempopen8780641757.fbx to C:\Civ5Mod\UnitWork_WarChariot\warchariot_horns_7.gr2
Exported GR2 C:\Civ5Mod\UnitWork_WarChariot\warchariot_horns_7.gr2 has 82860 bytes
Copying C:\Civ5Mod\UnitWork_WarChariot\warchariot_horns.fbx to C:\Users\245\AppData\Local\Temp\tempopen9852729778.fbx
Exporting FBX from C:\Users\245\AppData\Local\Temp\tempopen9852729778.fbx to C:\Civ5Mod\UnitWork_WarChariot\warchariot_horns_8.gr2
Exported GR2 C:\Civ5Mod\UnitWork_WarChariot\warchariot_horns_8.gr2 has 86432 bytes
Copying C:\Civ5Mod\UnitWork_WarChariot\warchariot_horns.fbx to C:\Users\245\AppData\Local\Temp\tempopen2908387509.fbx
Exporting FBX from C:\Users\245\AppData\Local\Temp\tempopen2908387509.fbx to C:\Civ5Mod\UnitWork_WarChariot\warchariot_horns_9.gr2
Exported GR2 C:\Civ5Mod\UnitWork_WarChariot\warchariot_horns_9.gr2 has 75400 bytes

This is why I writing a completely new import function that will not use FBX or Firaxis' code.

Work is progressing well. I have successfully created GR2 meshes from text file data with my code, and I now have all the data needed to create a GR2 including skeleton exporting from Blender in the required format. The final stage is to import all the data into Nexus Buddy from my new file format and write the skeleton and meshes to the GR2.

Also a couple of tips for getting your FBX successfully converted to GR2 without corruption in the meantime:
1. Close as many programs as possible so that you are minimizing the amount of memory you are using. This seems to improve stability. My theory is that GrannyExporterFBX is doing something bad like incorrectly writing/reading memory blocks - having more free memory seems to help.
2. Export single mesh models only. Exporting multi-mesh objects seems to massively increase the likelihood of corruption.
 
On my computer only the first try of exporting building/unit works normal. The second, the third etc. is empty window. Exporting lh is a fail all time. Even if your meshes are fine, vertex groups are corrupted and your leader lies on his back.
 
Minimum memory 1.10 GB-1.15 (computer start) Medium memory 1.25 GB-1.26 GB(I have at this moment) - 1.30 - 1. 60 GB. Maximum memory 1.60 - 1.80 (I have usually) - 2 GB(When I am in the game).
CP minimum - 0(I have usually). CP medium - 18-25 (When I am in the game). CP maximum - 75-80.

After Opening fbx in NeusBuddy2, Nexus, etc.
Memory 1.25+0.55=1.80
 
Still trying to work my leaderhead. THis fbx->gr2 thing is the biggest headache. For leaders the meshes and skeletons so large I can't get a clean export. Doing the separate mesh thing doesn't seem to help since the skeleton data is so huge.

I'm going to do some more work on my replacement import function this weekend. The mesh side is pretty much done so I just need to write the skeleton data. I'm fairly confident I can get everything working. I may be ready to upload the new tool by the end of Monday.
 
Nexus Buddy doesnt work for some people using win7 64 bit + framework 4.0

it doesnt load dll as i noticed.

could you please fix the issues? maybe its the path to dlls?


Please help me, i want to use your tutorial for a other game that use gr2 format, i know a plugin for 3ds max that loads gr2 + skeleton, but the skeleton of the gr2 is "packed" so the structure of the skeleton is totally wrong built when i load it.


Can you help me??
How to run nexus buddy 2.0 in win7 64 bit? Or maybe someone can create the skeleton from my gr2 file?

Thanks
 
Top Bottom