Skip to content

OpenGex Blender exporter updated#6

Open
miguelcartaxo wants to merge 12 commits intoEricLengyel:mainfrom
miguelcartaxo:main
Open

OpenGex Blender exporter updated#6
miguelcartaxo wants to merge 12 commits intoEricLengyel:mainfrom
miguelcartaxo:main

Conversation

@miguelcartaxo
Copy link
Copy Markdown

This is based on @joeld42 pull request (here). Created a new one because that one was never accepted or updated after comments. To be clear, this is the original blender exporter made by @EricLengyel with the updates made by @joeld42 plus the following:

  • Fixed crash "Scene.frame_set(): required parameter "subframe" to be a keyword argument!" when exporting animations;
  • Fixed crash when exporting with "Selection Only" option is set;
  • Fixed crash when exporting mesh with vertex colors;
  • Added option to export floats as hexadecimals;
  • Added option to export Vertex Colors (off by default);
  • Added option to export UVs (on by default);
  • Added option to export Normals (on by default);
  • Added option to export Materials (on by default);
  • Log the file name being exported and how long it took to export it;
  • Re-enable morph targets export, after a couple of fixes;
  • Updated calls to free allocated mesh to 2.80 api;

I've tested with a couple of free 3d assets on Blender 2.93 and 3.3 for these fixes. Obviously this is not battle tested, but I think it's in a basic useful state for people wanting to work with OpenGex.

miguelcartaxo and others added 5 commits April 16, 2023 12:25
- This is the original script (afaik) from Eric Lengyel with fixes to Blender 2.8 python API changes by Joel Davis @joeld42
- Fixed crash "Scene.frame_set(): required parameter "subframe" to be a keyword argument!" when exporting animations;
- Fixed crash when exporting with "Selection Only" option is set;
- Fixed crash when exporting mesh with vertex colors;
- Added option to export floats as hexadecimals;
- Added checkbox to export Vertex Colors (off by default);
- Added checkbox to export UVs (on by default);
- Added checkbox to export Normals (on by default);
- Added checkbox to export Materials (on by default);
- Fix mistake related to bones on previous submit for fixing "Export Selection Only";
- Log the file name being exported and how long it took to export it;
- Morph targets are now exported, the code was mostly 2.80 compatible already. My guess is that Joel Davis did most of the work? What seemed to be missing was calculating the loop triangles after getting the morph mesh, so that it didn't crash when accessing them. Also updated call to free the mesh at the end of the loop;
- Re-enable call to clear mesh at the end of the ExportGeometry and updated it to 2.80 api;
@neises
Copy link
Copy Markdown

neises commented Sep 29, 2024

@miguelcartaxo @miguelcartaxoZPX Thanks for the blender script. I tried and wondering if animation are still working. Importing works but with animation I have some trouble at least with models downloaded from mixamo. Did you encountered something similar or any issues with animation?

@miguelcartaxo
Copy link
Copy Markdown
Author

miguelcartaxo commented Sep 29, 2024

Hello, unfortunately, animation is not well tested. I didn't have animation models to tested on, I only recently grabbed some from a humble bundle to test but I have not gotten to it. Since this pull request was never accepted, and it's been more than a year, I've only made a couple more fixes on my private repos and been spending my time creating a OpenGex Blender importer, so I could have a .blend or .fbx file with animation and/or other stuff, import it to Blender, then exported as .ogex, see if it looks reasonable, then imported and compared with the original.

EDIT: It is a shame really, I wish the OpenGex support was better and more people were interested in it, I've done some quite thorough research looking for 3d file formats and this one seems the most reasonable and sane one with a good feature set, but no one uses it or supports it.

@neises
Copy link
Copy Markdown

neises commented Sep 29, 2024

@miguelcartaxo Thanks. I still investigating and try to fix the animation issues I currenlty have BUT I haven´t worked with blender or python a lot so I don´t have big insides of it. Will see how it goes.

@miguelcartaxo
Copy link
Copy Markdown
Author

What is the issue? Does it fail to export? Or exports successfully but there is missing data on the file?

I was in the same boat, I have never worked with Blender before this (code-wise), and my experience with python was very limited, so I had to research how to properly debug a plugin in blender, figure out the Blender API and all of that stuff.

@neises
Copy link
Copy Markdown

neises commented Sep 30, 2024

@miguelcartaxo I tried a few models from the mixamo website. Import the fbx into blender and exported the file with the ogex blender file ( I did modify it a bit - but nothing special so far). After I exported it I used the c4 engine to import the model into the world. The model itself was looking good BUT I encoutered issue when I export animation from Blender and import them into the c4 engine. The issue was mainly that the animation has some offset applied and keeps the model jiggling.

@neises
Copy link
Copy Markdown

neises commented Sep 30, 2024

@miguelcartaxo

Does it fail to export?

Mostly works BUT I suspect it depends on which option you choose. However I think animation are broken but not entirly sure.

Does it fail to export?

The export itself is succesful

Or exports successfully but there is missing data on the file?
I´m looking into the ogex file but from what I can tell it looks good - only the animation part is something that I´m not 100% sure.

Cheers

miguelcartaxo and others added 7 commits November 24, 2024 20:58
- Exporter now exports custom normals by default instead of normals calculated by Blender;
- Exporter no longer sanitizes the name of geometry nodes, reason being that we want to keep whatever the name was set in blender in the OpenGex, so that when we import we have the exact same name;
- Fix broken light export;
- Small adjustment to camera export;
- Exporter no longer hardcodes node name for lights and cameras;
- Fixed type in importer's README file;
Not thoroughly tested, but exporting a geometry + armature and skeleton
animation worked after importing into C4 (including the animation)
Updates to get the addon working on blender 4.4
- Now compatible with Blender 4.5
- Added __init__.py to correctly import OpenGex plugins;
- Fixed wrong module imports;
- Updated READMEs to include installation and debuggin how-tos;
- Added .zip files containing all source for easy installation through Blender UI;
- Updated credits on exporter;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants