X3d import crashes on texture #47374

Closed
opened 2016-02-09 14:13:17 +01:00 by Anton Fuhrmann · 6 comments

System Information
Windows 10x64, on Intel and Nvidia cards

Blender Version
Broken: import_x3d.py in 2.76b

Short description of error
Importing an X3d file containing a textureTransform node crashes importer

Exact steps for others to reproduce the error
Attached are a simple blend file and an .x3d exported from this blend file: demo.zip
When re-importing the .x3d with the "x3d/vrml" importer distributed with 2.76b, you get the following stacktrace:

Traceback (most recent call last):
  File "C:\Program Files\Blender Foundation\Blender\2.76\scripts\addons\io_scene_x3d\__init__.py", line 81, in execute
    return import_x3d.load(self, context, **keywords)
  File "C:\Program Files\Blender Foundation\Blender\2.76\scripts\addons\io_scene_x3d\import_x3d.py", line 2684, in load
    global_matrix=global_matrix,
  File "C:\Program Files\Blender Foundation\Blender\2.76\scripts\addons\io_scene_x3d\import_x3d.py", line 2604, in load_web3d
    importShape(node, ancestry, global_matrix)
  File "C:\Program Files\Blender Foundation\Blender\2.76\scripts\addons\io_scene_x3d\import_x3d.py", line 2223, in importShape
    apply_texmtx(blendata, texmtx)
NameError: name 'blendata' is not defined

This is caused by the following typo:

2220:                        if bpydata.uv_layers:
2221:                            if texmtx:
2222:                                # Apply texture transform?
2223:                                apply_texmtx(blendata, texmtx)

which should read:

2220:                        if bpydata.uv_layers:
2221:                            if texmtx:
2222:                                # Apply texture transform?
2223:                                apply_texmtx(bpydata, texmtx)

changing this results in another stacktrace in function "apply_texmtx":

Traceback (most recent call last):
  File "C:\Program Files\Blender Foundation\Blender\2.76\scripts\addons\io_scene_x3d\__init__.py", line 81, in execute
    return import_x3d.load(self, context, **keywords)
  File "C:\Program Files\Blender Foundation\Blender\2.76\scripts\addons\io_scene_x3d\import_x3d.py", line 2684, in load
    global_matrix=global_matrix,
  File "C:\Program Files\Blender Foundation\Blender\2.76\scripts\addons\io_scene_x3d\import_x3d.py", line 2604, in load_web3d
    importShape(node, ancestry, global_matrix)
  File "C:\Program Files\Blender Foundation\Blender\2.76\scripts\addons\io_scene_x3d\import_x3d.py", line 2223, in importShape
    apply_texmtx(bpydata, texmtx)
  File "C:\Program Files\Blender Foundation\Blender\2.76\scripts\addons\io_scene_x3d\import_x3d.py", line 2044, in apply_texmtx
    luv.uv = texmtx * luv.uv
ValueError: matrix * vector: len(matrix.col) and len(vector) must be the same, except for 4x4 matrix * 3D vector.

which results from trying to multiply a 2d UV-coordinate vector by an 4x4 matrix:

2042:    def apply_texmtx(blendata, texmtx):
2043:        for luv in bpydata.uv_layers.active.data:
2044:            luv.uv = texmtx * luv.uv

line 2044 should in my opinion read:

2044:            luv.uv = (texmtx * luv.uv.to_3d()).to_2d()

This results in a correct import of "demo.x3d":
Capture.PNG
then, changing the textureTransform values in the .x3d correctly results in a plausible transformation:
Capture1.PNG

