/* c3d3plug - august 2001 - by Macfly */ /* c3d3 plugin interface */ /* gestion des plugins */ struct Plug= [ filePlug : S, /* plugin definition file name */ chnPlug : Chn, /* plugin execution channel */ classPlug : S, /* plugin name */ cbnewPlug : fun [Ob] I, /* callback function for new instance */ cbendPlug : fun[] I, /* callback function for deleted instance */ paramPlug : [[S r1]r1], /* plugin general parameters */ typePlug : I, /* plugin type */ openeditorPlug : fun [ObjWin H3d HMat3d S] fun [] S, /* callback function for instance edition */ isProPlug : I /* pro state */ ]mkPlug;; typeof plugins=[Plug r1];; var preplug="preplug.pkg";; /* plugin informations values */ var PLUGIN_ONLINE_EDITING = 1;; var PLUGIN_OBJECT = 2;; var PLUGIN_MATERIAL = 4;; var PLUGIN_RESERVED = 8;; var PLUGIN_NOTRESERVED = 16;; var plugwaiting="...waiting";; fun plugbyfile(a,c)=!strcmp a.filePlug c;; fun plugbych(a,c)=a.chnPlug==c;; fun plugbyclass(a,c)=!strcmp a.classPlug c;; defcom SIniPlug=IniPlug S;; defcom SIniPlug0=IniPlug;; fun PLUG_GetFile (p) = p.filePlug;; fun PLUG_GetClass (p) = p.classPlug;; fun PLUGparams (p) = p.paramPlug;; fun PLUG_GetType (p) = p.typePlug;; fun PLUG_SetType (p, x) = set p.typePlug= x;; fun PLUGsetinfo (p, x) = PLUG_SetType p x;; /* obsolete function use PLUG_SetType instead */ fun PLUGdefineEditor(p,f)= set p.openeditorPlug=f; 0 ;; fun PLUGstartEditor(p,win,h3d,material,param) = exec p.openeditorPlug with [win h3d material param];; fun PLUGpath(p)= FILE_GetPath p.filePlug;; fun PlugDefine()= search_in_list plugins @plugbych _channel;; fun PlugParam()= let search_in_list plugins @plugbych _channel -> plug in plug.paramPlug ;; /* return strbuilded string of all plugins with their parameters */ fun PLUG_BuildStrFromList (l) = if l==nil then nil else let l->[p nxt] in (p.filePlug::(strbuild p.paramPlug)::nil)::(PLUG_BuildStrFromList nxt) ;; fun PLUG_GetStrData () = strbuild PLUG_BuildStrFromList plugins;; /* Gets the list of plugins, which are editable online */ fun PLUG_BuildOnlineEditingList (l)= if l == nil then nil else let l -> [p nl] in if (p.typePlug) & PLUGIN_ONLINE_EDITING then p::(PLUG_BuildOnlineEditingList nl) else PLUG_BuildOnlineEditingList nl ;; fun PLUG_GetOnlineEditingList () = PLUG_BuildOnlineEditingList plugins;;