As the title suggests,
I would like to compare two scenes of different projects in the same window of SC through the internet interface (accessible from localhost: 5555);
this is possible on the SC program, through menu "Present / Compare Scenes", then click "Add Scene" and finally "Present / Side by Side."
At present I can do 2 of 3 phases:
1 - Compare scenes: with the function COMPARISON_UI_SET_MODE :: 1 (true) or 0 (false)
2 - Add Scene: with the STAGE_OPEN :: path of the project
the 3 I just can not do it.
Looking at the SC console, I see that the click on "Side by Side" in the program correspond to these messages on the console:
(which is marked in red is the name of the project)
on WebRoot/index.html i used:
a) <a href="#" onclick="send_request('STAGE_ACTIVE_LIST::{Left:{}}||STAGE_ACTIVE_LIST::{Right:{Project-Completo.zip},Left:{}},');">Prova 14</a>
b) <a href="#" onclick="send_request('STAGE_ACTIVE_LIST::{<Left,Left: >}||STAGE_ACTIVE_LIST::{<Right,Right: Project-Completo.zip>,<Left,Left: >},');">Prova 13</a>
c) <a href="#" onclick="send_request('STAGE_ACTIVE_LIST::{<\'Left\',\'\'}||STAGE_ACTIVE_LIST::{<\'Right\',\'Project-Completo.zip\'>,<\'Left\',\'\'>},');">Prova 12</a>
d)<a href="#" onclick="send_request('STAGE_ACTIVE_LIST::{<Right,C:/TMP/Project-Completo.zip>,<Left, >}');">Prova 11</a>
e) <a href="#" onclick="send_request('STAGE_ACTIVE_LIST::{Right,Left},{C:/TMP/Project-Completo.zip,}');">Prova 10</a>
and other attempts at changing the syntax, SC I always returns the message:
then the problem should be on the syntax which I use the dictionary, can anyone help?
Solved! Go to Solution.
Solved by cikho. Go to Solution.
i took time to investigate a bit more, here is what i've found out
load a stage:
<li><A href="#" onclick="send_request('STAGE_OPEN::C:\\andrea\\testing\\compare\\test3.a3s');">open</a></li>
set side by side comparison mode (actually splits the screen in 2 viewport):
<li><A href="#" onclick="send_request('VIEWER_SET_LAYOUT::2::SideBySide');">TEST SIDESIDE</a></li>
change the position of files in viewports:
should be the STAGE_SET_ACTIVE code and not the STAGE_ACTIVE_LIST, but i can't figure out the correct syntax for the dictionary (dict) parameter set 😐
also for this one, you should use the scene ID given when the scene is loaded and not the full file path
it works good as is,
I haven't tried the dict syntax because it does what I need already.
Do you know if there is an opposite function to STAGE_OPEN?
(I read all the message reference but some have escaped me as the VIEWER_SET_LAYOUT )
@cikho wrote:
are you using the online sdk help?
contains a lot of informations 🙂
yes, I'm using it.
VIEWER_SET_LAYOUT can use also the parameters ::1::Single to reset the viewport to single and it will use the scene marked as left.
I did this already, I intended the possibility of closing one of the two scenes in sidebyside mode and then disable with Viewer_set_layout.
to actually close a scene i think it's quite complicated..
the only command i know is APPLICATION_CLOSE_SCENE, but if i'm not wrong it will close the whole scene not only one of the stages of the comparison mode..
try to test it, but imho it won't work.
I had already tried this, it close the whole scene, I keep looking. Thanks.
I could not to do what I wanted,
also happens that after I open a new scene with STAGE_OPEN
and then enable the dual display with VIEWER_SET_LAYOUT::2::SideBySide
if I come back with VIEWER_SET_LAYOUT::1::Single
the scene that remains active is the second to be opened, while I would like to remain active the first scene, how can I do?
the same behavior also happens if I do this directly from SC
documentation says that STAGE_ACTIVE_LIST requires a parameter:
viewportIdTostageId - A dictionary with the ID of the viewport as the key and the ID of the stage that will become active in that view as the value. (To get the viewport ID, create a custom script that listens to the VIEWPORT_LAYOUT message. To get the stage ID, listen to STAGE_ messages.)
the VIEWPORT_LAYOUT does not seem to exist anywhere but.
.. To get the stage ID, listen to STAGE_ messages ..
none of the STAGE_ messages seems to do this
I think so too,
infact trying some of the many tests that I did with STAGE_ACTIVE_LIST with STAGE_SET_ACTIVE return the same error on the dict:
(with STAGE_ACTIVE_LIST instead of STAGE_ACTIVE_LIST)
yep i made a lot of tests too, in my opinion it's problematic to understand how exactly the HTML command statement is converted into phyton language and then broadcasted.
i try to explain my self:
in the html sentence, most of the time :: splits the command from the parameter or a first parameter from a second one. meanwhile the || always marks the end of a command and the start of a brand new one.
|| it is used, for example, when you have to send a sequence of command one after the other.
also, the broadcasted commands are always kept inside a ' ' sepration ( eg 'VIEWER_SET_LAYOUT::2:: SideBySide' ).
in phyton, the dict should be with one of theese syntaxes:
>>> a = dict(one=1, two=2, three=3) >>> b = {'one': 1, 'two': 2, 'three': 3} >>> c = dict(zip(['one', 'two', 'three'], [1, 2, 3])) >>> d = dict([('two', 2), ('one', 1), ('three', 3)]) >>> e = dict({'three': 3, 'one': 1, 'two': 2})
due to the html syntax, b,c,d and e cannot be used because of the presence of the' , that potentially ends the send_request command.
i've tryed several times the syntax a, but it does not seem to work, maybe you'll have a better luck.
i seems to have understand that you're italian (ninja SCconsole file adress spying 😄 ) , so if you prefer an italian explanation just PM me 🙂
I could find the VIEWER_LAYOUT (which however is different from VIEWPORT_LAYOUT specified in the documents STAGE_SET_ACTIVE)
which has as this description:
VIEWER_LAYOUT (information application)
Internal message. Indicates how many viewports the viewer is split into, and a mask that controls the drawing in that viewport. For instance, when the viewer is split in half with a left viewport and a right viewport, this information will be sent in the format: ( (viewportName, 1), (viewportName, 2) ) This message is broadcastable.
Parameters:
viewportNameAndMask (tuple)
A tuple of (<viewportName>, <visibility mask>) pairs.
assuming that this can be of help (I doubt it, being an internal message I do not know if I can use it), there is the fact of seeing where and what to put in this custom script
Can't find what you're looking for? Ask the community or share your knowledge.