You are not logged in.

1

Friday, March 17th 2017, 6:55pm

Struggling to get the hlookat of a scene

I am trying to perform some math using stagewidth, stageheight and the hlookat of a particular scene. To help me see what I am doing I have included a temporary textfield plugin to display the results of the calculations and passing it the variables in an onresize event, e.g.

<events name="showvalues" keep="true"
onresize="
div(skin_settings.windowratio,stagewidth,stageheight);
txtadd(plugin[stagesize].html,[p],get(stagewidth),[br],get(stageheight),[br],get(skin_settings.windowratio),[br],get(scene[scene_name].view.hlookat) );"
/>

This works for the stagewidth, stageheight and windowratio variables,which all display correctly, but the hlookat displays as 'null', so I must have the syntax wrong for getting that variable, but I can't figure it out. If I substitute 'title' for 'view.hlookat' the scene's title is shown correctly, so I guess it must be something to do with the way I am trying to access the scene's view element.

Can anyone advise, please?

Regards

Andrew

This post has been edited 2 times, last edit by "Andrew H" (Mar 18th 2017, 12:05am)


Tuur

Sage

Posts: 3,839

Location: Netherlands

Occupation: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer

  • Send private message

2

Saturday, March 18th 2017, 2:41pm

Hi,

Quoted

Source code

1
2
3
4
5
<events name="showvalues" keep="true"
onresize="
div(skin_settings.windowratio,stagewidth,stageheight);
txtadd(plugin[stagesize].html,[p],get(stagewidth),[br],get(stageheight),[br],get(skin_settings.windowratio),[br],get(scene[scene_name].view.hlookat) );"
/>


instead of the above i would do something like:

Source code

1
2
3
4
5
6
set(_windowratio, calc:stagewidth / stageheight);
<!--
roundval(_windowratio);
roundval(view.hlookat);
-->
set(layer[textfield1].html, calc:'Stagewidth = ' + stagewidth + '[br]Stageheight = ' + stageheight + '[br]Windowration = ' + _windowratio + '[br]Hlookat = ' + view.hlookat);


But shortly: view.hlookat should be enough ;-)

hope it helps
Tuur *thumbsup*

3

Saturday, March 18th 2017, 4:27pm

Thanks, Tuur. I have never used calc: but I will from now on - it looks so much simpler than my way!

However, and I'm sorry I did not make this clear in my original post, I am trying to get to the hlookat value of a scene other than the current one, as declared in the scene's <view parameters, Then I could set the hlookat value according to the ratio of stagewidth to stageheight so that the user always sees a pleasing composition when the scene opens. Thus the hlookat value when the scene first loads would be different if the user is holding their tablet or phone in a vertical orientation rather than horizontal.

Just getting view.hlookat shows the current value for the current scene - hence my attempt to use get(scene[scene_name].view.hlookat) which just returns a null value. If as a test I use get(scene[scene-name].title) I do indeed see the scene's title string, but I can't get down to the scene's <view parameters. Obviously I have got the syntax wrong - but I am struggling to see why.

Regards
Andrew

Tourvista

Intermediate

Posts: 260

Location: Leicester UK

  • Send private message

4

Wednesday, January 24th 2018, 2:27pm

Hello,

Use the following code:

Source code

1
get(xml.view.hlookat)



Cheers