You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

publicitarios360

Intermediate

  • "publicitarios360" started this thread

Posts: 222

Location: Habana, Cuba

Occupation: Architect, Photographer.

  • Send private message

1

Monday, December 18th 2017, 5:50pm

Please, how to get any scene hlookat (no the current) ?

Hi, I visited others old posts, but there isn´t solution yet.

<scene
name="myscene">
<view hlookat="45"/>
</scene>

trace(get(scene[myscene].view.hlookat); NULL

Any idea please?

Best regards,

Fernando.

This post has been edited 2 times, last edit by "publicitarios360" (Jan 25th 2018, 6:55pm)


spacerywirtualne

Professional

Posts: 984

Location: Poland, Europe

Occupation: krpano developer : virtual tours

  • Send private message

2

Monday, December 18th 2017, 6:09pm

Hi,

To these elements You have access only within the current (active) scene. As far as I know, you can not access to the elements inside scene "A" if you are in scene "B".

Piotr
Your own online, cloud tool for creating virtual tours - www.cms4vr.com

facebook page :: youtube

cms4vr team *thumbsup*

publicitarios360

Intermediate

  • "publicitarios360" started this thread

Posts: 222

Location: Habana, Cuba

Occupation: Architect, Photographer.

  • Send private message

3

Monday, December 18th 2017, 7:10pm

Thanks Piotr for your answer,

Ok, agree, I tested it, no solution.

Best Regards,

Fernando

This post has been edited 2 times, last edit by "publicitarios360" (Dec 18th 2017, 7:41pm)


Tourvista

Intermediate

Posts: 258

Location: Leicester UK

  • Send private message

4

Wednesday, January 24th 2018, 2:28pm

Hello,

Try using the following code:

Source code

1
get(xml.view.hlookat)


Cheers

publicitarios360

Intermediate

  • "publicitarios360" started this thread

Posts: 222

Location: Habana, Cuba

Occupation: Architect, Photographer.

  • Send private message

5

Wednesday, January 24th 2018, 8:43pm

Thanks Rafael,


The idea if get from the OTHER scene, no the current scene:


as:trace(get(scene[myscene].view.hlookat);
but it isnot correct,



You solution is for CURRENT scene


Best Regards,


Fernando.

6

Wednesday, January 24th 2018, 10:05pm

in short:
you cannot read the content of another scene!
but--> you can read the attributes of another scene

<scene name="test" lookat="5">
<!-- anything here is only active if this scene is loaded -->
<view lookat="5"/>
</scene>

--> you can only read scene[test].lookat

publicitarios360

Intermediate

  • "publicitarios360" started this thread

Posts: 222

Location: Habana, Cuba

Occupation: Architect, Photographer.

  • Send private message

7

Thursday, January 25th 2018, 2:21am

Hi, yes... you duplicate the internal scene lookat to custom lookat property.
The solution maybe is to make this dinamically: To create the custom lookat before leave the scene...
I´am testing a idea about. You have any now?

8

Thursday, January 25th 2018, 9:05am

scene[..].content has the raw xml content,
but this must be parsed by yourself and you can only read it i guess.
if you really must do that, i'd do it outside of krpano with a script to prepare the xml
maybe thats even doable with krpano droplets (but not sure)

or.. its much easier to define lookat as scene prop
and have a scene onstart action that copies it to the view

but all of this is not elegant to do...
why do you want another scenes view?

9

Thursday, January 25th 2018, 9:43am

Hi,

for getting only the hlookat value from a scene it would be possible to do this via a simple 'text-searching' parsing - e.g. searching for '<view ' and '/>' and then inside that range for 'hlookat' and the value quotation characters.

Here an example action:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<action name="get_scene_hlookat" scope="local" args="returnvarname, scenename">
    parentscopeset(get(returnvarname),null);
    copy(scenecontent, scene[get(scenename)].content);
    set(viewtag, '%%3Cview ');
    set(endtag, '/%%3E');
    unescape(viewtag);
    unescape(endtag);
    indexoftxt(i1, get(scenecontent), get(viewtag));
    indexoftxt(i2, get(scenecontent), get(endtag), get(i1));
    if(i1 GT 0 AND i2 GT i1,
        subtxt(viewnode, scenecontent, get(i1), calc(i2-i1+2));
        txtreplace(viewnode, "'", '"');     <!-- ensure " as value quotation character -->
        indexoftxt(i1, get(viewnode), 'hlookat=');
        indexoftxt(i2, get(viewnode), '"', get(i1));
        indexoftxt(i3, get(viewnode), '"', calc(i2+1));
        if(i1 GT 0 AND i2 GT i1 AND i3 GT i2,
            subtxt(hlookatvalue, viewnode, calc(i2+1), calc(i3-i2-1));  
            parentscopeset(get(returnvarname),get(hlookatvalue));
        );
    );
</action>


Usage:

Source code

1
2
get_scene_hlookat(h, 'scene7');
trace(h);


Best regards,
Klaus

10

Thursday, January 25th 2018, 1:47pm

xml parsing in krpano action code, nice ;))

Tuur

Sage

Posts: 3,337

Location: Netherlands

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

  • Send private message

11

Thursday, January 25th 2018, 2:20pm

*love*
smart!

Tuur *thumbsup*
http://www.virtualtuur.com
Skype:studiotuur

12

Thursday, January 25th 2018, 2:24pm

I have never done this as I am new to KRPANO but could you use xml.content to get the full xml and pull values that you need. It looks like you would just need to do this prior to the first scene loading and store the values so you can get them later.

xml.contentStringThe xml.content variable contains the whole content of the currently loaded xml file as string. After loading a <scene> with the loadscene() action, the xml.content variable will contain only the content of the <scene> element.

EDIT: Just realized there were previous answers I did not see due to caching.