8000 File Header Handling · Issue #19 · alextsui05/blender-off-addon · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

File Header Handling #19

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

Open
Alphastrick opened this issue Aug 18, 2020 · 1 comment
Open

File Header Handling #19

Alphastrick opened this issue Aug 18, 2020 · 1 comment

Comments

@Alphastrick
Copy link
Alphastrick commented Aug 18, 2020

During importing files from ModelNet40 an error occured (example file bathtub_0102.off).

Some files of ModelNet contain an formating error in the first line.

OFF9278 6940 0
-10.326050 27.195520 7.062850

This will lead to a parsing error:

Failed with model E:\ai_datasets\ModelNet40\bathtub\train\bathtub_0106.off
Error: Traceback (most recent call last):
  File "C:\Users\%userprofil%\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\import_off.py", line 97, in execute
    mesh = load(self, context, **keywords)
  File "C:\Users\%userprofile%\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\import_off.py", line 199, in load
    vcount, fcount, ecount = [int(x) for x in line.split()]
  File "C:\Users\%userprofile%\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\import_off.py", line 199, in <listcomp>
    vcount, fcount, ecount = [int(x) for x in line.split()]
ValueError: invalid literal for int() with base 10: '26.828400'

Proposed changes line 194:

    if len(first_line) > 4:
        # Parsing invalid off file header 
        line = first_line[3:]
    else:
        # handle blank and comment lines after the first line
        line = file.readline()

    while line.isspace() or line[0]=='#':
        line = file.readline()
@alextsui05
Copy link
Owner

Sorry for the lateness of my reply, and thanks for your interest.

I'm unfamiliar with the ModelNet40 dataset, but I'll download and have a look at some sample data. I guess ideally we'd be able to parse the vertex/face count even with the formatting error. I hope you were able to modify the addon to get it to work for your specific use case.

As for updating this project, I think first of all it'd be nice to get some sort of testbed or CI setup for the project so that we can move forward with development and test proposals like yours. As it is, the addon just kind of works as-is on simple, standard OFF files, but it's very hard to guarantee behavior. I'll look into setting this up in my spare time.

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

No branches or pull requests

2 participants
0