#1710 closed defect (fixed)
Collada limitations and UnboundLocalError: local variable 's' referenced before assignment
| Reported by: | Owned by: | Tom Goddard | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Input/Output | Version: | |
| Keywords: | Cc: | meng@… | |
| Blocked By: | Blocking: | ||
| Notify when closed: | Platform: | all | |
| Project: | ChimeraX |
Description
The following bug report has been submitted: Platform: Darwin-18.2.0-x86_64-i386-64bit ChimeraX Version: 0.9 (2019-02-14) Description I was trying to load a 3D objects in Collada format. I also tried gltf and obj - none of these loaded successfully. Is it a bug or is it that some of the features present in my models are not supported in ChimeraX and won't load? Log: UCSF ChimeraX version: 0.9 (2019-02-14) © 2016-2019 Regents of the University of California. All rights reserved. How to cite UCSF ChimeraX > open /Users/jozef/Desktop/DH/GB1-IgG-complex.cxs format session opened ChimeraX session > view name test > save session /Users/jozef/Desktop/GB1-IgG-complex-test.cxs > open "/Users/jozef/Desktop/Rigged_Hand/Rigged_Hand_obj/Rigged Hand.obj" OBJ reader only handles triangle faces, line 1775: "f 106/1/1 105/2/2 358/3/3 103/4/4 " OBJ reader only handles triangle faces, line 1775: "f 106/1/1 105/2/2 358/3/3 103/4/4 " > open "/Users/jozef/Desktop/Rigged_Hand/Rigged Hand_dae.dae" Traceback (most recent call last): File "/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/ui/gui.py", line 549, in _qt_safe run(session, "open " + quote_if_necessary(paths[0])) File "/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/core/commands/run.py", line 31, in run results = command.run(text, log=log) File "/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/core/commands/cli.py", line 2617, in run result = ci.function(session, **kw_args) File "/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/core/commands/open.py", line 41, in open from_database=from_database, ignore_cache=ignore_cache, **kw)) File "/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/core/commands/open.py", line 117, in open models = handle_unknown_kw(session.models.open, paths, format=format, name=name, **kw) File "/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/core/commands/open.py", line 62, in handle_unknown_kw return f(*args, **kw) File "/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/core/models.py", line 598, in open session, filenames, format=format, name=name, **kw) File "/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/core/io.py", line 467, in open_multiple_data models, status = open_data(session, fspec, format=format, name=name, **kw) File "/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/core/io.py", line 423, in open_data models, status = open_func(*args, **kw) File "/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/surface/__init__.py", line 60, in open_file return collada.read_collada_surfaces(session, stream, file_name) File "/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/surface/collada.py", line 29, in read_collada_surfaces set_instance_positions_and_colors(s.all_drawings()) UnboundLocalError: local variable 's' referenced before assignment UnboundLocalError: local variable 's' referenced before assignment File "/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/surface/collada.py", line 29, in read_collada_surfaces set_instance_positions_and_colors(s.all_drawings()) See log for complete Python traceback. OpenGL version: 4.1 NVIDIA-12.0.21 355.11.10.50.10.103 OpenGL renderer: NVIDIA GeForce GT 750M OpenGL Engine OpenGL vendor: NVIDIA Corporation
Change History (4)
comment:1 by , 7 years ago
| Component: | Unassigned → Input/Output |
|---|---|
| Milestone: | → 1.0 |
| Owner: | set to |
| Platform: | → all |
| Project: | → ChimeraX |
| Status: | new → assigned |
| Summary: | ChimeraX bug report submission → Collada limitations and UnboundLocalError: local variable 's' referenced before assignment |
comment:2 by , 7 years ago
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
Yes, your files are using features of OBJ and Collada that ChimeraX does not handle. Reading these files is a fringe capability of ChimeraX. It may be improved in the future if funding permits.
The OBJ file you are trying to read has quadrilaterals instead of triangles which are not handled by ChimeraX as indicated by the error message
OBJ reader only handles triangle faces, line 1775: "f 106/1/1 105/2/2 358/3/3 103/4/4"
The Collada reading problem is that no TriangleSets were found in the file. I've improved the code to issue a readable error message when that happens.
comment:3 by , 7 years ago
| Cc: | added |
|---|---|
| Milestone: | 1.0 |
Elaine, might document if not already documented that OBJ reader only reads triangles (not quadrilaterals or larger polygonal faces) and the Collada reader only reads TriangleSets.
follow-up: 4 comment:4 by , 7 years ago
OK, for COLLADA I added “TriangleSets only” and for OBJ changed to "triangles only: vertices, vertex normals, faces; no colors.” If that still needs adjusting let me know - thanks! Elaine
Reported by Jozef Lewandowski