Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for empty mesh exports #34

Open
wants to merge 1 commit into
base: custom_bones
Choose a base branch
from

Conversation

raavus-funkmaster
Copy link

@raavus-funkmaster raavus-funkmaster commented Jul 29, 2024

When attempting to export a file that had an empty mesh within it, I encountered the following error:

Traceback (most recent call last):
  File "C:\Users\user\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\NieR2Blender2NieR-master\wmb\exporter\wmbExportOperator.py", line 45, in execute
    wmb_exporter.main(self.filepath)
  File "C:\Users\user\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\NieR2Blender2NieR-master\wmb\exporter\wmb_exporter.py", line 43, in main
    generated_data = c_generate_data()
  File "C:\Users\user\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\NieR2Blender2NieR-master\wmb\exporter\generate_data.py", line 72, in __init__
    self.vertexGroups = c_vertexGroups(self.vertexGroups_Offset)
  File "C:\Users\user\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\NieR2Blender2NieR-master\wmb\exporter\vertexGroups\create_vertexGroups.py", line 31, in __init__
    self.vertexGroups = get_vertexGroups(self, self.offsetVertexGroups)
  File "C:\Users\user\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\NieR2Blender2NieR-master\wmb\exporter\vertexGroups\create_vertexGroups.py", line 27, in get_vertexGroups
    vertexGroups.append(c_vertexGroup(index, vertexesOffset))
  File "C:\Users\user\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\NieR2Blender2NieR-master\wmb\exporter\vertexGroups\vertexGroup.py", line 28, in __init__
    self.blenderObjects = get_blenderObjects(self)
  File "C:\Users\user\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\NieR2Blender2NieR-master\wmb\exporter\vertexGroups\vertexGroup.py", line 19, in get_blenderObjects
    obj.data.calc_tangents()
RuntimeError: Error: Tangent space computation needs an UVMap, "(null)" not found, aborting

This change ran cleanly and allowed me to achieve what I was after, and I didn't see it in any previously rejected PRs, so I figured I would throw it up here just to see if it was something you considered merge-worthy.

@ArthurHeitmann
Copy link
Collaborator

Out of curiosity, for which use case do you need an empty mesh? And does the game accept the empty mesh wmb?

@raavus-funkmaster
Copy link
Author

Out of curiosity, for which use case do you need an empty mesh? And does the game accept the empty mesh wmb?

My use case was removing 2B's blindfold, mostly just to see if I could. I took someone else's .dtt, deleted the blindfold verts, successfully exported after making this change, and slapped the output into data/pl. It was sufficient, but I'm sure that wasn't the only path to that destination. I could imagine an empty mesh having particle-related uses, but I'm new to exploring this stuff and deferring to the experts here.

20240729230155_1

@ArthurHeitmann
Copy link
Collaborator

I see. I didn't know the game accepted empty meshes. Instead we've usually just kept a single tiny triangle.
I don't have any issues with this PR. I'll wait a bit to see if Woeful speaks up. If not, we can merge

@WoefulWolf
Copy link
Owner

Yeah, the reason we didn't implement this before is I was never certain if the game would accept an empty mesh in all cases. I never went through the trouble of going through and testing all the different mesh cases such as maps, collisions, skinned meshes, etc.

But if it seems to work fine for the most part, I don't see the issue with merging.

Maybe just another test or two with empty meshes in the above mentioned use cases would be nice.

One thing to note, this PR is for merging with the master branch, which isn't the most up to date; custom_bones is the what most people use I believe, for its more complete feature set (I still need to decide if I want to merge it to master or not, there are still some unpolished features like the physics editors).

@raavus-funkmaster
Copy link
Author

I'll test further and report back once I find the time in the next few days

@raavus-funkmaster raavus-funkmaster changed the base branch from master to custom_bones August 10, 2024 04:02
@raavus-funkmaster
Copy link
Author

raavus-funkmaster commented Aug 10, 2024

So, finally got around to playing with this a bit more. Was able to reduce 2B down to a pair of floating eyeballs using fully empty meshes without issue. That being said, I was able to find an issue with one of her eye layers wherein it being a fully empty mesh seemed to lead to an infinite loading screen. My vague theory is that it's material related or the fault of some kind of dependent relationship. Haven't dug deeper on the exact why.
20240809203138_1

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.

3 participants