mathutils missing to use vector in obj export #48276

Closed
opened 2016-04-26 11:47:13 +02:00 by Daniel Grauer · 12 comments
Member

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 pasted_file
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]))
**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** ![pasted_file](https://archive.blender.org/developer/F306681/pasted_file) ``` 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])) ```
Author
Member

Changed status to: 'Open'

Changed status to: 'Open'
Author
Member

Added subscriber: @DanielGrauer

Added subscriber: @DanielGrauer

Added subscriber: @Sergey

Added subscriber: @Sergey

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?

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?
Author
Member

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

in my file the import looks like this:
pasted_file

theres only a

   from mathutils import Color

so there is no vector import

hm strange, im using 2.77 2016-04-22 and obj version 2.3.0 in my file the import looks like this: ![pasted_file](https://archive.blender.org/developer/F306790/pasted_file) 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
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

Added subscriber: @mont29

Added subscriber: @mont29

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'
Bastien Montagne self-assigned this 2016-04-26 14:40:32 +02:00

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).

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).
Author
Member

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

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
You need to pull all the submodules. See https://wiki.blender.org/index.php/Dev:Doc/Building_Blender/Linux/get_the_source
Author
Member

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.

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.
Sign in to join this conversation.
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#48276
No description provided.