Sie sind nicht angemeldet.

publicitarios360

Fortgeschrittener

  • »publicitarios360« ist der Autor dieses Themas

Beiträge: 330

Wohnort: Habana, Cuba

Beruf: Architect, Photographer.

  • Nachricht senden

1

Montag, 18. Dezember 2017, 17:50

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.

Dieser Beitrag wurde bereits 2 mal editiert, zuletzt von »publicitarios360« (25. Januar 2018, 18:55)


Beiträge: 1 117

Wohnort: Poland, Europe

Beruf: krpano developer : virtual tours : the cms4vr owner

  • Nachricht senden

2

Montag, 18. Dezember 2017, 18:09

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 professional, online cloud tool for creating virtual tours - www.cms4vr.com

facebook page :: youtube :: wiki.cms4vr.com

cms4vr team *thumbsup*

publicitarios360

Fortgeschrittener

  • »publicitarios360« ist der Autor dieses Themas

Beiträge: 330

Wohnort: Habana, Cuba

Beruf: Architect, Photographer.

  • Nachricht senden

3

Montag, 18. Dezember 2017, 19:10

Thanks Piotr for your answer,

Ok, agree, I tested it, no solution.

Best Regards,

Fernando

Dieser Beitrag wurde bereits 2 mal editiert, zuletzt von »publicitarios360« (18. Dezember 2017, 19:41)


Tourvista

Fortgeschrittener

Beiträge: 260

Wohnort: Leicester UK

  • Nachricht senden

4

Mittwoch, 24. Januar 2018, 14:28

Hello,

Try using the following code:

Quellcode

1
get(xml.view.hlookat)


Cheers

publicitarios360

Fortgeschrittener

  • »publicitarios360« ist der Autor dieses Themas

Beiträge: 330

Wohnort: Habana, Cuba

Beruf: Architect, Photographer.

  • Nachricht senden

5

Mittwoch, 24. Januar 2018, 20:43

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

Mittwoch, 24. Januar 2018, 22:05

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

Fortgeschrittener

  • »publicitarios360« ist der Autor dieses Themas

Beiträge: 330

Wohnort: Habana, Cuba

Beruf: Architect, Photographer.

  • Nachricht senden

7

Donnerstag, 25. Januar 2018, 02:21

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

Donnerstag, 25. Januar 2018, 09:05

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

Donnerstag, 25. Januar 2018, 09:43

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:

Quellcode

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:

Quellcode

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


Best regards,
Klaus

10

Donnerstag, 25. Januar 2018, 13:47

xml parsing in krpano action code, nice ;))

Tuur

Erleuchteter

Beiträge: 3 839

Wohnort: Netherlands

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

  • Nachricht senden

12

Donnerstag, 25. Januar 2018, 14:24

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.