Sie sind nicht angemeldet.

Lieber Besucher, herzlich willkommen bei: krpano.com Forum. Falls dies Ihr erster Besuch auf dieser Seite ist, lesen Sie sich bitte die Hilfe durch. Dort wird Ihnen die Bedienung dieser Seite näher erläutert. Darüber hinaus sollten Sie sich registrieren, um alle Funktionen dieser Seite nutzen zu können. Benutzen Sie das Registrierungsformular, um sich zu registrieren oder informieren Sie sich ausführlich über den Registrierungsvorgang. Falls Sie sich bereits zu einem früheren Zeitpunkt registriert haben, können Sie sich hier anmelden.

Tuur

Erleuchteter

  • »Tuur« ist der Autor dieses Themas

Beiträge: 3 839

Wohnort: Netherlands

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

  • Nachricht senden

1

Dienstag, 30. Mai 2023, 15:17

includexml

Hi,

I am looking for a way to include an xml (path) relative to the plugin (js) location that is calling this.

like:
krpano.actions.includexml("stickie_data.xml");

the stickie_data.xml is in the same folder as the js plugin calling the includexml.

%VIEWER% etc seems not a good option when people use basepath etc..
Any idea?


Tuur *thumbsup*

kme

Fortgeschrittener

Beiträge: 310

Wohnort: Belgium

Beruf: Long time coder, product manager and 3D enthousiast

  • Nachricht senden

2

Dienstag, 30. Mai 2023, 16:18

I see this in some files, have not tested it but seems what you are looking for


Quellcode

1
2
3
4
	<!-- save the url path of this xml file (the url value will be adjusted during xml parsing) -->
	<videointerfacexmlpath url="./" />

	<style name="skin_base" url="calc:videointerfacexmlpath.url + skin_settings.design_skin_images" />

kme

Fortgeschrittener

Beiträge: 310

Wohnort: Belgium

Beruf: Long time coder, product manager and 3D enthousiast

  • Nachricht senden

3

Dienstag, 30. Mai 2023, 16:27

Also, if from javascript, the threejs sample plugin

https://krpano.com/viewsource.html?plugi…krpanoplugin.js

has a resolve_url_path() function which may be of help.

Tuur

Erleuchteter

  • »Tuur« ist der Autor dieses Themas

Beiträge: 3 839

Wohnort: Netherlands

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

  • Nachricht senden

4

Dienstag, 30. Mai 2023, 16:32

I think the includexml path is relative to the viewer /tour.js

I am looking for a way to includexml inside the js plugin. ( which works great) But i like the path to be relative to the js plugin it self.. where ever it is in the folder structure.

I'll try what you suggest but i don't think that works...

Edit: currentxml is xml file.. that is not the case

Tuur *thumbsup*

kme

Fortgeschrittener

Beiträge: 310

Wohnort: Belgium

Beruf: Long time coder, product manager and 3D enthousiast

  • Nachricht senden

5

Dienstag, 30. Mai 2023, 16:43

see my second post for a javascript solution (well, mabye)

Tuur

Erleuchteter

  • »Tuur« ist der Autor dieses Themas

Beiträge: 3 839

Wohnort: Netherlands

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

  • Nachricht senden

6

Dienstag, 30. Mai 2023, 17:03

doesn't give me the wanted path.
Anybody else?

Tuur *thumbsup*

kme

Fortgeschrittener

Beiträge: 310

Wohnort: Belgium

Beruf: Long time coder, product manager and 3D enthousiast

  • Nachricht senden

7

Dienstag, 30. Mai 2023, 17:05

ok, here is a working thing, put it in the loading of your plugin:
assuming you have

Quellcode

1
	local.registerplugin = function(krpanointerface, pluginpath, pluginobject)


Quellcode

1
2
3
4
		var urlstr = pluginobject.loadingurl;
		var regex = /[^\/]*$/;
		var path = urlstr.replace(regex, ''); 
		krpano.actions.includexml(path + "stickie_data.xml");


apologies if my first answers were not tested or what you expected.

Tuur

Erleuchteter

  • »Tuur« ist der Autor dieses Themas

Beiträge: 3 839

Wohnort: Netherlands

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

  • Nachricht senden

8

Dienstag, 30. Mai 2023, 17:25

Hi,

thanks that seems to work..
I'll test a bit more.

alternatively (from Indexofrefraction).. also seem to work and also thanks:

Quellcode

1
2
3
var path =  krpano.parsepath(pluginobj.url);
path = path.substring(0, path.lastIndexOf('/') + 1);
krpano.actions.includexml(path+"stickie_data.xml");  



Tuur *thumbsup*

9

Dienstag, 30. Mai 2023, 17:30

Quellcode

1
2
pluginobject.path = krpano.actions.parseurl(pluginobject.url).replace(/[^\/]*$/, ''); 
krpano.actions.includexml(pluginobject.path + "stickie_data.xml");


combo with kme's regex :)
parseurl() is probably needed depending on the given plugin url
(eg if %VIEWER% or another placeholder was used)

*squint* :)

Tuur

Erleuchteter

  • »Tuur« ist der Autor dieses Themas

Beiträge: 3 839

Wohnort: Netherlands

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

  • Nachricht senden

10

Dienstag, 30. Mai 2023, 17:33

Ah yes, i think you're right... *wacko*
Thanks again!
I'll test.
Tuur *thumbsup*

Tuur

Erleuchteter

  • »Tuur« ist der Autor dieses Themas

Beiträge: 3 839

Wohnort: Netherlands

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

  • Nachricht senden

11

Dienstag, 30. Mai 2023, 17:38

@kme (why always invisible?)
Where did you find that loadingurl thing?
Seems un-documented.. or?

Tuur *thumbsup*