SUBSIM Radio Room Forums

SUBSIM Radio Room Forums (https://www.subsim.com/radioroom/index.php)
-   SH5 Mods Workshop (https://www.subsim.com/radioroom/forumdisplay.php?f=249)
-   -   GR2 Editor/Viewer/Extractor/Importer (https://www.subsim.com/radioroom/showthread.php?t=188290)

TheDarkWraith 01-17-13 06:14 PM

Just noticed that there has been a constant bug in the importers. The bug deals with Calculating tangents and binormals checkbox on the importer screen. If you set that to unchecked the app was still re-calculating the tangents and binormals. This has been fixed in v1.1.279.1

TheDarkWraith 01-17-13 06:27 PM

I released v1.1.279.1 because of the bug I found in the imports and so that you all can start testing/playing around with adding new subsets to a mesh. I was unable to find any errors but if you do please post them in this thread. You can find the new version at post #1 of this thread.

All new subsets added will default to the first material listed in the GR2 file as their material. You'll need to manually edit this or add new materials for it.

Still working on the ability to move a subset of a mesh (currently you have to move the entire mesh [all of it's subsets] if you want to move it).

:|\\

gap 01-17-13 06:41 PM

Quote:

Originally Posted by TheDarkWraith (Post 1994733)
I released v1.1.279.1

Got it, thank you TDW :up:

TheDarkWraith 01-17-13 07:04 PM

After some thought on how to implement the ability to move subsets of a mesh vice the whole mesh I know how I will implement it. I have a coordinates class that is responsible for keeping track of position, rotation, scale, etc. of any object. It contains all the support functions for manipulating these values also. What I will do is have each mesh subset create an instance of this coordinates class. Thus each subset will now have the ability to move, rotate, and scale. Now just to update the code to support this :D

TheDarkWraith 01-18-13 12:04 PM

I knew the day was going to come when I would have to restructure my base classes. I was hoping that day was still a long ways away but the time had come to hunker down and do it. In order to give mesh subsets the ability to position, rotate, and scale I needed something that C# doesn't allow: multiple inheritance. Since I cannot have a class inherit from multiple base classes I had to restructure all my base classes. The benefit of this is the aforementioned and also reduced a lot of redundant methods and properties (thus saving memory). I have released v1.1.281.1 and you can find it at post #1. All this new version is is the previous version with all the base classes restructured and redundancy removed. Many, many changes were made and thus I hope there are no errors or bugs. You all can test this and tell me if you notice anything strange or notice any errors.

Now I can start coding the mesh subsets ability to translate, rotate, and scale :)

TheDarkWraith 01-18-13 06:41 PM

Exciting times ahead! :D

Just finished the bulk of the subset moving code and decided to give it a test. Here I picked Subset 0 of Hull01 and rotated it on it's Y axis to the right. Notice that the axis reference is positioned correctly on the subset of the mesh:

http://www.subsim.com/radioroom/pict...pictureid=6252

You'll also notice that the status bar is telling you that the app is adjusted Hull01 subset 0. You'll also notice that the Rotation box's Y button is activated. Everything works exactly like you're adjusting the mesh :rock:

So to really test the code I selected Hull01. I rotated it on it's Y axis a little to the right and rotated it on it's X axis a little. If everything is correct code wise then subset 0 should rotate with the main mesh and keep it's orientation to the main mesh. I would say we have success :D

http://www.subsim.com/radioroom/pict...pictureid=6253

Notice that the selected ref axis changed to the main mesh (Hull01). Everything working beautifully. Now I just have to finish the code for when you have adjusted a subset and you press the Store button in the Changes box.

If you'd like to playaround with this and/or test it here you go: http://www.mediafire.com/?1m55crcqe3yfcwk
I have disabled the Store button for mesh subsets. Pressing the Store button for meshes will NOT store the changes for any of the subsets. That's the code I'm working on now.

:|\\

gap 01-20-13 10:15 AM

Time to give the new version of your edotor a try, though I am still practising with its most basic functions :oops:

Talking about them I had a new tiny but, I believe. useful idea:

could you add an option for reloading diffuse/normal/occlusion maps? It would come handy when editing model's textures without changing textures definitions :)

TheDarkWraith 01-20-13 10:19 AM

Quote:

Originally Posted by gap (Post 1995991)
could you add an option for reloading diffuse/normal/occlusion maps? It would come handy when editing model's textures without changing textures definitions :)

IIRC that feature already exists. Select the Materials tab then select the material then select the Texture and right click on it for a list of actions. Select reload. You can do the same thing from the Textures tab. Pretty sure the Reload action is available from the Meshes tab also.

gap 01-20-13 10:23 AM

Quote:

Originally Posted by TheDarkWraith (Post 1995994)
IIRC that feature already exists. Select the Materials tab then select the material then select the Texture and right click on it for a list of actions. Select reload. You can do the same thing from the Textures tab. Pretty sure the Reload action is available from the Meshes tab also.

Thank you :up:

Ekmek 01-21-13 12:15 PM

Great stuff! On the gr2 question - you said that it requires knowing the magic number of the granny file to import. How did you find it? If I get it for you can you add it to the options to load gr2?

TheDarkWraith 01-21-13 01:33 PM

Quote:

Originally Posted by Ekmek (Post 1996604)
Great stuff! On the gr2 question - you said that it requires knowing the magic number of the granny file to import. How did you find it? If I get it for you can you add it to the options to load gr2?

Post a link to the GR2 file in question and I'll look at it. The GR2 format is highly customizable and thus it's nearly impossible to code something to read everything without using Rad Game Tools DLLs.

Ekmek 01-23-13 01:51 AM

Quote:

Originally Posted by TheDarkWraith (Post 1996643)
Post a link to the GR2 file in question and I'll look at it. The GR2 format is highly customizable and thus it's nearly impossible to code something to read everything without using Rad Game Tools DLLs.


Great! Thank you for the help. Here is a link to the GR2 and I included the DLLs they use to convert FBX to their granny format. We can convert units exported as FBX from blender and then convert it to their gr2. But this limits us on reusing animations and is a real pain to re-rig our meshes to work on their animations. With leadres its impossible.

I hope the DLLs help. All I want to do is export one of their gr2s with its skeleton and a rigged mesh into a format I can modify in blender. If you can do that it would be greatly appreciated!

http://www.mediafire.com/?n5j42il74fq8491

Madox58 01-24-13 05:28 PM

Quote:

Originally Posted by Ekmek (Post 1997589)
Great! Thank you for the help. Here is a link to the GR2 and I included the DLLs they use to convert FBX to their granny format. We can convert units exported as FBX from blender and then convert it to their gr2. But this limits us on reusing animations and is a real pain to re-rig our meshes to work on their animations. With leadres its impossible.

I hope the DLLs help. All I want to do is export one of their gr2s with its skeleton and a rigged mesh into a format I can modify in blender. If you can do that it would be greatly appreciated!

http://www.mediafire.com/?n5j42il74fq8491


The files are useing RAD's compression scheme to start with.
GrannyViewer can open those of course.
Until the compression is figured out?
You'd need to use RAD's dll's to access stuff.
They do frown on that.
:haha:

TheDarkWraith 02-03-13 02:23 PM

Quote:

Originally Posted by Ekmek (Post 1997589)
Great! Thank you for the help. Here is a link to the GR2 and I included the DLLs they use to convert FBX to their granny format. We can convert units exported as FBX from blender and then convert it to their gr2. But this limits us on reusing animations and is a real pain to re-rig our meshes to work on their animations. With leadres its impossible.

I hope the DLLs help. All I want to do is export one of their gr2s with its skeleton and a rigged mesh into a format I can modify in blender. If you can do that it would be greatly appreciated!

http://www.mediafire.com/?n5j42il74fq8491

Quote:

Originally Posted by privateer (Post 1998470)
The files are useing RAD's compression scheme to start with.
GrannyViewer can open those of course.
Until the compression is figured out?
You'd need to use RAD's dll's to access stuff.
They do frown on that.
:haha:

That file with the link is compressed. Since I had time to kill in the air I decided to RE the Granny Viewer from when you click load file till the data was displayed. Doing this exposed some slight problems with the app that I will have to fix (some things that I guessed on I guessed wrong).
I was able to inject some assembly code into the Granny Viewer that caused it to spit out each decompressed section into a hex file. I then had my app take these files and make a new GR2 file out of them. The app had to adjust a bunch of pointers also but the result was SUCCESS :rock: Compressed files are no longer an obstacle to the GR2 Editor/Viewer :D I will explain more later when I have more time :)

I'll send the decompressed GR2 file to you so you can open in Granny Viewer and see for yourself. The app won't open it because there are some map names (irradiance map and such) that it doesn't recognize and thus throws an error. I have to add these map names to the app so it knows how to handle them.

TheDarkWraith 02-03-13 02:47 PM

Here is the file decompressed: http://www.mediafire.com/?1ujh04d0wja6jj3

You can open in Granny Viewer with no problems. Try and open it with the app and you will get an error about irradiance map unknown. I'll be updating the app when I have more time.

This is probably the first GR2 file decompressed without the use of Rad Games Tools DLLs :D The Granny Viewer is going to be the downfall of them. It tells me everything I've wanted to know and more :rock:

There was no sense in re-inventing the wheel and adding the code to decompress the GR2 file into the app (not to mention it's rather complex how they do their compression). It was easier to have the app spawn the Granny Viewer app, insert some assembly code into it, have the user open the file they want to decompress with the Granny Viewer, once the Granny Viewer displays the contents user closes Granny Viewer, app then reads the decompressed files spit out and builds a new GR2 file. Easy, simple, elegant...Utter shear beauty! That takes exploitation to a new level for me :D


All times are GMT -5. The time now is 06:27 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright © 1995- 2024 Subsim®
"Subsim" is a registered trademark, all rights reserved.