Sie sind nicht angemeldet.

kyle

Schüler

  • »kyle« ist der Autor dieses Themas

Beiträge: 71

Wohnort: Grand Rapids, Michigan, USA

  • Nachricht senden

1

Mittwoch, 16. September 2009, 23:03

How do I access current scene attributes and nodes?

I see that I can access a specific scene's nodes and attributes with "scene[scenename].xxx", but I can't figure out how to access attributes (such as name) or nodes (such as data) for the current scene. Is there any way to do this?

2

Freitag, 18. September 2009, 10:50

Hi,

<scene> is special node in the xml,
only this three values can be accessed/read:
  • scene[name].name
  • scene[name].content
  • scene[name].onstart
best regards,
Klaus

Beiträge: 148

Wohnort: Italy

Beruf: Freelance Fotographer

  • Nachricht senden

3

Donnerstag, 9. Januar 2014, 18:04

Hi, this restriction is valid also with new krpano version? no read - no acces also for this atributes?

thumburl
lat
lng
heading

Beiträge: 770

Wohnort: Russian Federation

Beruf: Interpreting, Building virtual tours

  • Nachricht senden

4

Donnerstag, 9. Januar 2014, 21:08

Hi guys! Sorry if I understand you wrong about "get/access" for a scene's atributes, but the following stuff seems to work:

the modified "startup action:

Quellcode

1
2
3
4
5
<action name="startup">
		if(startscene === null, copy(startscene,scene[0].name));
		loadscene(get(startscene), null, MERGE);
		set(panonumber,1);
	</action>


an event to trigger a check on every new pano:

Quellcode

1
<events name="check_pano_data" keep="true" onnewpano="check_pano();" />


and the action itself:

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<action name="check_pano">
	add(panonumber,1);
	if(panonumber GT 4, 
	set(scene[get(xml.scene)].title, null);
	set(scene[get(xml.scene)].thumburl, null);
	set(scene[get(xml.scene)].lat, null);
	set(scene[get(xml.scene)].lng, null);
	set(scene[get(xml.scene)].heading, null);
	);
	showlog();
	trace(title=,scene[get(xml.scene)].title);
	trace(thumb=,scene[get(xml.scene)].thumburl);
	trace(latitude=,scene[get(xml.scene)].lat);
	trace(longitude=,scene[get(xml.scene)].lng);
	trace(heading=,scene[get(xml.scene)].heading);
	</action>


The idea is that after you went through four panoramas, the title, thumburl, latitude, longitude and heading are set to "null". And I see in the log that traces return corresponding values and "nulls" after fourth loaded pano.
Regards,

Alexey

5

Freitag, 10. Januar 2014, 11:37

Hi,

attributes AT the <scene> elements can be accessed!

It's only not possible to access elements or attributes INSIDE the <scene> elements.

The reason therefore is that the content inside the <scene> elements will be not parsed during the xml loading. Instead of parsing the whole <scene> content will be stored as text inside the 'scene[name].content' variable, and only parsed when calling loadscene() for that scene. That means a scene is like an 'inline-xml'.

Best regards,
Klaus

Beiträge: 770

Wohnort: Russian Federation

Beruf: Interpreting, Building virtual tours

  • Nachricht senden

6

Freitag, 10. Januar 2014, 11:43

So if I put a layer inside the <scene> and set keep="false", it will appear only when this scene is loaded? I remember I tried this way some time ago to make different photos appear in various scenes, but I rejected this way, - honestly, don't remember why exactly((

Or, I guess, this layer won't need keep="false"...
Regards,

Alexey

7

Freitag, 10. Januar 2014, 11:50

Right, that layer will appear only in that scene and disapear again when loading another scene/pano because of the keep=false (which right - is already the default and don't need to be set).