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

    2 Mal editiert, zuletzt von Andrew H (18. März 2017 um 00:05)

  • Hi,

    Zitat
    Code
    <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:

    Code
    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 *wink*

    hope it helps
    Tuur *thumbsup*

  • 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

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!