3D-FRONT-FUTURE / 3D-FRONT-ToolBox

93 stars 20 forks source link

Question about dependency(mathutils,bpy). #8

Open nobodypengium opened 3 years ago

nobodypengium commented 3 years ago

Hi,

I'm rendering using scripts/render.py. There is an error on LINE 57

direction = target - loc

Errrors shown here:

Traceback (most recent call last):
  File "render.py", line 223, in <module>
    render_function(mesh_list,tex_list,cam_info, os.path.join(args.scene_path, scene))
  File "render.py", line 182, in render_function
    point_at(cam, (info['target'][0],3.2,info['target'][1]))
  File "render.py", line 59, in point_at
    direction = target - loc
AttributeError: Vector subtraction: (Vector - Vector) invalid type for this operation

Then, I debug render.py from LINE 57. By running type(target) and type(loc), the results are all Vector. However, by running isinstance(target, mathutils.Vector) and isinstance(loc, mathutils.Vector), the results are True and False respectively. i.e. The

I find a way to solve this:

if not isinstance(loc, mathutils.Vector):
        loc = mathutils.Vector(loc.to_tuple())

But this is somewhat unnature.

I think this caused by the inappropriate version of mathutils and bpy. So could you please tell me the version of these two packages you are using?

Thanks a lot.

nobodypengium commented 3 years ago

Besides, I wonder that do you use the python interpreter embeded in blender?

jwzxgy2007 commented 3 years ago

Yes, we use the python in the blender, maybe it caused by the different version of blender. We use 2.7x