Page MenuHome

mathutils missing to use vector in obj export
Closed, InvalidPublic

Description

System Information
OS: windows 7 64bit
GPU: NVIDIA Quadro k4000

Blender Version
Broken: (example: 2.69.7 4b206af, see splash screen)
Worked: (optional)

Short description of error
Vector is used without mathhutils which causes a error when exporting a obj

Exact steps for others to reproduce the error
Based on a (as simple as possible) attached .blend file with minimum amount of steps

  1. add a new object
  2. create a new material
  3. create a new material texture
  4. assign a image to the material texture
  5. export the object. this should give you a couple of errors:

export options used

Traceback (most recent call last):
  File "D:\BlenderAddons\trunk\build\Blender_trunk\bin\Release\2.77\scripts\addons\io_scene_obj\__init__.py", line 306, in execute
    return export_obj.save(self, context, **keywords)
  File "D:\BlenderAddons\trunk\build\Blender_trunk\bin\Release\2.77\scripts\addons\io_scene_obj\export_obj.py", line 842, in save
    EXPORT_PATH_MODE=path_mode,
  File "D:\BlenderAddons\trunk\build\Blender_trunk\bin\Release\2.77\scripts\addons\io_scene_obj\export_obj.py", line 788, in _write
    progress,
  File "D:\BlenderAddons\trunk\build\Blender_trunk\bin\Release\2.77\scripts\addons\io_scene_obj\export_obj.py", line 709, in write_file
    write_mtl(scene, mtlfilepath, EXPORT_PATH_MODE, copy_set, mtl_dict)
  File "D:\BlenderAddons\trunk\build\Blender_trunk\bin\Release\2.77\scripts\addons\io_scene_obj\export_obj.py", line 196, in write_mtl
    if mtex.offset != Vector((0.0, 0.0, 0.0)):
NameError: name 'Vector' is not defined

io_scene_obj\export_obj.py line 187 & 189

should be mathutils.Vector instead of Vector

if mtex.offset != Vector((0.0, 0.0, 0.0)): 
    options += ['-o', mtex.offset.x, mtex.offset.y, mtex.offset.z]
if mtex.scale != Vector((1.0, 1.0, 1.0)):
    options += ['-s', mtex.scale.x, mtex.scale.y, mtex.scale.z]
fw('%s%s %s\n' % (key, " ".join(options), repr(filepath)[1:-1]))

Details

Type
Bug

Event Timeline

dan grauer (kromar) added a project: Add-ons.
dan grauer (kromar) set Type to Bug.
dan grauer (kromar) created this task.
dan grauer (kromar) raised the priority of this task from to Needs Triage by Developer.
Sergey Sharybin (sergey) triaged this task as Needs Information from User priority.

There is from mathutils import Color, Vector at the top of write_mtl() function, so it should all be fine.

I also can not reproduce the issue, so what's the exact blender version you're using?

dan grauer (kromar) added a comment.EditedApr 26 2016, 2:25 PM

hm strange, im using 2.77 2016-04-22 and obj version 2.3.0

in my file the import looks like this:

theres only a

from mathutils import Color

so there is no vector import

It doesn't seem you're using release or latest build. So please check whether:

  • Issue happens with 2.77a release
  • Issue happens with latest builds from builder.blender.org
Bastien Montagne (mont29) closed this task as Invalid.
Bastien Montagne (mont29) claimed this task.

Current (and official 2.77a) version of OBJ addon is 2.3.1, so one way or the other you are using an older version. You probably have an older version of that addon stuck into your own user's blender directory (e.g. because you installed it manually or something).

hmm how can it be that i only get version 2.3.0 when i pull from head? in 2.3.1 everything looks good

seemed for some reason the git submodule foreach git pull --rebase origin master was only doing its job when i got a coder here to ask him what i do wrong... so ticket can be closed, thanks for support.