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.

1

Monday, May 15th 2017, 11:49am

get scene name from plugin

Hi

I'm trying to get the scene names form a custom plugin but all I get is the name I set inside the gui but I need the scene name like it's wirtten inside the index.xml file...

For example my pano's name is C6-1 and the scene name is pano39... with the following code I create a javascript array with all my pano inside a group

Source code

1
{% set 0 as countGroups %}{% for group in project.panoGroups %}	{% if group.isExplicit %}group['pano{{group.description.name}}'] = [{{% for pano in group.panos %}'{{countGroups}}':'{{pano.description.name}}',{% set countGroups|plus:1 as countGroups %}{% endfor %}}]{% endif %}{% endfor %}


I get all my scene name and this is the output

Source code

1
group['panogroup47'] = [{'0':'C6-1','1':'C6-2','2':'C6-3','3':'C6-4','4':'C6-5'}]group['panogroup106'] = [{'0':'27','1':'31'}]


What I really need are the real scene names, so pano39, pano40, pano41 etc

Does anyone know how do get that?$

I appreciate any help

Thank you

2

Wednesday, May 17th 2017, 2:39pm

Hi,

your code example doesn't seem to be related to krpano,

but in a krpano plugin you could get the scene names e.g. this way:

Source code

1
2
3
4
5
6
7
8
var scenes = krpano.get("scene").getArray();

for (var i=0; i < scenes.length; i++)
{
  var scene = scenes[i];
  
  console.log(scene.name);
}


Best regards,
Klaus

3

Saturday, September 21st 2019, 4:44pm

Has the variable changed? I've tried your code and nothing is output at all to the console log apart from the initial output due to console log: true being set on embedpano:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// global krpano interface (will be set in the onready callback)var krpano = null;

// embed the krpano viewer into the 'pano' div element
embedpano({
  swf : null,   // path to flash viewer (use null if no flash fallback will be requiered)
  id : "krpanoSWFObject",
  xml : "tour.xml",
  target : "pano",
  consolelog : true,     // trace krpano messages also to the browser console
  passQueryParameters : true,   // pass query parameters of the url to krpano
  onready : krpano_onready_callback
});

// callback function that will be called when krpano is embedded and ready for using
function krpano_onready_callback(krpano_interface)
{
  krpano = krpano_interface;
  var scenes = krpano.get("scene").getArray();

  for (var i=0; i < scenes.length; i++)
  {
    var scene = scenes[i];

    console.log(scene.name);
  }
}

4

Wednesday, September 25th 2019, 3:20pm

No, that code should work.

Similar threads