/* ----------------------------------------------------------------------------- This source file is part of OpenSpace3D For the latest info, see http://www.openspace3d.com Copyright (c) 2012 I-maginer This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA, or go to http://www.gnu.org/copyleft/lesser.txt ----------------------------------------------------------------------------- */ /*! @defgroup plugITApi OpenSpace3D plugIT Api * OpenSpace3D plugIT Api * @{ */ /** @} */ // editor mode : 1 // player mode : 0 var iPluginMode = 0;; /* plugins manager */ struct Plug= [ PLUG_sFile : S, //!< plugin definition file name PLUG_sDir : S, //!< plugin directory PLUG_channel : Chn, //!< plugin execution channel PLUG_sName : S, //!< plugin name PLUG_sDesc : S, //!< plugin description PLUG_sDescLoc : S, //!< plugin description loc PLUG_sHelp : S, //!< plugin help Url PLUG_sKeywords : S, //!< plugin search keywords PLUG_tColors : [I I], //!< plugin colors PLUG_lAction : [S r1], //!< action list PLUG_lEvent : [S r1], //!< event list PLUG_lDefAction : [S r1], //!< action list PLUG_lDefEvent : [S r1], //!< event list PLUG_cbAddInstance : fun[PInstance] I, //!< callback function for add new instance PLUG_cbDelInstance : fun[PInstance] I, //!< callback function for deleted instance PLUG_cbNewUser : fun[UserI] I, //!< new user connected PLUG_cbDelUser : fun[UserI] I, //!< new user disconnected PLUG_lParams : [[S I] r1], //!< plugin general parameters PLUG_iType : I, //!< plugin type PLUG_sType : S, //!< plugin type name PLUG_lInstances : [[S PInstance] r1], //!< instance list //!< plugin use helpers in editor PLUG_openEditor : fun [EdWindow PInstance V3Dview EdControl] [fun [] [[S S] r1] fun [] I], //!< function to open the plugIT editor PLUG_initEditor : fun [PInstance] I, //!< function to init the plugIT editor, only needed if the plugit must do something without the editor window PLUG_dsEditor : fun [PInstance] I, //!< function to destroy the plugIT editor, only needed if the plugit must do something without the editor window PLUG_cbStartInstance : fun[PInstance] I, //!< callback function for start instance usefull for editor PLUG_cbStopInstance : fun[PInstance] I, //!< callback function for stop instance usefull for editor PLUG_bMultiInstance : I, //!< is multi instance PLUG_bUseHelpers : I, //!< using helpers PLUG_iUserLevel : I, //!< user level "basic" "advanced" "expert" PLUG_bHasError : I, //!< error on load PLUG_bIsDeprecated : I, //!< Deprecated PLUG_sAlternative : S //!< Alternative and compatible plugIT ]mkPlug;; struct PInstance= [ INST_sPluginClass : S, //!< plugin class name INST_sName : S, //!< instance name INST_DMI : DMI, //!< DMI INST_lParams : [[S S] r1], //!< instance parameters INST_plugin : Plug, //!< plugin structure INST_groupstr : Group, //!< group structure INST_lAction : [S r1], //!< actions list INST_lEvent : [S r1], //!< events list INST_bShowHelper : I, INST_bShowInGroup : I, // Instance Callback INST_cbDel : fun [PInstance] I, INST_cbAllPluginsLoaded : fun [PInstance] I, INST_cbGeneric : fun [PInstance I S S] I, INST_cbPreRenderEffects : fun [PInstance V3Dview] I, INST_cbPreRender : fun [PInstance V3Dview] I, INST_cbPreRender2 : fun [PInstance V3Dview] I, INST_cbPostRender : fun [PInstance V3Dview] I, INST_cbScenePreRender : fun [PInstance V3Dsession I] I, INST_cbScenePreRender2 : fun [PInstance V3Dsession I] I, INST_cbScenePreRenderPhysic : fun [PInstance V3Dsession I] I, INST_cbScenePostRender : fun [PInstance V3Dsession I] I, INST_cbNavigateControlState : fun [PInstance V3Dsession I] I, INST_cbClick : fun [PInstance V3Dview I I I] I, INST_cbDbClick : fun [PInstance V3Dview I I I] I, INST_cbUnClick : fun [PInstance V3Dview I I I] I, INST_cbWheel : fun [PInstance V3Dview I I I I] I, INST_cbCursorMove : fun [PInstance V3Dview I I I] I, INST_cbInputClick : fun [PInstance V3Dview I I I I [SO3_OBJECT SO3_MATERIAL I [F F F] [F F] F]] I, INST_cbInputUnClick : fun [PInstance V3Dview I I I I [SO3_OBJECT SO3_MATERIAL I [F F F] [F F] F]] I, INST_cbInputUpdate : fun [PInstance V3Dview I I I I [SO3_OBJECT SO3_MATERIAL I [F F F] [F F] F]] I, INST_cbKeyDown : fun [PInstance V3Dview I I] I, INST_cbKeyUp : fun [PInstance V3Dview I] I, INST_cbTouchPointAdd : fun [PInstance V3Dview I I I] I, INST_cbTouchPointRemove : fun [PInstance V3Dview I] I, INST_cbTouchPointUpdate : fun [PInstance V3Dview I I I I I] I, INST_cbCameraChange : fun [PInstance V3Dview V3Dsession SO3_OBJECT] I, INST_cbResizeView : fun [PInstance V3Dview I I] I, INST_cbFocusView : fun [PInstance V3Dview] I, INST_cbKillFocusView : fun [PInstance V3Dview] I, INST_cbDropFileView : fun [PInstance V3Dview I I [P r1]] I, INST_cbVrModeView : fun [PInstance V3Dview I] I, INST_cbCameraTeleport : fun [PInstance V3Dview SO3_OBJECT] I, // Network Callback INST_cbNetConnected : fun [PInstance NetComm] I, INST_cbNetClosed : fun [PInstance NetComm] I, INST_cbNetSConnected : fun [PInstance NetComm] I, INST_cbNetSrvMessage : fun [PInstance NetComm S S S] I, INST_cbNetUserMessage : fun [PInstance NetComm NetUser S S S] I, INST_cbNetUserPrivateMessage : fun [PInstance NetComm NetUser S S S] I, INST_cbNetUserChangeLogin : fun [PInstance NetComm NetUser S] I, INST_cbNetNewUser : fun [PInstance NetComm NetUser] I, INST_cbNetDelUser : fun [PInstance NetComm NetUser] I, INST_cbNetGetFile : fun [PInstance NetComm NetUser S S S] I, INST_cbNetUserGetItem : fun [PInstance NetComm NetUser S S] I, INST_cbNetRoomGetItem : fun [PInstance NetComm S S] I, INST_cbNetNbUsers : fun [PInstance NetComm I] I, INST_cbNetRoomChanged : fun [PInstance NetComm S] I, INST_cbEditorPreRender : fun [PInstance V3Dsession I] I, INST_cbEditorPostRender : fun [PInstance V3Dsession I] I, INST_cbEditorHelperState : fun [PInstance I] I, INST_iLoadState : I //!< loaded state ]mkPInstance;; typeof lPlugins=[[S Plug] r1];; typeof lInstCbAllPluginsLoaded = [PInstance r1];; typeof lInstCbGeneric = [PInstance r1];; typeof lInstCbPreRenderEffects = [PInstance r1];; typeof lInstCbPreRender = [PInstance r1];; typeof lInstCbPreRender2 = [PInstance r1];; typeof lInstCbPostRender = [PInstance r1];; typeof lInstCbScenePreRender = [PInstance r1];; typeof lInstCbScenePreRender2 = [PInstance r1];; typeof lInstCbScenePreRenderPhysic = [PInstance r1];; typeof lInstCbScenePostRender = [PInstance r1];; typeof lInstCbNavigateControlState = [PInstance r1];; typeof lInstCbClick = [PInstance r1];; typeof lInstCbDbClick = [PInstance r1];; typeof lInstCbUnClick = [PInstance r1];; typeof lInstCbWheel = [PInstance r1];; typeof lInstCbCursorMove = [PInstance r1];; typeof lInstCbInputClick = [PInstance r1];; typeof lInstCbInputUnClick = [PInstance r1];; typeof lInstCbInputUpdate = [PInstance r1];; typeof lInstCbKeyDown = [PInstance r1];; typeof lInstCbKeyUp = [PInstance r1];; typeof lInstCbTouchPointAdd = [PInstance r1];; typeof lInstCbTouchPointRemove = [PInstance r1];; typeof lInstCbTouchPointUpdate = [PInstance r1];; typeof lInstCbCameraChange = [PInstance r1];; typeof lInstCbResizeView = [PInstance r1];; typeof lInstCbFocusView = [PInstance r1];; typeof lInstCbKillFocusView = [PInstance r1];; typeof lInstCbDropFileView = [PInstance r1];; typeof lInstCbVrModeView = [PInstance r1];; typeof lInstCbCameraTeleport = [PInstance r1];; typeof lInstCbNetConnected = [PInstance r1];; typeof lInstCbNetClosed = [PInstance r1];; typeof lInstCbNetSConnected = [PInstance r1];; typeof lInstCbNetSrvMessage = [PInstance r1];; typeof lInstCbNetUserMessage = [PInstance r1];; typeof lInstCbNetUserPrivateMessage = [PInstance r1];; typeof lInstCbNetUserChangeLogin = [PInstance r1];; typeof lInstCbNetNewUser = [PInstance r1];; typeof lInstCbNetDelUser = [PInstance r1];; typeof lInstCbNetGetFile = [PInstance r1];; typeof lInstCbNetUserGetItem = [PInstance r1];; typeof lInstCbNetRoomGetItem = [PInstance r1];; typeof lInstCbNetNbUsers = [PInstance r1];; typeof lInstCbNetRoomChanged = [PInstance r1];; typeof lInstCbEditorPreRender = [PInstance r1];; typeof lInstCbEditorPostRender = [PInstance r1];; /* plugin informations values */ var PLUGIN_OBJECT = 2;; var PLUGIN_MATERIAL = 4;; var PLUGIN_RESERVED = 8;; var PLUGIN_NOTRESERVED = 16;; typeof cbPluginLoadInfo = fun [S] I;; defcom SIniPlug=IniPlug S;; var preplugPkg="os3dlib/os3dpreplug.pkg";; proto setPluginInstanceEditorCbPreRender = fun [PInstance fun [PInstance V3Dsession I] I] fun [PInstance V3Dsession I] I;; proto setPluginInstanceEditorCbPostRender = fun [PInstance fun [PInstance V3Dsession I] I] fun [PInstance V3Dsession I] I;; fun plugbyfile(a,c)=let a -> [_ plug] in !strcmpi plug.PLUG_sFile c;; fun plugbych(a,c)=let a -> [_ plug] in plug.PLUG_channel==c;; fun plugbyclass(a,c)=let a -> [_ plug] in!strcmpi plug.PLUG_sName c;; fun removeInstFromList(l, inst)= if l==nil then nil else let hd l -> [cinst _] in if inst == cinst then tl l else (hd l)::removeInstFromList tl l inst;; fun removeInstCallBacks(inst)= set lInstCbAllPluginsLoaded = remove_from_list lInstCbAllPluginsLoaded inst; set lInstCbGeneric = remove_from_list lInstCbGeneric inst; set lInstCbPreRenderEffects = remove_from_list lInstCbPreRenderEffects inst; set lInstCbPreRender = remove_from_list lInstCbPreRender inst; set lInstCbPreRender2 = remove_from_list lInstCbPreRender2 inst; set lInstCbPostRender = remove_from_list lInstCbPostRender inst; set lInstCbScenePreRender = remove_from_list lInstCbScenePreRender inst; set lInstCbScenePreRender2 = remove_from_list lInstCbScenePreRender2 inst; set lInstCbScenePreRenderPhysic = remove_from_list lInstCbScenePreRenderPhysic inst; set lInstCbScenePostRender = remove_from_list lInstCbScenePostRender inst; set lInstCbNavigateControlState = remove_from_list lInstCbNavigateControlState inst; set lInstCbClick = remove_from_list lInstCbClick inst; set lInstCbDbClick = remove_from_list lInstCbDbClick inst; set lInstCbUnClick = remove_from_list lInstCbUnClick inst; set lInstCbWheel = remove_from_list lInstCbWheel inst; set lInstCbCursorMove = remove_from_list lInstCbCursorMove inst; set lInstCbInputClick = remove_from_list lInstCbInputClick inst; set lInstCbInputUnClick = remove_from_list lInstCbInputUnClick inst; set lInstCbInputUpdate = remove_from_list lInstCbInputUpdate inst; set lInstCbKeyDown = remove_from_list lInstCbKeyDown inst; set lInstCbKeyUp = remove_from_list lInstCbKeyUp inst; set lInstCbTouchPointAdd = remove_from_list lInstCbTouchPointAdd inst; set lInstCbTouchPointRemove = remove_from_list lInstCbTouchPointRemove inst; set lInstCbTouchPointUpdate = remove_from_list lInstCbTouchPointUpdate inst; set lInstCbCameraChange = remove_from_list lInstCbCameraChange inst; set lInstCbResizeView = remove_from_list lInstCbResizeView inst; set lInstCbFocusView = remove_from_list lInstCbFocusView inst; set lInstCbKillFocusView = remove_from_list lInstCbKillFocusView inst; set lInstCbDropFileView = remove_from_list lInstCbDropFileView inst; set lInstCbVrModeView = remove_from_list lInstCbVrModeView inst; set lInstCbCameraTeleport = remove_from_list lInstCbCameraTeleport inst; set lInstCbNetConnected = remove_from_list lInstCbNetConnected inst; set lInstCbNetClosed = remove_from_list lInstCbNetClosed inst; set lInstCbNetSConnected = remove_from_list lInstCbNetSConnected inst; set lInstCbNetSrvMessage = remove_from_list lInstCbNetSrvMessage inst; set lInstCbNetUserMessage = remove_from_list lInstCbNetUserMessage inst; set lInstCbNetUserPrivateMessage = remove_from_list lInstCbNetUserPrivateMessage inst; set lInstCbNetUserChangeLogin = remove_from_list lInstCbNetUserChangeLogin inst; set lInstCbNetNewUser = remove_from_list lInstCbNetNewUser inst; set lInstCbNetDelUser = remove_from_list lInstCbNetDelUser inst; set lInstCbNetGetFile = remove_from_list lInstCbNetGetFile inst; set lInstCbNetUserGetItem = remove_from_list lInstCbNetUserGetItem inst; set lInstCbNetRoomGetItem = remove_from_list lInstCbNetRoomGetItem inst; set lInstCbNetNbUsers = remove_from_list lInstCbNetNbUsers inst; set lInstCbNetRoomChanged = remove_from_list lInstCbNetRoomChanged inst; // needed for editor let sizelist inst.INST_plugin.PLUG_lAction -> size in let 0 -> i in while (i < size) do ( let nth_list inst.INST_plugin.PLUG_lAction i -> action in ( _DMSdefineAction inst.INST_DMI (strcatn inst.INST_sName::"."::action::nil) nil; ); set i = i + 1; ); let sizelist inst.INST_lAction -> size in let 0 -> i in while (i < size) do ( let nth_list inst.INST_lAction i -> action in ( _DMSdefineAction inst.INST_DMI (strcatn inst.INST_sName::"."::action::nil) nil; ); set i = i + 1; ); 0;; fun resetInstCallBacks()= set lInstCbAllPluginsLoaded = nil; set lInstCbGeneric = nil; set lInstCbPreRenderEffects = nil; set lInstCbPreRender = nil; set lInstCbPreRender2 = nil; set lInstCbPostRender = nil; set lInstCbScenePreRender = nil; set lInstCbScenePreRender2 = nil; set lInstCbScenePreRenderPhysic = nil; set lInstCbScenePostRender = nil; set lInstCbNavigateControlState = nil; set lInstCbClick = nil; set lInstCbDbClick = nil; set lInstCbUnClick = nil; set lInstCbWheel = nil; set lInstCbCursorMove = nil; set lInstCbInputClick = nil; set lInstCbInputUnClick = nil; set lInstCbInputUpdate = nil; set lInstCbKeyDown = nil; set lInstCbKeyUp = nil; set lInstCbTouchPointAdd = nil; set lInstCbTouchPointRemove = nil; set lInstCbTouchPointUpdate = nil; set lInstCbCameraChange = nil; set lInstCbResizeView = nil; set lInstCbFocusView = nil; set lInstCbKillFocusView = nil; set lInstCbDropFileView = nil; set lInstCbVrModeView = nil; set lInstCbCameraTeleport = nil; set lInstCbNetConnected = nil; set lInstCbNetClosed = nil; set lInstCbNetSConnected = nil; set lInstCbNetSrvMessage = nil; set lInstCbNetUserMessage = nil; set lInstCbNetUserPrivateMessage = nil; set lInstCbNetUserChangeLogin = nil; set lInstCbNetNewUser = nil; set lInstCbNetDelUser = nil; set lInstCbNetGetFile = nil; set lInstCbNetUserGetItem = nil; set lInstCbNetRoomGetItem = nil; set lInstCbNetNbUsers = nil; set lInstCbNetRoomChanged = nil; set lInstCbEditorPreRender = nil; set lInstCbEditorPostRender = nil; 0;; fun deletePluginInstance(plug, instancename, dellinks)= let switchstr plug.PLUG_lInstances instancename -> inst in if inst == nil then nil else ( removeInstCallBacks inst; // Editor callbacks set lInstCbEditorPreRender = remove_from_list lInstCbEditorPreRender inst; set lInstCbEditorPostRender = remove_from_list lInstCbEditorPostRender inst; // Instance Callback set inst.INST_cbGeneric = nil; set inst.INST_cbAllPluginsLoaded = nil; set inst.INST_cbPreRenderEffects = nil; set inst.INST_cbPreRender = nil; set inst.INST_cbPreRender2 = nil; set inst.INST_cbPostRender = nil; set inst.INST_cbScenePreRender = nil; set inst.INST_cbScenePreRender2 = nil; set inst.INST_cbScenePreRenderPhysic = nil; set inst.INST_cbScenePostRender = nil; set inst.INST_cbNavigateControlState = nil; set inst.INST_cbClick = nil; set inst.INST_cbDbClick = nil; set inst.INST_cbUnClick = nil; set inst.INST_cbWheel = nil; set inst.INST_cbCursorMove = nil; set inst.INST_cbInputClick = nil; set inst.INST_cbInputUnClick = nil; set inst.INST_cbInputUpdate = nil; set inst.INST_cbKeyDown = nil; set inst.INST_cbKeyUp = nil; set inst.INST_cbTouchPointAdd = nil; set inst.INST_cbTouchPointRemove = nil; set inst.INST_cbTouchPointUpdate = nil; set inst.INST_cbCameraChange = nil; set inst.INST_cbResizeView = nil; set inst.INST_cbFocusView = nil; set inst.INST_cbKillFocusView = nil; set inst.INST_cbDropFileView = nil; set inst.INST_cbVrModeView = nil; set inst.INST_cbCameraTeleport = nil; // Network Callback set inst.INST_cbNetConnected = nil; set inst.INST_cbNetClosed = nil; set inst.INST_cbNetSConnected = nil; set inst.INST_cbNetSrvMessage = nil; set inst.INST_cbNetUserMessage = nil; set inst.INST_cbNetUserPrivateMessage = nil; set inst.INST_cbNetUserChangeLogin = nil; set inst.INST_cbNetNewUser = nil; set inst.INST_cbNetDelUser = nil; set inst.INST_cbNetGetFile = nil; set inst.INST_cbNetUserGetItem = nil; set inst.INST_cbNetRoomGetItem = nil; set inst.INST_cbNetNbUsers = nil; set inst.INST_cbNetRoomChanged = nil; set inst.INST_cbEditorPreRender = nil; set inst.INST_cbEditorPostRender = nil; set inst.INST_cbEditorHelperState = nil; if (!inst.INST_iLoadState) then nil else ( exec inst.INST_cbDel with [inst]; execch plug.PLUG_channel plug.PLUG_cbStopInstance [inst]; execch plug.PLUG_channel plug.PLUG_cbDelInstance [inst]; ); execch plug.PLUG_channel plug.PLUG_dsEditor [inst]; set inst.INST_cbDel = nil; if (!dellinks) then nil else ( removeDmiById instancename; //_DMSremoveActionStartedByName _DMSrootModule strcat instancename "."; //_DMSremoveEventStartedByName _DMSrootModule strcat instancename "."; ); set plug.PLUG_lInstances = remove_from_list plug.PLUG_lInstances (getSwitchStr plug.PLUG_lInstances instancename); set inst.INST_groupstr.GRP_lInstance = remove_from_list inst.INST_groupstr.GRP_lInstance inst; ); 0;; fun removeAllPluginInstanceFromGroup(groupstr)= let lPlugins -> l in while (l != nil) do ( let hd l -> [_ plug] in let plug.PLUG_lInstances -> linst in while (linst != nil) do ( let hd linst -> [_ inst] in if (inst.INST_groupstr != groupstr) then nil else deletePluginInstance plug inst.INST_sName 1; set linst = tl linst; ); set l = tl l; ); 0;; fun getPluginByName(name)= switchstr lPlugins name;; fun getPluginByFile(file)= let search_in_list lPlugins @plugbyfile file -> [_ plug] in plug;; fun getPluginInstanceByName(plug, instancename)= switchstr plug.PLUG_lInstances instancename;; fun createPluginInstance(groupstr, plug, instancename, params, laction, levent, showhelper, showingroup, load)= let getPluginInstanceByName plug instancename -> inststr in let inststr.INST_cbEditorPreRender -> edPreRender in let inststr.INST_cbEditorPostRender -> edPostRender in ( deletePluginInstance plug instancename 0; // keep the previous struct instance if exist (needed for editors) let if (inststr == nil) then mkPInstance[nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil 0] else inststr -> inst in ( set inst.INST_plugin = plug; set inst.INST_groupstr = groupstr; set inst.INST_sPluginClass = plug.PLUG_sName; set inst.INST_sName = instancename; set inst.INST_iLoadState = load; set inst.INST_lAction = laction; set inst.INST_lEvent = levent; set inst.INST_lParams = params; set inst.INST_bShowHelper = showhelper; set inst.INST_bShowInGroup = showingroup; // Instance Callback set inst.INST_cbDel = nil; set inst.INST_cbAllPluginsLoaded = nil; set inst.INST_cbGeneric = nil; set inst.INST_cbPreRenderEffects = nil; set inst.INST_cbPreRender = nil; set inst.INST_cbPreRender2 = nil; set inst.INST_cbPostRender = nil; set inst.INST_cbScenePreRender = nil; set inst.INST_cbScenePreRender2 = nil; set inst.INST_cbScenePreRenderPhysic = nil; set inst.INST_cbScenePostRender = nil; set inst.INST_cbNavigateControlState = nil; set inst.INST_cbClick = nil; set inst.INST_cbDbClick = nil; set inst.INST_cbUnClick = nil; set inst.INST_cbWheel = nil; set inst.INST_cbCursorMove = nil; set inst.INST_cbInputClick = nil; set inst.INST_cbInputUnClick = nil; set inst.INST_cbInputUpdate = nil; set inst.INST_cbKeyDown = nil; set inst.INST_cbKeyUp = nil; set inst.INST_cbTouchPointAdd = nil; set inst.INST_cbTouchPointRemove = nil; set inst.INST_cbTouchPointUpdate = nil; set inst.INST_cbCameraChange = nil; set inst.INST_cbResizeView = nil; set inst.INST_cbFocusView = nil; set inst.INST_cbKillFocusView = nil; set inst.INST_cbDropFileView = nil; set inst.INST_cbVrModeView = nil; set inst.INST_cbCameraTeleport = nil; set inst.INST_cbNetConnected = nil; set inst.INST_cbNetClosed = nil; set inst.INST_cbNetSConnected = nil; set inst.INST_cbNetSrvMessage = nil; set inst.INST_cbNetUserMessage = nil; set inst.INST_cbNetUserPrivateMessage = nil; set inst.INST_cbNetUserChangeLogin = nil; set inst.INST_cbNetNewUser = nil; set inst.INST_cbNetDelUser = nil; set inst.INST_cbNetGetFile = nil; set inst.INST_cbNetUserGetItem = nil; set inst.INST_cbNetRoomGetItem = nil; set inst.INST_cbNetNbUsers = nil; set inst.INST_cbNetRoomChanged = nil; set inst.INST_cbEditorPreRender = nil; set inst.INST_cbEditorPostRender = nil; set inst.INST_cbEditorHelperState = nil; set inst.INST_DMI = createDMI instancename; // reset editor on apply setPluginInstanceEditorCbPreRender inst edPreRender; setPluginInstanceEditorCbPostRender inst edPostRender; set plug.PLUG_lInstances = lcat plug.PLUG_lInstances [instancename inst]::nil; set groupstr.GRP_lInstance = lcat groupstr.GRP_lInstance inst::nil; execch plug.PLUG_channel plug.PLUG_initEditor [inst]; if (!inst.INST_iLoadState) then nil else ( execch plug.PLUG_channel plug.PLUG_cbStartInstance [inst]; execch plug.PLUG_channel plug.PLUG_cbAddInstance [inst]; ); inst; ); );; /*! @ingroup plugITApi * \brief Get a plugIT instance user actions * * Prototype: fun [PInstance] [S r1] * * \param PInstance : the plugIT instance * * \return [S r1] : the list of user actions **/ fun getPluginInstanceUserActions(inst)= inst.INST_lAction;; /*! @ingroup plugITApi * \brief Get a plugIT instance user events * * Prototype: fun [PInstance] [S r1] * * \param PInstance : the plugIT instance * * \return [S r1] : the list of user events **/ fun getPluginInstanceUserEvents(inst)= inst.INST_lEvent;; /*! @ingroup plugITApi * \brief Get a plugIT instance param value * * Prototype: fun [PInstance S] S * * \param PInstance : the plugIT instance * \param S : param name * * \return S : the param value **/ fun getPluginInstanceParam(inst, param)= switchstr inst.INST_lParams param;; fun getPluginParam(plug, param)= let switchstr plug.PLUG_lParams param -> type in if type != nil then type else ( // look in params named with "_" at the end let nil -> lfilter in ( let plug.PLUG_lParams -> l in while (l != nil) do ( let hd l -> [fname ftype] in if (!strcmp "_" (substr fname ((strlen fname) - 1) 1)) then ( set lfilter = [(substr fname 0 ((strlen fname) - 1)) ftype]::lfilter; ) else nil; set l = tl l; ); if (lfilter == nil) then nil else let lfilter -> l in while ((l != nil) && (type == nil)) do ( let hd l -> [fname ftype] in let (strfind "_" param 0) -> pos in if (pos == nil) then nil else let substr param 0 pos -> pname in if (!strcmp fname pname) then set type = ftype else nil; set l = tl l; ); ); type; );; fun getInstanceByName(instancename)= let nil -> inststr in ( let lPlugins -> l in while (l != nil) && (inststr == nil) do ( let hd l -> [_ plug] in set inststr = getPluginInstanceByName plug instancename; set l = tl l; ); inststr; );; /*! @ingroup plugITApi * \brief Get a plugIT instance group name * * Prototype: fun [PInstance] S * * \param PInstance : the plugIT instance * * \return S : the group name **/ fun getPluginInstanceGroupName(inst)= inst.INST_groupstr.GRP_sName;; /*! @ingroup plugITApi * \brief Get a plugIT instance name * * Prototype: fun [PInstance] S * * \param PInstance : the plugIT instance * * \return S : the instance name **/ fun getPluginInstanceName(inst)= inst.INST_sName;; /*! @ingroup plugITApi * \brief Get a plugIT instance full name * * Prototype: fun [PInstance] S * * \param PInstance : the plugIT instance * * \return S : the instance name combined with project name **/ fun getPluginInstanceFullname(inst)= strcatn inst.INST_groupstr.GRP_project.PRJ_sName::"_"::inst.INST_sName::nil;; fun setPluginInstanceParams(inst, lparam)= set inst.INST_lParams = lparam;; fun setPluginInstanceUserActions(inst, lparam)= set inst.INST_lAction = lparam;; fun setPluginInstanceUserEvents(inst, lparam)= set inst.INST_lEvent = lparam;; /*! @ingroup plugITApi * \brief Set a plugIT instance helper state * * Prototype: fun [PInstance I] I * * \param PInstance : the plugIT instance * \param I : helper state * * \return 0; **/ fun setPluginInstanceShowHelper(inst, state)= set inst.INST_bShowHelper = state; execch inst.INST_plugin.PLUG_channel inst.INST_cbEditorHelperState [inst inst.INST_bShowHelper]; 0;; /*! @ingroup plugITApi * \brief Get a plugIT instance helper state * * Prototype: fun [PInstance] I * * \param PInstance : the plugIT instance * * \return the instance helper state; **/ fun getPluginInstanceShowHelper(inst)= inst.INST_bShowHelper;; /*! @ingroup plugITApi * \brief Set a plugIT instance show in group state * * Prototype: fun [PInstance I] I * * \param PInstance : the plugIT instance * \param I : show in group state * * \return 0; **/ fun setPluginInstanceShowInGroup(inst, state)= set inst.INST_bShowInGroup = state; 0;; /*! @ingroup plugITApi * \brief Get a plugIT instance show in group state * * Prototype: fun [PInstance] I * * \param PInstance : the plugIT instance * * \return the instance show in group state; **/ fun getPluginInstanceShowInGroup(inst)= inst.INST_bShowInGroup;; // Instances callback /*! @ingroup plugITApi * \brief Define a generic plugIT instance callback that can be triggered by calling cbPlugGeneric with an unique id * * Prototype: fun [PInstance fun [PInstance I S S] u0] fun [PInstance I S S] u0 * * \param PInstance : the plugIT instance * \param fun [PInstance I S S] u0 : the callback function called event * \param - PInstance : the plugIT instance * \param - I : an unique event id * \param - S : the event value * \param - S : the event param * * \return 0 **/ fun setPluginInstanceCbGeneric(inst, cbfun)= set lInstCbGeneric = remove_from_list lInstCbGeneric inst; if (cbfun == nil) then nil else set lInstCbGeneric = lcat lInstCbGeneric inst::nil; // addLogMessage strcat ">> lInstCbGeneric : " itoa sizelist lInstCbGeneric; set inst.INST_cbGeneric = cbfun;; /*! @ingroup plugITApi * \brief Define a plugIT instance callback that is triggered when all the plugins of the group are loaded * * Prototype: fun [PInstance fun [PInstance] u0] fun [PInstance] u0 * * \param PInstance : the plugIT instance * \param fun [PInstance] u0 : the callback function called event * \param - PInstance : the plugIT instance * * \return 0 **/ fun setPluginInstanceCbAllPluginsLoaded(inst, cbfun)= set lInstCbAllPluginsLoaded = remove_from_list lInstCbAllPluginsLoaded inst; if (cbfun == nil) then nil else set lInstCbAllPluginsLoaded = lcat lInstCbAllPluginsLoaded inst::nil; // addLogMessage strcat ">> lInstCbAllPluginsLoaded : " itoa sizelist lInstCbAllPluginsLoaded; set inst.INST_cbAllPluginsLoaded = cbfun;; /*! @ingroup plugITApi * \brief Define the instance callback on delete event * * Prototype: fun [PInstance fun [PInstance] u0] fun [PInstance] u0 * * \param PInstance : the plugIT instance * \param fun [PInstance] u0 : the callback function called on del event * \param - PInstance : the plugIT instance * * \return 0 **/ fun setPluginInstanceCbDel(inst, cbfun)= set inst.INST_cbDel = cbfun;; // not used fun setPluginInstanceCbPreRenderEffects(inst, cbfun)= set lInstCbPreRenderEffects = remove_from_list lInstCbPreRenderEffects inst; if (cbfun == nil) then nil else set lInstCbPreRenderEffects = lcat lInstCbPreRenderEffects inst::nil; // addLogMessage strcat ">> lInstCbPreRenderEffects : " itoa sizelist lInstCbPreRenderEffects; set inst.INST_cbPreRenderEffects = cbfun;; /*! @ingroup plugITApi * \brief Define the instance callback on preRender event * * Prototype: fun [PInstance fun [PInstance V3Dview] u0] fun [PInstance V3Dview] u0 * * \param PInstance : the plugIT instance * \param fun [PInstance V3Dview] u0 : the callback function called on preRender event * \param - PInstance : the plugIT instance * \param - V3Dview : the 3d view structure * * \return fun [PInstance] u0 : the same callback **/ fun setPluginInstanceCbPreRender(inst, cbfun)= set lInstCbPreRender = remove_from_list lInstCbPreRender inst; if (cbfun == nil) then nil else set lInstCbPreRender = lcat lInstCbPreRender inst::nil; // addLogMessage strcatn ">> lInstCbPreRender from "::inst.INST_sName::" : "::(itoa sizelist lInstCbPreRender)::nil; set inst.INST_cbPreRender = cbfun;; /*! @ingroup plugITApi * \brief Define the instance callback on preRender2 event * * Prototype: fun [PInstance fun [PInstance V3Dview] u0] fun [PInstance V3Dview] u0 * * \param PInstance : the plugIT instance * \param fun [PInstance V3Dview] u0 : the callback function called on preRender event * \param - PInstance : the plugIT instance * \param - V3Dview : the 3d view structure * * \return fun [PInstance] u0 : the same callback **/ fun setPluginInstanceCbPreRender2(inst, cbfun)= set lInstCbPreRender2 = remove_from_list lInstCbPreRender2 inst; if (cbfun == nil) then nil else set lInstCbPreRender2 = lcat lInstCbPreRender2 inst::nil; // addLogMessage strcatn ">> lInstCbPreRender2 from "::inst.INST_sName::" : "::(itoa sizelist lInstCbPreRender)::nil; set inst.INST_cbPreRender2 = cbfun;; /*! @ingroup plugITApi * \brief Define the instance callback on postRender event * * Prototype: fun [PInstance fun [PInstance V3Dview] u0] fun [PInstance V3Dview] u0 * * \param PInstance : the plugIT instance * \param fun [PInstance V3Dview] u0 : the callback function called on postRender event * \param - PInstance : the plugIT instance * \param - V3Dview : the 3d view structure * * \return fun [PInstance V3Dview] u0 : the same callback **/ fun setPluginInstanceCbPostRender(inst, cbfun)= set lInstCbPostRender = remove_from_list lInstCbPostRender inst; if (cbfun == nil) then nil else set lInstCbPostRender = lcat lInstCbPostRender inst::nil; //addLogMessage strcatn ">> lInstCbPostRender from "::inst.INST_sName::" : "::(itoa sizelist lInstCbPostRender)::nil; set inst.INST_cbPostRender = cbfun;; /*! @ingroup plugITApi * \brief Define the editor instance callback on preRender event * * Prototype: fun [PInstance fun [PInstance V3Dview] u0] fun [PInstance V3Dview] u0 * * \param PInstance : the plugIT instance * \param fun [PInstance V3Dview] u0 : the callback function called on preRender event * \param - PInstance : the plugIT instance * \param - V3Dview : the 3d view structure * * \return fun [PInstance] u0 : the same callback **/ fun setPluginInstanceEditorCbPreRender(inst, cbfun)= set lInstCbEditorPreRender = remove_from_list lInstCbEditorPreRender inst; if (cbfun == nil) then nil else set lInstCbEditorPreRender = lcat lInstCbEditorPreRender inst::nil; set inst.INST_cbEditorPreRender = cbfun;; /*! @ingroup plugITApi * \brief Define the instance editor callback on postRender event * * Prototype: fun [PInstance fun [PInstance V3Dview] u0] fun [PInstance V3Dview] u0 * * \param PInstance : the plugIT instance * \param fun [PInstance V3Dview] u0 : the callback function called on postRender event * \param - PInstance : the plugIT instance * \param - V3Dview : the 3d view structure * * \return fun [PInstance V3Dview] u0 : the same callback **/ fun setPluginInstanceEditorCbPostRender(inst, cbfun)= set lInstCbEditorPostRender = remove_from_list lInstCbEditorPostRender inst; if (cbfun == nil) then nil else set lInstCbEditorPostRender = lcat lInstCbEditorPostRender inst::nil; set inst.INST_cbEditorPostRender = cbfun;; /*! @ingroup plugITApi * \brief Define the instance editor callback on helper state change * * Prototype: fun [PInstance fun [PInstance I] u0] fun [PInstance I] u0 * * \param PInstance : the plugIT instance * \param fun [PInstance I] u0 : the callback function called on helper state change * \param - PInstance : the plugIT instance * \param - I : the new helper state * * \return fun [PInstance I] u0 : the same callback **/ fun setPluginInstanceEditorCbHelperState(inst, cbfun)= set inst.INST_cbEditorHelperState = cbfun;; /*! @ingroup plugITApi * \brief Define the instance callback on Scene preRender event, this one is called before the animations and physics updates * * Prototype: fun [PInstance fun [PInstance V3Dsession I] u0] fun [PInstance V3Dsession I] u0 * * \param PInstance : the plugIT instance * \param fun [PInstance V3Dsession I] u0 : the callback function called on Scene preRender event * \param - PInstance : the plugIT instance * \param - V3Dsession : the scene 3d session structure * \param - I : the time passed since last frame in milli second * * \return fun [PInstance V3Dsession I] u0 : the same callback **/ fun setPluginInstanceCbScenePreRender(inst, cbfun)= set lInstCbScenePreRender = remove_from_list lInstCbScenePreRender inst; if (cbfun == nil) then nil else set lInstCbScenePreRender = lcat lInstCbScenePreRender inst::nil; // addLogMessage strcatn ">> lInstCbScenePreRender from "::inst.INST_sName::" : "::(itoa sizelist lInstCbScenePreRender)::nil; set inst.INST_cbScenePreRender = cbfun;; /*! @ingroup plugITApi * \brief Define the instance callback on Scene preRender2 event, this one is called after the animations and physics updates * * Prototype: fun [PInstance fun [PInstance V3Dsession I] u0] fun [PInstance V3Dsession I] u0 * * \param PInstance : the plugIT instance * \param fun [PInstance V3Dsession I] u0 : the callback function called on Scene preRender2 event * \param - PInstance : the plugIT instance * \param - V3Dsession : the scene 3d session structure * \param - I : the time passed since last frame in milli second * * \return fun [PInstance V3Dsession I] u0 : the same callback **/ fun setPluginInstanceCbScenePreRender2(inst, cbfun)= set lInstCbScenePreRender2 = remove_from_list lInstCbScenePreRender2 inst; if (cbfun == nil) then nil else set lInstCbScenePreRender2 = lcat lInstCbScenePreRender2 inst::nil; // addLogMessage strcat ">> lInstCbScenePreRender2 : " itoa sizelist lInstCbScenePreRender2; set inst.INST_cbScenePreRender2 = cbfun;; /*! @ingroup plugITApi * \brief Define the instance callback on Scene preRenderPhysic event, this one is called after the animations and before physics updates * * Prototype: fun [PInstance fun [PInstance V3Dsession I] u0] fun [PInstance V3Dsession I] u0 * * \param PInstance : the plugIT instance * \param fun [PInstance V3Dsession I] u0 : the callback function called on Scene preRender2 event * \param - PInstance : the plugIT instance * \param - V3Dsession : the scene 3d session structure * \param - I : the time passed since last frame in milli second * * \return fun [PInstance V3Dsession I] u0 : the same callback **/ fun setPluginInstanceCbScenePreRenderPhysic(inst, cbfun)= set lInstCbScenePreRenderPhysic = remove_from_list lInstCbScenePreRenderPhysic inst; if (cbfun == nil) then nil else set lInstCbScenePreRenderPhysic = lcat lInstCbScenePreRenderPhysic inst::nil; // addLogMessage strcatn ">> lInstCbScenePreRenderPhysic from "::inst.INST_sName::" : "::(itoa sizelist lInstCbScenePreRenderPhysic)::nil; set inst.INST_cbScenePreRenderPhysic = cbfun;; /*! @ingroup plugITApi * \brief Define the instance callback on Scene postRender event * * Prototype: fun [PInstance fun [PInstance V3Dsession I] u0] fun [PInstance V3Dsession I] u0 * * \param PInstance : the plugIT instance * \param fun [PInstance V3Dsession I] u0 : the callback function called on Scene postRender event * \param - PInstance : the plugIT instance * \param - V3Dsession : the scene 3d session structure * \param - I : the time passed since last frame in milli second * * \return fun [PInstance V3Dsession I] u0 : the same callback **/ fun setPluginInstanceCbScenePostRender(inst, cbfun)= set lInstCbScenePostRender = remove_from_list lInstCbScenePostRender inst; if (cbfun == nil) then nil else set lInstCbScenePostRender = lcat lInstCbScenePostRender inst::nil; // addLogMessage strcatn ">> lInstCbScenePostRender from "::inst.INST_sName::" : "::(itoa sizelist lInstCbScenePostRender)::nil; set inst.INST_cbScenePostRender = cbfun;; /*! @ingroup plugITApi * \brief Define the instance callback on navigate control enable event * * Prototype: fun [PInstance fun [PInstance V3Dsession I] u0] fun [PInstance V3Dsession I] u0 * * \param PInstance : the plugIT instance * \param fun [PInstance V3Dsession I] u0 : the callback function called on navigate control enable event * \param - PInstance : the plugIT instance * \param - V3Dsession : the scene 3d session structure * \param - I : the time passed since last frame in milli second * * \return fun [PInstance V3Dsession I] u0 : the same callback **/ fun setPluginInstanceCbNavigateControlState(inst, cbfun)= set lInstCbNavigateControlState = remove_from_list lInstCbNavigateControlState inst; if (cbfun == nil) then nil else set lInstCbNavigateControlState = lcat lInstCbNavigateControlState inst::nil; // addLogMessage strcatn ">> lInstCbNavigateControlState from "::inst.INST_sName::" : "::(itoa sizelist lInstCbNavigateControlState)::nil; set inst.INST_cbNavigateControlState = cbfun;; /*! @ingroup plugITApi * \brief Define the instance callback on mouse click event * * Prototype: fun [PInstance fun [PInstance V3Dview I I I] u0] fun [PInstance V3Dview I I I] u0 * * \param PInstance : the plugIT instance * \param fun [PInstance V3Dview I I I] u0 : the callback function called on mouse click event * \param - PInstance : the plugIT instance * \param - V3Dview : the 3d view structure * \param - I : click position on X * \param - I : click position on Y * \param - I : mouse button, 1 for left, 2 for right, 16 for middle button * * \return fun [PInstance V3Dview I I I] u0 : the same callback **/ fun setPluginInstanceCbClick(inst, cbfun)= set lInstCbClick = remove_from_list lInstCbClick inst; if (cbfun == nil) then nil else set lInstCbClick = lcat lInstCbClick inst::nil; set inst.INST_cbClick = cbfun;; /*! @ingroup plugITApi * \brief Define the instance callback on mouse double click event * * Prototype: fun [PInstance fun [PInstance V3Dview I I I] u0] fun [PInstance V3Dview I I I] u0 * * \param PInstance : the plugIT instance * \param fun [PInstance V3Dview I I I] u0 : the callback function called on mouse double click event * \param - PInstance : the plugIT instance * \param - V3Dview : the 3d view structure * \param - I : click position on X * \param - I : click position on Y * \param - I : mouse button, 1 for left, 2 for right, 16 for middle button * * \return fun [PInstance V3Dview I I I] u0 : the same callback **/ fun setPluginInstanceCbDbClick(inst, cbfun)= set lInstCbDbClick = remove_from_list lInstCbDbClick inst; if (cbfun == nil) then nil else set lInstCbDbClick = lcat lInstCbDbClick inst::nil; set inst.INST_cbDbClick = cbfun;; /*! @ingroup plugITApi * \brief Define the instance callback on mouse unclick event * * Prototype: fun [PInstance fun [PInstance V3Dview I I I] u0] fun [PInstance V3Dview I I I] u0 * * \param PInstance : the plugIT instance * \param fun [PInstance V3Dview I I I] u0 : the callback function called on mouse unclick event * \param - PInstance : the plugIT instance * \param - V3Dview : the 3d view structure * \param - I : click position on X * \param - I : click position on Y * \param - I : mouse button, 1 for left, 2 for right, 16 for middle button * * \return fun [PInstance V3Dview I I I] u0 : the same callback **/ fun setPluginInstanceCbUnClick(inst, cbfun)= set lInstCbUnClick = remove_from_list lInstCbUnClick inst; if (cbfun == nil) then nil else set lInstCbUnClick = lcat lInstCbUnClick inst::nil; set inst.INST_cbUnClick = cbfun;; /*! @ingroup plugITApi * \brief Define the instance callback on mouse wheel event * * Prototype: fun [PInstance fun [PInstance V3Dview I I I I] u0] fun [PInstance V3Dview I I I I] u0 * * \param PInstance : the plugIT instance * \param fun [PInstance V3Dview I I I I] u0 : the callback function called on mouse wheel event * \param - PInstance : the plugIT instance * \param - V3Dview : the 3d view structure * \param - I : click position on X * \param - I : click position on Y * \param - I : wheel delta * \param - I : mouse button, 1 for left, 2 for right, 16 for middle button * * \return fun [PInstance V3Dview I I I I] u0 : the same callback **/ fun setPluginInstanceCbWheel(inst, cbfun)= set lInstCbWheel = remove_from_list lInstCbWheel inst; if (cbfun == nil) then nil else set lInstCbWheel = lcat lInstCbWheel inst::nil; set inst.INST_cbWheel = cbfun;; /*! @ingroup plugITApi * \brief Define the instance callback on mouse move event * * Prototype: fun [PInstance fun [PInstance V3Dview I I I] u0] fun [PInstance V3Dview I I I] u0 * * \param PInstance : the plugIT instance * \param fun [PInstance V3Dview I I I] u0 : the callback function called on mouse move event * \param - PInstance : the plugIT instance * \param - V3Dview : the 3d view structure * \param - I : click position on X * \param - I : click position on Y * \param - I : mouse button, 1 for left, 2 for right, 16 for middle button * * \return fun [PInstance V3Dview I I I] u0 : the same callback **/ fun setPluginInstanceCbCursorMove(inst, cbfun)= set lInstCbCursorMove = remove_from_list lInstCbCursorMove inst; if (cbfun == nil) then nil else set lInstCbCursorMove = lcat lInstCbCursorMove inst::nil; set inst.INST_cbCursorMove = cbfun;; /*! @ingroup plugITApi * \brief Define the instance callback on input click event * * Prototype: fun [PInstance fun [PInstance V3Dview I I I I [SO3_OBJECT SO3_MATERIAL I [F F F] [F F] F]] u0] fun [PInstance V3Dview I I I] u0 * * \param PInstance : the plugIT instance * \param fun [PInstance V3Dview I I I] u0 : the callback function called on input click event * \param - PInstance : the plugIT instance * \param - V3Dview : the 3d view structure * \param - I : click position on X * \param - I : click position on Y * \param - I : mouse button, 1 for left, 2 for right, 16 for middle button * \param - [SO3_OBJECT SO3_MATERIAL I [F F F] [F F] F] : 3d mouse infos * * \return fun [PInstance V3Dview I I I I [SO3_OBJECT SO3_MATERIAL I [F F F] [F F] F]] u0 : the same callback **/ fun setPluginInstanceCbInputClick(inst, cbfun)= set lInstCbInputClick = remove_from_list lInstCbInputClick inst; if (cbfun == nil) then nil else set lInstCbInputClick = lcat lInstCbInputClick inst::nil; set inst.INST_cbInputClick = cbfun;; /*! @ingroup plugITApi * \brief Define the instance callback on input unclick event * * Prototype: fun [PInstance fun [PInstance V3Dview I I I I [SO3_OBJECT SO3_MATERIAL I [F F F] [F F] F]] u0] fun [PInstance V3Dview I I I] u0 * * \param PInstance : the plugIT instance * \param fun [PInstance V3Dview I I I] u0 : the callback function called on input unclick event * \param - PInstance : the plugIT instance * \param - V3Dview : the 3d view structure * \param - I : click position on X * \param - I : click position on Y * \param - I : mouse button, 1 for left, 2 for right, 16 for middle button * \param - [SO3_OBJECT SO3_MATERIAL I [F F F] [F F] F] : 3d mouse infos * * \return fun [PInstance V3Dview I I I I [SO3_OBJECT SO3_MATERIAL I [F F F] [F F] F]] u0 : the same callback **/ fun setPluginInstanceCbInputUnClick(inst, cbfun)= set lInstCbInputUnClick = remove_from_list lInstCbInputUnClick inst; if (cbfun == nil) then nil else set lInstCbInputUnClick = lcat lInstCbInputUnClick inst::nil; set inst.INST_cbInputUnClick = cbfun;; /*! @ingroup plugITApi * \brief Define the instance callback on input update event * * Prototype: fun [PInstance fun [PInstance V3Dview I I I I [SO3_OBJECT SO3_MATERIAL I [F F F] [F F] F]] u0] fun [PInstance V3Dview I I I] u0 * * \param PInstance : the plugIT instance * \param fun [PInstance V3Dview I I I] u0 : the callback function called on input update event * \param - PInstance : the plugIT instance * \param - V3Dview : the 3d view structure * \param - I : click position on X * \param - I : click position on Y * \param - I : mouse button, 1 for left, 2 for right, 16 for middle button * \param - [SO3_OBJECT SO3_MATERIAL I [F F F] [F F] F] : 3d mouse infos * * \return fun [PInstance V3Dview I I I I [SO3_OBJECT SO3_MATERIAL I [F F F] [F F] F]] u0 : the same callback **/ fun setPluginInstanceCbInputUpdate(inst, cbfun)= set lInstCbInputUpdate = remove_from_list lInstCbInputUpdate inst; if (cbfun == nil) then nil else set lInstCbInputUpdate = lcat lInstCbInputUpdate inst::nil; set inst.INST_cbInputUpdate = cbfun;; /*! @ingroup plugITApi * \brief Define the instance callback on keyboard key down event * * Prototype: fun [PInstance fun [PInstance V3Dview I I] u0] fun [PInstance V3Dview I I] u0 * * \param PInstance : the plugIT instance * \param fun [PInstance V3Dview I I] u0 : the callback function called on keyboard key down event * \param - PInstance : the plugIT instance * \param - V3Dview : the 3d view structure * \param - I : key scancode * \param - I : key ascii code * * \return fun [PInstance V3Dview I I] u0 : the same callback **/ fun setPluginInstanceCbKeyDown(inst, cbfun)= set lInstCbKeyDown = remove_from_list lInstCbKeyDown inst; if (cbfun == nil) then nil else set lInstCbKeyDown = lcat lInstCbKeyDown inst::nil; set inst.INST_cbKeyDown = cbfun;; /*! @ingroup plugITApi * \brief Define the instance callback on keyboard key up event * * Prototype: fun [PInstance fun [PInstance V3Dview I] u0] fun [PInstance V3Dview I] u0 * * \param PInstance : the plugIT instance * \param fun [PInstance V3Dview I] u0 : the callback function called on keyboard key up event * \param - PInstance : the plugIT instance * \param - V3Dview : the 3d view structure * \param - I : key scancode * * \return fun [PInstance V3Dview I] u0 : the same callback **/ fun setPluginInstanceCbKeyUp(inst, cbfun)= set lInstCbKeyUp = remove_from_list lInstCbKeyUp inst; if (cbfun == nil) then nil else set lInstCbKeyUp = lcat lInstCbKeyUp inst::nil; set inst.INST_cbKeyUp = cbfun;; /*! @ingroup plugITApi * \brief Define the instance callback on touch point add event * * Prototype: fun [PInstance fun [PInstance V3Dview I I I] u0] fun [PInstance V3Dview I I I] u0 * * \param PInstance : the plugIT instance * \param fun [PInstance V3Dview I I I] u0 : the callback function called on touch point add event * \param - PInstance : the plugIT instance * \param - V3Dview : the 3d view structure * \param - I : the point id * \param - I : the point position in window on X * \param - I : the point position in window on Y * * \return fun [PInstance V3Dview I I I] u0 : the same callback **/ fun setPluginInstanceCbTouchPointAdd(inst, cbfun)= set lInstCbTouchPointAdd = remove_from_list lInstCbTouchPointAdd inst; if (cbfun == nil) then nil else set lInstCbTouchPointAdd = lcat lInstCbTouchPointAdd inst::nil; set inst.INST_cbTouchPointAdd = cbfun;; /*! @ingroup plugITApi * \brief Define the instance callback on touch point remove event * * Prototype: fun [PInstance fun [PInstance V3Dview I] u0] fun [PInstance V3Dview I] u0 * * \param PInstance : the plugIT instance * \param fun [PInstance V3Dview I] u0 : the callback function called on touch point remove event * \param - PInstance : the plugIT instance * \param - V3Dview : the 3d view structure * \param - I : the point id * * \return fun [PInstance V3Dview I] u0 : the same callback **/ fun setPluginInstanceCbTouchPointRemove(inst, cbfun)= set lInstCbTouchPointRemove = remove_from_list lInstCbTouchPointRemove inst; if (cbfun == nil) then nil else set lInstCbTouchPointRemove = lcat lInstCbTouchPointRemove inst::nil; set inst.INST_cbTouchPointRemove = cbfun;; /*! @ingroup plugITApi * \brief Define the instance callback on touch point update event * * Prototype: fun [PInstance fun [PInstance V3Dview I I I I I] u0] fun [PInstance V3Dview I I I I I] u0 * * \param PInstance : the plugIT instance * \param fun [PInstance V3Dview I I I I I] u0 : the callback function called on touch point update event * \param - PInstance : the plugIT instance * \param - V3Dview : the 3d view structure * \param - I : the point id * \param - I : the point position in window on X * \param - I : the point position in window on Y * \param - I : relative move on X * \param - I :relative move on X * * \return fun [PInstance V3Dview I I I I I] u0 : the same callback **/ fun setPluginInstanceCbTouchPointUpdate(inst, cbfun)= set lInstCbTouchPointUpdate = remove_from_list lInstCbTouchPointUpdate inst; if (cbfun == nil) then nil else set lInstCbTouchPointUpdate = lcat lInstCbTouchPointUpdate inst::nil; set inst.INST_cbTouchPointUpdate = cbfun;; /*! @ingroup plugITApi * \brief Define the instance callback on default camera change * * Prototype: fun [PInstance fun [PInstance V3Dview V3Dsession SO3_OBJECT] u0] fun [PInstance V3Dview V3Dsession SO3_OBJECT] u0 * * \param PInstance : the plugIT instance * \param fun [PInstance V3Dview V3Dsession SO3_OBJECT] u0 : the callback function called on default camera change * \param - PInstance : the plugIT instance * \param - V3Dview : the 3d view structure * \param - V3Dsession : the scene 3d session structure * \param - SO3_OBJECT : the new default camera * * \return fun [PInstance V3Dview V3Dsession SO3_OBJECT] u0 : the same callback **/ fun setPluginInstanceCbCameraChange(inst, cbfun)= set lInstCbCameraChange = remove_from_list lInstCbCameraChange inst; if (cbfun == nil) then nil else set lInstCbCameraChange = lcat lInstCbCameraChange inst::nil; set inst.INST_cbCameraChange = cbfun;; /*! @ingroup plugITApi * \brief Define the instance callback on 3d view resize event * * Prototype: fun [PInstance fun [PInstance V3Dview I I] u0] fun [PInstance V3Dview I I] u0 * * \param PInstance : the plugIT instance * \param fun [PInstance V3Dview I I] u0 : the callback function called on 3d view resize event * \param - PInstance : the plugIT instance * \param - V3Dview : the 3d view structure * \param - I : the new width of the 3d view * \param - I : the new height of the 3d view * * \return fun [PInstance V3Dview I I] u0 : the same callback **/ fun setPluginInstanceCbResizeView(inst, cbfun)= set lInstCbResizeView = remove_from_list lInstCbResizeView inst; if (cbfun == nil) then nil else set lInstCbResizeView = lcat lInstCbResizeView inst::nil; // addLogMessage strcat ">> lInstCbResizeView : " itoa sizelist lInstCbResizeView; set inst.INST_cbResizeView = cbfun;; /*! @ingroup plugITApi * \brief Define the instance callback on 3d view get focus event * * Prototype: fun [PInstance fun [PInstance V3Dview] u0] fun [PInstance V3Dview] u0 * * \param PInstance : the plugIT instance * \param fun [PInstance V3Dview] u0 : the callback function called on 3d view get focus event * \param - PInstance : the plugIT instance * \param - V3Dview : the 3d view structure * * \return fun [PInstance V3Dview] u0 : the same callback **/ fun setPluginInstanceCbFocusView(inst, cbfun)= set lInstCbFocusView = remove_from_list lInstCbFocusView inst; if (cbfun == nil) then nil else set lInstCbFocusView = lcat lInstCbFocusView inst::nil; set inst.INST_cbFocusView = cbfun;; /*! @ingroup plugITApi * \brief Define the instance callback on 3d view lost focus event * * Prototype: fun [PInstance fun [PInstance V3Dview] u0] fun [PInstance V3Dview] u0 * * \param PInstance : the plugIT instance * \param fun [PInstance V3Dview] u0 : the callback function called on 3d view lost focus event * \param - PInstance : the plugIT instance * \param - V3Dview : the 3d view structure * * \return fun [PInstance V3Dview] u0 : the same callback **/ fun setPluginInstanceCbKillFocusView(inst, cbfun)= set lInstCbKillFocusView = remove_from_list lInstCbKillFocusView inst; if (cbfun == nil) then nil else set lInstCbKillFocusView = lcat lInstCbKillFocusView inst::nil; set inst.INST_cbKillFocusView = cbfun;; /*! @ingroup plugITApi * \brief Define the instance callback on 3d view Drag&Drop files event * * Prototype: fun [PInstance fun [PInstance V3Dview I I [P r1]] u0] fun [PInstance V3Dview I I [P r1]] u0 * * \param PInstance : the plugIT instance * \param fun [PInstance V3Dview I I [P r1]] u0 : the callback function called on 3d view Drag&Drop files event * \param - PInstance : the plugIT instance * \param - V3Dview : the 3d view structure * \param - I : Cursor X position * \param - I : Cursor Y position * \param - [P r1] : list of files * * \return fun [PInstance V3Dview I I [P r1]] u0 : the same callback **/ fun setPluginInstanceCbDropFile(inst, cbfun)= set lInstCbDropFileView = remove_from_list lInstCbDropFileView inst; if (cbfun == nil) then nil else set lInstCbDropFileView = lcat lInstCbDropFileView inst::nil; set inst.INST_cbDropFileView = cbfun;; /*! @ingroup plugITApi * \brief Define the instance callback on 3d view VR mode event * * Prototype: fun [PInstance fun [PInstance V3Dview I] u0] fun [PInstance V3Dview I] u0 * * \param PInstance : the plugIT instance * \param fun [PInstance V3Dview I] u0 : the callback function called on 3d view mode changed * \param - PInstance : the plugIT instance * \param - V3Dview : the 3d view structure * \param - I : Vr mode state * * \return fun [PInstance V3Dview I] u0 : the same callback **/ fun setPluginInstanceCbVrModeChanged(inst, cbfun)= set lInstCbVrModeView = remove_from_list lInstCbVrModeView inst; if (cbfun == nil) then nil else set lInstCbVrModeView = lcat lInstCbVrModeView inst::nil; set inst.INST_cbVrModeView = cbfun;; /*! @ingroup plugITApi * \brief Define the instance callback on main camera position change * * Prototype: fun [PInstance fun [PInstance V3Dview SO3_OBJECT] u0] fun [PInstance V3Dview SO3_OBJECT] u0 * * \param PInstance : the plugIT instance * \param fun [PInstance V3Dview I] u0 : the callback function called on camera teleport change * \param - PInstance : the plugIT instance * \param - V3Dview : the 3d view structure * \param - SO3_OBJECT] : Camera * * \return fun [PInstance V3Dview SO3_OBJECT] u0 : the same callback **/ fun setPluginInstanceCbCameraTeleport(inst, cbfun)= set lInstCbCameraTeleport = remove_from_list lInstCbCameraTeleport inst; if (cbfun == nil) then nil else set lInstCbCameraTeleport = lcat lInstCbCameraTeleport inst::nil; set inst.INST_cbCameraTeleport = cbfun;; /*! @ingroup plugITApi * \brief Define the instance callback on network server connection * * Prototype: fun [PInstance fun [PInstance NetComm] u0] fun [PInstance NetComm] u0 * * \param PInstance : the plugIT instance * \param fun [PInstance NetComm] u0 : the callback function called on network server connection * \param - PInstance : the plugIT instance * \param - NetComm : the network structure * * \return fun [PInstance NetComm] u0 : the same callback **/ fun setPluginInstanceCbNetConnected(inst, cbfun)= set lInstCbNetConnected = remove_from_list lInstCbNetConnected inst; if (cbfun == nil) then nil else set lInstCbNetConnected = lcat lInstCbNetConnected inst::nil; set inst.INST_cbNetConnected = cbfun;; /*! @ingroup plugITApi * \brief Define the instance callback on network server connection lost * * Prototype: fun [PInstance fun [PInstance NetComm] u0] fun [PInstance NetComm] u0 * * \param PInstance : the plugIT instance * \param fun [PInstance NetComm] u0 : the callback function called on network server connection lost * \param - PInstance : the plugIT instance * \param - NetComm : the network structure * * \return fun [PInstance NetComm] u0 : the same callback **/ fun setPluginInstanceCbNetClosed(inst, cbfun)= set lInstCbNetClosed = remove_from_list lInstCbNetClosed inst; if (cbfun == nil) then nil else set lInstCbNetClosed = lcat lInstCbNetClosed inst::nil; set inst.INST_cbNetClosed = cbfun;; /*! @ingroup plugITApi * \brief Define the instance callback on network server secure connection * * Prototype: fun [PInstance fun [PInstance NetComm] u0] fun [PInstance NetComm] u0 * * \param PInstance : the plugIT instance * \param fun [PInstance NetComm] u0 : the callback function called on network server secure connection * \param - PInstance : the plugIT instance * \param - NetComm : the network structure * * \return fun [PInstance NetComm] u0 : the same callback **/ fun setPluginInstanceCbNetSConnected(inst, cbfun)= set lInstCbNetSConnected = remove_from_list lInstCbNetSConnected inst; if (cbfun == nil) then nil else set lInstCbNetSConnected = lcat lInstCbNetSConnected inst::nil; set inst.INST_cbNetSConnected = cbfun;; /*! @ingroup plugITApi * \brief Define the instance callback on network incoming server message * * Prototype: fun [PInstance fun [PInstance NetComm S S S] u0] fun [PInstance NetComm S S S] u0 * * \param PInstance : the plugIT instance * \param fun [PInstance NetComm S S S] u0 : the callback function called on network incoming server message * \param - PInstance : the plugIT instance * \param - NetComm : the network structure * \param - S : command * \param - S : message * \param - S : parameters * * \return fun [PInstance NetComm S S S] u0 : the same callback **/ fun setPluginInstanceCbNetSrvMessage(inst, cbfun)= set lInstCbNetSrvMessage = remove_from_list lInstCbNetSrvMessage inst; if (cbfun == nil) then nil else set lInstCbNetSrvMessage = lcat lInstCbNetSrvMessage inst::nil; set inst.INST_cbNetSrvMessage = cbfun;; /*! @ingroup plugITApi * \brief Define the instance callback on network incoming user message * * Prototype: fun [PInstance fun [PInstance NetComm NetUser S S S] u0] fun [PInstance NetComm NetUser S S S] u0 * * \param PInstance : the plugIT instance * \param fun [PInstance NetComm NetUser S S S] u0 : the callback function called on network incoming user message * \param - PInstance : the plugIT instance * \param - NetComm : the network structure * \param - NetUser : the user structure who sent the message * \param - S : command * \param - S : message * \param - S : parameters * * \return fun [PInstance NetComm NetUser S S S] u0 : the same callback **/ fun setPluginInstanceCbNetUserMessage(inst, cbfun)= set lInstCbNetUserMessage = remove_from_list lInstCbNetUserMessage inst; if (cbfun == nil) then nil else set lInstCbNetUserMessage = lcat lInstCbNetUserMessage inst::nil; set inst.INST_cbNetUserMessage = cbfun;; /*! @ingroup plugITApi * \brief Define the instance callback on network incoming user private message * * Prototype: fun [PInstance fun [PInstance NetComm NetUser S S S] u0] fun [PInstance NetComm NetUser S S S] u0 * * \param PInstance : the plugIT instance * \param fun [PInstance NetComm NetUser S S S] u0 : the callback function called on network incoming user private message * \param - PInstance : the plugIT instance * \param - NetComm : the network structure * \param - NetUser : the user structure who sent the message * \param - S : command * \param - S : message * \param - S : parameters * * \return fun [PInstance NetComm NetUser S S S] u0 : the same callback **/ fun setPluginInstanceCbNetUserPrivateMessage(inst, cbfun)= set lInstCbNetUserPrivateMessage = remove_from_list lInstCbNetUserPrivateMessage inst; if (cbfun == nil) then nil else set lInstCbNetUserPrivateMessage = lcat lInstCbNetUserPrivateMessage inst::nil; set inst.INST_cbNetUserPrivateMessage = cbfun;; /*! @ingroup plugITApi * \brief Define the instance callback on network incoming user file * * Prototype: fun [PInstance fun [PInstance NetComm NetUser S S S] u0] fun [PInstance NetComm NetUser S S S] u0 * * \param PInstance : the plugIT instance * \param fun [PInstance NetComm NetUser S S S] u0 : the callback function called on network incoming user file * \param - PInstance : the plugIT instance * \param - NetComm : the network structure * \param - NetUser : the user structure who sent the file * \param - S : command * \param - S : file data * \param - S : file name * * \return fun [PInstance NetComm NetUser S S S] u0 : the same callback **/ fun setPluginInstanceCbNetGetFile(inst, cbfun)= set lInstCbNetGetFile = remove_from_list lInstCbNetGetFile inst; if (cbfun == nil) then nil else set lInstCbNetGetFile = lcat lInstCbNetGetFile inst::nil; set inst.INST_cbNetGetFile = cbfun;; /*! @ingroup plugITApi * \brief Define the instance callback on network user item value change * * Prototype: fun [PInstance fun [PInstance NetComm NetUser S S] u0] fun [PInstance NetComm NetUser S S] u0 * * \param PInstance : the plugIT instance * \param fun [PInstance NetComm NetUser S S] u0 : the callback function called on network user item value change * \param - PInstance : the plugIT instance * \param - NetComm : the network structure * \param - NetUser : the user structure * \param - S : item name * \param - S : item value * * \return fun [PInstance NetComm NetUser S S] u0 : the same callback **/ fun setPluginInstanceCbNetUserGetItem(inst, cbfun)= set lInstCbNetUserGetItem = remove_from_list lInstCbNetUserGetItem inst; if (cbfun == nil) then nil else set lInstCbNetUserGetItem = lcat lInstCbNetUserGetItem inst::nil; set inst.INST_cbNetUserGetItem = cbfun;; /*! @ingroup plugITApi * \brief Define the instance callback on network room item value change * * Prototype: fun [PInstance fun [PInstance NetComm S S] u0] fun [PInstance NetComm S S] u0 * * \param PInstance : the plugIT instance * \param fun [PInstance NetComm S S] u0 : the callback function called on network room item value change * \param - PInstance : the plugIT instance * \param - NetComm : the network structure * \param - S : item name * \param - S : item value * * \return fun [PInstance NetComm S S] u0 : the same callback **/ fun setPluginInstanceCbNetRoomGetItem(inst, cbfun)= set lInstCbNetRoomGetItem = remove_from_list lInstCbNetRoomGetItem inst; if (cbfun == nil) then nil else set lInstCbNetRoomGetItem = lcat lInstCbNetRoomGetItem inst::nil; set inst.INST_cbNetRoomGetItem = cbfun;; /*! @ingroup plugITApi * \brief Define the instance callback on network new user connected * * Prototype: fun [PInstance fun [PInstance NetComm NetUser] u0] fun [PInstance NetComm NetUser] u0 * * \param PInstance : the plugIT instance * \param fun [PInstance NetComm NetUser] u0 : the callback function called on network new user connected * \param - PInstance : the plugIT instance * \param - NetComm : the network structure * \param - NetUser : the new user structure * * \return fun [PInstance NetComm NetUser] u0 : the same callback **/ fun setPluginInstanceCbNetNewUser(inst, cbfun)= set lInstCbNetNewUser = remove_from_list lInstCbNetNewUser inst; if (cbfun == nil) then nil else set lInstCbNetNewUser = lcat lInstCbNetNewUser inst::nil; set inst.INST_cbNetNewUser = cbfun;; /*! @ingroup plugITApi * \brief Define the instance callback on network user is disconnected * * Prototype: fun [PInstance fun [PInstance NetComm NetUser] u0] fun [PInstance NetComm NetUser] u0 * * \param PInstance : the plugIT instance * \param fun [PInstance NetComm NetUser] u0 : the callback function called on network user is disconnected * \param - PInstance : the plugIT instance * \param - NetComm : the network structure * \param - NetUser : the disconnected user structure * * \return fun [PInstance NetComm NetUser] u0 : the same callback **/ fun setPluginInstanceCbNetDelUser(inst, cbfun)= set lInstCbNetDelUser = remove_from_list lInstCbNetDelUser inst; if (cbfun == nil) then nil else set lInstCbNetDelUser = lcat lInstCbNetDelUser inst::nil; set inst.INST_cbNetDelUser = cbfun;; /*! @ingroup plugITApi * \brief Define the instance callback on network user change his login * * Prototype: fun [PInstance fun [PInstance NetComm NetUser S] u0] fun [PInstance NetComm NetUser S] u0 * * \param PInstance : the plugIT instance * \param fun [PInstance NetComm NetUser S] u0 : the callback function called on network user change his login * \param - PInstance : the plugIT instance * \param - NetComm : the network structure * \param - NetUser : the user structure * \param - S : the new user login * * \return fun [PInstance NetComm NetUser S] u0 : the same callback **/ fun setPluginInstanceCbNetUserChangeLogin(inst, cbfun)= set lInstCbNetUserChangeLogin = remove_from_list lInstCbNetUserChangeLogin inst; if (cbfun == nil) then nil else set lInstCbNetUserChangeLogin = lcat lInstCbNetUserChangeLogin inst::nil; set inst.INST_cbNetUserChangeLogin = cbfun;; /*! @ingroup plugITApi * \brief Define the instance callback on network number of users change * * Prototype: fun [PInstance fun [PInstance NetComm I] u0] fun [PInstance NetComm I] u0 * * \param PInstance : the plugIT instance * \param fun [PInstance NetComm I] u0 : the callback function called on network number of users change * \param - PInstance : the plugIT instance * \param - NetComm : the network structure * \param - I : the new number of users * * \return fun [PInstance NetComm I] u0 : the same callback **/ fun setPluginInstanceCbNetNbUsers(inst, cbfun)= set lInstCbNetNbUsers = remove_from_list lInstCbNetNbUsers inst; if (cbfun == nil) then nil else set lInstCbNetNbUsers = lcat lInstCbNetNbUsers inst::nil; set inst.INST_cbNetNbUsers = cbfun;; /*! @ingroup plugITApi * \brief Define the instance callback on network room change * * Prototype: fun [PInstance fun [PInstance NetComm S] u0] fun [PInstance NetComm S] u0 * * \param PInstance : the plugIT instance * \param fun [PInstance NetComm S] u0 : the callback function called on network room change * \param - PInstance : the plugIT instance * \param - NetComm : the network structure * \param - S : the new room value * * \return fun [PInstance NetComm S] u0 : the same callback **/ fun setPluginInstanceCbNetRoomChanged(inst, cbfun)= set lInstCbNetRoomChanged = remove_from_list lInstCbNetRoomChanged inst; if (cbfun == nil) then nil else set lInstCbNetRoomChanged = lcat lInstCbNetRoomChanged inst::nil; set inst.INST_cbNetRoomChanged = cbfun;; fun initPluginInstance(plug, instancename)= let switchstr plug.PLUG_lInstances instancename -> inst in if (inst.INST_iLoadState) then nil else ( execch plug.PLUG_channel plug.PLUG_cbStartInstance [inst]; execch plug.PLUG_channel plug.PLUG_cbAddInstance [inst]; set inst.INST_iLoadState = 1; ); 0;; fun stopPluginInstance(plug, instancename, dellinks)= let switchstr plug.PLUG_lInstances instancename -> inst in ( // Instance Callback removeInstCallBacks inst; set inst.INST_cbGeneric = nil; set inst.INST_cbAllPluginsLoaded = nil; set inst.INST_cbPreRenderEffects = nil; set inst.INST_cbPreRender = nil; set inst.INST_cbPreRender2 = nil; set inst.INST_cbPostRender = nil; set inst.INST_cbScenePreRender = nil; set inst.INST_cbScenePreRender2 = nil; set inst.INST_cbScenePreRenderPhysic = nil; set inst.INST_cbScenePostRender = nil; set inst.INST_cbClick = nil; set inst.INST_cbDbClick = nil; set inst.INST_cbUnClick = nil; set inst.INST_cbWheel = nil; set inst.INST_cbCursorMove = nil; set inst.INST_cbInputClick = nil; set inst.INST_cbInputUnClick = nil; set inst.INST_cbInputUpdate = nil; set inst.INST_cbKeyDown = nil; set inst.INST_cbKeyUp = nil; set inst.INST_cbTouchPointAdd = nil; set inst.INST_cbTouchPointRemove = nil; set inst.INST_cbTouchPointUpdate = nil; set inst.INST_cbCameraChange = nil; set inst.INST_cbResizeView = nil; set inst.INST_cbFocusView = nil; set inst.INST_cbKillFocusView = nil; set inst.INST_cbDropFileView = nil; set inst.INST_cbVrModeView = nil; set inst.INST_cbCameraTeleport = nil; // Network Callback set inst.INST_cbNetConnected = nil; set inst.INST_cbNetClosed = nil; set inst.INST_cbNetSConnected = nil; set inst.INST_cbNetSrvMessage = nil; set inst.INST_cbNetUserMessage = nil; set inst.INST_cbNetUserPrivateMessage = nil; set inst.INST_cbNetUserChangeLogin = nil; set inst.INST_cbNetNewUser = nil; set inst.INST_cbNetDelUser = nil; set inst.INST_cbNetGetFile = nil; set inst.INST_cbNetUserGetItem = nil; set inst.INST_cbNetRoomGetItem = nil; set inst.INST_cbNetNbUsers = nil; set inst.INST_cbNetRoomChanged = nil; // Editor can still open //set inst.INST_cbEditorPreRender = nil; //set inst.INST_cbEditorPostRender = nil; exec inst.INST_cbDel with [inst]; set inst.INST_cbDel = nil; execch plug.PLUG_channel plug.PLUG_cbStopInstance [inst]; execch plug.PLUG_channel plug.PLUG_cbDelInstance [inst]; if (!dellinks) then nil else ( removeDmiById instancename; //_DMSremoveActionStartedByName _DMSrootModule instancename; //_DMSremoveEventStartedByName _DMSrootModule instancename; ); ); 0;; /*! @ingroup plugITApi * \brief Get the plugIT structure from an instance * * Prototype: fun [PInstance] Plug * * \param PInstance : the plugIT instance * * \return Plug : the instance plugIT structure **/ fun getInstancePlugin(inst) = inst.INST_plugin;; /*! @ingroup plugITApi * \brief Get a plugIT file name * * Prototype: fun [Plug] S * * \param Plug : the plugIT structure * * \return S : the file name **/ fun getPluginFile(p) = p.PLUG_sFile;; /*! @ingroup plugITApi * \brief Get a plugIT directory * * Prototype: fun [Plug] S * * \param Plug : the plugIT structure * * \return S : the directory **/ fun getPluginDirectory(p) = p.PLUG_sDir;; /*! @ingroup plugITApi * \brief Get a plugIT class * * Prototype: fun [Plug] S * * \param Plug : the plugIT structure * * \return S : the class **/ fun getPluginClass(p) = p.PLUG_sName;; /*! @ingroup plugITApi * \brief Get if a plugIT editor use helper * * Prototype: fun [Plug] S * * \param Plug : the plugIT structure * * \return I : 1 if the plugit use helpers **/ fun getPluginUseHelper(p) = p.PLUG_bUseHelpers;; /*! @ingroup plugITApi * \brief Get a plugIT general parameters * * Prototype: fun [Plug] [[S I] r1] * * \param Plug : the plugIT structure * * \return [[S I] r1] : the plugIT general parameters **/ fun getPluginParams(p) = p.PLUG_lParams;; /*! @ingroup plugITApi * \brief Get a plugIT type * * Prototype: fun [Plug] I * * \param Plug : the plugIT structure * * \return I : the plugIT type **/ fun getPluginType(p) = p.PLUG_iType;; /*! @ingroup plugITApi * \brief Set a plugIT type * * Prototype: fun [Plug I] I * * \param Plug : the plugIT structure * \param I : the new plugIT type * * \return I : the new type **/ fun setPluginType(p, x) = set p.PLUG_iType = x;; /*! @ingroup plugITApi * \brief Get a plugIT type name * * Prototype: fun [Plug] S * * \param Plug : the plugIT structure * * \return S : the plugIT type name **/ fun getPluginTypeName(p) = p.PLUG_sType;; /*! @ingroup plugITApi * \brief Set a plugIT type name * * Prototype: fun [Plug S] S * * \param Plug : the plugIT structure * \param S : the new plugIT type name * * \return S : the new type name **/ fun setPluginTypeName(p, x) = set p.PLUG_sType= x;; /*! @ingroup plugITApi * \brief Get a plugIT path * * Prototype: fun [Plug] S * * \param Plug : the plugIT structure * * \return S : the plugIT path **/ fun getPluginPath(p)= let getPathFile p.PLUG_sFile nil -> [path _ ] in path;; /*! @ingroup plugITApi * \brief Define a plugIT editor function, this must be called in the plugIT client or editor * * Prototype: fun [fun [EdWindow PInstance V3Dview EdControl] [fun [] [[S S] r1] fun [] I]] I * * \param PInstance : the plugIT instance * \param fun [EdWindow PInstance V3Dview] [fun [] [[S S] r1] fun [] I] : the callback function of the editor * \param - EdWindow : the editor window * \param - PInstance : the plugIT instance * \param - V3Dview : the 3d view structure * \param - return [fun [] [[S S] r1] fun [] I] : the editor close callback and the editor destroy callback * * \return 0 **/ fun setPluginEditor(edtfun)= let search_in_list lPlugins @plugbych _channel -> [_ plug] in if plug==nil then nil else ( set plug.PLUG_openEditor=edtfun; ); 0;; /*! @ingroup plugITApi * \brief Define plugIT editor functions for init and destroy instance, this must be called in the plugIT client * * Prototype: fun [fun [PInstance] I fun [PInstance] I fun [PInstance] I fun [PInstance] I] I * * \param PInstance : the plugIT instance * \param fun [PInstance] I : the init callback function of the editor * \param fun [PInstance] I : the destroy callback function of the editor * \param fun [PInstance] I : the start callback function of the editor / play mode * \param fun [PInstance] I : the stop callback function of the editor / stop mode * \param - PInstance : the plugIT instance * \param - return I : 0 * * \return 0 **/ fun setPluginEditorInstanceCb(initfun, dsfun, startfun, stopfun)= let search_in_list lPlugins @plugbych _channel -> [_ plug] in if plug==nil then nil else ( set plug.PLUG_initEditor=initfun; set plug.PLUG_dsEditor=dsfun; set plug.PLUG_cbStartInstance=startfun; set plug.PLUG_cbStopInstance=stopfun; ); 0;; fun reloadPluginsLoc()= let lPlugins -> lp in while (lp != nil) do ( let hd lp -> [_ plug] in let getlastPathDir plug.PLUG_sDir -> langbase in addloc strcatn plug.PLUG_sDir::"/lang/"::langbase::nil; set lp = tl lp; ); 0;; fun PlugDefine()= let search_in_list lPlugins @plugbych _channel -> [_ plug] in ( let getlastPathDir plug.PLUG_sDir -> langbase in addloc strcatn plug.PLUG_sDir::"/lang/"::langbase::nil; plug; );; /*! @ingroup plugITApi * \brief Define a plugIT new and close callback for instances * * Prototype: fun [fun [PInstance] I fun [PInstance] I]] I * * \param fun [PInstance] I : the callback function on new instance * \param fun [PInstance] I : the callback function on close instance * * \return 0 **/ fun PlugRegister(new, close)= let search_in_list lPlugins @plugbych _channel -> [_ plug] in if plug==nil then nil else ( set plug.PLUG_cbAddInstance=new; set plug.PLUG_cbDelInstance=close; ); 0;; fun PlugRegisterClients(new,close)= let search_in_list lPlugins @plugbych _channel -> [_ plug] in if plug==nil then nil else ( set plug.PLUG_cbNewUser=new; set plug.PLUG_cbDelUser=close; ); 0;; /*! @ingroup plugITApi * \brief Get a plugIT instance event name * * Prototype: fun [PInstance S] S * * \param PInstance : the plugIT instance * \param S : the event name * * \return S : the complete instance event name **/ fun getPluginInstanceEvent(inst, event)= strcatn inst.INST_sName::"."::event::nil;; fun startPluginInstances(plugstr)= if plugstr.PLUG_channel == nil then nil else let plugstr.PLUG_lInstances -> l in while (l != nil) do ( let hd l -> [_ inst] in ( if inst.INST_iLoadState then nil else ( execch plugstr.PLUG_channel plugstr.PLUG_cbStartInstance [inst]; execch plugstr.PLUG_channel plugstr.PLUG_cbAddInstance [inst]; set inst.INST_iLoadState = 1; ); ); set l = tl l; ); 0;; fun execAllPluginsLoaded(projstr)= let lInstCbAllPluginsLoaded -> linst in while (linst != nil) do ( let hd linst -> inst in if (((projstr != nil) && (inst.INST_groupstr.GRP_project != projstr)) || (inst.INST_cbAllPluginsLoaded == nil)) then nil else exec inst.INST_cbAllPluginsLoaded with [inst]; set linst = tl linst; ); 0;; fun startGroupPluginInstances(groupstr)= let groupstr.GRP_lInstance -> linst in while (linst != nil) do ( let hd linst -> inst in if (inst.INST_iLoadState) then nil else ( execch inst.INST_plugin.PLUG_channel inst.INST_plugin.PLUG_cbStartInstance [inst]; execch inst.INST_plugin.PLUG_channel inst.INST_plugin.PLUG_cbAddInstance [inst]; set inst.INST_iLoadState = 1; ); set linst = tl linst; ); 0;; fun startAllPluginInstances(projstr)= let lPlugins -> l in while l != nil do ( let hd l -> [_ plugstr] in startPluginInstances plugstr; set l = tl l; ); set projstr.PRJ_bPluginsLoaded = 1; execAllPluginsLoaded projstr; 0;; fun stopPluginInstances(plugstr, dellinks)= let plugstr.PLUG_lInstances -> l in while (l != nil) do ( let hd l -> [_ inst] in ( stopPluginInstance plugstr inst.INST_sName dellinks; set inst.INST_iLoadState = 0; ); set l = tl l; ); 0;; fun stopAllPluginInstances(projstr)= let lPlugins -> l in let 0 -> i in while (l != nil) do ( let hd l -> [_ plugstr] in stopPluginInstances plugstr 0; set l = tl l; ); set projstr.PRJ_bPluginsLoaded = 0; 0;; fun destroyPluginInstances(plugstr)= let plugstr.PLUG_lInstances -> l in while (l != nil) do ( let hd l -> tinst in let tinst -> [_ inst] in ( stopPluginInstance plugstr inst.INST_sName 1; execch plugstr.PLUG_channel plugstr.PLUG_dsEditor [inst]; set plugstr.PLUG_lInstances = remove_from_list plugstr.PLUG_lInstances tinst; ); set l = tl l; ); 0;; fun destroyAllPluginInstances()= let lPlugins -> l in while (l != nil) do ( let hd l -> [_ plugstr] in destroyPluginInstances plugstr; set l = tl l; ); 0;; fun unloadPlugin(plugstr)= destroyPluginInstances plugstr; _killchannel plugstr.PLUG_channel; set plugstr.PLUG_channel = nil; set plugstr.PLUG_openEditor = nil; set plugstr.PLUG_initEditor = nil; set plugstr.PLUG_dsEditor = nil; set lPlugins = remove_from_list lPlugins (getSwitchStr lPlugins plugstr.PLUG_sName); 0;; fun unloadPluginsRec(l)= if (l == nil) then nil else ( let hd l -> [_ pluginstr] in unloadPlugin pluginstr; unloadPluginsRec tl l; ); 0;; fun unloadPlugins()= resetInstCallBacks; let lPlugins -> l in unloadPluginsRec l; 0;; fun getPluginDescLoc(pluginmark)= let XMLgetMarkByValueFromMark pluginmark "DESCRIPTION" -> markstr in XMLgetParam markstr "loc";; fun locPluginDesc(plugstr)= let loc plugstr.PLUG_sDescLoc -> locref in if ((locref != nil) && (strcmp locref "*")) then locref else plugstr.PLUG_sDesc;; fun getPluginDesc(pluginmark)= let XMLgetMarkByValueFromMark pluginmark "DESCRIPTION" -> markstr in let XMLgetParam markstr "loc" -> markloc in let loc markloc -> locref in if ((markloc != nil) && (locref != nil) && (strcmp locref "*")) then locref else utf8tostr XMLgetData markstr;; fun getPluginHelp(pluginmark)= let XMLgetMarkByValueFromMark pluginmark "HELP" -> markstr in let XMLgetParam markstr "loc" -> markloc in let loc markloc -> locref in if ((markloc != nil) && (locref != nil) && (strcmp locref "*")) then locref else utf8tostr XMLgetData markstr;; fun getPluginKeywords(pluginmark)= let XMLgetMarkByValueFromMark pluginmark "KEYWORDS" -> markstr in let XMLgetParam markstr "loc" -> markloc in let loc markloc -> locref in if ((markloc != nil) && (locref != nil) && (strcmp locref "*")) then locref else utf8tostr XMLgetData markstr;; fun getUserLevelFromName(name)= if (!strcmpi name "advanced") then 1 else if (!strcmpi name "expert") then 2 else 0 // basic ;; fun getUserLevelName(id)= if (id == 1) then "advanced" else if (id == 2) then "expert" else "basic" ;; fun loadPlugin(file)= if (_checkpack file) == nil then nil else ( let getPathFile file "" -> [dir _] in let XMLload file -> xmlpluginstr in let XMLgetMarkByValue xmlpluginstr "PLUGIN" -> pluginmark in let XMLgetParam pluginmark "name" -> plugname in let XMLgetParam pluginmark "type" -> plugtype in let XMLgetBoolParam pluginmark "deprecated" -> deprecated in let XMLgetParam pluginmark "alternative" -> alternative in let XMLgetMarkByValueFromMark pluginmark "EDITOR" -> editormark in let XMLgetBoolParam editormark "useHelper" -> usehelper in let XMLgetParam editormark "userLevel" -> userlevel in let XMLgetParam editormark "colorOn" -> colorOn in let XMLgetParam editormark "colorOff" -> colorOff in let XMLgetMarksByValueFromMark editormark "SCRIPT" -> lescriptmarks in let XMLgetMarkByValueFromMark pluginmark "CLIENT" -> clientmark in let XMLgetMarksByValueFromMark clientmark "SCRIPT" -> lcscriptmarks in let XMLgetMarksByValueFromMarkSons clientmark "ACTION" -> actionmarks in let XMLgetMarksByValueFromMarkSons clientmark "EVENT" -> eventmarks in let XMLgetMarksByValueFromMarkSons clientmark "DEFACTION" -> actiondefmarks in let XMLgetMarksByValueFromMarkSons clientmark "DEFEVENT" -> eventdefmarks in let XMLgetMarksByValueFromMarkSons editormark "PARAM" -> lplugparams in let getPluginByFile file -> plugexist in if pluginmark == nil || plugexist != nil then nil else let mkPlug[nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil 0 0 0 0 deprecated alternative] -> newplug in ( exec cbPluginLoadInfo with [plugname]; set newplug.PLUG_sDir = getDirectoryWithoutLastSlash dir; set newplug.PLUG_sName = plugname; set newplug.PLUG_sFile = file; set newplug.PLUG_sType = plugtype; set newplug.PLUG_bUseHelpers = usehelper; set newplug.PLUG_iUserLevel = getUserLevelFromName userlevel; if ((colorOn == nil) && (colorOff == nil)) then nil else set newplug.PLUG_tColors = [(htoi colorOn) (htoi colorOff)]; let nil -> lpparam in ( while (lplugparams != nil) do ( let hd lplugparams -> ppmark in let XMLgetParam ppmark "name" -> ppname in let XMLgetParam ppmark "type" -> pptype in set lpparam = [ppname (getOS3DResourceTypeByName pptype)]::lpparam; set lplugparams = tl lplugparams; ); set newplug.PLUG_lParams = revertlist lpparam; ); // add instance actions while (actionmarks != nil) do ( let hd actionmarks -> actionmark in let XMLgetParam actionmark "name" -> actname in set newplug.PLUG_lAction = actname::newplug.PLUG_lAction; set actionmarks = tl actionmarks; ); // add instance events while (eventmarks != nil) do ( let hd eventmarks -> eventmark in let XMLgetParam eventmark "name" -> evtname in set newplug.PLUG_lEvent = evtname::newplug.PLUG_lEvent; set eventmarks = tl eventmarks; ); // add instance def actions while (actiondefmarks != nil) do ( let hd actiondefmarks -> actiondefmark in let XMLgetParam actiondefmark "name" -> actname in set newplug.PLUG_lDefAction = actname::newplug.PLUG_lDefAction; set actiondefmarks = tl actiondefmarks; ); // add instance def events while (eventdefmarks != nil) do ( let hd eventdefmarks -> eventdefmark in let XMLgetParam eventdefmark "name" -> evtname in set newplug.PLUG_lDefEvent = evtname::newplug.PLUG_lDefEvent; set eventdefmarks = tl eventdefmarks; ); let _openchannel nil nil _envchannel mainChn -> ch in set newplug.PLUG_channel = ch; if newplug.PLUG_channel == nil then nil else ( execch newplug.PLUG_channel @_load [strcat APPBASEDIR preplugPkg]; // navigation plugits should start at the end if !strcmpi plugtype "navigation" then set lPlugins = lcat lPlugins [plugname newplug]::nil else set lPlugins = [plugname newplug]::lPlugins; _scriptc newplug.PLUG_channel "reg"; // Only in editor if !iPluginMode then nil else while (lescriptmarks != nil) do ( let hd lescriptmarks -> escriptmark in let getRelativePath newplug.PLUG_sDir (XMLgetParam escriptmark "path") -> nfile in let (execch newplug.PLUG_channel @_testpak [nfile]) -> rettest in if rettest == nil then ( execch newplug.PLUG_channel @_load [nfile]; 0; ) else ( addLogMessage strcatn "Error : PlugIT "::plugname::" in file :"::nfile::"\n"::rettest::nil; exec cbPluginLoadInfo with [strcat "Error in " plugname]; set newplug.PLUG_bHasError = 1; //_DLGMessageBox _channel nil strcat "Error in " nfile rettest 0; //unloadPlugin newplug; //set newplug = nil; 0; ); set lescriptmarks = tl lescriptmarks; ); if newplug == nil then nil else while (lcscriptmarks != nil) do ( let hd lcscriptmarks -> cscriptmark in let getRelativePath newplug.PLUG_sDir (XMLgetParam cscriptmark "path") -> nfile in let (execch newplug.PLUG_channel @_testpak [nfile]) -> rettest in if rettest == nil then ( execch newplug.PLUG_channel @_load [nfile]; 0; ) else ( addLogMessage strcatn "Error : PlugIT "::plugname::" in file :"::nfile::"\n"::rettest::nil; //_DLGMessageBox _channel nil strcat "Error in " nfile rettest 0; exec cbPluginLoadInfo with [strcat "Error in " plugname]; set newplug.PLUG_bHasError = 1; //unloadPlugin newplug; //set newplug = nil; 0; ); set lcscriptmarks = tl lcscriptmarks; ); if newplug == nil then nil else _scriptc newplug.PLUG_channel mkscript SIniPlug [file]; ); // dot it when loaded for loc files let getPluginDesc pluginmark -> plugdesc in let getPluginDescLoc pluginmark -> plugdescloc in let getPluginHelp pluginmark -> help in let getPluginKeywords pluginmark -> keywords in ( set newplug.PLUG_sDesc = plugdesc; set newplug.PLUG_sDescLoc = plugdescloc; set newplug.PLUG_sHelp = help; set newplug.PLUG_sKeywords = keywords; ); XMLclose xmlpluginstr; newplug; ); );; fun loadPluginsRec(l)= if (l == nil) then nil else ( let hd l -> [_ pluginstr] in loadPlugin pluginstr.PLUG_sFile; loadPluginsRec tl l; ); 0;; fun loadPluginsFromDirRec(srcdir, ldir)= if (ldir == nil) then nil else ( let hd ldir -> dir in let getlastPathDir dir -> name in let strcatn dir::"/"::name::".xml"::nil -> file in if (_checkpack file) != nil then ( loadPlugin file; 0; ) else ( let _listofsubdir dir -> ldir in loadPluginsFromDirRec dir ldir; 0; ); loadPluginsFromDirRec srcdir tl ldir; 0; );; fun loadPluginsFromDir(srcdir)= // only for editor let _listofsubdir srcdir -> ldir in loadPluginsFromDirRec srcdir ldir; 0;; fun cbLoadPluginsAsync(trm, p)= let p -> [lplugs cbfun] in if (lplugs == nil) then ( _deltimer trm; exec cbfun with []; 0; ) else ( let lplugs -> [plugfile next] in ( _fooS strcat ">>> loading: " plugfile; loadPlugin plugfile; mutate p <- [next _]; ); 0; ); 0;; fun listPluginsFromDir(ldir, l)= if (ldir == nil) then l else let ldir -> [dir next] in ( let getlastPathDir dir -> name in let strcatn dir::"/"::name::".xml"::nil -> file in if (_checkpack file) != nil then ( set l = listPluginsFromDir next file::l; ) else ( let _listofsubdir dir -> nldir in set l = listPluginsFromDir nldir l; set l = listPluginsFromDir next l; ); );; fun loadPluginsFromDirAsync(srcdir, cbfun)= // only for editor let _listofsubdir srcdir -> ldir in let revertlist (listPluginsFromDir ldir nil) -> lplugs in _rfltimer _starttimer _channel 16 @cbLoadPluginsAsync [lplugs cbfun]; 0;; fun reloadPluginsFromDir(srcdir)= unloadPlugins; loadPluginsFromDir srcdir; 0;; fun getPluginPathByName(name)= let _listofsubdir sPLUGINSPATH -> ldir in let listPluginsFromDir ldir nil -> lplugs in let nil -> found in ( while ((lplugs != nil) && (found == nil)) do ( let hd lplugs -> file in if (_checkpack file) == nil then nil else ( let XMLload file -> xmlpluginstr in let XMLgetMarkByValue xmlpluginstr "PLUGIN" -> pluginmark in let XMLgetParam pluginmark "name" -> plugname in if (strcmp plugname name) then nil else set found = file; ); set lplugs = tl lplugs; ); found; );; fun loadPlugins(pluginpath)= createRootDMI "root"; // Only for editor if !iPluginMode then nil else loadPluginsFromDir pluginpath; 0;; fun loadPluginsAsync(pluginpath, cbfun)= createRootDMI "root"; // Only for editor if !iPluginMode then nil else loadPluginsFromDirAsync pluginpath cbfun; 0;; fun getPluginAndLoad(file)= let getPluginByFile file -> plugstr in if plugstr == nil then loadPlugin file else plugstr;; fun loadPluginInstance(groupstr, instancemark, start)= if instancemark == nil then nil else let XMLgetParam groupstr.GRP_xmlMark "id" -> groupid in let XMLgetParam groupstr.GRP_xmlMark "name" -> groupname in let if (groupname == nil) || (groupid == nil) then if (groupstr.GRP_project.PRJ_bMode < 2) then "Scene" else strcat (strreplace groupstr.GRP_project.PRJ_sName " " "_") ".Scene" else if (groupstr.GRP_project.PRJ_bMode < 2) then strcatn groupid::"."::groupname::nil else strcatn (strreplace groupstr.GRP_project.PRJ_sName " " "_")::"."::groupid::"."::groupname::nil -> groupname in let strcatn groupname::"."::(XMLgetParam instancemark "name")::nil -> instname in let XMLgetParam instancemark.XMLfather "name" -> plugname in let getPluginByName plugname -> plugstr in //manage deprecated and alternative plugin let if plugstr.PLUG_bIsDeprecated && (plugstr.PLUG_sAlternative != nil) && (strcmp plugstr.PLUG_sAlternative "") then 1 else 0 -> replace in let if replace then getPluginByName plugstr.PLUG_sAlternative else plugstr -> plugstr in let if (XMLgetParam instancemark "showHelper") == nil then plugstr.PLUG_bUseHelpers else XMLgetBoolParam instancemark "showHelper" -> showhelper in let if (XMLgetParam instancemark "showInGroup") == nil then 1 else XMLgetBoolParam instancemark "showInGroup" -> showingroup in let nil -> lparams in let nil -> laction in let nil -> levent in if plugstr == nil then ( addLogMessage strcat "Error: PlugIT not found > " plugname; 0; ) else ( //manage deprecated and alternative plugin if (!replace) then nil else ( XMLsetParam instancemark.XMLfather "name" plugstr.PLUG_sName; let strlen sPLUGINSPATH -> subpath in let substr plugstr.PLUG_sFile subpath + 1 (strlen plugstr.PLUG_sFile) - subpath -> nsource in XMLsetParam instancemark.XMLfather "source" nsource; ); let XMLgetMarksByValueFromMark instancemark "PARAM" -> lparammarks in while (lparammarks != nil) do ( let hd lparammarks -> parammark in let XMLgetParam parammark "name" -> paramname in let XMLgetData parammark -> value in let getPluginParam plugstr paramname -> paramtype in let if (groupstr.GRP_project.PRJ_bMode < 2) then value else if ((value != nil) && (strcmp value "") && (paramtype == iTypeScene || paramtype == iTypeNode || paramtype == iTypeLight || paramtype == iTypeCamera || paramtype == iTypeEntity || paramtype == iTypeAnim || paramtype == iTypeBone || paramtype == iTypeParticle || paramtype == iTypeCubeMap || paramtype == iTypeReflectionMap || paramtype == iTypeGroup) && (strcmpi value "Current camera") && (strcmpi value "Current camera shell")) then strcatn (strreplace groupstr.GRP_project.PRJ_sName " " "_")::"."::value::nil else value -> value in set lparams = [paramname value]::lparams; set lparammarks = tl lparammarks; ); set lparams = revertlist lparams; let XMLgetMarksByValueFromMark instancemark "ACTION" -> lactionmarks in let XMLgetMarksByValueFromMark instancemark "EVENT" -> leventmarks in if ((lactionmarks != nil) || (leventmarks != nil)) then ( while (lactionmarks != nil) do ( let hd lactionmarks -> actionmark in let XMLgetParam actionmark "name" -> actionname in set laction = actionname::laction; set lactionmarks = tl lactionmarks; ); set laction = revertlist laction; while (leventmarks != nil) do ( let hd leventmarks -> eventmark in let XMLgetParam eventmark "name" -> eventname in set levent = eventname::levent; set leventmarks = tl leventmarks; ); set levent = revertlist levent; 0; ) else ( set laction = plugstr.PLUG_lDefAction; let sizelist laction -> asize in let 0 -> iact in while (iact < asize) do ( let nth_list laction iact -> elem in XMLaddMark groupstr.GRP_project.PRJ_xmlFile "ACTION" instancemark ["name" elem]::nil nil; set iact = iact + 1; ); set levent = plugstr.PLUG_lDefEvent; let sizelist levent -> esize in let 0 -> ievt in while (ievt < esize) do ( let nth_list levent ievt -> elem in XMLaddMark groupstr.GRP_project.PRJ_xmlFile "EVENT" instancemark ["name" elem]::nil nil; set ievt = ievt + 1; ); 0; ); let XMLgetMarksByValueFromMark instancemark "LINK" -> llinkmarks in while (llinkmarks != nil) do ( let hd llinkmarks -> linkmark in let XMLgetParam linkmark "event" -> event in let XMLgetParam linkmark "group" -> destgroup in let if (groupstr.GRP_project.PRJ_bMode < 2) then destgroup else strcatn (strreplace groupstr.GRP_project.PRJ_sName " " "_")::"."::destgroup::nil -> destgroup in let strcatn destgroup::"."::(XMLgetParam linkmark "instance")::nil -> destinst in let XMLgetParam linkmark "action" -> action in let XMLgetData linkmark -> value in let if (!strcmpi value "") || value == nil then "_" else value -> value in setModLink (createDMI instname) (createDMI destinst) nil strbuild ((strcatn instname::"."::event::nil)::(strcatn destinst::"."::action::nil)::value::"_"::"_"::nil)::nil; set llinkmarks = tl llinkmarks; ); createPluginInstance groupstr plugstr instname lparams laction levent showhelper showingroup start; 0; ); 0;; fun cleanUpOrphanLinksFromPlugins(xmlfile, groupmark)= let XMLgetParam groupmark "id" -> groupid in let XMLgetParam groupmark "name" -> groupname in let if (groupname == nil) || (groupid == nil) then "Scene" else strcatn groupid::"."::groupname::nil -> groupname in let XMLgetMarkByValueFromMarkSons groupmark "PLUGINS" -> pluginsmark in if pluginsmark == nil then nil else ( let XMLgetMarksByValueFromMarkSons pluginsmark "PLUGIN" -> lpluginmarks in while (lpluginmarks != nil) do ( let hd lpluginmarks -> pluginmark in let XMLgetParam pluginmark "name" -> plugname in let XMLgetParam pluginmark "source" -> plugfile in let getPluginByFile strcatn sPLUGINSPATH::"/"::plugfile::nil -> plugstr in if plugstr == nil then nil else ( let XMLgetMarksByValueFromMark pluginmark "INSTANCE" -> linstancemarks in while (linstancemarks != nil) do ( let hd linstancemarks -> instancemark in let strcatn groupname::"."::(XMLgetParam instancemark "name")::nil -> instname in ( let XMLgetMarksByValueFromMark instancemark "LINK" -> llinkmarks in while (llinkmarks != nil) do ( let hd llinkmarks -> linkmark in let XMLgetParam linkmark "event" -> event in let XMLgetParam linkmark "group" -> destgroup in let strcatn destgroup::"."::(XMLgetParam linkmark "instance")::nil -> destinst in let XMLgetParam linkmark "action" -> action in let XMLgetData linkmark -> value in ( let getInstanceByName destinst -> dinst in if (dinst != nil) then nil else ( addLogMessage strcatn "[Warning] Link not found and removed "::(strcatn instname::"."::event::nil)::" to "::(strcatn destgroup::"."::destinst::"."::action::nil)::nil; XMLdelMark xmlfile linkmark; delModLink (getDMI instname) strbuild ((strcatn instname::"."::event::nil)::(strcatn destgroup::"."::destinst::"."::action::nil)::value::"_"::"_"::nil)::nil; removeDmiById destinst; ); ); set llinkmarks = tl llinkmarks; ); ); set linstancemarks = tl linstancemarks; ); ); set lpluginmarks = tl lpluginmarks; ); ); 0;; fun loadPluginInstances(groupstr, start)= let XMLgetParam groupstr.GRP_xmlMark "id" -> groupid in let XMLgetParam groupstr.GRP_xmlMark "name" -> groupname in let if (groupname == nil) || (groupid == nil) then if (groupstr.GRP_project.PRJ_bMode < 2) then "Scene" else strcat (strreplace groupstr.GRP_project.PRJ_sName " " "_") ".Scene" else if (groupstr.GRP_project.PRJ_bMode < 2) then strcatn groupid::"."::groupname::nil else strcatn (strreplace groupstr.GRP_project.PRJ_sName " " "_")::"."::groupid::"."::groupname::nil -> groupname in let XMLgetMarkByValueFromMarkSons groupstr.GRP_xmlMark "PLUGINS" -> pluginsmark in if pluginsmark == nil then nil else ( let XMLgetMarksByValueFromMarkSons pluginsmark "PLUGIN" -> lpluginmarks in while (lpluginmarks != nil) do ( let hd lpluginmarks -> pluginmark in let XMLgetParam pluginmark "name" -> plugname in let XMLgetParam pluginmark "source" -> plugfile in let getPluginAndLoad strcatn sPLUGINSPATH::"/"::plugfile::nil -> plugstr in let if plugstr.PLUG_bIsDeprecated && (plugstr.PLUG_sAlternative != nil) && (strcmp plugstr.PLUG_sAlternative "") then 1 else 0 -> replace in //manage deprecated and alternative plugin let if replace then getPluginAndLoad (getPluginPathByName plugstr.PLUG_sAlternative) else plugstr -> plugstr in if plugstr == nil then ( addLogMessage strcat "Error: PlugIT not found > " plugname; 0; ) else ( //manage deprecated and alternative plugin if (!replace) then nil else ( XMLsetParam pluginmark "name" plugstr.PLUG_sName; let strlen sPLUGINSPATH -> subpath in let substr plugstr.PLUG_sFile subpath + 1 (strlen plugstr.PLUG_sFile) - subpath -> nsource in XMLsetParam pluginmark "source" nsource; ); let XMLgetMarksByValueFromMark pluginmark "INSTANCE" -> linstancemarks in while (linstancemarks != nil) do ( let hd linstancemarks -> instancemark in let strcatn groupname::"."::(XMLgetParam instancemark "name")::nil -> instname in let if (XMLgetParam instancemark "showHelper") == nil then plugstr.PLUG_bUseHelpers else XMLgetBoolParam instancemark "showHelper" -> showhelper in let if (XMLgetParam instancemark "showInGroup") == nil then 1 else XMLgetBoolParam instancemark "showInGroup" -> showingroup in let nil -> lparams in let nil -> laction in let nil -> levent in ( let XMLgetMarksByValueFromMark instancemark "PARAM" -> lparammarks in while (lparammarks != nil) do ( let hd lparammarks -> parammark in let XMLgetParam parammark "name" -> paramname in let XMLgetData parammark -> value in let getPluginParam plugstr paramname -> paramtype in let if (groupstr.GRP_project.PRJ_bMode < 2) then value else if ((value != nil) && (strcmp value "") && (paramtype == iTypeScene || paramtype == iTypeNode || paramtype == iTypeLight || paramtype == iTypeCamera || paramtype == iTypeEntity || paramtype == iTypeAnim || paramtype == iTypeBone || paramtype == iTypeParticle || paramtype == iTypeCubeMap || paramtype == iTypeReflectionMap || paramtype == iTypeGroup) && (strcmpi value "Current camera") && (strcmpi value "Current camera shell")) then strcatn (strreplace groupstr.GRP_project.PRJ_sName " " "_")::"."::value::nil else value -> value in set lparams = [paramname value]::lparams; set lparammarks = tl lparammarks; ); set lparams = revertlist lparams; let XMLgetMarksByValueFromMark instancemark "ACTION" -> lactionmarks in let XMLgetMarksByValueFromMark instancemark "EVENT" -> leventmarks in if ((lactionmarks != nil) || (leventmarks != nil)) then ( while (lactionmarks != nil) do ( let hd lactionmarks -> actionmark in let XMLgetParam actionmark "name" -> actionname in set laction = actionname::laction; set lactionmarks = tl lactionmarks; ); set laction = revertlist laction; while (leventmarks != nil) do ( let hd leventmarks -> eventmark in let XMLgetParam eventmark "name" -> eventname in set levent = eventname::levent; set leventmarks = tl leventmarks; ); set levent = revertlist levent; 0; ) else ( set laction = plugstr.PLUG_lDefAction; let sizelist laction -> asize in let 0 -> iact in while (iact < asize) do ( let nth_list laction iact -> elem in XMLaddMark groupstr.GRP_project.PRJ_xmlFile "ACTION" instancemark ["name" elem]::nil nil; set iact = iact + 1; ); set levent = plugstr.PLUG_lDefEvent; let sizelist levent -> esize in let 0 -> ievt in while (ievt < esize) do ( let nth_list levent ievt -> elem in XMLaddMark groupstr.GRP_project.PRJ_xmlFile "EVENT" instancemark ["name" elem]::nil nil; set ievt = ievt + 1; ); 0; ); let XMLgetMarksByValueFromMark instancemark "LINK" -> llinkmarks in while (llinkmarks != nil) do ( let hd llinkmarks -> linkmark in let XMLgetParam linkmark "event" -> event in let XMLgetParam linkmark "group" -> destgroup in let if (groupstr.GRP_project.PRJ_bMode < 2) then destgroup else strcatn (strreplace groupstr.GRP_project.PRJ_sName " " "_")::"."::destgroup::nil -> destgroup in let strcatn destgroup::"."::(XMLgetParam linkmark "instance")::nil -> destinst in let XMLgetParam linkmark "action" -> action in let XMLgetData linkmark -> value in let if (!strcmpi value "") || value == nil then "_" else value -> value in setModLink (createDMI instname) (createDMI destinst) nil strbuild ((strcatn instname::"."::event::nil)::(strcatn destinst::"."::action::nil)::value::"_"::"_"::nil)::nil; set llinkmarks = tl llinkmarks; ); createPluginInstance groupstr plugstr instname lparams laction levent showhelper showingroup start; ); set linstancemarks = tl linstancemarks; ); 0; ); set lpluginmarks = tl lpluginmarks; ); ); 0;; fun cbPluginAction(from, action, param, ulist, tag, z)= let z->[inst f] in exec f with [inst from action param tag] ;; fun cbEventOnLoad(trm, p)= let p -> [inst event param reply] in if inst.INST_groupstr.GRP_project.PRJ_bPluginsLoaded then ( _deltimer trm; _DMSevent inst.INST_DMI (getPluginInstanceEvent inst event) param reply; 0; ) else nil; 0;; /*! @ingroup plugITApi * \brief Send an event to another plugITs * * Prototype: fun [PInstance S S S] I * * \param PInstance : the plugIT instance * \param S : event name * \param S : event param * \param S : event reply param * * \return 0 **/ fun SendPluginEvent(inst, event, param, reply)= if inst.INST_groupstr.GRP_project.PRJ_bPluginsLoaded then ( _DMSevent inst.INST_DMI (getPluginInstanceEvent inst event) param reply; 0; ) else ( _rfltimer _starttimer _channel 100 @cbEventOnLoad [inst event param reply]; 0; ); 0;; fun IsEventLinked(inst, event)= _DMShasEvent inst.INST_DMI (getPluginInstanceEvent inst event);; fun IsInEditor(inst)= (inst.INST_groupstr.GRP_project.PRJ_bMode == 1);; /*! @ingroup plugITApi * \brief Define the instance callback on an action call * * Prototype: fun [PInstance S fun [PInstance DMI S S S] u0] I * * \param PInstance : the plugIT instance * \param S : the action name * \param fun [PInstance DMI S S S] u0 : the callback function * \param - PInstance : the plugIT instance * \param - DMI : the sender module (ignore this for OS3D) * \param - S : action name * \param - S : param * \param - S : reply param * * \return 0 **/ fun PluginRegisterAction(inst, action, f)= _DMSdefineAction inst.INST_DMI (strcatn inst.INST_sName::"."::action::nil) (mkfun6 @cbPluginAction [inst f]); 0;; /*! @ingroup plugITApi * \brief Remove the instance callback on an action call * * Prototype: fun [PInstance S] I * * \param PInstance : the plugIT instance * \param S : the action name * * \return 0 **/ fun PluginUnRegisterAction(inst, action)= _DMSdefineAction inst.INST_DMI (strcatn inst.INST_sName::"."::action::nil) nil; 0;; /****************************/ /* Plugin resource selector */ /****************************/ //used for mouse selection in 3D view typeof currentPluginResourceTree = EdControl;; typeof currentPluginResourceMask = I;; typeof currentPluginResourceBtn = EdControl;; fun getGraphName(markstr)= let XMLgetParam markstr "id" -> id in let XMLgetParam markstr "name" -> name in let XMLgetParam markstr "alias" -> alias in [(if (alias == nil) || (!strcmp alias "") then (strcatn name::" #"::id::nil) else (strcatn alias::" ("::name::" #"::id::")"::nil)) (strcatn id::"."::name::nil)];; fun cbSortNodes(m1, m2)= let getGraphName m1 -> [n1 _] in let getGraphName m2 -> [n2 _] in (strcmp n1 n2) < 0;; fun getTreeItemBitmapByType(name, type)= if (type == iTypeNode) then sTreeBitmapNode else if (type == iTypeGroup) then sTreeBitmapGroup else if (type == iTypeEntity) then sTreeBitmapEntity else if (type == iTypeBone) then sTreeBitmapBone else if (type == iTypeLight) then sTreeBitmapLight else if (type == iTypeCamera) then sTreeBitmapCamera else if (type == iTypeParticle) then sTreeBitmapParticle else if (type == iTypeCubeMap) then sTreeBitmapCubeMap else if (type == iTypeReflectionMap) then sTreeBitmapReflectionMap else if (type == iTypeAnim) then sTreeBitmapAnim else if (type == iTypeCinematics) then sTreeBitmapAnim else if (type == iTypeCompositor) then sTreeBitmapCompositor else sTreeBitmapNode ;; fun fillGroupTreeGraph(ctrltree, mask, groupstr, nodemark, treefather, mode, getbitmap)= if !mode then ( // SHELL let XMLgetMarksByValueFromMarkSons nodemark "shell" -> lnodexml in while (lnodexml != nil) do ( let hd lnodexml -> nodexml in let getGraphName nodexml -> [dname xname] in let addEdCtrlTreeItem ctrltree treefather dname xname iTypeNode (exec getbitmap with [xname iTypeNode]) -> treenode in fillGroupTreeGraph ctrltree mask groupstr nodexml treenode mode getbitmap; set lnodexml = tl lnodexml; ); // ENTITY let XMLgetMarksByValueFromMarkSons nodemark "mesh" -> lnodexml in while (lnodexml != nil) do ( let hd lnodexml -> nodexml in let getGraphName nodexml -> [dname xname] in let addEdCtrlTreeItem ctrltree treefather dname xname iTypeEntity (exec getbitmap with [xname iTypeEntity]) -> treenode in fillGroupTreeGraph ctrltree mask groupstr nodexml treenode mode getbitmap; set lnodexml = tl lnodexml; ); // BONE let XMLgetMarksByValueFromMarkSons nodemark "bone" -> lnodexml in while (lnodexml != nil) do ( let hd lnodexml -> nodexml in let getGraphName nodexml -> [dname xname] in let addEdCtrlTreeItem ctrltree treefather dname xname iTypeBone (exec getbitmap with [xname iTypeBone]) -> treenode in fillGroupTreeGraph ctrltree mask groupstr nodexml treenode mode getbitmap; set lnodexml = tl lnodexml; ); // LIGHT let XMLgetMarksByValueFromMarkSons nodemark "light" -> lnodexml in while (lnodexml != nil) do ( let hd lnodexml -> nodexml in let getGraphName nodexml -> [dname xname] in let addEdCtrlTreeItem ctrltree treefather dname xname iTypeLight (exec getbitmap with [xname iTypeLight]) -> treenode in fillGroupTreeGraph ctrltree mask groupstr nodexml treenode mode getbitmap; set lnodexml = tl lnodexml; ); // CAMERA let XMLgetMarksByValueFromMarkSons nodemark "camera" -> lnodexml in while (lnodexml != nil) do ( let hd lnodexml -> nodexml in let getGraphName nodexml -> [dname xname] in let addEdCtrlTreeItem ctrltree treefather dname xname iTypeCamera (exec getbitmap with [xname iTypeCamera]) -> treenode in fillGroupTreeGraph ctrltree mask groupstr nodexml treenode mode getbitmap; set lnodexml = tl lnodexml; ); // PARTICLE let XMLgetMarksByValueFromMarkSons nodemark "particle" -> lnodexml in while (lnodexml != nil) do ( let hd lnodexml -> nodexml in let getGraphName nodexml -> [dname xname] in let addEdCtrlTreeItem ctrltree treefather dname xname iTypeParticle (exec getbitmap with [xname iTypeParticle]) -> treenode in fillGroupTreeGraph ctrltree mask groupstr nodexml treenode mode getbitmap; set lnodexml = tl lnodexml; ); // CUBEMAP let XMLgetMarksByValueFromMarkSons nodemark "cubemap" -> lnodexml in while (lnodexml != nil) do ( let hd lnodexml -> nodexml in let getGraphName nodexml -> [dname xname] in let addEdCtrlTreeItem ctrltree treefather dname xname iTypeCubeMap (exec getbitmap with [xname iTypeCubeMap]) -> treenode in fillGroupTreeGraph ctrltree mask groupstr nodexml treenode mode getbitmap; set lnodexml = tl lnodexml; ); // REFLECTIONMAP let XMLgetMarksByValueFromMarkSons nodemark "reflectionmap" -> lnodexml in while (lnodexml != nil) do ( let hd lnodexml -> nodexml in let getGraphName nodexml -> [dname xname] in let addEdCtrlTreeItem ctrltree treefather dname xname iTypeReflectionMap (exec getbitmap with [xname iTypeReflectionMap]) -> treenode in fillGroupTreeGraph ctrltree mask groupstr nodexml treenode mode getbitmap; set lnodexml = tl lnodexml; ); // ANIMS if mask & iTypeAnim then let XMLgetMarkByValueFromMarkSons nodemark "animations" -> animsmark in let if animsmark == nil then nodemark else animsmark -> animsmark in let XMLgetMarksByValueFromMarkSons animsmark "animation" -> lanimmarks in let XMLlSortList lanimmarks @cbSortNodes -> lanimmarks in while (lanimmarks != nil) do ( let hd lanimmarks -> animmark in let getGraphName animmark -> [dname xname] in addEdCtrlTreeItem ctrltree treefather dname xname iTypeAnim (exec getbitmap with [xname iTypeAnim]); set lanimmarks = tl lanimmarks; ) else nil; ) else ( // SHELL if (mask & iTypeNode) then let XMLgetMarksByValueFromMark nodemark "shell" -> lnodexml in while (lnodexml != nil) do ( let hd lnodexml -> nodexml in let getGraphName nodexml -> [dname xname] in addEdCtrlTreeItem ctrltree treefather dname xname iTypeNode (exec getbitmap with [xname iTypeNode]); set lnodexml = tl lnodexml; ) else nil; // ENTITY if (mask & iTypeEntity) then let XMLgetMarksByValueFromMark nodemark "mesh" -> lnodexml in while (lnodexml != nil) do ( let hd lnodexml -> nodexml in let getGraphName nodexml -> [dname xname] in addEdCtrlTreeItem ctrltree treefather dname xname iTypeEntity (exec getbitmap with [xname iTypeEntity]); set lnodexml = tl lnodexml; ) else nil; // BONE if (mask & iTypeBone) then let XMLgetMarksByValueFromMark nodemark "bone" -> lnodexml in while (lnodexml != nil) do ( let hd lnodexml -> nodexml in let getGraphName nodexml -> [dname xname] in addEdCtrlTreeItem ctrltree treefather dname xname iTypeBone (exec getbitmap with [xname iTypeBone]); set lnodexml = tl lnodexml; ) else nil; // LIGHT if (mask & iTypeLight) then let XMLgetMarksByValueFromMark nodemark "light" -> lnodexml in while (lnodexml != nil) do ( let hd lnodexml -> nodexml in let getGraphName nodexml -> [dname xname] in addEdCtrlTreeItem ctrltree treefather dname xname iTypeLight (exec getbitmap with [xname iTypeLight]); set lnodexml = tl lnodexml; ) else nil; // CAMERA if (mask & iTypeCamera) then let XMLgetMarksByValueFromMark nodemark "camera" -> lnodexml in while (lnodexml != nil) do ( let hd lnodexml -> nodexml in let getGraphName nodexml -> [dname xname] in addEdCtrlTreeItem ctrltree treefather dname xname iTypeCamera (exec getbitmap with [xname iTypeCamera]); set lnodexml = tl lnodexml; ) else nil; // PARTICLE if (mask & iTypeParticle) then let XMLgetMarksByValueFromMark nodemark "particle" -> lnodexml in while (lnodexml != nil) do ( let hd lnodexml -> nodexml in let getGraphName nodexml -> [dname xname] in addEdCtrlTreeItem ctrltree treefather dname xname iTypeParticle (exec getbitmap with [xname iTypeParticle]); set lnodexml = tl lnodexml; ) else nil; // CUBEMAP if (mask & iTypeCubeMap) then let XMLgetMarksByValueFromMark nodemark "cubemap" -> lnodexml in while (lnodexml != nil) do ( let hd lnodexml -> nodexml in let getGraphName nodexml -> [dname xname] in addEdCtrlTreeItem ctrltree treefather dname xname iTypeCubeMap (exec getbitmap with [xname iTypeCubeMap]); set lnodexml = tl lnodexml; ) else nil; // REFLECTIONMAP if (mask & iTypeReflectionMap) then let XMLgetMarksByValueFromMark nodemark "reflectionmap" -> lnodexml in while (lnodexml != nil) do ( let hd lnodexml -> nodexml in let getGraphName nodexml -> [dname xname] in addEdCtrlTreeItem ctrltree treefather dname xname iTypeReflectionMap (exec getbitmap with [xname iTypeReflectionMap]); set lnodexml = tl lnodexml; ) else nil; // ANIMS if (mask & iTypeAnim) then let XMLgetMarksByValueFromMark nodemark "animation" -> lanimmarks in let XMLlSortList lanimmarks @cbSortNodes -> lanimmarks in while (lanimmarks != nil) do ( let hd lanimmarks -> animmark in let getGraphName animmark -> [dname xname] in let getEdCtrlTreeItemByValue ctrltree xname -> exist in if exist != nil then nil else addEdCtrlTreeItem ctrltree treefather dname xname iTypeAnim (exec getbitmap with [xname iTypeAnim]); set lanimmarks = tl lanimmarks; ) else nil; ); 0;; fun fillSonsGroupTree(ctrltree, mask, groupstr, nodemark, treefather, mode, getbitmap)= let XMLgetMarksByValueFromMarkSons nodemark "group" -> lgroupmarks in while(lgroupmarks != nil) do ( let hd lgroupmarks -> groupmark in let XMLgetMarkByValueFromMarkSons groupmark "graph" -> graphmark in let XMLgetParam groupmark "id" -> id in let XMLgetParam groupmark "name" -> name in let XMLgetParam groupmark "alias" -> alias in let addEdCtrlTreeItem ctrltree treefather (if (alias == nil) || (!strcmp alias "") then (strcatn name::" #"::id::nil) else (strcatn alias::" ("::name::" #"::id::")"::nil)) (strcatn id::"."::name::nil) iTypeGroup (exec getbitmap with [(strcatn id::"."::name::nil) iTypeGroup]) -> treenode in ( if (mask & iTypeAnim) then ( let XMLgetMarkByValueFromMarkSons groupmark "cinematics" -> cinematicsmark in if (cinematicsmark == nil) then nil else let addEdCtrlTreeItem ctrltree treenode "cinematics" "cinematics" iTypeCinematics (exec getbitmap with ["cinematics" iTypeCinematics]) -> treenode in fillGroupTreeGraph ctrltree mask groupstr cinematicsmark treenode mode getbitmap; ) else nil; fillGroupTreeGraph ctrltree mask groupstr graphmark treenode mode getbitmap; fillSonsGroupTree ctrltree mask groupstr groupmark treenode mode getbitmap; ); set lgroupmarks = tl lgroupmarks; ); 0;; fun fillGroupTree(ctrltree, groupstr, mask, value, mode, getbitmap)= let XMLgetParam groupstr.GRP_xmlMark "id" -> grpid in let XMLgetParam groupstr.GRP_xmlMark "name" -> grpname in let if grpname == nil then "Scene" else (strcatn grpid::"."::grpname::nil) -> grpname in let addEdCtrlTreeItem ctrltree nil grpname grpname iTypeGroup sTreeBitmapGroup -> treenode in ( if (mask & iTypeNode) then ( let addEdCtrlTreeItem ctrltree treenode "Current camera shell" "Current camera shell" iTypeNode (exec getbitmap with ["Current camera shell" iTypeNode]) -> camshellnode in if (mask & iTypeCamera) then addEdCtrlTreeItem ctrltree camshellnode "Current camera" "Current camera" iTypeCamera (exec getbitmap with ["Current camera" iTypeCamera]) else nil; ) else if (mask &iTypeCamera) then addEdCtrlTreeItem ctrltree nil "Current camera" "Current camera" iTypeCamera (exec getbitmap with ["Current camera" iTypeCamera]) else nil; if (strcmp grpname "Scene") || !(mask & iTypeCompositor) then nil else ( let XMLgetMarksByValueFromMark groupstr.GRP_xmlMark "compositor" -> lcompmarks in while (lcompmarks != nil) do ( let hd lcompmarks -> compmmark in let XMLgetParam compmmark "name" -> compname in let XMLgetParam compmmark "alias" -> alias in let getEdCtrlTreeItemByValue ctrltree if (alias == nil) || (!strcmp alias "") then (strcatn "Compositor \""::compname::"\""::nil) else (strcatn alias::" (Compositor \""::compname::"\")"::nil) -> exist in if exist != nil then nil else addEdCtrlTreeItem ctrltree treenode if (alias == nil) || (!strcmp alias "") then (strcatn "Compositor \""::compname::"\""::nil) else (strcatn alias::" (Compositor \""::compname::"\")"::nil) compname iTypeCompositor (exec getbitmap with [compname iTypeCompositor]); set lcompmarks = tl lcompmarks; ); ); if (mask & iTypeAnim) then ( let XMLgetMarkByValueFromMarkSons groupstr.GRP_xmlMark "cinematics" -> cinematicsmark in if (cinematicsmark == nil) then nil else let addEdCtrlTreeItem ctrltree treenode "cinematics" "cinematics" iTypeCinematics (exec getbitmap with ["cinematics" iTypeCinematics]) -> treenode in fillGroupTreeGraph ctrltree mask groupstr cinematicsmark treenode mode getbitmap; ) else nil; let XMLgetMarkByValueFromMarkSons groupstr.GRP_xmlMark "graph" -> graphmark in fillGroupTreeGraph ctrltree mask groupstr graphmark treenode mode getbitmap; //if (mask & iTypeGroup) then fillSonsGroupTree ctrltree mask groupstr groupstr.GRP_xmlMark treenode mode getbitmap //else nil; ); setEdCtrlTreeExpandAll ctrltree 1; if value == nil then selEdCtrlTreeItem ctrltree getEdCtrlTreeRootItem ctrltree else selEdCtrlTreeItemByValue ctrltree value; 0;; fun cbBtnPluginInstanceResourceOk(btnstr, p)= let p -> [winstr ctrltree mask cbend] in let getEdCtrlTreeSelectedItem ctrltree -> item in let getEdCtrlTreeFullValuesByItem ctrltree item -> [father val type] in if type & mask then ( exec cbend with [val type]; dsEdWindow winstr; set currentPluginResourceTree = nil; ) else nil; 0;; fun cbBtnPluginInstanceResourceCancel(btnstr, winstr)= dsEdWindow winstr; set currentPluginResourceTree = nil; 0;; fun cbTreePluginInstanceDbClick(ctrl, father, item, val, type, x, y, p)= let p -> [winstr ctrltree mask cbend] in if type & mask then ( exec cbend with [val type]; dsEdWindow winstr; set currentPluginResourceTree = nil; ) else nil; 0;; fun cbWinPluginInstanceDestroy(winstr, cbclose)= exec cbclose with []; set currentPluginResourceTree = nil; 0;; fun cbTreePluginInstanceSelect(ctrl, father, item, val, type, p)= let p -> [mask okbtn] in let if type & mask then 1 else 0 -> state in setEdCtrlButtonEnable okbtn state; 0;; fun cbChangePluginSelectMode(tbstr, check, btn, mask, state, p)= let p -> [ctrltree groupstr mask] in let getEdCtrlTreeValueByItem ctrltree (getEdCtrlTreeSelectedItem ctrltree) -> [value _] in ( resetEdCtrlTree ctrltree; fillGroupTree ctrltree groupstr mask value state @getTreeItemBitmapByType; ); 0;; fun selectPluginResourceByName(name)= if (currentPluginResourceTree == nil) then nil else ( let getEdCtrlTreeItemByValue currentPluginResourceTree name -> item in let getEdCtrlTreeFullValuesByItem currentPluginResourceTree item -> [father val type] in let if type & currentPluginResourceMask then 1 else 0 -> state in ( selEdCtrlTreeItem currentPluginResourceTree item; setEdCtrlButtonEnable currentPluginResourceBtn state; ); ); 0;; fun cbWinPluginResourceFocus(win, p)= let p -> [mask okbtn ctrltree] in ( set currentPluginResourceTree = ctrltree; set currentPluginResourceBtn = okbtn; set currentPluginResourceMask = mask; ); 0;; /*! @ingroup plugITApi * \brief Show a dialog window to choose a resource in the editor * * Prototype: fun [PInstance EdWindow I S fun [S I] I fun [] I I] I * * \param PInstance : the plugIT instance * \param EdWindow : the parent window * \param I : the resources types iTypeEntity|iTypeNode|iTypeLight|iTypeBone|iTypeCamera|iTypeParticle|iTypeCubeMap|iTypeAnim * \param fun [S I] I : the callback function on selection * \param - S : selected value * \param - I : selected type * \param fun [] I : the callback function on close * \param I : 1 for a filtered list, 0 for the resource tree * * \return 0 **/ fun dlgSelectPluginInstanceResource(inst, winfather, mask, value, cbend, cbclose, defmode)= let _GETscreenSize -> [sw sh] in let [320 240] -> [iw ih] in let if mask == nil then "Select resource" else "Select " -> title in let if mask & iTypeNode then strcat title "Shell " else title -> title in let if mask & iTypeLight then strcat title "Light " else title -> title in let if mask & iTypeCamera then strcat title "Camera " else title -> title in let if mask & iTypeEntity then strcat title "Mesh " else title -> title in let if mask & iTypeAnim then strcat title "Animation " else title -> title in let if mask & iTypeCompositor then strcat title "Compositor " else title -> title in let if mask & iTypeBone then strcat title "Bones " else title -> title in let if mask & iTypeParticle then strcat title "Particle " else title -> title in let if mask & iTypeCubeMap then strcat title "Cube map " else title -> title in let if mask & iTypeReflectionMap then strcat title "Reflection map " else title -> title in let if mask == nil then iTypeGroup|iTypeNode|iTypeLight|iTypeCamera|iTypeEntity|iTypeAnim|iTypeSkeleton|iTypeSkyBox|iTypeSkyDome|iTypeSkyPlane|iTypeCompositor|iTypeBone|iTypeParticle|iTypeCubeMap|iTypeReflectionMap else mask -> mask in let setEdWindowIcon (crEdWindow winfather.EDW_channel winfather ((sw / 2) - (iw / 2)) ((sh / 2) - (ih / 2)) iw ih WN_NOSCOL|WN_MENU|WN_SIZEBOX nil nil title) sWinDlgIcon -> winstr in let crEdWindowToolBar winstr 0 0 iw 28 5 1 0x373737 ETB_HORIZONTAL -> tbstr in let crEdCtrlTree winstr 5 33 (iw - 10) (ih - 73) EDWIN_RESIZE_MW|EDWIN_RESIZE_MH -> ctrltree in let crEdCtrlButton winstr 10 (ih - 30) 90 20 "Ok" EDWIN_RESIZE_LH|EDWIN_RESIZE_RW -> okbtn in let crEdCtrlButton winstr (iw - 100) (ih - 30) 90 20 "Cancel" EDWIN_RESIZE_LH|EDWIN_RESIZE_LW -> cancelbtn in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/tb_list_tree.png" -> apng in let crEdToolBarCheck tbstr apng ETB_ALIGN_LEFT "List mode / Tree mode" nil -> ctrlmode in //let crEdToolBarText tbstr "Select resource in the tree or by mouse in the 3D view" "Arial" 9 FF_PIXEL 0xffffff nil ETB_ALIGN_LEFT -> ctrltbtitle in ( _CBwinFocus winstr.EDW_win @cbWinPluginResourceFocus [mask okbtn ctrltree]; setEdToolBarCheckState tbstr ctrlmode defmode; setEdToolBarCheckCbClick tbstr ctrlmode mkfun6 @cbChangePluginSelectMode [ctrltree inst.INST_groupstr.GRP_project.PRJ_group mask]; setEdCtrlButtonCb okbtn mkfun2 @cbBtnPluginInstanceResourceOk [winstr ctrltree mask cbend]; setEdCtrlButtonCb cancelbtn mkfun2 @cbBtnPluginInstanceResourceCancel winstr; fillGroupTree ctrltree inst.INST_groupstr.GRP_project.PRJ_group mask value defmode @getTreeItemBitmapByType; setEdwindowCbDestroy winstr mkfun2 @cbWinPluginInstanceDestroy cbclose; setEdCtrlTreeCbDbClick ctrltree mkfun8 @cbTreePluginInstanceDbClick [winstr ctrltree mask cbend]; setEdCtrlTreeCbSelect ctrltree mkfun6 @cbTreePluginInstanceSelect [mask okbtn]; let getEdCtrlTreeValueByItem ctrltree (getEdCtrlTreeSelectedItem ctrltree) -> [sval _] in if (!strcmp value sval) && (value != nil) then nil else setEdCtrlButtonEnable okbtn defmode; set currentPluginResourceTree = ctrltree; set currentPluginResourceBtn = okbtn; set currentPluginResourceMask = mask; paintEdToolBar tbstr; ); 0;; fun dlgSelectPluginResource(groupstr, winfather, mask, value, cbend, cbclose, defmode)= let _GETscreenSize -> [sw sh] in let [320 240] -> [iw ih] in let if mask == nil then "Select resource" else "Select " -> title in let if mask & iTypeNode then strcat title "Shell " else title -> title in let if mask & iTypeLight then strcat title "Light " else title -> title in let if mask & iTypeCamera then strcat title "Camera " else title -> title in let if mask & iTypeEntity then strcat title "Mesh " else title -> title in let if mask & iTypeAnim then strcat title "Animation " else title -> title in let if mask & iTypeCompositor then strcat title "Compositor " else title -> title in let if mask & iTypeBone then strcat title "Bones " else title -> title in let if mask & iTypeParticle then strcat title "Particle " else title -> title in let if mask & iTypeCubeMap then strcat title "Cube map " else title -> title in let if mask & iTypeReflectionMap then strcat title "Reflection map " else title -> title in let if mask == nil then iTypeNode|iTypeLight|iTypeCamera|iTypeEntity|iTypeAnim|iTypeSkeleton|iTypeSkyBox|iTypeSkyDome|iTypeSkyPlane|iTypeCompositor|iTypeBone|iTypeParticle|iTypeCubeMap|iTypeReflectionMap else mask -> mask in let setEdWindowIcon (crEdWindow winfather.EDW_channel winfather ((sw / 2) - (iw / 2)) ((sh / 2) - (ih / 2)) iw ih WN_NOSCOL|WN_MENU|WN_SIZEBOX nil nil title) sWinDlgIcon -> winstr in let crEdWindowToolBar winstr 0 0 iw 28 5 1 0x373737 ETB_HORIZONTAL -> tbstr in let crEdCtrlTree winstr 5 33 (iw - 10) (ih - 73) EDWIN_RESIZE_MW|EDWIN_RESIZE_MH -> ctrltree in let crEdCtrlButton winstr 10 (ih - 30) 90 20 "Ok" EDWIN_RESIZE_LH|EDWIN_RESIZE_RW -> okbtn in let crEdCtrlButton winstr (iw - 100) (ih - 30) 90 20 "Cancel" EDWIN_RESIZE_LH|EDWIN_RESIZE_LW -> cancelbtn in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/tb_list_tree.png" -> apng in let crEdToolBarCheck tbstr apng ETB_ALIGN_LEFT "List mode / Tree mode" nil -> ctrlmode in ( _CBwinFocus winstr.EDW_win @cbWinPluginResourceFocus [mask okbtn ctrltree]; setEdToolBarCheckState tbstr ctrlmode defmode; setEdToolBarCheckCbClick tbstr ctrlmode mkfun6 @cbChangePluginSelectMode [ctrltree groupstr mask]; setEdCtrlButtonCb okbtn mkfun2 @cbBtnPluginInstanceResourceOk [winstr ctrltree mask cbend]; setEdCtrlButtonCb cancelbtn mkfun2 @cbBtnPluginInstanceResourceCancel winstr; fillGroupTree ctrltree groupstr mask value defmode @getTreeItemBitmapByType; setEdwindowCbDestroy winstr mkfun2 @cbWinPluginInstanceDestroy cbclose; setEdCtrlTreeCbDbClick ctrltree mkfun8 @cbTreePluginInstanceDbClick [winstr ctrltree mask cbend]; setEdCtrlTreeCbSelect ctrltree mkfun6 @cbTreePluginInstanceSelect [mask okbtn]; let getEdCtrlTreeValueByItem ctrltree (getEdCtrlTreeSelectedItem ctrltree) -> [sval _] in if (!strcmp value sval) && (value != nil) then nil else setEdCtrlButtonEnable okbtn defmode; set currentPluginResourceTree = ctrltree; set currentPluginResourceBtn = okbtn; set currentPluginResourceMask = mask; paintEdToolBar tbstr; ); 0;; /* ********************************************************************************************* / Modules / ********************************************************************************************* */ /* InterfacePos */ var iPOS_INTERFACE_2D = 1;; var iPOS_INTERFACE_MAT = 2;; var iPOS_INTERFACE_3D = 4;; var iPOS_INTERFACE_VR = 8;; var iPOS_INTERFACE_2D_NO_KEEPRATIO = 16;; var iPOS_INTERFACE_2D_NO_BACKGROUND = 32;; var iPOS_INTERFACE_2D_NO_BACKGROUND_NO_KEEPRATIO = 48;; struct InterfacePos2D = [ IP2D_winstr : EdWindow, IP2D_tPos : [F F], IP2D_tSize : [F F], IP2D_tRatiosize : [I I I I I I I I], IP2D_tAlign : [I I], IP2D_bBackground : I, IP2D_bKeepRatio : I, IP2D_iOpacity : I, IP2D_iQuality : I, IP2D_iZorder : I ]mkInterfacePos2D;; struct InterfacePosMat = [ IPMAT_winstr : EdWindow, IPMAT_sObjectName : S, IPMAT_Object : SO3_OBJECT, IPMAT_sMaterialName : S, IPMAT_Material : SO3_MATERIAL, IPMAT_iTechnique : I, IPMAT_iPass : I, IPMAT_iTexture : I, IPMAT_tSize : [F F], IPMAT_iOpacity : I, IPMAT_iQuality : I ]mkInterfacePosMat;; struct InterfacePos3D = [ IP3D_winstr : EdWindow, IP3D_sParentName : S, IP3D_Parent : SO3_OBJECT, IP3D_tSize : [F F], IP3D_tOffset : [F F], IP3D_fScale : F, IP3D_iOpacity : I, IP3D_iQuality : I, IP3D_bConstantSize : I, IP3D_fMaxAutoscaleDist : F, IP3D_bTarget : I, IP3D_bShowOnTop : I ]mkInterfacePos3D;; struct InterfacePosVR = [ IPVR_winstr : EdWindow, IPVR_tSize : [F F], IPVR_fScale : F, IPVR_iOpacity : I, IPVR_iQuality : I, IPVR_iZorder : I ]mkInterfacePosVR;; struct InterfacePos = [ IP_iMode : I, IP_pos2Dstr : InterfacePos2D, IP_posmatstr : InterfacePosMat, IP_pos3Dstr : InterfacePos3D, IP_posvrstr : InterfacePosVR, IP_iPrevWinSize : I ]mkInterfacePos;; fun getVUIgroupFromInstance(inst)= inst.INST_groupstr.GRP_project.PRJ_vuiGroup;; fun getThemeFromInstance(inst)= VUIgetGroupTheme inst.INST_groupstr.GRP_project.PRJ_vuiGroup;; fun get2DInterfaceSaveData(pos2Dstr)= let pos2Dstr.IP2D_tPos -> [x y] in let pos2Dstr.IP2D_tSize -> [w h] in let pos2Dstr.IP2D_tRatiosize -> [px py pw ph ox oy ow oh] in let pos2Dstr.IP2D_tAlign -> [ax ay] in ["xpercent2D" itoa px]:: ["xalign2D" itoa ax]:: ["xpos2D" ftoa x]:: ["ypercent2D" itoa py]:: ["yalign2D" itoa ay]:: ["ypos2D" ftoa y]:: ["wpercent2D" itoa pw]:: ["width2D" ftoa w]:: ["hpercent2D" itoa ph]:: ["height2D" ftoa h]:: ["xoffset2D" itoa ox]:: ["yoffset2D" itoa oy]:: ["woffset2D" itoa ow]:: ["hoffset2D" itoa oh]:: ["background2D" itoa pos2Dstr.IP2D_bBackground]:: ["ratio2D" itoa pos2Dstr.IP2D_bKeepRatio]:: ["opacity2D" itoa pos2Dstr.IP2D_iOpacity]:: ["quality2D" itoa pos2Dstr.IP2D_iQuality]:: ["zorder2D" itoa pos2Dstr.IP2D_iZorder]:: nil;; fun getMatInterfaceSaveData(posmatstr)= let posmatstr.IPMAT_tSize -> [w h] in ["objectMat" posmatstr.IPMAT_sObjectName]:: ["materialMat" posmatstr.IPMAT_sMaterialName]:: ["techniqueMat" itoa posmatstr.IPMAT_iTechnique]:: ["passMat" itoa posmatstr.IPMAT_iPass]:: ["textureMat" itoa posmatstr.IPMAT_iTexture]:: ["widthMat" ftoa w]:: ["heightMat" ftoa h]:: ["opacityMat" itoa posmatstr.IPMAT_iOpacity]:: ["qualityMat" itoa posmatstr.IPMAT_iQuality]:: nil;; fun get3DInterfaceSaveData(pos3Dstr)= let pos3Dstr.IP3D_tSize -> [w h] in let pos3Dstr.IP3D_tOffset -> [ox oy] in ["parent3D" pos3Dstr.IP3D_sParentName]:: ["width3D" ftoa w]:: ["height3D" ftoa h]:: ["xoffset3D" ftoa ox]:: ["yoffset3D" ftoa oy]:: ["scale3D" ftoa pos3Dstr.IP3D_fScale]:: ["opacity3D" itoa pos3Dstr.IP3D_iOpacity]:: ["quality3D" itoa pos3Dstr.IP3D_iQuality]:: ["constsize3D" itoa pos3Dstr.IP3D_bConstantSize]:: ["maxautoscaledist3D" ftoa pos3Dstr.IP3D_fMaxAutoscaleDist]:: ["target3D" itoa pos3Dstr.IP3D_bTarget]:: ["showontop3D" itoa pos3Dstr.IP3D_bShowOnTop]:: nil;; fun getVRInterfaceSaveData(posvrstr)= let posvrstr.IPVR_tSize -> [w h] in ["widthVR" ftoa w]:: ["heightVR" ftoa h]:: ["scaleVR" ftoa posvrstr.IPVR_fScale]:: ["opacityVR" itoa posvrstr.IPVR_iOpacity]:: ["qualityVR" itoa posvrstr.IPVR_iQuality]:: ["zorderVR" itoa posvrstr.IPVR_iZorder]:: nil;; fun getInterfaceSaveData(posstr)= let ["interface mode" itoa posstr.IP_iMode]:: ["ACTION" "Set interface size"]:: nil -> commonSaveData in let if (posstr.IP_iMode == 0) then lcat commonSaveData ["ACTION" "Set interface position"]::nil else if (posstr.IP_iMode == 2) || (posstr.IP_iMode == 3) then lcat commonSaveData ["ACTION" "Set interface size"]::nil else commonSaveData -> commonSaveData in let get2DInterfaceSaveData posstr.IP_pos2Dstr -> saveData2D in let getMatInterfaceSaveData posstr.IP_posmatstr -> saveDataMat in let get3DInterfaceSaveData posstr.IP_pos3Dstr -> saveData3D in let getVRInterfaceSaveData posstr.IP_posvrstr -> saveDataVR in lcat commonSaveData (lcat saveData2D (lcat saveDataMat (lcat saveData3D saveDataVR)));; fun loadInterfacePos2D(inst)= let atof (getPluginInstanceParam inst "xpos2D") -> posx in let if posx == nil then 0.0 else posx -> posx in let atoi (getPluginInstanceParam inst "xpercent2D") -> xpercent in let if xpercent == nil then 0 else xpercent -> xpercent in let atoi (getPluginInstanceParam inst "xoffset2D") -> xoffset in let if xoffset == nil then 0 else xoffset -> xoffset in let atoi (getPluginInstanceParam inst "xalign2D") -> xalign in let if xalign == nil then 0 else xalign -> xalign in let atof (getPluginInstanceParam inst "ypos2D") -> posy in let if posy == nil then 0.0 else posy -> posy in let atoi (getPluginInstanceParam inst "ypercent2D") -> ypercent in let if ypercent == nil then 0 else ypercent -> ypercent in let atoi (getPluginInstanceParam inst "yoffset2D") -> yoffset in let if yoffset == nil then 0 else yoffset -> yoffset in let atoi (getPluginInstanceParam inst "yalign2D") -> yalign in let if yalign == nil then 0 else yalign -> yalign in let atof (getPluginInstanceParam inst "width2D") -> width in let if width == nil then 256.0 else width -> width in let atoi (getPluginInstanceParam inst "wpercent2D") -> wpercent in let if wpercent == nil then 0 else wpercent -> wpercent in let atoi (getPluginInstanceParam inst "woffset2D") -> woffset in let if woffset == nil then 0 else woffset -> woffset in let atof (getPluginInstanceParam inst "height2D") -> height in let if height == nil then 256.0 else height -> height in let atoi (getPluginInstanceParam inst "hpercent2D") -> hpercent in let if hpercent == nil then 0 else hpercent -> hpercent in let atoi (getPluginInstanceParam inst "hoffset2D") -> hoffset in let if hoffset == nil then 0 else hoffset -> hoffset in let atoi (getPluginInstanceParam inst "background2D") -> background in let if background == nil then 0 else background -> background in let atoi (getPluginInstanceParam inst "ratio2D") -> ratio in let if ratio == nil then 0 else ratio -> ratio in let atoi (getPluginInstanceParam inst "opacity2D") -> opacity in let if opacity == nil then 100 else opacity -> opacity in let atoi (getPluginInstanceParam inst "quality2D") -> quality in let if quality == nil then 100 else quality -> quality in let atoi (getPluginInstanceParam inst "zorder2D") -> zorder in let if zorder == nil then 101 else zorder -> zorder in mkInterfacePos2D [nil [posx posy] [width height] [xpercent ypercent wpercent hpercent xoffset yoffset woffset hoffset] [xalign yalign] background ratio opacity quality zorder];; fun loadInterfacePosMat(inst, sessionstr)= let V3DgetSession sessionstr -> scene in let getPluginInstanceParam inst "objectMat" -> objname in let SO3SceneGetObject scene objname -> obj in let (getPluginInstanceParam inst "materialMat") -> matname in let SO3SceneGetMaterial scene (SO3EntityGetResourceGroup obj) matname -> mat in let atoi (getPluginInstanceParam inst "techniqueMat") -> technique in let if (technique == nil) || (technique < 0) then 0 else technique -> technique in let atoi (getPluginInstanceParam inst "passMat") -> pass in let if (pass == nil) || (pass < 0) then 0 else pass -> pass in let atoi (getPluginInstanceParam inst "textureMat") -> texture in let if (texture == nil) || (texture < 0) then 0 else texture -> texture in let atof (getPluginInstanceParam inst "widthMat") -> width in let if width == nil then 100.0 else width -> width in let atof (getPluginInstanceParam inst "heightMat") -> height in let if height == nil then 100.0 else height -> height in let atoi (getPluginInstanceParam inst "opacityMat") -> opacity in let if opacity == nil then 100 else opacity -> opacity in let atoi (getPluginInstanceParam inst "qualityMat") -> quality in let if quality == nil then 100 else quality -> quality in mkInterfacePosMat [nil objname obj matname mat technique pass texture [width height] opacity quality];; fun loadInterfacePos3D(inst, sessionstr)= let getPluginInstanceParam inst "parent3D" -> objname in let V3DgetObjectByName sessionstr objname -> obj in let atof (getPluginInstanceParam inst "width3D") -> width in let if width == nil then 100.0 else width -> width in let atof (getPluginInstanceParam inst "height3D") -> height in let if height == nil then 100.0 else height -> height in let atof (getPluginInstanceParam inst "xoffset3D") -> xoffset in let if xoffset == nil then 0.5 else xoffset -> xoffset in let atof (getPluginInstanceParam inst "yoffset3D") -> yoffset in let if yoffset == nil then 0.5 else yoffset -> yoffset in let atof (getPluginInstanceParam inst "scale3D") -> scale in let if scale == nil then 1.0 else scale -> scale in let atoi (getPluginInstanceParam inst "opacity3D") -> opacity in let if opacity == nil then 100 else opacity -> opacity in let atoi (getPluginInstanceParam inst "quality3D") -> quality in let if quality == nil then 100 else quality -> quality in let atoi (getPluginInstanceParam inst "constsize3D") -> constsize in let if constsize == nil then 1 else constsize -> constsize in let atof (getPluginInstanceParam inst "maxautoscaledist3D") -> maxautoscaledist in let if maxautoscaledist == nil then 5.0 else maxautoscaledist -> maxautoscaledist in let atoi (getPluginInstanceParam inst "target3D") -> target in let if target == nil then 1 else target -> target in let atoi (getPluginInstanceParam inst "showontop3D") -> showontop in let if showontop == nil then 0 else showontop -> showontop in mkInterfacePos3D [nil objname obj [width height] [xoffset yoffset] scale opacity quality constsize maxautoscaledist target showontop];; fun loadInterfacePosVR(inst)= let atof (getPluginInstanceParam inst "widthVR") -> width in let if width == nil then 100.0 else width -> width in let atof (getPluginInstanceParam inst "heightVR") -> height in let if height == nil then 100.0 else height -> height in let atof (getPluginInstanceParam inst "scaleVR") -> scale in let if scale == nil then 1.0 else scale -> scale in let atoi (getPluginInstanceParam inst "opacityVR") -> opacity in let if opacity == nil then 100 else opacity -> opacity in let atoi (getPluginInstanceParam inst "qualityVR") -> quality in let if quality == nil then 100 else quality -> quality in let atoi (getPluginInstanceParam inst "zorderVR") -> zorder in let if zorder == nil then 1 else zorder -> zorder in mkInterfacePosVR [nil [width height] scale opacity quality zorder];; fun loadInterfacePos(inst, sessionstr)= let atoi (getPluginInstanceParam inst "interface mode") -> mode in let if mode == nil then 0 else mode -> mode in let loadInterfacePos2D inst -> pos2Dstr in let loadInterfacePosMat inst sessionstr -> posmatstr in let loadInterfacePos3D inst sessionstr -> pos3Dstr in let loadInterfacePosVR inst -> posvrstr in mkInterfacePos [mode pos2Dstr posmatstr pos3Dstr posvrstr 0];; fun cbSet2DInterfacePosition(inst, from, action, param, reply, p)= let p -> [contstr posstr] in if param == nil then nil else ( let strextr param -> lp in let (nth_list (hd lp) 0) -> sx in let (nth_list (hd lp) 1) -> sy in let atoi (nth_list (hd lp) 2) -> ox in let atoi (nth_list (hd lp) 3) -> oy in let atof sx -> x in let atof sy -> y in let [(if x == nil then 0.0 else x) (if y == nil then 0.0 else y)] -> [x y] in let if (!strcmp "%" (substr sx ((strlen sx) - 1) 1)) then 1 else 0 -> xpercent in let if (!strcmp "%" (substr sy ((strlen sy) - 1) 1)) then 1 else 0 -> ypercent in let if (ox == nil) && (oy == nil) then let posstr.IP_pos2Dstr.IP2D_tRatiosize -> [_ _ _ _ ox oy _ _] in [ox oy] else let [(if ox == nil then 0 else ox) (if oy == nil then 0 else oy)] -> [ox oy] in [ox oy] -> [ox oy] in ( VUIsetContainerPos contstr [x y] nil [xpercent ypercent ox oy]; mutate posstr.IP_pos2Dstr.IP2D_tRatiosize <- [xpercent ypercent _ _ ox oy _ _]; set posstr.IP_pos2Dstr.IP2D_tPos = [x y]; ); ); 0;; fun cbSet2DInterfaceSize(inst, from, action, param, reply, p)= let p -> [contstr posstr] in if param == nil then nil else ( let strextr param -> lp in let (nth_list (hd lp) 0) -> sw in let (nth_list (hd lp) 1) -> sh in let atoi (nth_list (hd lp) 2) -> ow in let atoi (nth_list (hd lp) 3) -> oh in let atof sw -> w in let atof sh -> h in let [(if w == nil then 0.0 else w) (if h == nil then 0.0 else h)] -> [w h] in let if (!strcmp "%" (substr sw ((strlen sw) - 1) 1)) then 1 else 0 -> wpercent in let if (!strcmp "%" (substr sh ((strlen sh) - 1) 1)) then 1 else 0 -> hpercent in let if (ow == nil) && (oh == nil) then let posstr.IP_pos2Dstr.IP2D_tRatiosize -> [_ _ _ _ _ _ ow oh] in [ow oh] else let [(if ow == nil then 0 else ow) (if oh == nil then 0 else oh)] -> [ow oh] in [ow oh] -> [ow oh] in ( VUIsetContainerSize contstr [w h] [wpercent hpercent ow oh]; mutate posstr.IP_pos2Dstr.IP2D_tRatiosize <- [_ _ wpercent hpercent _ _ ow oh]; set posstr.IP_pos2Dstr.IP2D_tSize = [w h]; ); ); 0;; fun cbSetInterfaceSize(inst, from, action, param, reply, p)= let p -> [contstr posstr] in if param == nil then nil else ( let strextr param -> lp in let atof (hd (hd lp)) -> w in let atof (hd tl (hd lp)) -> h in let [(if w == nil then 0.0 else w) (if h == nil then 0.0 else h)] -> [w h] in ( VUIsetContainerSize contstr [w h] nil; if (posstr.IP_iMode == 1) then set posstr.IP_posmatstr.IPMAT_tSize = [w h] else if (posstr.IP_iMode == 2) then set posstr.IP_pos3Dstr.IP3D_tSize = [w h] else if (posstr.IP_iMode == 3) then set posstr.IP_posvrstr.IPVR_tSize = [w h] else nil; ); ); 0;; fun cbSet3DInterfaceScale(inst, from, action, param, reply, p)= let p -> [contstr posstr] in if param == nil then nil else ( let atof param -> scale in ( VUIset3DContainerScale contstr scale; if (posstr.IP_iMode == 2) then set posstr.IP_pos3Dstr.IP3D_fScale = scale else if (posstr.IP_iMode == 3) then set posstr.IP_posvrstr.IPVR_fScale = scale else nil; ); ); 0;; fun cbChangeInterface3DCamera(inst, viewstr, sessionstr, camera, p)= let p -> [pos3Dstr contstr iobjmode] in ( set pos3Dstr.IP3D_Parent = V3DgetCameraByType sessionstr camera iobjmode; VUIset3DContainerParentTarget contstr pos3Dstr.IP3D_Parent; ); 0;; fun crInterfacePosContainer(inst, posstr, sessionstr)= let V3DgetSessionView sessionstr -> viewstr in let nil -> contstr in ( if posstr.IP_iMode == 0 then let posstr.IP_pos2Dstr -> pos2Dstr in ( set contstr = VUIcreateContainer viewstr (getVUIgroupFromInstance inst) pos2Dstr.IP2D_tPos pos2Dstr.IP2D_tSize pos2Dstr.IP2D_tRatiosize pos2Dstr.IP2D_tAlign pos2Dstr.IP2D_iOpacity pos2Dstr.IP2D_iZorder; VUIsetContainerQuality contstr pos2Dstr.IP2D_iQuality; PluginRegisterAction inst "Set interface position" mkfun6 @cbSet2DInterfacePosition [contstr posstr]; PluginRegisterAction inst "Set interface size" mkfun6 @cbSet2DInterfaceSize [contstr posstr]; 0; ) else if posstr.IP_iMode == 1 then let posstr.IP_posmatstr -> posmatstr in ( set contstr = VUIcreateContainerOnMaterial sessionstr (getVUIgroupFromInstance inst) posmatstr.IPMAT_Material posmatstr.IPMAT_iTechnique posmatstr.IPMAT_iPass posmatstr.IPMAT_iTexture posmatstr.IPMAT_tSize posmatstr.IPMAT_iOpacity; VUIsetContainerQuality contstr posmatstr.IPMAT_iQuality; PluginRegisterAction inst "Set interface size" mkfun6 @cbSetInterfaceSize [contstr posstr]; 0; ) else if posstr.IP_iMode == 2 then let posstr.IP_pos3Dstr -> pos3Dstr in let SO3ObjectGetGlobalPosition pos3Dstr.IP3D_Parent -> pos in ( set contstr = VUIcreate3dContainer sessionstr (getVUIgroupFromInstance inst) pos pos3Dstr.IP3D_tOffset pos3Dstr.IP3D_tSize pos3Dstr.IP3D_fScale pos3Dstr.IP3D_bConstantSize pos3Dstr.IP3D_fMaxAutoscaleDist pos3Dstr.IP3D_bTarget pos3Dstr.IP3D_iOpacity pos3Dstr.IP3D_bShowOnTop; VUIset3DContainerParentTarget contstr pos3Dstr.IP3D_Parent; VUIsetContainerQuality contstr pos3Dstr.IP3D_iQuality; let V3DgetObjectTypeByName pos3Dstr.IP3D_sParentName -> iobjmode in if (!iobjmode) then nil else setPluginInstanceCbCameraChange inst mkfun5 @cbChangeInterface3DCamera [pos3Dstr contstr iobjmode]; PluginRegisterAction inst "Set interface size" mkfun6 @cbSetInterfaceSize [contstr posstr]; PluginRegisterAction inst "Set interface scale" mkfun6 @cbSet3DInterfaceScale [contstr posstr]; 0; ) else if posstr.IP_iMode == 3 then let posstr.IP_posvrstr -> posvrstr in ( set contstr = VUIcreateVrContainer sessionstr (getVUIgroupFromInstance inst) /*offset*/[0.0 0.0] posvrstr.IPVR_tSize posvrstr.IPVR_fScale posvrstr.IPVR_iOpacity /*ontop*/1 posvrstr.IPVR_iZorder; VUIsetContainerQuality contstr posvrstr.IPVR_iQuality; PluginRegisterAction inst "Set interface size" mkfun6 @cbSetInterfaceSize [contstr posstr]; PluginRegisterAction inst "Set interface scale" mkfun6 @cbSet3DInterfaceScale [contstr posstr]; 0; ) else nil; contstr; );; fun getInterfacePosSize(posstr)= if posstr.IP_iMode == 0 then let posstr.IP_pos2Dstr.IP2D_tRatiosize -> [_ _ pw ph _ _ ow oh] in [posstr.IP_pos2Dstr.IP2D_tSize [pw ph ow oh]] else if posstr.IP_iMode == 1 then [posstr.IP_posmatstr.IPMAT_tSize [0 0 0 0]] else if posstr.IP_iMode == 2 then [posstr.IP_pos3Dstr.IP3D_tSize [0 0 0 0]] else if posstr.IP_iMode == 3 then [posstr.IP_posvrstr.IPVR_tSize [0 0 0 0]] else nil;; fun cb2DChangeXPos(ctrlstr, value, pos2Dstr)= mutate pos2Dstr.IP2D_tPos <- [value _]; 0;; fun cb2DChangeYPos(ctrlstr, value, pos2Dstr)= mutate pos2Dstr.IP2D_tPos <- [_ value]; 0;; fun cb2DChangeWidth(ctrlstr, value, pos2Dstr)= mutate pos2Dstr.IP2D_tSize <- [value _]; 0;; fun cb2DChangeHeight(ctrlstr, value, pos2Dstr)= mutate pos2Dstr.IP2D_tSize <- [_ value]; 0;; fun cb2DPercentCheck(ctrlstr, state, p)= let p -> [pos2Dstr ctrlcoord ctrloffset i] in ( setEdCtrlFloatNbDecimals ctrlcoord (if state then 2 else 0); setEdCtrlFloatEnable ctrloffset state; if i == 0 then mutate pos2Dstr.IP2D_tRatiosize <- [state _ _ _ _ _ _ _] else if i == 1 then mutate pos2Dstr.IP2D_tRatiosize <- [_ state _ _ _ _ _ _] else if i == 2 then mutate pos2Dstr.IP2D_tRatiosize <- [_ _ state _ _ _ _ _] else if i == 3 then mutate pos2Dstr.IP2D_tRatiosize <- [_ _ _ state _ _ _ _] else nil; ); 0;; fun cb2DChangeXOffset(ctrlstr, value, pos2Dstr)= mutate pos2Dstr.IP2D_tRatiosize <- [_ _ _ _ (ftoi value) _ _ _]; 0;; fun cb2DChangeYOffset(ctrlstr, value, pos2Dstr)= mutate pos2Dstr.IP2D_tRatiosize <- [_ _ _ _ _ (ftoi value) _ _]; 0;; fun cb2DChangeWOffset(ctrlstr, value, pos2Dstr)= mutate pos2Dstr.IP2D_tRatiosize <- [_ _ _ _ _ _ (ftoi value) _]; 0;; fun cb2DChangeHOffset(ctrlstr, value, pos2Dstr)= mutate pos2Dstr.IP2D_tRatiosize <- [_ _ _ _ _ _ _ (ftoi value)]; 0;; fun cb2DChangeXAlign(ctrlstr, value, name, pos2Dstr)= mutate pos2Dstr.IP2D_tAlign <- [value _]; 0;; fun cb2DChangeYAlign(ctrlstr, value, name, pos2Dstr)= mutate pos2Dstr.IP2D_tAlign <- [_ value]; 0;; fun cb2DChangeRatio(ctrlstr, state, p)= let p -> [pos2Dstr ctrlheight ctrlhpercent ctrlhoffset] in ( set pos2Dstr.IP2D_bKeepRatio = state; setEdCtrlFloatEnable ctrlheight !state; setEdCtrlCheckEnable ctrlhpercent !state; setEdCtrlFloatEnable ctrlhoffset (!state && (getEdCtrlCheckState ctrlhpercent)); ); 0;; fun cb2DChangeBackground(ctrlstr, state, pos2Dstr)= set pos2Dstr.IP2D_bBackground = state; 0;; fun cb2DChangeOpacity(ctrlstr, value, pos2Dstr)= set pos2Dstr.IP2D_iOpacity = ftoi value; 0;; fun cb2DChangeQuality(ctrlstr, value, pos2Dstr)= set pos2Dstr.IP2D_iQuality = ftoi value; 0;; fun cb2DChangeZorder(ctrlstr, value, pos2Dstr)= set pos2Dstr.IP2D_iZorder = ftoi value; 0;; fun show2DPositionInterface(inst, pwinstr, pos2Dstr, flags, ix, iy, iw, ih)= let 10 -> ypos in ( let pos2Dstr.IP2D_tPos -> [posx posy] in let pos2Dstr.IP2D_tSize -> [width height] in let pos2Dstr.IP2D_tRatiosize -> [xpercent ypercent wpercent hpercent xoffset yoffset woffset hoffset] in let pos2Dstr.IP2D_tAlign -> [xalign yalign] in let pos2Dstr.IP2D_bBackground -> background in let pos2Dstr.IP2D_bKeepRatio -> ratio in let pos2Dstr.IP2D_iOpacity -> opacity in let pos2Dstr.IP2D_iQuality -> quality in let pos2Dstr.IP2D_iZorder -> zorder in let crEdWindow _channel pwinstr ix iy iw 235 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crEdCtrlLabel winstr 10 ((set ypos = 10) + 2) 90 20 (loc "OS3D_0642") nil -> labelx in let crEdCtrlFloat winstr 110 ypos 60 20 posx (-.10000.0) 10000.0 1.0 (if xpercent then 2 else 0) nil EDWIN_RESIZE_MW -> ctrlxpos in let crEdCtrlCheck winstr 180 ypos 40 20 "(%)" EDWIN_RESIZE_MW -> ctrlxpercent in let crEdCtrlLabel winstr 220 (ypos + 2) 60 20 (loc "OS3D_0644") nil -> labelxo in let crEdCtrlFloat winstr 285 ypos 60 20 itof xoffset (-.10000.0) 10000.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlxoffset in let crEdCtrlSelect winstr 355 ypos 100 120 EDWIN_RESIZE_MW -> ctrlxalign in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 90 20 (loc "OS3D_0643") nil -> labely in let crEdCtrlFloat winstr 110 ypos 60 20 posy (-.10000.0) 10000.0 1.0 (if ypercent then 2 else 0) nil EDWIN_RESIZE_MW -> ctrlypos in let crEdCtrlCheck winstr 180 ypos 40 20 "(%)" EDWIN_RESIZE_MW -> ctrlypercent in let crEdCtrlLabel winstr 220 (ypos + 2) 60 20 (loc "OS3D_0644") nil -> labelyo in let crEdCtrlFloat winstr 285 ypos 60 20 itof yoffset (-.10000.0) 10000.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlyoffset in let crEdCtrlSelect winstr 355 ypos 100 120 EDWIN_RESIZE_MW -> ctrlyalign in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 90 20 (loc "OS3D_0645") nil -> labelw in let crEdCtrlFloat winstr 110 ypos 60 20 width 0.0 10000.0 1.0 (if wpercent then 2 else 0) nil EDWIN_RESIZE_MW -> ctrlwidth in let crEdCtrlCheck winstr 180 ypos 40 20 "(%)" EDWIN_RESIZE_MW -> ctrlwpercent in let crEdCtrlLabel winstr 220 (ypos + 2) 60 20 (loc "OS3D_0644") nil -> labelwo in let crEdCtrlFloat winstr 285 ypos 60 20 itof woffset (-.10000.0) 10000.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlwoffset in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 90 20 (loc "OS3D_0646") nil -> labelh in let crEdCtrlFloat winstr 110 ypos 60 20 height 0.0 10000.0 1.0 (if hpercent then 2 else 0) nil EDWIN_RESIZE_MW -> ctrlheight in let crEdCtrlCheck winstr 180 ypos 40 20 "(%)" EDWIN_RESIZE_MW -> ctrlhpercent in let crEdCtrlLabel winstr 220 (ypos + 2) 60 20 (loc "OS3D_0644") nil -> labelho in let crEdCtrlFloat winstr 285 ypos 60 20 itof hoffset (-.10000.0) 10000.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlhoffset in let if (flags & iPOS_INTERFACE_2D_NO_BACKGROUND) then nil else crEdCtrlCheck winstr 10 (set ypos = ypos + 25) 280 20 (loc "OS3D_0648") EDWIN_RESIZE_MW -> ctrlbackground in let if (flags & iPOS_INTERFACE_2D_NO_KEEPRATIO) then nil else crEdCtrlCheck winstr 10 (set ypos = ypos + 25) 280 20 (loc "OS3D_0647") EDWIN_RESIZE_MW -> ctrlratio in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3D_0640") nil -> labelopacity in let crEdCtrlFloat winstr 180 ypos 100 20 itof opacity 0.0 100.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlopacity in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3D_0641") nil -> labelquality in let crEdCtrlFloat winstr 180 ypos 100 20 itof quality 1.0 100.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlquality in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3D_0649") nil -> labelzorder in let crEdCtrlFloat winstr 180 ypos 100 20 itof zorder 0.0 10000.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlzorder in ( set pos2Dstr.IP2D_winstr = winstr; setEdCtrlFloatCbChange ctrlxpos mkfun3 @cb2DChangeXPos pos2Dstr; setEdCtrlFloatCbChange ctrlypos mkfun3 @cb2DChangeYPos pos2Dstr; setEdCtrlFloatCbChange ctrlwidth mkfun3 @cb2DChangeWidth pos2Dstr; setEdCtrlFloatCbChange ctrlheight mkfun3 @cb2DChangeHeight pos2Dstr; setEdCtrlCheckState ctrlxpercent xpercent; setEdCtrlCheckState ctrlypercent ypercent; setEdCtrlCheckState ctrlwpercent wpercent; setEdCtrlCheckState ctrlhpercent hpercent; setEdCtrlCheckCbState ctrlxpercent mkfun3 @cb2DPercentCheck [pos2Dstr ctrlxpos ctrlxoffset 0]; setEdCtrlCheckCbState ctrlypercent mkfun3 @cb2DPercentCheck [pos2Dstr ctrlypos ctrlyoffset 1]; setEdCtrlCheckCbState ctrlwpercent mkfun3 @cb2DPercentCheck [pos2Dstr ctrlwidth ctrlwoffset 2]; setEdCtrlCheckCbState ctrlhpercent mkfun3 @cb2DPercentCheck [pos2Dstr ctrlheight ctrlhoffset 3]; setEdCtrlFloatEnable ctrlxoffset (getEdCtrlCheckState ctrlxpercent); setEdCtrlFloatEnable ctrlyoffset (getEdCtrlCheckState ctrlypercent); setEdCtrlFloatEnable ctrlwoffset (getEdCtrlCheckState ctrlwpercent); setEdCtrlFloatEnable ctrlhoffset (getEdCtrlCheckState ctrlhpercent); setEdCtrlFloatCbChange ctrlxoffset mkfun3 @cb2DChangeXOffset pos2Dstr; setEdCtrlFloatCbChange ctrlyoffset mkfun3 @cb2DChangeYOffset pos2Dstr; setEdCtrlFloatCbChange ctrlwoffset mkfun3 @cb2DChangeWOffset pos2Dstr; setEdCtrlFloatCbChange ctrlhoffset mkfun3 @cb2DChangeHOffset pos2Dstr; fillEdCtrlSelect ctrlxalign (loc "OS3D_0650")::(loc "OS3D_0654")::(loc "OS3D_0651")::nil; fillEdCtrlSelect ctrlyalign (loc "OS3D_0652")::(loc "OS3D_0654")::(loc "OS3D_0653")::nil; selectEdCtrlSelectByPos ctrlxalign xalign; selectEdCtrlSelectByPos ctrlyalign yalign; setEdCtrlSelectCb ctrlxalign mkfun4 @cb2DChangeXAlign pos2Dstr; setEdCtrlSelectCb ctrlyalign mkfun4 @cb2DChangeYAlign pos2Dstr; if (flags & iPOS_INTERFACE_2D_NO_KEEPRATIO) then nil else ( setEdCtrlCheckState ctrlratio ratio; setEdCtrlCheckCbState ctrlratio mkfun3 @cb2DChangeRatio [pos2Dstr ctrlheight ctrlhpercent ctrlhoffset]; setEdCtrlFloatEnable ctrlheight !ratio; setEdCtrlCheckEnable ctrlhpercent !ratio; setEdCtrlFloatEnable ctrlhoffset !ratio; ); setEdCtrlCheckState ctrlbackground background; setEdCtrlCheckCbState ctrlbackground mkfun3 @cb2DChangeBackground pos2Dstr; setEdCtrlFloatCbChange ctrlopacity mkfun3 @cb2DChangeOpacity pos2Dstr; setEdCtrlFloatCbChange ctrlquality mkfun3 @cb2DChangeQuality pos2Dstr; setEdCtrlFloatCbChange ctrlzorder mkfun3 @cb2DChangeZorder pos2Dstr; ); pos2Dstr; );; fun cbMatTextureName(ctrlstr, pos, elem, p)= let p -> [inst viewstr group posmatstr ctrlmatname ctrlmattech ctrlmatpass] in let getSelectedEdCtrlSelect ctrlmatname -> matname in let V3DgetDefaultSession viewstr -> sessionstr in if matname == nil || (SO3SceneGetMaterial (V3DgetSession sessionstr) group matname) == nil then nil else set posmatstr.IPMAT_iPass = pos; 0;; fun fillMaterialTextureSelector(viewstr, posmatstr, ctrlselect, mat, tech, pass)= if mat == nil then nil else let V3DgetDefaultSession viewstr -> sessionstr in let SO3MaterialNumberOfTexturesByTechniqueAndPass mat tech pass -> size in let 0 -> i in let nil -> lmatname in ( while i < size do ( let SO3MaterialTextureUnitGetNameByIndex mat tech pass i -> matname in set lmatname = lcat lmatname matname::nil; set i = i + 1; ); fillEdCtrlSelect ctrlselect lmatname; set posmatstr.IPMAT_iTexture = 0; ); 0;; fun cbMatPassName(ctrlstr, pos, elem, p)= let p -> [inst viewstr group posmatstr ctrlmatname ctrlmattech ctrlmattex] in let getSelectedEdCtrlSelectPos ctrlmattech -> tech in let getSelectedEdCtrlSelect ctrlmatname -> matname in let V3DgetDefaultSession viewstr -> sessionstr in let if matname != nil then SO3SceneGetMaterial (V3DgetSession sessionstr) group matname else nil -> mat in if mat == nil then nil else ( fillMaterialTextureSelector viewstr posmatstr ctrlmattex mat tech pos; set posmatstr.IPMAT_iPass = pos; ); 0;; fun fillMaterialPassSelector(viewstr, p, mat, tech)= let p -> [posmatstr ctrlselect ctrlmatname ctrlmattech ctrlmattex] in if mat == nil then nil else let V3DgetDefaultSession viewstr -> sessionstr in let SO3MaterialNumberOfPassesByTechnique mat tech -> size in let 0 -> i in let nil -> lmatname in ( while i < size do ( let SO3MaterialPassGetNameByIndex mat tech i -> matname in let if (!strcmp matname "") then (itoa i) else matname -> matname in set lmatname = lcat lmatname matname::nil; set i = i + 1; ); fillEdCtrlSelect ctrlselect lmatname; set posmatstr.IPMAT_iPass = 0; fillMaterialTextureSelector viewstr posmatstr ctrlmattex mat tech 0; ); 0;; fun cbMatTechniqueName(ctrlstr, pos, elem, p)= let p -> [inst viewstr group posmatstr ctrlmatname ctrlmatpass ctrlmattex] in let getSelectedEdCtrlSelect ctrlmatname -> matname in let V3DgetDefaultSession viewstr -> sessionstr in let if matname != nil then SO3SceneGetMaterial (V3DgetSession sessionstr) group matname else nil -> mat in if mat == nil then nil else ( fillMaterialPassSelector viewstr [posmatstr ctrlmatpass ctrlmatname ctrlstr ctrlmattex] mat pos; set posmatstr.IPMAT_iTechnique = pos; ); 0;; fun fillMaterialTechSelector(viewstr, p, mat)= let p -> [posmatstr ctrlselect ctrlmatname ctrlmatpass ctrlmattex] in if mat == nil then nil else let V3DgetDefaultSession viewstr -> sessionstr in let SO3MaterialNumberOfTechniques mat -> size in let 0 -> i in let nil -> lmatname in ( while i < size do ( let SO3MaterialTechniqueGetNameByIndex mat i -> matname in set lmatname = lcat lmatname matname::nil; set i = i + 1; ); fillEdCtrlSelect ctrlselect lmatname; set posmatstr.IPMAT_iTechnique = 0; fillMaterialPassSelector viewstr [posmatstr ctrlmatpass ctrlmatname ctrlselect ctrlmattex] mat 0; ); 0;; fun cbMatName(ctrlstr, pos, elem, p)= let p -> [inst viewstr group posmatstr ctrlmattech ctrlmatpass ctrlmattex] in let V3DgetDefaultSession viewstr -> sessionstr in let if elem != nil then SO3SceneGetMaterial (V3DgetSession sessionstr) group elem else nil -> mat in if mat == nil then nil else ( fillMaterialTechSelector viewstr [posmatstr ctrlmattech ctrlstr ctrlmatpass ctrlmattex] mat; set posmatstr.IPMAT_sMaterialName = elem; ); 0;; fun fillMaterialSelector(viewstr, p, objname)= let p -> [inst posmatstr ctrlselect ctrlmattech ctrlmatpass ctrlmattex] in if objname == nil then nil else let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) objname -> obj in let SO3EntityGetResourceGroup obj -> group in let SO3EntityMaterialList obj -> lmat in let nil -> lmatname in ( setEdCtrlSelectCb ctrlselect mkfun4 @cbMatName [inst viewstr group posmatstr ctrlmattech ctrlmatpass ctrlmattex]; setEdCtrlSelectCb ctrlmattech mkfun4 @cbMatTechniqueName [inst viewstr group posmatstr ctrlselect ctrlmatpass ctrlmattex]; setEdCtrlSelectCb ctrlmatpass mkfun4 @cbMatPassName [inst viewstr group posmatstr ctrlselect ctrlmattech ctrlmattex]; setEdCtrlSelectCb ctrlmattex mkfun4 @cbMatTextureName [inst viewstr group posmatstr ctrlselect ctrlmattech ctrlmatpass]; let sizelist lmat -> size in let 0 -> i in while i < size do ( let nth_list lmat i -> mat in let SO3MaterialGetName mat -> matname in set lmatname = matname::lmatname; set i = i + 1; ); set lmatname = revertlist lmatname; fillEdCtrlSelect ctrlselect lmatname; set posmatstr.IPMAT_sMaterialName = hd lmatname; fillMaterialTechSelector viewstr [posmatstr ctrlmattech ctrlselect ctrlmatpass ctrlmattex] (SO3SceneGetMaterial (V3DgetSession sessionstr) group (hd lmatname)); ); 0;; fun cbMatSelectObj(val, type, p)= let p -> [inst winstr viewstr posmatstr ctrlobjname ctrlmatname ctrlmattech ctrlmatpass ctrlmattex] in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> obj in if obj == nil then nil else ( setEdCtrlTextLineValue ctrlobjname val; set posmatstr.IPMAT_sObjectName = val; fillMaterialSelector viewstr [inst posmatstr ctrlmatname ctrlmattech ctrlmatpass ctrlmattex] val; ); 0;; fun cbMatCloseRes(ctrlbtn)= setEdCtrlButtonEnable ctrlbtn 1; 0;; fun cbMatBtnPickObj(ctrlbtn, p)= let p -> [inst winstr viewstr posmatstr ctrlobjname ctrlmatname ctrlmattech ctrlmatpass ctrlmattex objname] in ( setEdCtrlButtonEnable ctrlbtn 0; dlgSelectPluginInstanceResource inst winstr iTypeEntity objname mkfun3 @cbMatSelectObj [inst winstr viewstr posmatstr ctrlobjname ctrlmatname ctrlmattech ctrlmatpass ctrlmattex] mkfun1 @cbMatCloseRes ctrlbtn 0; ); 0;; fun cbMatRefreshBtnSpec(pickbtn, p)= let p -> [posmatstr ctrlobjname ctrlmatname ctrlmattech ctrlmatpass ctrlmattex] in ( setEdCtrlTextLineValue ctrlobjname ""; set posmatstr.IPMAT_sObjectName = ""; fillEdCtrlSelect ctrlmatname nil; fillEdCtrlSelect ctrlmattech nil; fillEdCtrlSelect ctrlmatpass nil; fillEdCtrlSelect ctrlmattex nil; set posmatstr.IPMAT_sMaterialName = nil; set posmatstr.IPMAT_iTechnique = nil; set posmatstr.IPMAT_iPass = nil; set posmatstr.IPMAT_iTexture = nil; ); 0;; fun cbMatChangeWidth(ctrlstr, value, posmatstr)= mutate posmatstr.IPMAT_tSize <- [value _]; 0;; fun cbMatChangeHeight(ctrlstr, value, posmatstr)= mutate posmatstr.IPMAT_tSize <- [_ value]; 0;; fun cbMatChangeOpacity(ctrlstr, value, posmatstr)= set posmatstr.IPMAT_iOpacity = ftoi value; 0;; fun cbMatChangeQuality(ctrlstr, value, posmatstr)= set posmatstr.IPMAT_iQuality = ftoi value; 0;; fun showMatPositionInterface(inst, viewstr, pwinstr, posmatstr, ix, iy, iw, ih)= let 10 -> ypos in ( let posmatstr.IPMAT_sObjectName -> objname in let posmatstr.IPMAT_sMaterialName -> matname in let posmatstr.IPMAT_iTechnique -> technique in let posmatstr.IPMAT_iPass -> pass in let posmatstr.IPMAT_iTexture -> texture in let posmatstr.IPMAT_tSize -> [width height] in let posmatstr.IPMAT_iOpacity -> opacity in let posmatstr.IPMAT_iQuality -> quality in let crEdWindow _channel pwinstr ix iy iw 235 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crEdCtrlLabel winstr 10 ((set ypos = 10) + 2) 170 20 (loc "OS3D_0655") nil -> labelobj in let crEdCtrlTextLine winstr 180 ypos 170 20 objname nil EDWIN_RESIZE_MW -> ctrlobjname in let crEdCtrlButton winstr 360 ypos 55 20 "..." nil -> pickbtn in let crEdCtrlButton winstr 420 ypos 35 20 "X" nil -> refreshobjname in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 170 20 (loc "OS3D_0656") nil -> labelmat in let crEdCtrlSelect winstr 180 ypos (iw - 180) 120 EDWIN_RESIZE_MW -> ctrlmatname in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 170 20 (loc "OS3D_0657") nil -> labeltech in let crEdCtrlSelect winstr 180 ypos (iw - 180) 120 EDWIN_RESIZE_MW -> ctrlmattech in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 170 20 (loc "OS3D_0658") nil -> labelpass in let crEdCtrlSelect winstr 180 ypos (iw - 180) 120 EDWIN_RESIZE_MW -> ctrlmatpass in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 170 20 (loc "OS3D_0659") nil -> labelpass in let crEdCtrlSelect winstr 180 ypos (iw - 180) 120 EDWIN_RESIZE_MW -> ctrlmattex in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3D_0645") nil -> labelw in let crEdCtrlFloat winstr 180 ypos 100 20 width 0.0 10000.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlwidth in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3D_0646") nil -> labelh in let crEdCtrlFloat winstr 180 ypos 100 20 height 0.0 10000.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlheight in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3D_0640") nil -> labelopacity in let crEdCtrlFloat winstr 180 ypos 100 20 itof opacity 0.0 100.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlopacity in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3D_0641") nil -> labelquality in let crEdCtrlFloat winstr 180 ypos 100 20 itof quality 1.0 100.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlquality in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) objname -> obj in let SO3EntityGetResourceGroup obj -> group in ( set posmatstr.IPMAT_winstr = winstr; setEdCtrlButtonCb pickbtn mkfun2 @cbMatBtnPickObj [inst winstr viewstr posmatstr ctrlobjname ctrlmatname ctrlmattech ctrlmatpass ctrlmattex objname]; setEdCtrlTextLineEnable ctrlobjname 0; setEdCtrlButtonCb refreshobjname mkfun2 @cbMatRefreshBtnSpec [posmatstr ctrlobjname ctrlmatname ctrlmattech ctrlmatpass ctrlmattex]; fillMaterialSelector viewstr [inst posmatstr ctrlmatname ctrlmattech ctrlmatpass ctrlmattex] objname; selectEdCtrlSelect ctrlmatname matname; set posmatstr.IPMAT_sMaterialName = matname; let SO3SceneGetMaterial (V3DgetSession sessionstr) group matname -> mat in if mat == nil then nil else ( fillMaterialTechSelector viewstr [posmatstr ctrlmattech ctrlmatname ctrlmatpass ctrlmattex] mat; selectEdCtrlSelectByPos ctrlmattech technique; set posmatstr.IPMAT_iTechnique = technique; fillMaterialPassSelector viewstr [posmatstr ctrlmatpass ctrlmatname ctrlmattech ctrlmattex] mat technique; selectEdCtrlSelectByPos ctrlmatpass pass; set posmatstr.IPMAT_iPass = pass; fillMaterialTextureSelector viewstr posmatstr ctrlmattex mat technique pass; selectEdCtrlSelectByPos ctrlmattex texture; set posmatstr.IPMAT_iTexture = texture; ); setEdCtrlFloatCbChange ctrlwidth mkfun3 @cbMatChangeWidth posmatstr; setEdCtrlFloatCbChange ctrlheight mkfun3 @cbMatChangeHeight posmatstr; setEdCtrlFloatCbChange ctrlopacity mkfun3 @cbMatChangeOpacity posmatstr; setEdCtrlFloatCbChange ctrlquality mkfun3 @cbMatChangeQuality posmatstr; posmatstr; ); );; fun cb3DSelectObj(val, type, p)= let p -> [inst winstr viewstr pos3Dstr ctrlobjname] in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> obj in if (obj != nil) || (!strcmpi "Current camera" val) || (!strcmpi "Current camera shell" val) then ( setEdCtrlTextLineValue ctrlobjname val; set pos3Dstr.IP3D_sParentName = val; ); 0;; fun cb3DCloseRes(ctrlbtn)= setEdCtrlButtonEnable ctrlbtn 1; 0;; fun cb3DBtnPickObj(ctrlbtn, p)= let p -> [inst winstr viewstr pos3Dstr ctrlobjname objname] in ( setEdCtrlButtonEnable ctrlbtn 0; dlgSelectPluginInstanceResource inst winstr iTypeEntity|iTypeNode|iTypeLight|iTypeCamera|iTypeParticle|iTypeBone|iTypeCubeMap objname mkfun3 @cb3DSelectObj [inst winstr viewstr pos3Dstr ctrlobjname] mkfun1 @cb3DCloseRes ctrlbtn 0; ); 0;; fun cb3DRefreshBtn(pickbtn, p)= let p -> [pos3Dstr ctrlobjname] in ( setEdCtrlTextLineValue ctrlobjname ""; set pos3Dstr.IP3D_sParentName = ""; ); 0;; fun cb3DChangeWidth(ctrlstr, value, pos3Dstr)= mutate pos3Dstr.IP3D_tSize <- [value _]; 0;; fun cb3DChangeHeight(ctrlstr, value, pos3Dstr)= mutate pos3Dstr.IP3D_tSize <- [_ value]; 0;; fun cb3DChangeXOffset(ctrlstr, value, pos3Dstr)= mutate pos3Dstr.IP3D_tOffset <- [value _]; 0;; fun cb3DChangeYOffset(ctrlstr, value, pos3Dstr)= mutate pos3Dstr.IP3D_tOffset <- [_ value]; 0;; fun cb3DChangeScale(ctrlstr, value, pos3Dstr)= set pos3Dstr.IP3D_fScale = value; 0;; fun cb3DChangeOpacity(ctrlstr, value, pos3Dstr)= set pos3Dstr.IP3D_iOpacity = ftoi value; 0;; fun cb3DChangeQuality(ctrlstr, value, pos3Dstr)= set pos3Dstr.IP3D_iQuality = ftoi value; 0;; fun cb3DChangeConstSize(ctrlstr, state, p)= let p -> [pos3Dstr ctrlmaxautoscaledist] in ( setEdCtrlFloatEnable ctrlmaxautoscaledist state; set pos3Dstr.IP3D_bConstantSize = state; ); 0;; fun cb3DChangeMaxAutoscaleDist(ctrlstr, value, pos3Dstr)= set pos3Dstr.IP3D_fMaxAutoscaleDist = value; 0;; fun cb3DChangeTarget(ctrlstr, state, pos3Dstr)= set pos3Dstr.IP3D_bTarget = state; 0;; fun cb3DChangeOnTop(ctrlstr, state, pos3Dstr)= set pos3Dstr.IP3D_bShowOnTop = state; 0;; fun show3DPositionInterface(inst, viewstr, pwinstr, pos3Dstr, ix, iy, iw, ih)= let 10 -> ypos in ( let pos3Dstr.IP3D_sParentName -> objname in let pos3Dstr.IP3D_tSize -> [width height] in let pos3Dstr.IP3D_tOffset -> [xoffset yoffset] in let pos3Dstr.IP3D_fScale -> scale in let pos3Dstr.IP3D_iOpacity -> opacity in let pos3Dstr.IP3D_iQuality -> quality in let pos3Dstr.IP3D_bConstantSize -> constsize in let pos3Dstr.IP3D_fMaxAutoscaleDist -> maxautoscaledist in let pos3Dstr.IP3D_bTarget -> target in let pos3Dstr.IP3D_bShowOnTop -> showontop in let crEdWindow _channel pwinstr ix iy iw 260 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crEdCtrlLabel winstr 10 ((set ypos = 10) + 2) 170 20 (loc "OS3D_0660") nil -> labelobj in let crEdCtrlTextLine winstr 180 ypos 170 20 objname nil EDWIN_RESIZE_MW -> ctrlobjname in let crEdCtrlButton winstr 360 ypos 55 20 "..." nil -> pickbtn in let crEdCtrlButton winstr 420 ypos 35 20 "X" nil -> refreshobjname in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 90 20 (loc "OS3D_0645") nil -> labelw in let crEdCtrlFloat winstr 180 ypos 100 20 width 0.0 10000.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlwidth in let crEdCtrlLabel winstr 290 (ypos + 2) 60 20 (loc "OS3D_0644") nil -> labelxo in let crEdCtrlFloat winstr 355 ypos 60 20 xoffset (-.10000.0) 10000.0 0.1 4 nil EDWIN_RESIZE_MW -> ctrlxoffset in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 90 20 (loc "OS3D_0646") nil -> labelh in let crEdCtrlFloat winstr 180 ypos 100 20 height 0.0 10000.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlheight in let crEdCtrlLabel winstr 290 (ypos + 2) 60 20 (loc "OS3D_0644") nil -> labelyo in let crEdCtrlFloat winstr 355 ypos 60 20 yoffset (-.10000.0) 10000.0 0.1 4 nil EDWIN_RESIZE_MW -> ctrlyoffset in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3D_0664") nil -> labelscale in let crEdCtrlFloat winstr 180 ypos 100 20 scale 0.001 10000.0 0.1 3 nil EDWIN_RESIZE_MW -> ctrlscale in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3D_0640") nil -> labelopacity in let crEdCtrlFloat winstr 180 ypos 100 20 itof opacity 0.0 100.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlopacity in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3D_0641") nil -> labelquality in let crEdCtrlFloat winstr 180 ypos 100 20 itof quality 1.0 100.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlquality in let crEdCtrlCheck winstr 10 (set ypos = ypos + 25) 280 20 (loc "OS3D_0661") EDWIN_RESIZE_MW -> ctrlconstsize in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3D_0671") nil -> labelmaxautoscaledist in let crEdCtrlFloat winstr 180 ypos 100 20 maxautoscaledist 0.0 1000000.0 1.0 4 nil EDWIN_RESIZE_MW -> ctrlmaxautoscaledist in let crEdCtrlCheck winstr 10 (set ypos = ypos + 25) 280 20 (loc "OS3D_0662") EDWIN_RESIZE_MW -> ctrltarget in let crEdCtrlCheck winstr 10 (set ypos = ypos + 25) 280 20 (loc "OS3D_0663") EDWIN_RESIZE_MW -> ctrlontop in ( set pos3Dstr.IP3D_winstr = winstr; setEdCtrlTextLineEnable ctrlobjname 0; setEdCtrlButtonCb pickbtn mkfun2 @cb3DBtnPickObj [inst winstr viewstr pos3Dstr ctrlobjname objname]; setEdCtrlButtonCb refreshobjname mkfun2 @cb3DRefreshBtn [pos3Dstr ctrlobjname]; setEdCtrlFloatCbChange ctrlwidth mkfun3 @cb3DChangeWidth pos3Dstr; setEdCtrlFloatCbChange ctrlxoffset mkfun3 @cb3DChangeXOffset pos3Dstr; setEdCtrlFloatCbChange ctrlheight mkfun3 @cb3DChangeHeight pos3Dstr; setEdCtrlFloatCbChange ctrlyoffset mkfun3 @cb3DChangeYOffset pos3Dstr; setEdCtrlFloatCbChange ctrlscale mkfun3 @cb3DChangeScale pos3Dstr; setEdCtrlFloatCbChange ctrlopacity mkfun3 @cb3DChangeOpacity pos3Dstr; setEdCtrlFloatCbChange ctrlquality mkfun3 @cb3DChangeQuality pos3Dstr; setEdCtrlCheckState ctrlconstsize constsize; setEdCtrlCheckCbState ctrlconstsize mkfun3 @cb3DChangeConstSize [pos3Dstr ctrlmaxautoscaledist]; setEdCtrlFloatCbChange ctrlmaxautoscaledist mkfun3 @cb3DChangeMaxAutoscaleDist pos3Dstr; setEdCtrlFloatEnable ctrlmaxautoscaledist (getEdCtrlCheckState ctrlconstsize); setEdCtrlCheckState ctrltarget target; setEdCtrlCheckState ctrlontop showontop; setEdCtrlCheckCbState ctrltarget mkfun3 @cb3DChangeTarget pos3Dstr; setEdCtrlCheckCbState ctrlontop mkfun3 @cb3DChangeOnTop pos3Dstr; pos3Dstr; ); );; fun cbVRChangeWidth(ctrlstr, value, posvrstr)= mutate posvrstr.IPVR_tSize <- [value _]; 0;; fun cbVRChangeHeight(ctrlstr, value, posvrstr)= mutate posvrstr.IPVR_tSize <- [_ value]; 0;; fun cbVRChangeScale(ctrlstr, value, posvrstr)= set posvrstr.IPVR_fScale = value; 0;; fun cbVRChangeOpacity(ctrlstr, value, posvrstr)= set posvrstr.IPVR_iOpacity = ftoi value; 0;; fun cbVRChangeQuality(ctrlstr, value, posvrstr)= set posvrstr.IPVR_iQuality = ftoi value; 0;; fun cbVRChangeZorder(ctrlstr, value, posvrstr)= set posvrstr.IPVR_iZorder = ftoi value; 0;; fun showVrPositionInterface(inst, pwinstr, posvrstr, ix, iy, iw, ih)= let 10 -> ypos in ( let posvrstr.IPVR_tSize -> [width height] in let posvrstr.IPVR_fScale -> scale in let posvrstr.IPVR_iOpacity -> opacity in let posvrstr.IPVR_iQuality -> quality in let posvrstr.IPVR_iZorder -> zorder in let crEdWindow _channel pwinstr ix iy iw 160 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crEdCtrlLabel winstr 10 ((set ypos = 10) + 2) 90 20 (loc "OS3D_0645") nil -> labelw in let crEdCtrlFloat winstr 180 ypos 100 20 width 0.0 10000.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlwidth in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 90 20 (loc "OS3D_0646") nil -> labelh in let crEdCtrlFloat winstr 180 ypos 100 20 height 0.0 10000.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlheight in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3D_0664") nil -> labelscale in let crEdCtrlFloat winstr 180 ypos 100 20 scale 0.001 10000.0 0.1 3 nil EDWIN_RESIZE_MW -> ctrlscale in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3D_0640") nil -> labelopacity in let crEdCtrlFloat winstr 180 ypos 100 20 itof opacity 0.0 100.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlopacity in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3D_0641") nil -> labelquality in let crEdCtrlFloat winstr 180 ypos 100 20 itof quality 1.0 100.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlquality in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3D_0649") nil -> labelzorder in let crEdCtrlFloat winstr 180 ypos 100 20 itof zorder 0.0 10000.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlzorder in ( set posvrstr.IPVR_winstr = winstr; setEdCtrlFloatCbChange ctrlwidth mkfun3 @cbVRChangeWidth posvrstr; setEdCtrlFloatCbChange ctrlheight mkfun3 @cbVRChangeHeight posvrstr; setEdCtrlFloatCbChange ctrlscale mkfun3 @cbVRChangeScale posvrstr; setEdCtrlFloatCbChange ctrlopacity mkfun3 @cbVRChangeOpacity posvrstr; setEdCtrlFloatCbChange ctrlquality mkfun3 @cbVRChangeQuality posvrstr; setEdCtrlFloatCbChange ctrlzorder mkfun3 @cbVRChangeZorder posvrstr; posvrstr; ); );; fun updateWinstr(p, flags, nbmode, mode, prevsize)= let p -> [ewinstr winfrm winstr iw] in let if nbmode == 1 then 0 else 35 -> basewinsize in let if (prevsize > 0) then prevsize else (-25 - basewinsize) -> prevsize in let if (mode == 0) then (235 - (25 * if flags & iPOS_INTERFACE_2D_NO_BACKGROUND then 1 else 0) - (25 * if flags & iPOS_INTERFACE_2D_NO_KEEPRATIO then 1 else 0) ) else 0 -> subwinsize in //2D let if (mode == 1) then 235 else subwinsize -> subwinsize in //Mat let if (mode == 2) then 260 else subwinsize -> subwinsize in //3D let if (mode == 3) then 160 else subwinsize -> subwinsize in //VR let _GETwindowPositionSize ewinstr.EDW_win -> [_ _ w h] in ( setEdWindowSize ewinstr w (h - (25 + basewinsize + prevsize) + (25 + basewinsize + subwinsize)); setEdWindowSize winfrm iw (25 + basewinsize + subwinsize); setEdWindowSize winstr iw (basewinsize + subwinsize); subwinsize; );; fun cbInterfaceMode(ctrlstr, state, p)= let p -> [inst viewstr ctrl2D ctrlonmat ctrl3D ctrlvr nbmode posstr flags toUpdate] in let toUpdate -> [_ _ winstr iw] in if state == 0 then nil else ( if (ctrl2D == ctrlstr) then ( set posstr.IP_iMode = 0; if (posstr.IP_pos2Dstr == nil) then ( set posstr.IP_pos2Dstr = show2DPositionInterface inst winstr (loadInterfacePos2D inst) flags 0 35 iw nil; 0; ) else ( setEdWindowVisible posstr.IP_pos2Dstr.IP2D_winstr 1; 0; ); ) else ( setEdCtrlRadioState ctrl2D 0; setEdWindowVisible posstr.IP_pos2Dstr.IP2D_winstr 0; 0; ); if (ctrlonmat == ctrlstr) then ( set posstr.IP_iMode = 1; if (posstr.IP_posmatstr == nil) then ( set posstr.IP_posmatstr = showMatPositionInterface inst viewstr winstr (loadInterfacePosMat inst nil) 0 35 iw nil; 0; ) else ( setEdWindowVisible posstr.IP_posmatstr.IPMAT_winstr 1; 0; ); ) else ( setEdCtrlRadioState ctrlonmat 0; setEdWindowVisible posstr.IP_posmatstr.IPMAT_winstr 0; 0; ); if (ctrl3D == ctrlstr) then ( set posstr.IP_iMode = 2; if (posstr.IP_pos3Dstr == nil) then ( set posstr.IP_pos3Dstr = show3DPositionInterface inst viewstr winstr (loadInterfacePos3D inst nil) 0 35 iw nil; 0; ) else ( setEdWindowVisible posstr.IP_pos3Dstr.IP3D_winstr 1; 0; ); ) else ( setEdCtrlRadioState ctrl3D 0; setEdWindowVisible posstr.IP_pos3Dstr.IP3D_winstr 0; 0; ); if (ctrlvr == ctrlstr) then ( set posstr.IP_iMode = 3; if (posstr.IP_posvrstr == nil) then ( set posstr.IP_posvrstr = showVrPositionInterface inst winstr (loadInterfacePosVR inst) 0 35 iw nil; 0; ) else ( setEdWindowVisible posstr.IP_posvrstr.IPVR_winstr 1; 0; ); ) else ( setEdCtrlRadioState ctrlvr 0; setEdWindowVisible posstr.IP_posvrstr.IPVR_winstr 0; 0; ); set posstr.IP_iPrevWinSize = updateWinstr toUpdate flags nbmode posstr.IP_iMode posstr.IP_iPrevWinSize; ); 0;; fun crPositionInterface(inst, viewstr, ewinstr, winname, flags, iw, ih)= let 10 -> ypos in ( let if ((winname != nil) && ((strcmpi winname "") != 0)) then winname else (loc "OS3D_0635") -> winname in let crEdFrameWindow _channel ewinstr 0 0 iw 220 EDWIN_RESIZE_MW nil winname (loc "OS3D_0250") -> winfrm in let crEdWindow _channel winfrm 0 18 iw 195 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let ((iPOS_INTERFACE_2D | iPOS_INTERFACE_2D_NO_BACKGROUND | iPOS_INTERFACE_2D_NO_KEEPRATIO) & flags) + (iPOS_INTERFACE_MAT & flags) + (iPOS_INTERFACE_3D & flags) + (iPOS_INTERFACE_VR & flags) -> nbmode in let (-100) -> xpos in let if (nbmode == 0) || ((nbmode > 1) && ((iPOS_INTERFACE_2D | iPOS_INTERFACE_2D_NO_BACKGROUND | iPOS_INTERFACE_2D_NO_KEEPRATIO) & flags)) then crEdCtrlRadio winstr (set xpos = 10) (set ypos = 10) 100 20 (loc "OS3D_0636") EDWIN_RESIZE_MW else nil -> ctrl2D in let if (nbmode == 0) || ((nbmode > 1) && (iPOS_INTERFACE_MAT & flags)) then crEdCtrlRadio winstr (set xpos = xpos + 110) (set ypos = 10) 100 20 (loc "OS3D_0637") EDWIN_RESIZE_MW else nil -> ctrlonmat in let if (nbmode == 0) || ((nbmode > 1) && (iPOS_INTERFACE_3D & flags)) then crEdCtrlRadio winstr (set xpos = xpos + 110) (set ypos = 10) 100 20 (loc "OS3D_0638") EDWIN_RESIZE_MW else nil -> ctrl3D in let if (nbmode == 0) || ((nbmode > 1) && (iPOS_INTERFACE_VR & flags)) then crEdCtrlRadio winstr (set xpos = xpos + 110) (set ypos = 10) 100 20 (loc "OS3D_0639") EDWIN_RESIZE_MW else nil -> ctrlvr in // get the saved mode. If there isn't a seved mode, take a default mode according to the available modes let atoi (getPluginInstanceParam inst "interface mode") -> mode in let if mode == nil then ( if ((iPOS_INTERFACE_2D | iPOS_INTERFACE_2D_NO_BACKGROUND | iPOS_INTERFACE_2D_NO_KEEPRATIO) & flags) then 0 else if (iPOS_INTERFACE_MAT & flags) then 1 else if (iPOS_INTERFACE_3D & flags) then 2 else if (iPOS_INTERFACE_VR & flags) then 3 else 0; ) else mode -> mode in let if (nbmode == 1) then 0 else ypos + 25 -> ypos in let if (mode == 0) then show2DPositionInterface inst winstr (loadInterfacePos2D inst) flags 0 ypos iw ih else nil -> pos2Dstr in let if (mode == 1) then showMatPositionInterface inst viewstr winstr (loadInterfacePosMat inst nil) 0 ypos iw ih else nil -> posmatstr in let if (mode == 2) then show3DPositionInterface inst viewstr winstr (loadInterfacePos3D inst nil) 0 ypos iw ih else nil -> pos3Dstr in let if (mode == 3) then showVrPositionInterface inst winstr (loadInterfacePosVR inst) 0 ypos iw ih else nil -> posvrstr in let [ewinstr winfrm winstr iw] -> toUpdate in let mkInterfacePos [mode pos2Dstr posmatstr pos3Dstr posvrstr 0] -> posstr in ( set posstr.IP_iPrevWinSize = updateWinstr toUpdate flags nbmode mode 0; setEdCtrlRadioState ctrl2D (mode == 0); setEdCtrlRadioState ctrlonmat (mode == 1); setEdCtrlRadioState ctrl3D (mode == 2); setEdCtrlRadioState ctrlvr (mode == 3); setEdCtrlRadioCbState ctrl2D mkfun3 @cbInterfaceMode [inst viewstr ctrl2D ctrlonmat ctrl3D ctrlvr nbmode posstr flags toUpdate]; setEdCtrlRadioCbState ctrlonmat mkfun3 @cbInterfaceMode [inst viewstr ctrl2D ctrlonmat ctrl3D ctrlvr nbmode posstr flags toUpdate]; setEdCtrlRadioCbState ctrl3D mkfun3 @cbInterfaceMode [inst viewstr ctrl2D ctrlonmat ctrl3D ctrlvr nbmode posstr flags toUpdate]; setEdCtrlRadioCbState ctrlvr mkfun3 @cbInterfaceMode [inst viewstr ctrl2D ctrlonmat ctrl3D ctrlvr nbmode posstr flags toUpdate]; posstr; ); );; fun cbPopupCancel(ctrlbtn, winstr)= dsEdWindow winstr; 0;; fun cbPopupDestroy(winstr, ctrlbtn)= setEdCtrlButtonEnable ctrlbtn 1; 0;; fun cbPopup2DOk(ctrlbtn, p)= let p -> [winstr posstr pos2Dstrcpy] in ( set posstr.IP_pos2Dstr = pos2Dstrcpy; dsEdWindow winstr; ); 0;; fun cbPopupMatOk(ctrlbtn, p)= let p -> [winstr posstr posmatstrcpy] in ( set posstr.IP_posmatstr = posmatstrcpy; dsEdWindow winstr; ); 0;; fun cbPopup3DOk(ctrlbtn, p)= let p -> [winstr posstr pos3Dstrcpy] in ( set posstr.IP_pos3Dstr = pos3Dstrcpy; dsEdWindow winstr; ); 0;; fun cbPopupVROk(ctrlbtn, p)= let p -> [winstr posstr posvrstrcpy] in ( set posstr.IP_posvrstr = posvrstrcpy; dsEdWindow winstr; ); 0;; fun cbPopup2Dbtn(ctrlbtn, p)= let p -> [inst pwinstr viewstr posstr flags] in let _GETscreenSize -> [sw sh] in let [465 308] -> [iw ih] in let ih - (25 * if flags & iPOS_INTERFACE_2D_NO_BACKGROUND then 1 else 0) - (25 * if flags & iPOS_INTERFACE_2D_NO_KEEPRATIO then 1 else 0) -> ih in let setEdWindowIcon (crEdWindow pwinstr.EDW_channel pwinstr ((sw / 2) - (iw / 2)) ((sh / 2) - (ih / 2)) iw ih WN_NOSCOL|WN_MENU nil nil (loc "OS3D_0665")) sWinDlgIcon -> winstr in let crEdWindowToolBar winstr 0 0 iw 28 5 1 EdDefaultTheme.EDT_iToolBarColor ETB_HORIZONTAL -> tbstr in let posstr.IP_pos2Dstr -> p2D in let p2D.IP2D_tPos -> [x y] in let p2D.IP2D_tSize -> [w h] in let p2D.IP2D_tRatiosize -> [px py pw ph ox oy ow oh] in let p2D.IP2D_tAlign -> [ax ay] in let mkInterfacePos2D [p2D.IP2D_winstr [x y] [w h] [px py pw ph ox oy ow oh] [ax ay] p2D.IP2D_bBackground p2D.IP2D_bKeepRatio p2D.IP2D_iOpacity p2D.IP2D_iQuality p2D.IP2D_iZorder] -> pos2Dstrcpy in let show2DPositionInterface inst winstr pos2Dstrcpy flags 0 33 iw ih -> pos2Dstrcpy in let crEdCtrlButton winstr 10 (ih - 30) 90 20 "Ok" EDWIN_RESIZE_LH|EDWIN_RESIZE_RW -> okbtn in let crEdCtrlButton winstr (iw - 100) (ih - 30) 90 20 "Cancel" EDWIN_RESIZE_LH|EDWIN_RESIZE_LW -> cancelbtn in ( setEdCtrlButtonEnable ctrlbtn 0; setEdCtrlButtonCb okbtn mkfun2 @cbPopup2DOk [winstr posstr pos2Dstrcpy]; setEdCtrlButtonCb cancelbtn mkfun2 @cbPopupCancel winstr; setEdwindowCbDestroy winstr mkfun2 @cbPopupDestroy ctrlbtn; ); 0;; fun cbPopupMatbtn(ctrlbtn, p)= let p -> [inst pwinstr viewstr posstr] in let _GETscreenSize -> [sw sh] in let [465 308] -> [iw ih] in let setEdWindowIcon (crEdWindow pwinstr.EDW_channel pwinstr ((sw / 2) - (iw / 2)) ((sh / 2) - (ih / 2)) iw ih WN_NOSCOL|WN_MENU nil nil (loc "OS3D_0666")) sWinDlgIcon -> winstr in let crEdWindowToolBar winstr 0 0 iw 28 5 1 EdDefaultTheme.EDT_iToolBarColor ETB_HORIZONTAL -> tbstr in let posstr.IP_posmatstr -> pmat in let pmat.IPMAT_tSize -> [w h] in let mkInterfacePosMat [pmat.IPMAT_winstr pmat.IPMAT_sObjectName pmat.IPMAT_Object pmat.IPMAT_sMaterialName pmat.IPMAT_Material pmat.IPMAT_iTechnique pmat.IPMAT_iPass pmat.IPMAT_iTexture [w h] pmat.IPMAT_iOpacity pmat.IPMAT_iQuality] -> posmatstrcpy in let showMatPositionInterface inst viewstr winstr posmatstrcpy 0 33 iw ih -> posmatstrcpy in let crEdCtrlButton winstr 10 (ih - 30) 90 20 "Ok" EDWIN_RESIZE_LH|EDWIN_RESIZE_RW -> okbtn in let crEdCtrlButton winstr (iw - 100) (ih - 30) 90 20 "Cancel" EDWIN_RESIZE_LH|EDWIN_RESIZE_LW -> cancelbtn in ( setEdCtrlButtonEnable ctrlbtn 0; setEdCtrlButtonCb okbtn mkfun2 @cbPopupMatOk [winstr posstr posmatstrcpy]; setEdCtrlButtonCb cancelbtn mkfun2 @cbPopupCancel winstr; setEdwindowCbDestroy winstr mkfun2 @cbPopupDestroy ctrlbtn; ); 0;; fun cbPopup3Dbtn(ctrlbtn, p)= let p -> [inst pwinstr viewstr posstr] in let _GETscreenSize -> [sw sh] in let [465 333] -> [iw ih] in let setEdWindowIcon (crEdWindow pwinstr.EDW_channel pwinstr ((sw / 2) - (iw / 2)) ((sh / 2) - (ih / 2)) iw ih WN_NOSCOL|WN_MENU nil nil (loc "OS3D_0667")) sWinDlgIcon -> winstr in let crEdWindowToolBar winstr 0 0 iw 28 5 1 EdDefaultTheme.EDT_iToolBarColor ETB_HORIZONTAL -> tbstr in let posstr.IP_pos3Dstr -> p3D in let p3D.IP3D_tSize -> [w h] in let p3D.IP3D_tOffset -> [ox oy] in let mkInterfacePos3D [p3D.IP3D_winstr p3D.IP3D_sParentName p3D.IP3D_Parent [w h] [ox oy] p3D.IP3D_fScale p3D.IP3D_iOpacity p3D.IP3D_iQuality p3D.IP3D_bConstantSize p3D.IP3D_fMaxAutoscaleDist p3D.IP3D_bTarget p3D.IP3D_bShowOnTop] -> pos3Dstrcpy in let show3DPositionInterface inst viewstr winstr pos3Dstrcpy 0 33 iw ih -> pos3Dstrcpy in let crEdCtrlButton winstr 10 (ih - 30) 90 20 "Ok" EDWIN_RESIZE_LH|EDWIN_RESIZE_RW -> okbtn in let crEdCtrlButton winstr (iw - 100) (ih - 30) 90 20 "Cancel" EDWIN_RESIZE_LH|EDWIN_RESIZE_LW -> cancelbtn in ( setEdCtrlButtonEnable ctrlbtn 0; setEdCtrlButtonCb okbtn mkfun2 @cbPopup3DOk [winstr posstr pos3Dstrcpy]; setEdCtrlButtonCb cancelbtn mkfun2 @cbPopupCancel winstr; setEdwindowCbDestroy winstr mkfun2 @cbPopupDestroy ctrlbtn; ); 0;; fun cbPopupVRbtn(ctrlbtn, p)= let p -> [inst pwinstr viewstr posstr] in let _GETscreenSize -> [sw sh] in let [465 233] -> [iw ih] in let setEdWindowIcon (crEdWindow pwinstr.EDW_channel pwinstr ((sw / 2) - (iw / 2)) ((sh / 2) - (ih / 2)) iw ih WN_NOSCOL|WN_MENU nil nil (loc "OS3D_0668")) sWinDlgIcon -> winstr in let crEdWindowToolBar winstr 0 0 iw 28 5 1 EdDefaultTheme.EDT_iToolBarColor ETB_HORIZONTAL -> tbstr in let posstr.IP_posvrstr -> pvr in let pvr.IPVR_tSize -> [w h] in let mkInterfacePosVR [pvr.IPVR_winstr [w h] pvr.IPVR_fScale pvr.IPVR_iOpacity pvr.IPVR_iQuality pvr.IPVR_iZorder] -> posvrstrcpy in let showVrPositionInterface inst winstr posvrstrcpy 0 33 iw ih -> posvrstrcpy in let crEdCtrlButton winstr 10 (ih - 30) 90 20 "Ok" EDWIN_RESIZE_LH|EDWIN_RESIZE_RW -> okbtn in let crEdCtrlButton winstr (iw - 100) (ih - 30) 90 20 "Cancel" EDWIN_RESIZE_LH|EDWIN_RESIZE_LW -> cancelbtn in ( setEdCtrlButtonEnable ctrlbtn 0; setEdCtrlButtonCb okbtn mkfun2 @cbPopupVROk [winstr posstr posvrstrcpy]; setEdCtrlButtonCb cancelbtn mkfun2 @cbPopupCancel winstr; setEdwindowCbDestroy winstr mkfun2 @cbPopupDestroy ctrlbtn; ); 0;; fun cbPopupInterfaceMode(ctrlstr, state, p)= let p -> [ctrl2D ctrlonmat ctrl3D ctrlvr posstr] in if state == 0 then nil else ( if (ctrl2D == ctrlstr) then set posstr.IP_iMode = 0 else setEdCtrlRadioState ctrl2D 0; if (ctrlonmat == ctrlstr) then set posstr.IP_iMode = 1 else setEdCtrlRadioState ctrlonmat 0; if (ctrl3D == ctrlstr) then set posstr.IP_iMode = 2 else setEdCtrlRadioState ctrl3D 0; if (ctrlvr == ctrlstr) then set posstr.IP_iMode = 3 else setEdCtrlRadioState ctrlvr 0; ); 0;; fun crPopupPositionInterface(inst, viewstr, ewinstr, winname, flags, iw, ih)= let (-15) -> ypos in ( let loadInterfacePos inst nil -> posstr in let ((iPOS_INTERFACE_2D | iPOS_INTERFACE_2D_NO_BACKGROUND | iPOS_INTERFACE_2D_NO_KEEPRATIO) & flags) + (iPOS_INTERFACE_MAT & flags) + (iPOS_INTERFACE_3D & flags) + (iPOS_INTERFACE_VR & flags) -> nbmode in let crEdFrameWindow _channel ewinstr 0 0 iw 135 EDWIN_RESIZE_MW nil if winname != nil then winname else loc "OS3D_0635" (loc "OS3D_0250") -> winfrm in let crEdWindow _channel winfrm 0 18 iw 110 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let if (nbmode == 0) || ((iPOS_INTERFACE_2D | iPOS_INTERFACE_2D_NO_BACKGROUND | iPOS_INTERFACE_2D_NO_KEEPRATIO) & flags) then crEdCtrlRadio winstr 10 (set ypos = 10) 100 20 (loc "OS3D_0636") EDWIN_RESIZE_MW else nil -> ctrl2D in let if (nbmode == 0) || ((iPOS_INTERFACE_2D | iPOS_INTERFACE_2D_NO_BACKGROUND | iPOS_INTERFACE_2D_NO_KEEPRATIO) & flags) then crEdCtrlButton winstr 180 ypos 55 20 "..." nil else nil -> popupbtn2D in let if (nbmode == 0) || (iPOS_INTERFACE_MAT & flags) then crEdCtrlRadio winstr 10 (set ypos = ypos + 25) 100 20 (loc "OS3D_0637") EDWIN_RESIZE_MW else nil -> ctrlonmat in let if (nbmode == 0) || (iPOS_INTERFACE_MAT & flags) then crEdCtrlButton winstr 180 ypos 55 20 "..." nil else nil -> popupbtnmat in let if (nbmode == 0) || (iPOS_INTERFACE_3D & flags) then crEdCtrlRadio winstr 10 (set ypos = ypos + 25) 100 20 (loc "OS3D_0638") EDWIN_RESIZE_MW else nil -> ctrl3D in let if (nbmode == 0) || (iPOS_INTERFACE_3D & flags) then crEdCtrlButton winstr 180 ypos 55 20 "..." nil else nil -> popupbtn3D in let if (nbmode == 0) || (iPOS_INTERFACE_VR & flags) then crEdCtrlRadio winstr 10 (set ypos = ypos + 25) 100 20 (loc "OS3D_0639") EDWIN_RESIZE_MW else nil -> ctrlvr in let if (nbmode == 0) || (iPOS_INTERFACE_VR & flags) then crEdCtrlButton winstr 180 ypos 55 20 "..." nil else nil -> popupbtnvr in ( setEdWindowSize winfrm iw (ih + 25 + ypos + 25); setEdWindowSize winfrm iw (25 + ypos + 25); setEdWindowSize winstr iw (ypos + 25); setEdCtrlRadioState ctrl2D (posstr.IP_iMode == 0); setEdCtrlRadioState ctrlonmat (posstr.IP_iMode == 1); setEdCtrlRadioState ctrl3D (posstr.IP_iMode == 2); setEdCtrlRadioState ctrlvr (posstr.IP_iMode == 3); setEdCtrlRadioCbState ctrl2D mkfun3 @cbPopupInterfaceMode [ctrl2D ctrlonmat ctrl3D ctrlvr posstr]; setEdCtrlRadioCbState ctrlonmat mkfun3 @cbPopupInterfaceMode [ctrl2D ctrlonmat ctrl3D ctrlvr posstr]; setEdCtrlRadioCbState ctrl3D mkfun3 @cbPopupInterfaceMode [ctrl2D ctrlonmat ctrl3D ctrlvr posstr]; setEdCtrlRadioCbState ctrlvr mkfun3 @cbPopupInterfaceMode [ctrl2D ctrlonmat ctrl3D ctrlvr posstr]; setEdCtrlButtonCb popupbtn2D mkfun2 @cbPopup2Dbtn [inst winstr viewstr posstr flags]; setEdCtrlButtonCb popupbtnmat mkfun2 @cbPopupMatbtn [inst winstr viewstr posstr]; setEdCtrlButtonCb popupbtn3D mkfun2 @cbPopup3Dbtn [inst winstr viewstr posstr]; setEdCtrlButtonCb popupbtnvr mkfun2 @cbPopupVRbtn [inst winstr viewstr posstr]; posstr; ); );; /* Theme Elt Selector */ fun getThemeEltSelectorSaveFromValues(lvalues, suffix)= let if (suffix == nil) then "" else suffix -> suffix in let nil -> lsave in let sizelist lvalues -> size in let 0 -> i in ( while (i < size) do ( let nth_list lvalues i -> value in set lsave = [(strcatn "themeref"::suffix::"_"::(itoa i)::nil) value]::lsave; set i = i + 1; ); lsave; );; fun getThemeEltSelectorSave(theltselector)= let theltselector -> [lctrlthemerefs] in let nil -> lsave in let sizelist lctrlthemerefs -> size in let 0 -> i in ( while (i < size) do ( let nth_list lctrlthemerefs i -> [_ ctrlthemeref _ _] in let getSelectedEdCtrlSelect ctrlthemeref -> value in set lsave = [(strcat "themeref_" (itoa i)) value]::lsave; set i = i + 1; ); lsave; );; fun setThemeEltSelectorEnable(theltselector, state)= let theltselector -> [lctrlthemerefs] in let sizelist lctrlthemerefs -> size in let 0 -> i in while (i < size) do ( let nth_list lctrlthemerefs i -> [labelthemeref ctrlthemeref _ _] in ( setEdCtrlLabelEnable labelthemeref state; setEdCtrlSelectEnable ctrlthemeref state; ); set i = i + 1; ); 0;; fun setThemeEltSelectorVisible(theltselector, state)= let theltselector -> [lctrlthemerefs] in let sizelist lctrlthemerefs -> size in let 0 -> i in while (i < size) do ( let nth_list lctrlthemerefs i -> [labelthemeref ctrlthemeref _ _] in ( setEdCtrlVisible labelthemeref state; setEdCtrlVisible ctrlthemeref state; ); set i = i + 1; ); 0;; fun getThemeEltSelectorThemeValues(theltselector)= let theltselector -> [lctrlthemerefs] in let nil -> lvalues in let sizelist lctrlthemerefs -> size in let 0 -> i in ( while (i < size) do ( let nth_list lctrlthemerefs i -> [_ ctrlthemeref _ _] in let getSelectedEdCtrlSelect ctrlthemeref -> value in set lvalues = value::lvalues; set i = i + 1; ); lvalues; );; fun setThemeEltSelectorThemeValues(theltselector, lvalues)= let theltselector -> [lctrlthemerefs] in let sizelist lctrlthemerefs -> size in let 0 -> i in while (i < size) do ( let nth_list lctrlthemerefs i -> [_ ctrlthemeref subset lthemerefs] in let nth_list lvalues i -> value in //let if (value == nil) || !(isStringInListi lthemerefs value) then subset else value -> value in selectEdCtrlSelect ctrlthemeref value; set i = i + 1; ); 0;; fun getThemeSubsetRefs(themestr, subset)= let nil -> lthemerefs in let VUIsplitThemeRef subset -> [defname eltname] in if (eltname == nil) then ( let sizelist themestr.VUITH_lDefinitions -> size in let 0 -> i in while (i < size) do ( let nth_list themestr.VUITH_lDefinitions i -> [name def] in ( if ((strcmpi name defname) != 0 && (strcmpi (VUIgetThemerefPrefix name) defname) != 0) then nil else set lthemerefs = name::lthemerefs; ); set i = i + 1; ); lthemerefs; ) else ( let switchstri themestr.VUITH_lDefinitions defname -> defstr in let switchstri defstr.VUITHD_lElements eltname -> eltstr in if (eltstr == nil) then nil else ( //Add elements from custom let switchstri themestr.VUITH_lDefinitions "custom" -> customdef in let sizelist customdef.VUITHD_lElements -> size in let 0 -> i in while (i < size) do ( let nth_list customdef.VUITHD_lElements i -> [name elt] in set lthemerefs = (strcat "custom/" name)::lthemerefs; set i = i + 1; ); // Add elements from all definition copies let if (strcmpi subset "common/font") == 0 then 1 else if (strcmpi subset "common/title") == 0 then 2 else if (strcmpi subset "common/label") == 0 then 3 else 0 -> isfontelt in //let addLogMessage strcatnSep "subset:"::subset::"isfontelt:"::(itoa isfontelt)::nil " " -> _ in let sizelist themestr.VUITH_lDefinitions -> size in let 0 -> i in while (i < size) do ( let nth_list themestr.VUITH_lDefinitions i -> [name def] in ( if ((strcmpi name defname) != 0 && (strcmpi (VUIgetThemerefPrefix name) defname) != 0) then nil else ( set lthemerefs = (strcatn name::"/"::eltname::nil)::lthemerefs; if (isfontelt <= 1) then nil else set lthemerefs = (strcat name "/font")::lthemerefs; if (isfontelt != 1 && isfontelt != 3) then nil else set lthemerefs = (strcat name "/title")::lthemerefs; if (isfontelt != 1 && isfontelt != 2) then nil else set lthemerefs = (strcat name "/label")::lthemerefs; ); ); set i = i + 1; ); lthemerefs; ); );; fun isThemeSelectorDefault(lsubsets, lvalues)= let 1 -> isdefault in ( let sizelist lsubsets -> size in let 0 -> i in while (i < size) do ( let nth_list lsubsets i -> subset in let nth_list lvalues i -> value in if ((strcmpi value subset) == 0) then nil else set isdefault = 0; set i = i + 1; ); isdefault; );; fun loadThemeEltSelectorValuesSuffix(inst, lsubsets, suffix)= let if (suffix == nil) then "" else suffix -> suffix in let nil -> lvalues in let sizelist lsubsets -> size in ( while (size > 0) do ( set size = size - 1; let nth_list lsubsets size -> subset in let getThemeSubsetRefs (getThemeFromInstance inst) subset -> lthemerefs in let getPluginInstanceParam inst (strcatn "themeref"::suffix::"_"::(itoa size)::nil) -> value in let if (value == nil) || !(isStringInListi lthemerefs value) then subset else value -> value in set lvalues = value::lvalues; ); lvalues; );; fun loadThemeEltSelectorValues(inst, lsubsets)= loadThemeEltSelectorValuesSuffix inst lsubsets "";; fun crThemeEltSelects(inst, winstr, lsubsets, lvalues, y, iw, selectxpos)= let nil -> lctrlthemerefs in let sizelist lsubsets -> size in let 0 -> i in ( while (i < size) do ( let nth_list lsubsets i -> subset in let nth_list lvalues i -> value in let strcatn (loc "OS3D_0797")::" "::subset::nil -> label in let getThemeSubsetRefs (getThemeFromInstance inst) subset -> lthemerefs in let y + 25 * i -> ypos in let 25 + (sizelist lthemerefs) * 20 -> selectheight in let crEdCtrlLabel winstr 10 ypos + 2 (selectxpos - 10) 20 label nil -> labelthemeref in let crEdCtrlSelect winstr selectxpos ypos (iw - selectxpos - 20) selectheight EDWIN_RESIZE_MW -> ctrlthemeref in ( //addLogMessage strcat "selectheight: " (itoa selectheight); fillEdCtrlSelect ctrlthemeref lthemerefs; selectEdCtrlSelect ctrlthemeref value; set lctrlthemerefs = [labelthemeref ctrlthemeref subset lthemerefs]::lctrlthemerefs; ); set i = i + 1; ); [revertlist lctrlthemerefs]; );; fun crIntegratedThemeEltSelector(inst, ewinstr, lwinstr, lsubsets, ypos, iw)= let 25 * (sizelist lsubsets) -> winheight in ( while (lwinstr != nil) do ( let hd lwinstr -> winstr in let _GETwindowPositionSize winstr.EDW_win -> [_ _ w h] in setEdWindowSize winstr w (h + winheight); set lwinstr = tl lwinstr ); let loadThemeEltSelectorValues inst lsubsets -> lvalues in let crThemeEltSelects inst ewinstr lsubsets lvalues ypos iw 180 -> theltselector in ( [winheight theltselector]; ); );; fun crThemeEltSelector(inst, ewinstr, winname, lsubsets, iw, ih)= let if ((winname != nil) && ((strcmpi winname "") != 0)) then winname else (loc "OS3D_0796") -> winname in let 10 + 25 * (sizelist lsubsets) -> winheight in let loadThemeEltSelectorValues inst lsubsets -> lvalues in let isThemeSelectorDefault lsubsets lvalues -> isdefault in ( let _GETwindowPositionSize ewinstr.EDW_win -> [_ _ w h] in setEdWindowSize ewinstr w (h + 20 + (if isdefault then 0 else winheight)); let crEdFrameWindowEx _channel ewinstr 0 0 iw (winheight + 20) EDWIN_RESIZE_MW nil winname (loc "OS3D_0250") isdefault -> winfrm in let crEdWindow _channel winfrm 0 18 iw winheight WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crThemeEltSelects inst winstr lsubsets lvalues 10 iw 180 -> theltselector in ( theltselector; ); );;