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

Tuesday, August 16th 2016, 1:12pm

How to embed additional xml contents dynamically?

Hello krpano friends~

I think same question was posted long time ago but I couldn't find the right answer.

- dynamic includes



What I want is to add xml content dynamically to certain scene. I know there is "addlayer()" and "addhotspot()"

actions which let me add layer, hotspot objects dynamically but when xml content gets too big or when I need

to add xml objects other than layer or hotspot, I need another solution.


"loadpano()", "loadscene()", "loadxml()" -> all these actions is for loading new panorama(scene), which means

old panorama(scene) is unloaded when calling these actions.


Anybody have an idea?


Best Regards,
hyung

spacerywirtualne

Professional

Posts: 874

Location: Poland, Europe

Occupation: krpano developer : virtual tours

  • Send private message

2

Tuesday, August 16th 2016, 4:11pm

Hi

Have you tried loadpano function() but with KEEPSCENES flag *question*


Source code

1
2
loadpano(xmlpath_to_included, null, KEEPSCENES); 
updatescreen();



Piotr
You own online, cloud tool for creating virtual tours - www.cms4vr.com

facebook page :: facebook group :: youtube

cms4vr team *thumbsup*

3

Wednesday, August 17th 2016, 9:14am

Hi Piotr,

Thanks for your reply. Even using loadpano() and "KEEPSCENES", the previous panorama disappears and I
get black panorama.

I think "KEEPSCENES" keeps scene objects so that I can (re)load scenes after I load new panorama from new
xml.

Even by using loadxml() action, previous panorama is gone.

I think I should just refresh the html so that it loads a new xml file. :(


Best Regards,
hyung


spacerywirtualne

Professional

Posts: 874

Location: Poland, Europe

Occupation: krpano developer : virtual tours

  • Send private message

4

Wednesday, August 17th 2016, 10:43am

Hi

This should work, but not in project based on 'scene' tag. In this situation, I have no clu.

Maybe javascript?

Piotr
You own online, cloud tool for creating virtual tours - www.cms4vr.com

facebook page :: facebook group :: youtube

cms4vr team *thumbsup*

Taurus

Trainee

Posts: 133

Location: Belarus

Occupation: photographer & virtual tour developer

  • Send private message

5

Wednesday, August 17th 2016, 8:18pm

Hi,
that you want to add to an existing tour, what objects?
in the case of additional scenes - use

Source code

1
set(scene[new_scene].content, '.......')

in the case of additionsl action

Source code

1
set(new_action, '........')
--
in order to comply the word with the affairs, you need to keep quiet and do nothing!

Virtual tour Gomel
Virtual tour
Virtual tour
Elbrus
...

Windows 10x64 & krpano 1.19pr16

6

Thursday, August 18th 2016, 4:50am

@Piotr,


I will share if I find any workaround :)


----------------------------------------------------------------


@Taurus,


Maybe "scene.content" is what I am looking for. What I want to do is to add additional
information to the current scene on the fly (hopefully simply by including xml dynamically,
which seems impossible at the moment).

Refering to your code, I have tried to change the content of the current scene and but
old content is showing in the panorama. However when I trace the scene.content, new
content is printed to the console. I have called "updatedscreen()" function but it's the
same.

Maybe there is additional action I have to apply after I change the scene.content?

7

Thursday, August 18th 2016, 7:28am

give examples what you change...

Taurus

Trainee

Posts: 133

Location: Belarus

Occupation: photographer & virtual tour developer

  • Send private message

8

Thursday, August 18th 2016, 11:27am

Maybe there is additional action I have to apply after I change the scene.content?

Unfortunately, I do not know about such opportunities
you must ask Klaus directly
--
in order to comply the word with the affairs, you need to keep quiet and do nothing!

Virtual tour Gomel
Virtual tour
Virtual tour
Elbrus
...

Windows 10x64 & krpano 1.19pr16

spacerywirtualne

Professional

Posts: 874

Location: Poland, Europe

Occupation: krpano developer : virtual tours

  • Send private message

9

Thursday, August 18th 2016, 12:41pm

Each xml is parsed before virtual tour is started. It seems to me that you need to focus on dynamic loading.

Piotr
You own online, cloud tool for creating virtual tours - www.cms4vr.com

facebook page :: facebook group :: youtube

cms4vr team *thumbsup*

Taurus

Trainee

Posts: 133

Location: Belarus

Occupation: photographer & virtual tour developer

  • Send private message

10

Thursday, August 18th 2016, 1:07pm

Each xml is parsed before virtual tour is started


Piotr, maybe you're right, but I have been successfully using to add scenes including image and view tags, change event handlers and action content during a tour of work
--
in order to comply the word with the affairs, you need to keep quiet and do nothing!

Virtual tour Gomel
Virtual tour
Virtual tour
Elbrus
...

Windows 10x64 & krpano 1.19pr16

Mael B.

Trainee

Posts: 130

Location: France, Montpellier

  • Send private message

11

Thursday, July 4th 2019, 3:06pm

Hello everybody,

I found that loadpano() with the following combination of flags seems to do the job :)

Source code

1
    loadpano(new.xml,null,KEEPIMAGE|MERGE|KEEPHOTSPOTS|KEEPALL|KEEPSCENES,NOBLEND);


The only issue that I see is that it triggers the onnewpano event but no the onloadcomplete event, so if a temporary layer or message (e.g. loading... message) is displayed by the onnewpano event, it is not removed by the onloadcomplete event *sad*

Mael B.

Trainee

Posts: 130

Location: France, Montpellier

  • Send private message

12

Thursday, July 4th 2019, 4:52pm

Another issue with the solution of using loadpano() is that the xml.scene variable does not contain the name of currently loaded scene anymore *sad*