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.
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
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
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
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
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
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):
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
Offline
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
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
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
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