blensor
blensor copied to clipboard
TypeError in blensor.tof.scan_advanced
Issue description:
Hi, I get TypeError: unsupported operand type(s) for <<: 'tuple' and 'int'
when I run blensor.tof.scan_advanced
from script in Blensor 1.0.18 RC 10 Windows.
Here is a simple script producing the error:
import bpy
import blensor
camera = bpy.data.objects['Camera']
camera.select = True
blensor.tof.scan_advanced(camera, evd_file='cube.pcd') # TypeError
camera.select = False
and I get:
Traceback (most recent call last):
File "Blensor-1.0.18-Blender-2.79-Winx64\2.79\scripts\addons\blensor\evd.py", line 225, in writePCLFile
self.write_point(pcl, pcl_noisy, INVALID_POINT, self.output_labels)
File "Blensor-1.0.18-Blender-2.79-Winx64\2.79\scripts\addons\blensor\evd.py", line 190, in write_point
color_uint32 = (e[12]<<16) | (e[13]<<8) | (e[14])
TypeError: unsupported operand type(s) for <<: 'tuple' and 'int'
Solution:
The following quick fix solved the issue: modifying the line 42-44 in evd.py
INVALID_POINT = [0.0, 0.0, 0.0, float('NaN'), float('NaN'),
float('NaN'),float('NaN'),float('NaN'),float('NaN'),
float('NaN'),float('NaN'),-1,(0,0,0),-1]
to
INVALID_POINT = [0.0, 0.0, 0.0, float('NaN'), float('NaN'),
float('NaN'),float('NaN'),float('NaN'),float('NaN'),
float('NaN'),float('NaN'),-1,0,0,0,-1]
Hope this helps!
Thank you aoikaneko. Your comment saved me a lot of time bugfixing. I hope, this will be fixed in the next release.