Scolring - Forum

Entraides et échanges autour de la technologie Scol - Informations and exchanges on the Scol technology

Vous pouvez changer la langue de l'interface une fois inscrit - You can change the language once registered

You are not logged in.

#1 17-Nov-2014 20:39:46

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,543
Website

can os3d query a loaded project to see if plugit is present [solved]

colleagues:

is there a way that os3d can query a loaded scene to check to see whether a certain plugit is present or not? i would like my app to determine whether:

an examine plugit ispresent
an fps plugit is present
or a walk plugit is present
and branch its behavior depending on the type of navigation being used by a scene (by showing certain visual instructions on scene navigation depending on the plugit used by the scene author)

i would think i could use one of the xml parser functions, no?

thx!

-h

Last edited by hebdemnobad (17-Nov-2014 23:06:05)

Offline

#2 17-Nov-2014 20:50:20

arkeon
Admin. / Scol language & OpenSpace3D developer
From: Nantes
Registered: 30-Mar-2009
Posts: 5,161
Website

Re: can os3d query a loaded project to see if plugit is present [solved]

hmm look at the OS3Dplugins.pkg in os3dlib maybe there is something you can use in it

Offline

#3 17-Nov-2014 21:02:38

iri
Admin. / Scol language & Scol apps developer
From: France
Registered: 22-Feb-2009
Posts: 2,024
Website

Re: can os3d query a loaded project to see if plugit is present [solved]

getPluginByFile
in os3dplugins.pkg

This function returns nil if a plugin is not loaded (or the Plug structure if it is loaded).
This function takes the file name as argument.

fun getPluginByFile(file)= let search_in_list lPlugins @plugbyfile file -> [_ plug] in plug;;

Also, getPluginByName can be useful. From the plugin name, it returns nil if not loaded.

fun getPluginByName(name)= switchstr lPlugins name;;

Offline

#4 17-Nov-2014 22:05:35

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,543
Website

Re: can os3d query a loaded project to see if plugit is present [solved]

thx iri

i'm not using the function correctly....

   if (getPluginByFile"tools/os3dplugins/navigation/viewer_navigation/cviewernav.pkg" != nil) then _fooS "Examine Navigation" else nil;

throws

line 454 in ..\..\..\vm\kernel5\src\compiler\typmisc.cpp
File : C:\Program Files (x86)\Scol Voyager\Partition_LockedApp\tools\mediaoctopus3dplayer\mediaoctopus3dplayer.pkg
(!) Line #322:
   if (getPluginByFile"tools/os3dplugins/navigation/viewer_navigation/cviewernav.pkg" != nil??) then _fooS "Examine Navigation" else nil;
>>> ERROR - Type mismatch (detail):
Found:    [I]
Expected: [S]
<<<

i thought i wouldn't have to post a question like this anymore, but I'm stumped on this one, I mean you can use != nil test on any function, no?

Offline

#5 17-Nov-2014 22:11:38

iri
Admin. / Scol language & Scol apps developer
From: France
Registered: 22-Feb-2009
Posts: 2,024
Website

Re: can os3d query a loaded project to see if plugit is present [solved]

You should write :

if ((getPluginByFile"tools/os3dplugins/navigation/viewer_navigation/cviewernav.pkg") != nil) then

or

if (nil != getPluginByFile"tools/os3dplugins/navigation/viewer_navigation/cviewernav.pkg") then

Are you sure the error occurs on this line ?

Offline

#6 17-Nov-2014 22:17:45

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,543
Website

Re: can os3d query a loaded project to see if plugit is present [solved]

i thought i was stumped and then i am now embarrased, yes thx iri i wasn't using the () correctly...still encountering problems though, but of a different kind

Offline

#7 17-Nov-2014 22:28:22

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,543
Website

Re: can os3d query a loaded project to see if plugit is present [solved]

the 1.8 libraries broke my version of the player severely (the plugits don't appear to  load at all ... that's ok, i will rebuild on arkeon's code and see what happens)
this works, the function looks for the .xml file (as oppposed to client or editor .pkg): 

smile

  let getPluginByFile"tools/os3dplugins/navigation/viewer_navigation/cviewernav.pkg" -> result in
   if (result != nil) then _fooS "Examine Navigation" else _fooS "Not Exmine navigation";
   let getPluginByFile"tools/os3dplugins/navigation/basic_navigation/cbasicnav.pkg"->result in
   if result!=nil then _fooS "Walkthrough Navigation" else _fooS "Not walkthrough navigation";
   let getPluginByFile"tools/os3dplugins/navigation/fps_navigation/fps_navigation.xml"->result in
   if result != nil then _fooS "fps Navigation" else _fooS "Not fps navigation";

evaluates correctly, i.e. with a scene that refers to fps_navigation.xml, the console prints "fps Navigation".  this is great, as my app will adapt guidance to the user to the type of navigation involved, displaying different widgets with instructions depending on the navigation plugit used. if all the "result" local variables evaluate to nil, i'll branch the code to default to tips for examine navigation, since that's what the player does when you don't any plugits to it.

Last edited by hebdemnobad (17-Nov-2014 22:33:18)

Offline

#8 17-Nov-2014 22:32:53

arkeon
Admin. / Scol language & OpenSpace3D developer
From: Nantes
Registered: 30-Mar-2009
Posts: 5,161
Website

Re: can os3d query a loaded project to see if plugit is present [solved]

try getting by name and check also the size of the plugin instances list to know if one is present in the project.

Offline

#9 17-Nov-2014 22:34:28

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,543
Website

Re: can os3d query a loaded project to see if plugit is present [solved]

arkeon wrote:

try getting by name and check also the size of the plugin instances list to know if one is present in the project.

I think getting by file is better, less users will be changing .xml file names than the names of plugit instances.

Offline

#10 17-Nov-2014 22:36:33

arkeon
Admin. / Scol language & OpenSpace3D developer
From: Nantes
Registered: 30-Mar-2009
Posts: 5,161
Website

Re: can os3d query a loaded project to see if plugit is present [solved]

hmm here this is the plugin name not the instance name.
so it should not change, this is the name provided in the plugit xml definition.

Offline

#11 17-Nov-2014 22:37:51

arkeon
Admin. / Scol language & OpenSpace3D developer
From: Nantes
Registered: 30-Mar-2009
Posts: 5,161
Website

Re: can os3d query a loaded project to see if plugit is present [solved]

a plugin can be loaded with 0 instance. (in the editor)

Offline

#12 17-Nov-2014 22:52:51

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,543
Website

Re: can os3d query a loaded project to see if plugit is present [solved]

arkeon wrote:

try getting by name and check also the size of the plugin instances list to know if one is present in the project.

doesn't the project only load the plugits that it needs?

Offline

#13 17-Nov-2014 22:56:59

arkeon
Admin. / Scol language & OpenSpace3D developer
From: Nantes
Registered: 30-Mar-2009
Posts: 5,161
Website

Re: can os3d query a loaded project to see if plugit is present [solved]

yes in player mode only, in editor all plugins are loaded.

Offline

#14 17-Nov-2014 22:58:39

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,543
Website

Re: can os3d query a loaded project to see if plugit is present [solved]

arkeon wrote:

yes in player mode only, in editor all plugins are loaded.


right, so this will work for a player implementation (to check what type of camera setup the scene has and change ui accordingly)


uh oh...what if the author has put more than one navigation plugit in his/her scene and is allowing the user to swap camera modes, ah, another thread....

Last edited by hebdemnobad (17-Nov-2014 23:05:40)

Offline

Board footer

Powered by FluxBB