Sie sind nicht angemeldet.

Yomas

Fortgeschrittener

  • »Yomas« ist der Autor dieses Themas

Beiträge: 190

Wohnort: Anglet, France

  • Nachricht senden

1

Donnerstag, 11. August 2011, 10:12

Starting with if(condition, then-actions, else-actions) problems ^^

Hi all ^^
Here we are I'm getting started with the if condition to dry my code, and allready have a problem ^^
Just a short code I tried is not working as I would like it to :

Quellcode

1
2
3
4
5
6
7
8
9
    <plugin name="spotinfo" 
	keep="true" 
	onclick="scene2load(); movemap(); showinfo();"
	...
	/>
	
        <action name="scene2load">
	if (scene == scene_pano2, null();, loadscene(scene_pano2););
	</action>


My aim is to tell my spotinfo button not to reload the scene_pano2 if we are already in it ...

I tried : if (scene == scene_pano2, null(), loadscene(scene_pano2) );
and the opposite : if(scene != scene_pano2, loadscene(scene_pano2));

with or without ; at action end does'nt change anything.
Either it loads the scene or not, but donesn't detect the scene state...

Someone maybe has a idea ?
Thanks in advance,
Best regards.
My website: www.eboovisite.com, See me also on www.Viewat.com, Facebook and Twitter

2

Donnerstag, 11. August 2011, 11:41

Hi Yomas,

I use the following to check for scene names:

set(scenename,get(xml.scene));
if(scenename == blabla, do_whatever());


I´ve never got it to work your way using "scene == blabla".

Best regards
Nupsi

P.S.: I love the style of your homepage *smile* Very clever!

Yomas

Fortgeschrittener

  • »Yomas« ist der Autor dieses Themas

Beiträge: 190

Wohnort: Anglet, France

  • Nachricht senden

3

Freitag, 12. August 2011, 11:04

Hi Nupsi !!
Thanks a lot it worked perfectly ^^
I missed the set(scenename,get(xml.scene)); part ^^
I think i have to look around more on krpano action/scripting documentation ;-)
Thanks also for the comment on my home page, glad you like it ;-)
Best regards.
My website: www.eboovisite.com, See me also on www.Viewat.com, Facebook and Twitter

Yomas

Fortgeschrittener

  • »Yomas« ist der Autor dieses Themas

Beiträge: 190

Wohnort: Anglet, France

  • Nachricht senden

4

Dienstag, 11. Oktober 2011, 16:15

Up again with variables things I'm not ease with those yet ^^
I'm trying to make a photo gallery seamless to the simpleviewer only using xml cause the flash ones doesn't work like I want it to.
I know how to get this "plugin" work but my code wouldn't be dry and it could be usefull for lots of people.
Here were I am from now on :

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<!-------------------------------------- Background Image   -------------------------------------------->
<plugin name="photogallerybackground" url="../imgs/black.png" align="center" width="80%" height="80%" keep="true" visible="true" handcursor="false" />

<!-------------------------------------- Thumb area -------------------------------------------->
<plugin name="photogallerythumbstage" url="../imgs/transparent.png" align="left" edge="left" x="0" y="0" parent="photogallerybackground" width="33%" height="100%" keep="true" visible="true" handcursor="false" />
<!-------------------------------------- The first 3 ones -------------------------------------------->
<plugin name="thumb1" url="../photos/thumbs/01.jpg" align="lefttop" edge="lefttop" width="25%" height="prop"  parent="photogallerythumbstage" x="10%" y="10%" keep="true" visible="true"
onover="showphoto();" onout="hidephoto();"/>
<plugin name="thumb2" url="../photos/thumbs/02.jpg" align="lefttop" edge="lefttop" width="25%" height="prop"  parent="photogallerythumbstage" x="40%" y="10%" keep="true" visible="true" />
<plugin name="thumb3" url="../photos/thumbs/03.jpg" align="lefttop" edge="lefttop" width="25%" height="prop"  parent="photogallerythumbstage" x="70%" y="10%" keep="true" visible="true" />


<!-------------------------------------- The photos to be shown-------------------------------------------->
<plugin name="photogallerystage" url="../imgs/black.png" align="right" edge="right" x="0" y="0" parent="photogallerybackground" width="60%" height="100%" keep="true" visible="true" handcursor="false" />
<plugin name="photo1" url="../photos/01.jpg" align="righttop" edge="righttop" width="80%" height="prop"  parent="photogallerystage" x="10%" y="10%" keep="true" visible="false" />
<plugin name="photo2" url="../photos/02.jpg" align="righttop" edge="righttop" width="80%" height="prop"  parent="photogallerystage" x="10%" y="10%" keep="true" visible="false" />
<plugin name="photo3" url="../photos/03.jpg" align="righttop" edge="righttop" width="80%" height="prop"  parent="photogallerystage" x="10%" y="10%" keep="true" visible="false" />
<!-------------------------------------- Actions to make the photos visible -------------------------------------------->
<action name="showphoto">
set(plugin[photo1].visible, true);
</action>

<action name="hidephoto">
set(plugin[photo1].visible, false);
</action>
...


Here it would work, just have to continue coding with repeated action for showing the right photo according to the thumb hovered...
But that makes a lot of coding for a simple action :'(
I'm trying to do something like :

<plugin name="photo" url="" align="righttop" edge="righttop" width="80%" height="prop" parent="photogallerystage" x="10%" y="10%" keep="true" visible="false" />
<action name="showphoto">
set(plugin[photo].url, ../photos/01.jpg);
set(plugin[photo].visible, true);
...
</action>

But as you see it'll be moreover complicated this way and not much dryer ^^
I'm a bit lost.
I miss the part to make only one action that loads different photo from a different thumb, without having to create as many actions as there are thumbs...

Would be great if someone could give me a clue here ^^
Thanks in advance.
At least when done it'll be a good xml plugin to share ;-)
Best regards.
My website: www.eboovisite.com, See me also on www.Viewat.com, Facebook and Twitter

Yomas

Fortgeschrittener

  • »Yomas« ist der Autor dieses Themas

Beiträge: 190

Wohnort: Anglet, France

  • Nachricht senden

5

Mittwoch, 12. Oktober 2011, 10:28

Hi again;-)
Nobody?!
Therefore I got it to work nicely but the XML code and images aren't not dry at all^^
Getting further in this plugin developement would be great to have a auto onover effect on the thumbs,
And auto caption under the photos...
Actually I use the crop onovercrop method to change the thumbs and photos aspect, but itI'll ne nice to automate all that;-)
This could be a cool plugin for showing non spherical images !!
Hoping domaine would give a little help for me and the plugin comunity sharing^^
Thanks in advance'
Best regards.
My website: www.eboovisite.com, See me also on www.Viewat.com, Facebook and Twitter