Closed cekees closed 5 years ago
We actually already generate images from the canvas for the purposes of "freezing" the canvas when it's not in use. So yes, it's possible, and probably not that hard to add.
On Tue, Jun 20, 2017 at 8:24 AM, Chris Kees notifications@github.com wrote:
Our team is looking for a way to generate image frames (for animations) based on our pythreejs canvas. Would this be a worthwhile thing for us to try adding to pythreejs?
https://stackoverflow.com/questions/15558418/how-do-you- save-an-image-from-a-three-js-canvas
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jovyan/pythreejs/issues/106, or mute the thread https://github.com/notifications/unsubscribe-auth/AAMNduZ4UqsKhk72izyB94LcHL1TxMAoks5sF-QSgaJpZM4N_wDc .
-- Abel Allison abel.allison@gmail.com
I'm trying to implement this.
From what I understand I need to register a callback in Renderer.py
:
self.on_msg(self._screenshot_ret_val)
And in Renderable.js
I have a screenshot function that sends data back to the python side:
this.send({
type: '...',
method_name: 'screenshot',
ret_val: ...,}, this.callbacks(), null);
However, I'm unclear on how ret_val
needs to be packaged. I tried to set ret_val: this.renderer.domElement.toDataURL()
, but then session.py
complained that it could not handle a string and was expecting a byte object.
Are there some js functions I can call with exec_three_obj_method
that actually return something so that I can gain a better understanding on how the communication from javascript to python is supposed to work?
I tried calling localToWorld
from Object3D.js
but that method could not be found.
see also my comment here
Our team is looking for a way to generate image frames (for animations) based on our pythreejs canvas. Would this be a worthwhile thing for us to try adding to pythreejs?
https://stackoverflow.com/questions/15558418/how-do-you-save-an-image-from-a-three-js-canvas