Page 1 of 1

Multiple viewers in 1 page

Posted: Wed Apr 12, 2017 3:46 pm
by Nicat
Hello,
I'm trying to change scenes via js,

Code: Select all

viewer.story.loadScene(c);
used this, then this

Code: Select all

viewer.story.sceneUid = c;
all changing scene actions changing in all Forge.viewer elements.
So my question: when u have multiple elements in one page, is there any other methods for changing scene?
which will not affect to other viewers

My test code:
https://codepen.io/Nodelines/pen/GmRNYJ

Re: Multiple viewers in 1 page

Posted: Thu Apr 13, 2017 3:27 pm
by rroux
Hi Nicat,

In fact we did not test this case, so thank you very much for this very clear sample!
I will make multi instances tests as soon as possible.
I'll try to get back to you with an answer during next week.

Did you tried with the non minified code and break points, any clues?

Have a nice week end!

Re: Multiple viewers in 1 page

Posted: Sat Apr 15, 2017 2:57 am
by Nicat
So i found out FORGE.BackgroundShaderRenderer._mesh.material.uniforms a same for both viewers, cus they linked with

Code: Select all

this._viewer.renderer.view.current.shaderSTW
, so when changing texture in other viewer changes too, so i cloned this with

Code: Select all

var shaderSTW = JSON.parse(JSON.stringify(this._viewer.renderer.view.current.shaderSTW));
and now works perfect

Re: Multiple viewers in 1 page

Posted: Sat Apr 15, 2017 9:31 pm
by rroux
Hi Nicat,

thank you very much for your investigation!
I'll try to push a fix next week based on your informations :)

Have a nice week end!

Re: Multiple viewers in 1 page

Posted: Tue Apr 25, 2017 8:33 am
by rroux
Hi Nicat,

I still working on the multiple instances case, because it does not affects only the shaders, it also affects plugins for example.
That's why there's no fix for multiple viewers in the 0.9.2 release.
I'll tell you when my fix will be in the master!

Have a nice day!

Re: Multiple viewers in 1 page

Posted: Tue Apr 25, 2017 9:45 am
by rroux
Hey, I have a pull request for the multiple instance case if want to test it!
https://github.com/gopro/forgejs/pull/59

Re: Multiple viewers in 1 page

Posted: Mon May 15, 2017 3:16 pm
by gwhiz
rroux wrote:Hey, I have a pull request for the multiple instance case if want to test it!
https://github.com/gopro/forgejs/pull/59


Hi, so can we have multiple viewers per page now? Is there a limit to the number ? Is there an issue having one viewer that is not displayed, but is running anyway?

Re: Multiple viewers in 1 page

Posted: Wed May 17, 2017 12:13 pm
by rroux
Hi gwhiz,

We do not test how many Viewers you can have at the same time.
I know that you have to disable the history feature to make it work like in this example : https://github.com/gopro/forgejs-sample ... fig-0.json

I don't think that have an hidden Viewer running is a problem but we haven't tested it.

If you make some test you can provide feedback.

Have a nice day!