trimesh icon indicating copy to clipboard operation
trimesh copied to clipboard

'Scene' object has no attribute 'visual'

Open cochaviz opened this issue 4 years ago • 3 comments

I'm trying to use the unwrapping feature in trimesh, but have not been successful in doing so. I exported the default cube from blender in obj format and trying to unwrap it using a 512x512 png texture.

    mesh = trimesh.load_mesh('cube.obj', process=False, force='mesh')
    uv_img = Image.open('tex.png')
    unwrapped = trimesh.unwrap.unwrap(mesh, image=uv_img)
    unwrapped.show()

This is the second attempt at UV unwrapping. For my specific application, I would actually like to use an STL format. These apparently carry no texture data, so I thought that might be the issue. When trying with obj, however, I still face this issue. I've also tried forcing to loading it as a mesh, but no success.

When running this code it breaks, giving the following error code

Traceback (most recent call last):
  File "SimpleProgram.py", line 36, in <module>
    POINTS = generate_points(
  File "SimpleProgram.py", line 24, in generate_points
    unwrapped = trimesh.unwrap.unwrap(mesh, image=uv_img)
  File "/home/$USER/.local/lib/python3.8/site-packages/trimesh/unwrap.py", line 39, in unwrap
    result.visual.material.image = image
AttributeError: 'Scene' object has no attribute 'visual'

I'm using the latest version of trimesh (output of pip show trimesh)

Name: trimesh
Version: 3.9.1
Summary: Import, export, process, analyze and view triangular meshes.
[...]

cochaviz avatar Jan 14 '21 11:01 cochaviz

Having the same problem...

kapsl avatar Apr 09 '21 09:04 kapsl

Similar bugs here. When I tried to export trimesh to .obj which contains Path3D obj, I got error:

    mesh.visual.kind in ['vertex', 'face'] and
AttributeError: 'Path3D' object has no attribute 'visual'

kxhit avatar Jan 14 '22 17:01 kxhit

Having the same problem...

hhoangg avatar Feb 21 '22 10:02 hhoangg