-
Notifications
You must be signed in to change notification settings - Fork 1
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
fix(widgets): handle registration and state delivery #7
Conversation
Posting stack trace of the crash that happens when uncommenting these lines in // crash: sceneManager.unRegisterState(cid);
// crash: sceneManager.updateStatesFromObjects(); at abort (http://localhost:8080/__trame_vtklocal/wasm/9.3.20240626/vtkWasmSceneManager.mjs:688:40)
at assert (http://localhost:8080/__trame_vtklocal/wasm/9.3.20240626/vtkWasmSceneManager.mjs:456:3)
at ___cxa_throw (http://localhost:8080/__trame_vtklocal/wasm/9.3.20240626/vtkWasmSceneManager.mjs:1494:2)
at vtkWasmSceneManager.wasm.std::__2::__throw_out_of_range[abi:ne180100](char const*) (http://localhost:8080/__trame_vtklocal/wasm/9.3.20240626/vtkWasmSceneManager.wasm:wasm-function[959]:0x9b58d)
at vtkWasmSceneManager.wasm.std::__2::map<std::__2::basic_string<char, std::__2::char_traits<char>, std::__2::allocator<char>>, std::__2::set<vtkSmartPointer<vtkObjectBase>, std::__2::less<vtkSmartPointer<vtkObjectBase>>, std::__2::allocator<vtkSmartPointer<vtkObjectBase>>>, std::__2::less<std::__2::basic_string<char, std::__2::char_traits<char>, std::__2::allocator<char>>>, std::__2::allocator<std::__2::pair<std::__2::basic_string<char, std::__2::char_traits<char>, std::__2::allocator<char>> const, std::__2::set<vtkSmartPointer<vtkObjectBase>, std::__2::less<vtkSmartPointer<vtkObjectBase>>, std::__2::allocator<vtkSmartPointer<vtkObjectBase>>>>>>::at(std::__2::basic_string<char, std::__2::char_traits<char>, std::__2::allocator<char>> const&) const (http://localhost:8080/__trame_vtklocal/wasm/9.3.20240626/vtkWasmSceneManager.wasm:wasm-function[951]:0x9ab3d)
at vtkWasmSceneManager.wasm.vtkObjectManager::UpdateStatesFromObjects() (http://localhost:8080/__trame_vtklocal/wasm/9.3.20240626/vtkWasmSceneManager.wasm:wasm-function[950]:0x9a785)
at vtkWasmSceneManager.wasm.(anonymous namespace)::updateStatesFromObjects() (http://localhost:8080/__trame_vtklocal/wasm/9.3.20240626/vtkWasmSceneManager.wasm:wasm-function[276]:0x7ae17)
at vtkWasmSceneManager.wasm.emscripten::internal::Invoker<void>::invoke(void (*)()) (http://localhost:8080/__trame_vtklocal/wasm/9.3.20240626/vtkWasmSceneManager.wasm:wasm-function[294]:0x7bb77)
at dynCall (http://localhost:8080/__trame_vtklocal/wasm/9.3.20240626/vtkWasmSceneManager.mjs:4893:34)
at http://localhost:8080/__trame_vtklocal/wasm/9.3.20240626/vtkWasmSceneManager.mjs:4899:22 |
// crash: sceneManager.updateStatesFromObjects(); | ||
const cameraState = sceneManager.getState(cid); | ||
console.log(`${cameraState.Position}`); | ||
emit("camera", cameraState); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed the crash in my development branch. The logs of cameraState.Position
in console shows x,y,z that change as I rotate the view so I think it works.
Can you suggest how to catch this emission of the cameraState
and apply it in python? I checked the protocol.py
and vtklocal.py
just in case, nothing seems obvious.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
state.camera = None
VtkLocal(rw, camera="camera = $event")
@state.change("camera"):
def on_camera_change(camera, **_):
print("camera state available", camera)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! also had to do a small change in LocalView.__init__
--- a/trame_vtklocal/widgets/vtklocal.py
+++ b/trame_vtklocal/widgets/vtklocal.py
@@ -75,6 +75,7 @@ class LocalView(HtmlElement):
"updated",
("memory_vtk", "memory-vtk"),
("memory_arrays", "memory-arrays"),
+ ("camera", "camera"),
]
9bf4f85
to
f6011c0
Compare
07fb48c
to
b03dbcf
Compare
No description provided.