Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VTP parsing fails for DataArray with multiple components #23683

Closed
eino opened this issue Mar 9, 2022 · 0 comments · Fixed by #23684
Closed

VTP parsing fails for DataArray with multiple components #23683

eino opened this issue Mar 9, 2022 · 0 comments · Fixed by #23684

Comments

@eino
Copy link
Contributor

eino commented Mar 9, 2022

Describe the bug

Using VTKLoader to parse a VTP file containing DataArrays with multiple components
fails with a parsing error

To Reproduce

Steps to reproduce the behavior:

  1. Save face.vtp that it attached to the bug face.zip
  2. Try to load it with VTKLoader

Code

import { VTKLoader} from 'three/examples/jsm/loaders/VTKLoader.js';
// ...
var loader1 = new VTKLoader();
    loader1.load( 'face.vtp',
    function ( geometry ) {
});

Loading fails with the following error

VTKLoader.js?e3d9:42 Error: Invalid string. Length must be a multiple of 4
    at Base64toByteArray (VTKLoader.js?e3d9:661:1)
    at parseDataArray (VTKLoader.js?e3d9:741:1)
    at parseXML (VTKLoader.js?e3d9:928:1)
    at VTKLoader.parse (VTKLoader.js?e3d9:1135:1)
    at Object.eval [as onLoad] (VTKLoader.js?e3d9:32:1)
    at eval (three.module.js?5a89:39645:1)

Expected behavior

VTP file is loaded

Platform:

  • Device: Desktop
  • OS: Linux
  • Browser: Chrome, Firefox
  • Three.js version: r138

PR

The issue is that in parseDataArray, rather than the usual/expected string, the data is in form of an array, containing 1 element (the compressed string). If using this first element as string, parsing works as expected.
I hope you don't mind, I started a PR to fix this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants