Sie sind nicht angemeldet.

1

Donnerstag, 18. März 2021, 13:37

Loop addplugin

Hello guys,

I try to bring some logic into our panotours especially for floorplan navigation. Normally I would have added one "plugin" for every location I would need.
For example:

Quellcode

1
<plugin name="Standort01" style="skin_mappoints" x="220" y="210" /><plugin name="Standort02" style="skin_mappoints" x="320" y="260" />


I know wanted to simply create the "plugins" automatically by the number of scenes.

This is what I camp up with:

Quellcode

1
for(set(i,0), i LT scene.count, inc(i), set(temp, get(scene[get(i)].name), '_Mappoint');addplugin(get(temp));plugin[get(temp)].loadstyle(skin_mappoints);set(plugin[get(temp)].x, get(scene[get(i)].mappointX));set(plugin[get(temp)].y, get(scene[get(i)].mappointY));            );



Problem is that only one "plugin" is getting created. Even tough the loop works double checked via a trace.

Anyone know what could be the issue?

UPDATE:
Got it! Problem was "set" of the variable. Instead using "txtadd" did the job.

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »dreidesign« (18. März 2021, 14:38)


Tuur

Erleuchteter

Beiträge: 3 839

Wohnort: Netherlands

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

  • Nachricht senden

2

Donnerstag, 18. März 2021, 17:09

Hi,

you need each 'temp' to be unique..
because it is the name of the new generated plugin.
If the name is just temp each time it will 'overwrite'/replace the previous one (plugin[temp])

try like:

Quellcode

1
2
3
4
for(set(i,0), i LT scene.count, inc(i), 
calc(temp, scene[get(i)].name + '_Mappoint');

blabla


or

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
		for(set(i,0), i LT scene.count, inc(i), 
			calc(temp, scene[get(i)].name + '_Mappoint');
			addplugin(get(temp),tmp);
			tmp.loadstyle(skin_mappoints);
			set(tmp,
				x=calc(scene[get(i)].mappointX),
				y=calc(scene[get(i)].mappointY)
			);
		<!--
		trace(temp);
		trace(tmp.x);
		trace(tmp.y);
		-->
		);


Edit: ah you got it already.. missed that.. i also was a bit sloppy in my answer..edited now

hope it helps,
Tuur *thumbsup*

Dieser Beitrag wurde bereits 3 mal editiert, zuletzt von »Tuur« (18. März 2021, 17:55)


3

Donnerstag, 18. März 2021, 18:15

...

Dieser Beitrag wurde bereits 2 mal editiert, zuletzt von »indexofrefraction« (18. März 2021, 21:35)