**System Information** Windows 10x64, on Intel and Nvidia cards **Blender Version** Broken: import_x3d.py in 2.76b **Short description of error** Importing an X3d file containing a textureTransform node crashes importer **Exact steps for others to reproduce the error** Attached are a simple blend file and an .x3d exported from this blend file: [demo.zip](https://archive.blender.org/developer/F281176/demo.zip) When re-importing the .x3d with the "x3d/vrml" importer distributed with 2.76b, you get the following stacktrace: ``` Traceback (most recent call last): File "C:\Program Files\Blender Foundation\Blender\2.76\scripts\addons\io_scene_x3d\__init__.py", line 81, in execute return import_x3d.load(self, context, **keywords) File "C:\Program Files\Blender Foundation\Blender\2.76\scripts\addons\io_scene_x3d\import_x3d.py", line 2684, in load global_matrix=global_matrix, File "C:\Program Files\Blender Foundation\Blender\2.76\scripts\addons\io_scene_x3d\import_x3d.py", line 2604, in load_web3d importShape(node, ancestry, global_matrix) File "C:\Program Files\Blender Foundation\Blender\2.76\scripts\addons\io_scene_x3d\import_x3d.py", line 2223, in importShape apply_texmtx(blendata, texmtx) NameError: name 'blendata' is not defined ``` This is caused by the following typo: ``` 2220: if bpydata.uv_layers: 2221: if texmtx: 2222: # Apply texture transform? 2223: apply_texmtx(blendata, texmtx) ``` which should read: ``` 2220: if bpydata.uv_layers: 2221: if texmtx: 2222: # Apply texture transform? 2223: apply_texmtx(bpydata, texmtx) ``` changing this results in another stacktrace in function "apply_texmtx": ``` Traceback (most recent call last): File "C:\Program Files\Blender Foundation\Blender\2.76\scripts\addons\io_scene_x3d\__init__.py", line 81, in execute return import_x3d.load(self, context, **keywords) File "C:\Program Files\Blender Foundation\Blender\2.76\scripts\addons\io_scene_x3d\import_x3d.py", line 2684, in load global_matrix=global_matrix, File "C:\Program Files\Blender Foundation\Blender\2.76\scripts\addons\io_scene_x3d\import_x3d.py", line 2604, in load_web3d importShape(node, ancestry, global_matrix) File "C:\Program Files\Blender Foundation\Blender\2.76\scripts\addons\io_scene_x3d\import_x3d.py", line 2223, in importShape apply_texmtx(bpydata, texmtx) File "C:\Program Files\Blender Foundation\Blender\2.76\scripts\addons\io_scene_x3d\import_x3d.py", line 2044, in apply_texmtx luv.uv = texmtx * luv.uv ValueError: matrix * vector: len(matrix.col) and len(vector) must be the same, except for 4x4 matrix * 3D vector. ``` which results from trying to multiply a 2d UV-coordinate vector by an 4x4 matrix: ``` 2042: def apply_texmtx(blendata, texmtx): 2043: for luv in bpydata.uv_layers.active.data: 2044: luv.uv = texmtx * luv.uv ``` line 2044 should in my opinion read: ``` 2044: luv.uv = (texmtx * luv.uv.to_3d()).to_2d() ``` This results in a correct import of "demo.x3d": ![Capture.PNG](https://archive.blender.org/developer/F281179/Capture.PNG) then, changing the textureTransform values in the .x3d correctly results in a plausible transformation: ![Capture1.PNG](https://archive.blender.org/developer/F281181/Capture1.PNG)
Author

Changed status to: 'Open'

Changed status to: 'Open'
Author

Added subscriber: @alfv

Added subscriber: @alfv

Added subscriber: @ideasman42

Added subscriber: @ideasman42

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Campbell Barton self-assigned this 2016-02-09 14:42:54 +01:00

Confirmed the bug in 2.76b.

This is fixed in master, (note that its worth testing daily builds when reporting bugs).

Confirmed the bug in 2.76b. This is fixed in master, *(note that its worth testing daily builds when reporting bugs)*.
Author

OK, next time I will check daily builds.

Thank you!

OK, next time I will check daily builds. Thank you!
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
2 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#47374
No description provided.