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.
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.
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
Thanks Piotr for your answer,
Ok, agree, I tested it, no solution.
Best Regards,
Fernando
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.
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
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?
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?
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:
<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>
Display More
Usage:
Best regards,
Klaus
xml parsing in krpano action code, nice ;))
smart!
Tuur
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.
Don’t have an account yet? Register yourself now and be a part of our community!