You are not logged in.

Kev-in-spain

Intermediate

  • "Kev-in-spain" started this thread

Posts: 152

Location: Barcelona

Occupation: VR Photographer

  • Send private message

1

Monday, February 21st 2011, 4:34pm

Wrong xml structure?

Hi guys,
Can anyone advise me as to what I have done wrong in this xml?: http://www.projectsolutions.es/demos/yomec/tour.xml
The tour ( http://www.projectsolutions.es/demos/yomec/tour.html ) does everything I want it to do but takes forever to load.
The xml does contain quite a few hotspots, plugins and actions, but I've seen other examples with just as many, and more, and they don't take as long to load.

As always, any advice will be gratefully recieved.

VN2011

Professional

Posts: 1,336

Location: Duluth MN

  • Send private message

2

Monday, February 21st 2011, 4:55pm

it actually loaded quite fast for me in the US. that tour is not that large at all. to reduce loading times you could use only 1 picture plugin and 1 text plugin. then create an action that sets the appropriate image and text based on whatever hotspot was clicked. craete an action and set it to each hotspot. you have a ton of replicated code for actions, plugins and hotspots. use some varaibles like below. also you could set a 'style' on the of the hotspot or plugin code so you do not have to replicate the same code taht way also.

<action name=showstuff>
set(plugin[photo].url, %1);
set(plugin[text].url, %2);
set(plugin[photo].visible, true);
set(plugin[text]/visible, true);
<action/>

hotspot1
onclick="showstuff(pathtoimageurl, pathtotexturl);"

hotspot2
onclick="showstuff(pathtoimageurl2, pathtotexturl2);"


right now you are loading every jped and text image even when they are not needed.

Kev-in-spain

Intermediate

  • "Kev-in-spain" started this thread

Posts: 152

Location: Barcelona

Occupation: VR Photographer

  • Send private message

3

Monday, February 21st 2011, 7:02pm

Thanks VN2011.
It's all a bit much for my beginners brain *confused* but I think I understand the concept.
I'll go away and try it but I have a feeling I'm going to be back!

Kev-in-spain

Intermediate

  • "Kev-in-spain" started this thread

Posts: 152

Location: Barcelona

Occupation: VR Photographer

  • Send private message

4

Monday, February 21st 2011, 8:23pm

Ok.... I knew it couldn't be that simple!

Here's what I did:

<action name="showImage">
set(plugin[photo].url, %1);
set(plugin[text].url, %2);
set(plugin[photo].visible, true);
set(plugin[text]/visible, true);
</action>

<plugin name="photo" url=""
align="center"
visible="false"/>

<plugin name="text" url=""
align="center"
y="250"
zorder="10"
visible="false"/>

<hotspot name="spot1" style="cog_hotspot" ath="6.3" atv="-1.4" onhover="showtext(Clique para más info, buttonstyle);" onclick="showImage(url=graphics/car_lift.png,url=graphics/text_area.png)" />

When I click on spot1 in the tour I get an error message:

WARNING: not local trusted - ExternalInterface disabled!
ERROR: download of "url=graphics/car_lift.png" failed
ERROR: download of "url=graphics/text_area.png" failed

Where did I go wrong?

5

Monday, February 21st 2011, 8:49pm

Hi,

see the red marked parts here - they are wrong:
hotspot name="spot1" style="cog_hotspot" ath="6.3" atv="-1.4" onhover="showtext(Clique para más info, buttonstyle);" onclick="showImage(url=graphics/car_lift.png,url=graphics/text_area.png)" />

When I click on spot1 in the tour I get an error message:

WARNING: not local trusted - ExternalInterface disabled!
ERROR: download of "url=graphics/car_lift.png" failed
ERROR: download of "url=graphics/text_area.png" failed
best regards,
klaus

VN2011

Professional

Posts: 1,336

Location: Duluth MN

  • Send private message

6

Monday, February 21st 2011, 8:59pm

you do not need the url= part since the %1 and %2 variables are only for the path itself. but you are headed in the right direction!

onclick="showImage(graphics/car_lift.png,graphics/text_area.png)"

Kev-in-spain

Intermediate

  • "Kev-in-spain" started this thread

Posts: 152

Location: Barcelona

Occupation: VR Photographer

  • Send private message

7

Monday, February 21st 2011, 9:11pm

Hmm... why didn't I think to try that?!

Next thing is, why is y="250" & zorder="10" being ignored?

8

Monday, February 21st 2011, 9:13pm

why should it have been ignored?

btw - here is also something wrong: (red)

Quoted

set(plugin[text]/visible, true);

Kev-in-spain

Intermediate

  • "Kev-in-spain" started this thread

Posts: 152

Location: Barcelona

Occupation: VR Photographer

  • Send private message

9

Monday, February 21st 2011, 10:00pm

Thanks guys, you've got me out of another hole.

Another question;
How do I scale the plugin images to screen size?
I've tried using % & prop but then the image scales on both x & y at the same time.
What I like to use is, first expand width followed by height using this action:
tween(plugin[photo].width, 1074,0.2,easyOut,
tween(plugin[photo].height, 725,0.3,easyOut);

10

Monday, February 21st 2011, 10:07pm

here a solution:

Source code

1
tween(width,get(stagewidth),0.2,easeOutQuad, set(width,100%); tween(height,get(stageheight),0.2,easeOutQuad, set(height,100%) ) );


first the width will get tweened to the current stagewidth,
and then will it be set to 100% to keep the full screemwidth also on resizing,
then the the same will be done with the height,

Kev-in-spain

Intermediate

  • "Kev-in-spain" started this thread

Posts: 152

Location: Barcelona

Occupation: VR Photographer

  • Send private message

11

Tuesday, February 22nd 2011, 11:52am

Thanks Klaus,
I've entered the code you suggested as follows:

<action name="showImage">
set(plugin[photo].url, %1);
set(plugin[text].url, %2);
tween(view.fov, 120,0.7,,
tween(plugin[photo].width,get(stagewidth),0.2,easeOutQuad, set(width,70%);
tween(plugin[photo].height,get(stageheight),0.2,easeOutQuad, set(height,prop);
tween(plugin[text].scale, 0.56,0.2,,
tween(plugin[text].scale, 0.52,0.05,,
tween(plugin[text].scale, 0.55,0.1,,
loadscene('scene_2',null,KEEPALL,BLEND(1.2))))))));
</action>

However, no matter what percentage I put for the width, the image still opens full screen and is in propotion to the screen size rather than in proportion with itself.
What have I done wrong? *confused*

Kev-in-spain

Intermediate

  • "Kev-in-spain" started this thread

Posts: 152

Location: Barcelona

Occupation: VR Photographer

  • Send private message

12

Tuesday, February 22nd 2011, 9:14pm

I've sorted it out and feel a bit foolish as it is so obvious *wacko*

<action name="showImage">
set(plugin[photo].url, %1);
set(plugin[text].url, %2);
tween(view.fov, 120,0.7,,
tween(plugin[photo].width,get(stagewidth),0.2,, set(plugin[photo].width,70%);
tween(plugin[photo].height,get(stageheight),0.2,, set(plugin[photo].height,prop);
tween(plugin[text].scale, 0.56,0.2,,
tween(plugin[text].scale, 0.52,0.05,,
tween(plugin[text].scale, 0.55,0.1,,
loadscene('scene_2',null,KEEPALL,BLEND(1.2))))))));
</action>

Next issue:
On the good advice of VN2011, I'm using the following action to show an image which changes the colour of a car:
<action name="changeTruck">
set(hotspot[truck].url,%1);
tween(hotspot[truck].alpha,1,1.2);
</action>
This works perfectly for one colour change but when another colour is selected, the first colour disappears immediately. as the url is replaced with the onClick command.
What I would liketo happen is for the selected colour to fade out as the new one fades in.
Possible?

Kev-in-spain

Intermediate

  • "Kev-in-spain" started this thread

Posts: 152

Location: Barcelona

Occupation: VR Photographer

  • Send private message

13

Friday, February 25th 2011, 12:44pm

Any ideas guys?

14

Friday, February 25th 2011, 10:39pm

sorry, what is the question or problem? what do you want to do?

Kev-in-spain

Intermediate

  • "Kev-in-spain" started this thread

Posts: 152

Location: Barcelona

Occupation: VR Photographer

  • Send private message

15

Friday, February 25th 2011, 11:22pm

On the good advice of VN2011, I'm using the following action to show an image which changes the colour of a car:
<action name="changeTruck">
set(hotspot[truck].url,%1);
tween(hotspot[truck].alpha,1,1.2);
</action>
This works perfectly for one colour change but when another colour is selected, the first colour disappears immediately. as the url is replaced with the onClick command.
What I would liketo happen is for the selected colour to fade out as the new one fades in.
Possible?
Hi Klaus,
Here's an example of what I would like to happen: http://www.projectsolutions.es/demos/yomec/tour.html but I would like to use a different method (see the quote) as the way I have done it takes too long to load the tour.

16

Friday, February 25th 2011, 11:31pm

Hi,

okay, I think I understand,
but in this case you would need several hotspots - a hotspot for each color,
and then instead of changing the url fade all other hotspots out and only the selected in,
(note - when you're tweening a value once (e.g. when fadeing all out), and then tween
that value again with an other value, then the first tween will automatically stop,
so you can do that - fade out all + fade in only one)

e.g. do this with some actions:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<action name="fadeout">
 tween(hotspot[%1].alpha, 0.0, 0.5, default, set(hotspot[%1].visible,false));
</action>

<action name="fadein">
 set(hotspot[%1].visible,true);
 tween(hotspot[%1].alpha, 1.0, 0.5, default);
</action>

<action name="fadeout_all_colors">
 fadeout(color1);
 fadeout(color2);
 fadeout(color3);
 ...
</action>

<hotspot name="color1" ... onclick="fadeout_all_colors(); fadein(color1);" />
<hotspot name="color2" ... onclick="fadeout_all_colors(); fadein(color2);" />
...


one more note - the visible=true/false in the fadein/fadeout actions is
done for better rendering performance, all hotspots with visible=true (even with alpha=0) can be slow,

best regards,
Klaus

Kev-in-spain

Intermediate

  • "Kev-in-spain" started this thread

Posts: 152

Location: Barcelona

Occupation: VR Photographer

  • Send private message

17

Friday, February 25th 2011, 11:50pm

That's pretty much the way I have it at the moment.
The problem is, all the hotspots load at the start of the tour which slows dow the loading time.
What I wanted to use was something like:
<hotspot name="truck"
url=""
ath="83.47264086546944" atv="4.018223006068532" distorted="true"
width="740" height="215"
scale="0.6220326732917445" rx="1.5" ry="6.5" rz="0.23177069875548434"
handcursor="false" alpha="0.00" />

and use the action to call the url:
<action name="changeTruck">
set(hotspot[truck].url,%1);
tween(hotspot[truck].alpha,1,1.2);
</action>

This works perfectly for one colour change but when another colour is selected, the first colour disappears immediately. as the url is replaced with the onClick command.
What I would liketo happen is for the selected colour to fade out as the new one fades in.

18

Friday, March 4th 2011, 12:28pm

Hi,

in this case you would need at least two hotspots - a current one - and one for loading the next,
when the loading of the next one was done - fade out the old one + fade in the new one,
and then in the next call both hotspots must be swapped,
implementing that should be possible but can be tricky of course,

best regards,
Klaus

Kev-in-spain

Intermediate

  • "Kev-in-spain" started this thread

Posts: 152

Location: Barcelona

Occupation: VR Photographer

  • Send private message

19

Friday, March 4th 2011, 8:22pm

Thanks Klause, I think I've sorted it out. As you said 'tricky'!

Going back to the issue of stagewidth/height earlier in this thread, I'm using the following action (as you suggested) to reveal a plugin image.
The relevent part is in red font:

<action name="showImage">
set(plugin[photo].url, %1);

set(plugin[text].url, %2);
tween(view.fov, 120,0.7,,
tween(plugin[photo].width,get(stagewidth),0.5,, set(plugin[photo].width,prop);
tween(plugin[photo].height,get(stageheight),0.5,, set(plugin[photo].height,70%);

tween(plugin[text].scale, 0.56,0.2,,
tween(plugin[text].scale, 0.52,0.05,,
tween(plugin[text].scale, 0.55,0.1,,
loadscene('scene_2',null,KEEPALL,BLEND(1.2))))))));
</action>

It works, and the image opens to scale and proportion but not before first opening to full screen and then shrinking down to the correct size in proportion to the screen.
I've tried several things to try to rectify it myself but, due to my inexperience, without success.
Any idea where I've gone wrong?

20

Thursday, March 10th 2011, 3:16pm

Hi,

what exactly should the photo image do?

best regards,
Klaus