You are not logged in.

tonesh

Trainee

  • "tonesh" started this thread

Posts: 75

Location: Rome

Occupation: Photographer

  • Send private message

1

Friday, October 11th 2013, 4:32pm

IF and Multiple Values

When changing scene I would like to have a special action only for selected scenes (for example resetting the architectural view) so I have this type of action:

Source code

1
2
3
<action name="reset_arch"> 
if(linkedscene == var2, reset_arch_off, reset_arch_on )
</action>


it works if I have only one value for var2 but var2 has obviusly multiple values:

scene_03, scene_24, scene_71, etc.

how can I make this working? How can I assign to var2 multiple values?

thanks

Toni

BTW, I use defined architectural view setting in each <scene> property, but my loading actions to connect the scenes through hotspots have the KEEPVIEW setting so it does not work.
If your curious why I have this KEEPVIEW setting see here

Alexey Tkachenko

Professional

Posts: 770

Location: Russian Federation

Occupation: Interpreting, Building virtual tours

  • Send private message

2

Friday, October 11th 2013, 4:40pm

Hi!

Introduce the "view_tag" inside each "scene" node. Like this:

Source code

1
<scene name="DSC_0619_Panorama_cube_equi" title="Gallery" view_tag="pattern_1"  > 


Let's say you have 3 view patterns. Then create an action which will check the "view_tag" of each scene:

Source code

1
if(scene[get(xml.scene)].view_tag == pattern_1. set(view... blah-blah-blah);  );if(scene[get(xml.scene)].view_tag == pattern_2. set(view... another blah-blah-blah);  );  if(scene[get(xml.scene)].view_tag == pattern_3. set(view... third blah-blah-blah);  );  


This should work *smile*
Regards,

Alexey

tonesh

Trainee

  • "tonesh" started this thread

Posts: 75

Location: Rome

Occupation: Photographer

  • Send private message

3

Friday, October 11th 2013, 5:41pm

Alexey, your system is the same as Klaus said on this thread.

My problem now is how to assign multiple values to one variable, or better how to code:

if (A) is (B,C,D) then do_this else do_that

thanks in any case ;-)

Posts: 1,082

Location: Russia, Kaliningrad

  • Send private message

4

Friday, October 11th 2013, 8:16pm

Hi
a little trick

set(A_in_List,false);
if(a == b, set(A_in_List,true) );
if(a == c, set(A_in_List,true) );
if(a == d, set(A_in_List,true) );
if(a == e, set(A_in_List,true) );
if(A_in_List, do_something(); );

Hope it help
Andrey *thumbup*
VRAP - desktop VR content player based on krpano.
Common tasks in one place in one click! Discussion thread
DOWNLOAD for MAC
DOWNLOAD for WIN

Posts: 1,082

Location: Russia, Kaliningrad

  • Send private message

5

Friday, October 11th 2013, 8:35pm

Or


<myarray>
<item name="i0" value="blabla1"/>
<item name="i1" value="blabla2"/>
<item name="i2" value="blabla3"/>
<item name="i3" value="blabla4"/>
<item name="i4" value="blabla5"/>
<item name="i5" value="blabla6"/>
</myarray>


....
set(checkvar,false);

for(set(i,0), i LT myarray.item.count, inc(i),
if(a == myarray.item[get(i)].value, set(checkvar,true); );
);
if(checkvar, do_something() );
....


Or




set(var_with_many_values,one two three four five);

set(my_var,three);
indexoftxt(searched_index,get(var_with_many_values),get(my_var));
searched_index - wil have "8" value, means value in list




set(my_var,ten);
indexoftxt(searched_index,get(var_with_many_values),get(my_var));
searched_index - wil have "-1" value, means value not in list


If(searched_index GT -1, do_something() );

Andrey
VRAP - desktop VR content player based on krpano.
Common tasks in one place in one click! Discussion thread
DOWNLOAD for MAC
DOWNLOAD for WIN

tonesh

Trainee

  • "tonesh" started this thread

Posts: 75

Location: Rome

Occupation: Photographer

  • Send private message

6

Saturday, October 12th 2013, 10:25am

thank you Andrey Sudarchikov for the lesson *smile* !

I use the second example in the three you suggested, using an array.

Now I have for each scene the viewing defined settings for architectural, for example this:

Source code

1
2
3
4
5
6
7
<scene name="scene_070" title="070"   thumburl="panos/070.tiles/thumb.jpg"  >
<view hlookat=" " vlookat=" " architectural="1.0" architecturalonlymiddle="false"  />

.................

<scene name="scene_090" title="090" thumburl="panos/090.tiles/thumb.jpg"  >
<view hlookat=" " vlookat=" " architectural="1.0" architecturalonlymiddle="false"  />


or this:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
<scene name="scene_e06" title="e06"  thumburl="panos/e06.tiles/thumb.jpg" >
<view hlookat="0" vlookat="-20" architectural="0.0" />

...............

<scene name="scene_044" title="044" thumburl="panos/044.tiles/thumb.jpg" >
<view hlookat="0" vlookat="-10" architectural="0.0" />

...............

<scene name="scene_065" title="065" thumburl="panos/065.tiles/thumb.jpg" >
<view hlookat="0" vlookat="90" architectural="0.0" />


When I click on thumbs or on next/prev buttons or on a button on a map that uses the "MERGE" to load a new scene, I get the defined (for each scene) architectural view setting.

But if I load a scene with hotspots that uses "KEEPVIEW" (I'm doing this to have a same orientation as said here) like this:

Source code

1
2
3
4
5
<style name="skin_hotspotstyle" url="vtourskin_hotspot.png" scale="0.2" edge="top" oy="0"
	       distorted="true"
	       onclick="if(linkedscene, tween(scale,0.25,0.5); tween(oy,-20,0.5); tween(alpha,0,0.5); loadscene(get(linkedscene),null,KEEPVIEW,BLEND(1)); reset_arch(); skin_updatescroll(); );"
	       onhover="if(skin_settings.tooltips_hotspots, if(linkedscene, showtext(get(scene[get(linkedscene)].title),SKIN_TOOLTIPS)) );"
	       />


With the code below, I get correct architectural view settings:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
        <myarray>
		<item name="i0" value="scene_e06"/>
		<item name="i2" value="scene_044"/>
		<item name="i3" value="scene_065"/>
	</myarray>
		
	<action name="reset_arch"> 
		set(checkvar,false);
		for(set(i,0), i LT myarray.item.count, inc(i), 
		if(linkedscene == myarray.item[get(i)].value, set(checkvar,true); );
		);
		if(checkvar,reset_arch_off(),reset_arch_on());  
	</action>
	
	<action name="reset_arch_on"> 
                set(view.architectural,1.0); set(view.architecturalonlymiddle,false); 
        </action>
	<action name="reset_arch_off"> 
                set(view.architectural,0.0); 
         </action>


Thank you again. *thumbup*
toni