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.

1

Dienstag, 15. März 2016, 20:54

Call functions that live in three.krpanoplugin.js

Hi all

How do I call functions that live in three.krpanoplugin.js from my xml file. For instance when a hotspot is clicked I need to modify a 3d model material but I having hard time targeting functions that live in three.krpanoplugin.js.



My xml:

Quellcode

1
<action name='hotspot_clicked'>	plugin[threejs].changeTexture() /// was hoping something like this works</action>



three.krpanoplugin.js

Quellcode

1
function changeTexture(){	console.log('changeTexture called');}

Beiträge: 1 857

Beruf: Virtual Tours - Photography - Krpano developer

  • Nachricht senden

2

Dienstag, 15. März 2016, 21:59

See Klaus's plugin.
It's got a plugin open source plugin on how to do this.

Use three.js (3d objects) inside krpano (with VR support)
KRPano Developer: Portfolio ::Gigapixel Tagging Solutions - Porfolio 2 :: Facebook :: Twitter :: reddit.com/r/VirtualTour

3

Dienstag, 15. März 2016, 22:14

Awesome Thank You!

4

Mittwoch, 16. März 2016, 18:38

Still having issues here with calling plugin functions. I believe I have it set up properly but it's still generating an error WARNING: unknown action: plugin[threejs].changeTexture

Any suggestions?


EDIT: This works, minor mistake. But I did notice that the plugin functions are not available on onstart. Anyhow I'm happy I got this resolved.

in my xml

Quellcode

1
<action name='hotspot_clicked'>	plugin[threejs].changeTexture();</action>



In three.krpano.js plugin

Quellcode

1
2
3
local.registerplugin = function(krpanointerface, pluginpath, pluginobject){	//.......	//.....	plugin.changeTexture = changeTexture;
}
function changeTexture(){	console.log( 'changeTexture called');}

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »ecsancho« (16. März 2016, 18:58)


5

Mittwoch, 16. März 2016, 21:37

Hi,

the name of the function at the plugin object need to be 'lowercase'!
Otherwise it wouldn't be callable by xml actions code.

Thats because all variable and function names that will be used in the xml will be internally converted to lower-case to be callable regardless of the case.

That means instead of:
plugin.changeTexture = changeTexture

this would need to be used:
plugin.changetexture = changeTexture

The case in the xml itself doesn't matter.

Best regards,
Klaus