react-vtkjs-viewport
react-vtkjs-viewport copied to clipboard
Updating to latest vtk.js version
First of all, great work, so far everything works very well. I'm toying with creating a sample viewer that consumes the react-vtkjs-viewport directly (which works now).
My only concern is that updating to the latest vtk.js version isn't currently possible (and how to handle such cases in the future).
When using the latest vtk.js (14.11.4 currently) there is one breaking change that creates an error when using together with this library: in View2D.js Ln 77: handle.rotateFromDirections(handle.getDirection(), normal);
Apparently the api has changed and rotateFromDirections is now in vtkMatrixBuilder.
Unfortunately I also have a problem using the new api, replacing with:
vtkMatrixBuilder.buildfromDegree().matrix.rotateFromDirections(handle.getDirection(), normal);
and including the vtkMatrixBuilder:
import vtkMatrixBuilder from 'vtk.js/Sources/Common/Core/MatrixBuilder';
compiles but I get scope issues with webpack later running the example:
Uncaught TypeError: vtk_js_Sources_Common_Core_MatrixBuilder__WEBPACK_IMPORTED_MODULE_19__.default.buildfromDegree is not a function
Here is my fork with the changes: https://github.com/knopkem/react-vtkjs-viewport
Thanks
vtkPaintWidget changed API slightly. You should no longer need the method updatePaintbrush, as vtkPaintWidget now handles the paintbrush orientation internally.
As floryst was suggesting, would it be sufficient to just update the updatePaintbrush method? To modify anything only if rotateFromDirections exists? I've tested this with the newest vtk.js and have encountered no issues. I could create a PR if that's desired.
I get this error when I try to import this library:
./node_modules/vtk.js/Sources/Filters/General/PaintFilter/PaintFilter.worker.js
ValidationError: Invalid options object. Worker Loader has been initialized using an options object that does not match the API schema.
- options has an unknown property 'fallback'. These properties are valid:
object { worker?, publicPath?, filename?, chunkFilename?, inline?, esModule? }
- options.inline should be one of these:
"no-fallback" | "fallback"
is this because I'm using vtk.js 15?
vtk.js v15 updates to webpack 5, and with it worker-loader options object changed. Assuming react-vtkjs-viewport is using the vtk dependency file, that shouldn't be happening. Can you print out the whole webpack config?
As floryst was suggesting, would it be sufficient to just update the
updatePaintbrushmethod? To modify anything only ifrotateFromDirectionsexists? I've tested this with the newest vtk.js and have encountered no issues. I could create a PR if that's desired.
@manjebrinkhuis +1 for this. Would be appreciated to see this accepted as it's causing us some grief right now. If you don't have time at the moment however I can take it on myself.
@Punzo @floryst or @JamesAPetts just wondering if there was any word on getting the PR approved. If there are any issues just let me know and I'll address them as best as I can.
Hi @tamaynard, sorry I didn't manage to do create the PR for this. Thanks for that!
Additionally to the changes mentioned on this thread, the rendering profile must be included since v18.0.0
Please accept change, this issue open too long