Sie sind nicht angemeldet.

1

Freitag, 17. März 2017, 18:55

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

Dieser Beitrag wurde bereits 2 mal editiert, zuletzt von »Andrew H« (18. März 2017, 00:05)


Tuur

Erleuchteter

Beiträge: 3 839

Wohnort: Netherlands

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

  • Nachricht senden

2

Samstag, 18. März 2017, 14:41

Hi,

Zitat

Quellcode

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:

Quellcode

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

Samstag, 18. März 2017, 16:27

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

Fortgeschrittener

Beiträge: 260

Wohnort: Leicester UK

  • Nachricht senden

4

Mittwoch, 24. Januar 2018, 14:27

Hello,

Use the following code:

Quellcode

1
get(xml.view.hlookat)



Cheers