/* ----------------------------------------------------------------------------- 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 ----------------------------------------------------------------------------- */ /******************************************************************************* Version: 1.0 Author: Bastien BOURINEAU Date: 10/07/2012 Warning: loading too much bitmaps at start can take long and use uncessary large amount of memory *******************************************************************************/ struct StrZone = [ PZ_font : VUIfont, PZ_sContent : S, PZ_ifColor : I, PZ_iAlign : I, PZ_tCoords : [I I I I] ] MkStrZone;; struct PlugTxtZone = [ PTZ_instance : PInstance, PTZ_bOnMaterial : I, PTZ_Material : SO3_MATERIAL, PTZ_iTechnique : I, PTZ_iPass : I, PTZ_iTexture : I, PTZ_win : SO3_WIDGET, PTZ_AlphaBuffer : AlphaBitmap, PTZ_AlphaDraw : AlphaBitmap, PTZ_iPosX : I, PTZ_iPosY : I, PTZ_iWidth : I, PTZ_iHeight : I, PTZ_tPercent : [I I I I I I I I], PTZ_tAlign : [I I], PTZ_bTransparency : I, PTZ_iOpacity : I, PTZ_iTransition : I, PTZ_fTransOpacity : F, PTZ_bUrl : I, PTZ_sPath : S, PTZ_bShow : I, PTZ_iState : I, PTZ_iTick : I, PTZ_httpReq : ObjCURL, PTZ_lZones : [StrZone r1], PTZ_iZorder : I ] MkPlugTxtZone;; var sTmpDownloadPath = "tmp/textzone/";; fun restoreTexture(obstr)= V3DremoveWidgetControl (V3DgetDefaultViewport (V3DgetSessionView c3dXsession)) obstr.PTZ_win; SO3WidgetDestroy obstr.PTZ_win; set obstr.PTZ_win = nil; _DSalphaBitmap obstr.PTZ_AlphaBuffer; _DSalphaBitmap obstr.PTZ_AlphaDraw; set obstr.PTZ_AlphaDraw = nil; set obstr.PTZ_AlphaBuffer = nil; 0;; fun drawLabel(abmp, obstr)= let obstr.PTZ_lZones -> l in while (l != nil) do ( //BT_TEXT_HORIZ_CENTERED|BT_TEXT_VERT_CENTER let hd l -> zstr in ( VUIdrawTextAlphaBitmap abmp zstr.PZ_font zstr.PZ_tCoords [0 0] zstr.PZ_ifColor zstr.PZ_iAlign zstr.PZ_sContent; /*let if ((zstr.PZ_font.VUIF_iFontType == 0) || (!(zstr.PZ_iAlign & iVUITEXT_VALIGNCENTER) && !(zstr.PZ_iAlign & iVUITEXT_VALIGNBOTTOM))) then zstr.PZ_tCoords else let G2DgetStringSize zstr.PZ_font.VUIF_Font zstr.PZ_sContent -> [_ th] in let zstr.PZ_tCoords -> [ztx zty ztw zth] in if (zstr.PZ_iAlign & iVUITEXT_VALIGNCENTER) then [ztx zty + ((zth / 2) - (th / 2) - 4) ztw zth] else [ztx zty + (zth - th - 4) ztw zth] //bottom -> rect in let if (zstr.PZ_font.VUIF_iFontType == 0) then zstr.PZ_iAlign else (zstr.PZ_iAlign & ~(iVUITEXT_VALIGNCENTER)) & ~(iVUITEXT_VALIGNBOTTOM) -> alignflags in VUIdrawTextAlphaBitmap abmp zstr.PZ_font rect [0 0] zstr.PZ_ifColor alignflags zstr.PZ_sContent;*/ ); set l = tl l; ); 0;; fun updateBuffer(obstr)= if (obstr.PTZ_win == nil) then nil else let _GETalphaBitmapSize obstr.PTZ_AlphaBuffer -> [width height] in let _GETalphaBitmapSize obstr.PTZ_AlphaDraw -> [awd ahd] in ( if ((obstr.PTZ_AlphaDraw == nil) || (width != awd) || (height != ahd)) then ( _DSalphaBitmap obstr.PTZ_AlphaDraw; let _CRbitmap _channel width height -> bmp24 in let _CRbitmap8 _channel width height -> bmp8 in set obstr.PTZ_AlphaDraw = _CRalphaBitmap _channel bmp24 bmp8 nil nil; ) else nil; let _GETalphaBitmaps obstr.PTZ_AlphaBuffer -> [colorLayer alphaLayer] in let _GETalphaBitmaps obstr.PTZ_AlphaDraw -> [colorDraw alphaDraw] in ( _CPbitmap24 colorDraw 0 0 colorLayer 0 0 width height nil; _CPbitmap8 alphaDraw 0 0 alphaLayer 0 0 width height nil; ); drawLabel obstr.PTZ_AlphaDraw obstr; SO3BitmapWidgetBlitAlpha obstr.PTZ_win obstr.PTZ_AlphaDraw; ); 0;; fun computePosSize(obstr, vw, vh)= let obstr.PTZ_tPercent -> [px py pw ph xo yo wo ho] in let obstr.PTZ_tAlign -> [ax ay] in let if pw then (ftoi (((itof obstr.PTZ_iWidth) /. 100.0) *. (itof vw))) + wo else obstr.PTZ_iWidth -> pw in let if ph then (ftoi (((itof obstr.PTZ_iHeight) /. 100.0) *. (itof vh))) + ho else obstr.PTZ_iHeight -> ph in let if px then (ftoi (((itof obstr.PTZ_iPosX) /. 100.0) *. (itof vw))) + xo else obstr.PTZ_iPosX -> px in let if (ax == 1) then ((vw / 2) - (pw / 2)) + px else if (ax == 2) then (vw - pw) - px else px -> px in let if py then (ftoi (((itof obstr.PTZ_iPosY) /. 100.0) *. (itof vh))) + yo else obstr.PTZ_iPosY -> py in let if (ay == 1) then ((vh / 2) - (ph / 2)) + py else if (ay == 2) then (vh - ph) - py else py -> py in [px py pw ph];; fun cbResizeCtrl(inst, viewstr, ww, wh, obstr)= if obstr.PTZ_win == nil || obstr.PTZ_bOnMaterial then nil else let V3DgetDefaultViewport viewstr -> viewportstr in let V3DgetViewportSize viewstr viewportstr -> [_ _ vw vh] in let computePosSize obstr vw vh -> [px py pw ph] in ( SO3WidgetSetPosition obstr.PTZ_win px py; SO3WidgetSetSize obstr.PTZ_win pw ph; updateBuffer obstr; ); 0;; fun cbFocused(widget, obstr, state)= 0;; fun createPicture(inst, obstr)= let V3DgetSessionView c3dXsession -> viewstr in let V3DgetDefaultViewport viewstr -> viewportstr in if obstr.PTZ_win != nil then nil else ( V3DremoveWidgetControl viewportstr obstr.PTZ_win; SO3WidgetDestroy obstr.PTZ_win; if obstr.PTZ_bOnMaterial then ( set obstr.PTZ_win = SO3BitmapWidgetCreateOnMaterial (V3DgetSession c3dXsession) obstr.PTZ_Material (strcat (getPluginInstanceName inst) "_txtzoneCtrl") obstr.PTZ_iWidth obstr.PTZ_iHeight obstr.PTZ_iTechnique obstr.PTZ_iPass obstr.PTZ_iTexture; 0; ) else ( let V3DgetViewportSize viewstr viewportstr -> [_ _ vw vh] in let computePosSize obstr vw vh -> [px py pw ph] in set obstr.PTZ_win = SO3BitmapWidgetCreate (V3DgetSession c3dXsession) viewportstr.V3D_viewport (strcat (getPluginInstanceName inst) "_txtzoneCtrl") px py pw ph obstr.PTZ_iZorder; SO3WidgetSetTopOnFocus obstr.PTZ_win 0; SO3WidgetSetForeground obstr.PTZ_win 1; 0; ); V3DaddWidgetControl viewportstr obstr.PTZ_win; SO3WidgetSetKeyboardEnable obstr.PTZ_win 0; SO3WidgetSetMouseEnable obstr.PTZ_win 0; SO3WidgetSetTransparency obstr.PTZ_win obstr.PTZ_bTransparency; SO3WidgetSetOpacity obstr.PTZ_win (itof obstr.PTZ_iOpacity) *. 0.01; SO3WidgetSetVisibility obstr.PTZ_win 0; ); 0;; fun cbControlPreRenderShow(inst, sessionstr, etime, obstr)= let if etime <= 1000 then 1000 else etime -> etime in let (itof obstr.PTZ_iOpacity) /. (itof obstr.PTZ_iTransition) -> step in ( set obstr.PTZ_fTransOpacity = obstr.PTZ_fTransOpacity +. (step *. (itof (etime / 1000))); if obstr.PTZ_fTransOpacity >=. (itof obstr.PTZ_iOpacity) then ( SO3WidgetSetOpacity obstr.PTZ_win (itof obstr.PTZ_iOpacity) *. 0.01; set obstr.PTZ_fTransOpacity = (itof obstr.PTZ_iOpacity); setPluginInstanceCbScenePreRender inst nil; SendPluginEvent obstr.PTZ_instance "Shown" nil nil; 0; ) else ( SO3WidgetSetOpacity obstr.PTZ_win (obstr.PTZ_fTransOpacity *. 0.01); 0; ); ); 0;; fun cbControlPreRenderHide(inst, sessionstr, etime, obstr)= let if etime <= 1000 then 1000 else etime -> etime in let (itof obstr.PTZ_iOpacity) /. (itof obstr.PTZ_iTransition) -> step in ( set obstr.PTZ_fTransOpacity = obstr.PTZ_fTransOpacity -. (step *. (itof (etime / 1000))); if obstr.PTZ_fTransOpacity <=. 0.0 then ( SO3WidgetSetOpacity obstr.PTZ_win 0.0; setPluginInstanceCbScenePreRender inst nil; set obstr.PTZ_fTransOpacity = 0.0; if (obstr.PTZ_win == nil) then nil else ( V3DremoveWidgetControl (V3DgetDefaultViewport (V3DgetSessionView c3dXsession)) obstr.PTZ_win; SO3WidgetDestroy obstr.PTZ_win; set obstr.PTZ_win = nil; _DSalphaBitmap obstr.PTZ_AlphaBuffer; set obstr.PTZ_AlphaBuffer = nil; SendPluginEvent obstr.PTZ_instance "Hidden" nil nil; ); 0; ) else ( SO3WidgetSetOpacity obstr.PTZ_win (obstr.PTZ_fTransOpacity *. 0.01); 0; ); ); 0;; fun cbDownloaded(file, data, obstr)= if data == nil then nil else let strcatn sTmpDownloadPath::(getPluginInstanceName obstr.PTZ_instance)::".tmp"::nil -> tmpfile in ( _storepack data tmpfile; let G2DloadAlphaBmp _channel tmpfile -> bmp in if bmp == nil then nil else ( if(obstr.PTZ_iState == 2) then nil else set obstr.PTZ_iState = 0; _DSalphaBitmap obstr.PTZ_AlphaBuffer; set obstr.PTZ_AlphaBuffer = bmp; if (!obstr.PTZ_bShow) then nil else ( createPicture obstr.PTZ_instance obstr; updateBuffer obstr; if (obstr.PTZ_iTransition == 0) then ( SO3WidgetSetVisibility obstr.PTZ_win 1; SendPluginEvent obstr.PTZ_instance "Shown" nil nil; 0; ) else ( SO3WidgetSetOpacity obstr.PTZ_win (obstr.PTZ_fTransOpacity *. 0.01); SO3WidgetSetVisibility obstr.PTZ_win 1; setPluginInstanceCbScenePreRender obstr.PTZ_instance mkfun4 @cbControlPreRenderShow obstr; 0; ); ); ); ); 0;; fun cbChange(inst, from, action, param, reply, obstr)= let if param == nil then obstr.PTZ_bUrl else strIsUrl param -> isurl in let if param == nil then obstr.PTZ_sPath else param -> url in ( set obstr.PTZ_bUrl = isurl; set obstr.PTZ_sPath = url; if (!obstr.PTZ_bShow) then nil else ( if(obstr.PTZ_iState == 2) then nil else set obstr.PTZ_iState = 0; if !obstr.PTZ_bUrl then ( let G2DloadAlphaBmp _channel obstr.PTZ_sPath -> bmp in if bmp == nil then nil else ( set obstr.PTZ_AlphaBuffer = bmp; createPicture inst obstr; updateBuffer obstr; SO3WidgetSetVisibility obstr.PTZ_win 1; ); 0; ) else ( if (obstr.PTZ_httpReq == nil) then nil else ( killHttpRequest obstr.PTZ_httpReq; set obstr.PTZ_httpReq = nil; ); set obstr.PTZ_httpReq = downloadFile obstr.PTZ_sPath mkfun3 @cbDownloaded obstr; 0; ); ); ); 0;; fun cbSetLabel(inst, from, action, param, reply, p)= let p -> [obstr zstr] in ( set zstr.PZ_sContent = param; updateBuffer obstr; ); 0;; fun cbShow(inst, from, action, param, reply, obstr)= if (obstr.PTZ_bShow) then nil else ( setPluginInstanceCbScenePreRender inst nil; if(obstr.PTZ_iState == 2) then nil else set obstr.PTZ_iState = 0; if !obstr.PTZ_bUrl then ( let G2DloadAlphaBmp _channel obstr.PTZ_sPath -> bmp in if bmp == nil then nil else ( set obstr.PTZ_AlphaBuffer = bmp; createPicture inst obstr; updateBuffer obstr; if (obstr.PTZ_iTransition == 0) then ( SO3WidgetSetVisibility obstr.PTZ_win 1; SendPluginEvent obstr.PTZ_instance "Shown" nil nil; 0; ) else ( SO3WidgetSetOpacity obstr.PTZ_win (obstr.PTZ_fTransOpacity *. 0.01); SO3WidgetSetVisibility obstr.PTZ_win 1; setPluginInstanceCbScenePreRender inst mkfun4 @cbControlPreRenderShow obstr; 0; ); ); 0; ) else ( if (obstr.PTZ_httpReq == nil) then nil else ( killHttpRequest obstr.PTZ_httpReq; set obstr.PTZ_httpReq = nil; ); set obstr.PTZ_httpReq = downloadFile obstr.PTZ_sPath mkfun3 @cbDownloaded obstr; 0; ); set obstr.PTZ_bShow = 1; ); 0;; fun cbHide(inst, from, action, param, reply, obstr)= if (!obstr.PTZ_bShow) then nil else ( setPluginInstanceCbScenePreRender inst nil; if(obstr.PTZ_iState == 2) then nil else set obstr.PTZ_iState = 0; set obstr.PTZ_bShow = 0; if (obstr.PTZ_iTransition == 0) then ( if (obstr.PTZ_win == nil) then nil else ( V3DremoveWidgetControl (V3DgetDefaultViewport (V3DgetSessionView c3dXsession)) obstr.PTZ_win; SO3WidgetDestroy obstr.PTZ_win; set obstr.PTZ_win = nil; _DSalphaBitmap obstr.PTZ_AlphaBuffer; set obstr.PTZ_AlphaBuffer = nil; SendPluginEvent obstr.PTZ_instance "Hidden" nil nil; ); 0; ) else ( SO3WidgetSetOpacity obstr.PTZ_win (obstr.PTZ_fTransOpacity *. 0.01); setPluginInstanceCbScenePreRender inst mkfun4 @cbControlPreRenderHide obstr; 0; ); ); 0;; fun cbSetPosition(inst, from, action, param, reply, obstr)= 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 V3DgetSessionView c3dXsession -> viewstr in let V3DgetDefaultViewport viewstr -> viewportstr in let V3DgetViewportSize viewstr viewportstr -> [_ _ vw vh] in ( let 0 -> xpercent in let if (!strcmp "%" (substr sx ((strlen sx) - 1) 1)) then ( set xpercent = 1; atoi sx; ) else atoi sx -> px in let 0 -> ypercent in let if (!strcmp "%" (substr sy ((strlen sy) - 1) 1)) then ( set ypercent = 1; atoi sy; ) else atoi sy -> py in let [(if px == nil then 0 else px) (if py == nil then 0 else py)] -> [px py] in ( mutate obstr.PTZ_tPercent <- [xpercent ypercent _ _ _ _ _ _]; set obstr.PTZ_iPosX = px; set obstr.PTZ_iPosY = py; let computePosSize obstr vw vh -> [px py pw ph] in ( SO3WidgetSetPosition obstr.PTZ_win px py; SO3WidgetSetSize obstr.PTZ_win pw ph; ); ); ); 0;; fun cbSetSize(inst, from, action, param, reply, obstr)= 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 V3DgetSessionView c3dXsession -> viewstr in let V3DgetDefaultViewport viewstr -> viewportstr in let V3DgetViewportSize viewstr viewportstr -> [_ _ vw vh] in ( let 0 -> wpercent in let if (!strcmp "%" (substr sx ((strlen sx) - 1) 1)) then ( set wpercent = 1; atoi sx; ) else atoi sx -> px in let 0 -> hpercent in let if (!strcmp "%" (substr sy ((strlen sy) - 1) 1)) then ( set hpercent = 1; atoi sy; ) else atoi sy -> py in let [(if px == nil then 0 else px) (if py == nil then 0 else py)] -> [px py] in ( mutate obstr.PTZ_tPercent <- [_ _ wpercent hpercent _ _ _ _]; set obstr.PTZ_iWidth = px; set obstr.PTZ_iHeight = py; let computePosSize obstr vw vh -> [px py pw ph] in ( SO3WidgetSetPosition obstr.PTZ_win px py; SO3WidgetSetSize obstr.PTZ_win pw ph; ); ); ); 0;; fun cbSetOpacity(inst, from, action, param, reply, obstr)= if (param == nil) || (!strcmp "" strtrim param) || ((atoi param) == nil) then nil else let atoi param -> opacity in ( set obstr.PTZ_iOpacity = opacity; SO3WidgetSetOpacity obstr.PTZ_win (itof obstr.PTZ_iOpacity) *. 0.01; ); 0;; // Destroy instance fun deleteOb(inst, obstr)= setPluginInstanceCbScenePreRender inst nil; if (obstr.PTZ_httpReq == nil) then nil else ( killHttpRequest obstr.PTZ_httpReq; set obstr.PTZ_httpReq = nil; ); while (obstr.PTZ_lZones != nil) do ( let hd obstr.PTZ_lZones -> zstr in VUIdelFont zstr.PZ_font; set obstr.PTZ_lZones = tl obstr.PTZ_lZones; ); restoreTexture obstr; 0;; fun getValign(mode)= if (mode == 0) then iVUITEXT_HALIGNLEFT else if (mode == 1) then iVUITEXT_HALIGNCENTER else if (mode == 2) then iVUITEXT_HALIGNRIGHT else if (mode == 3) then iVUITEXT_HALIGNCENTER else iVUITEXT_HALIGNLEFT;; fun getHalign(mode)= if (mode == 0) then iVUITEXT_VALIGNTOP else if (mode == 1) then iVUITEXT_VALIGNCENTER else if (mode == 2) then iVUITEXT_VALIGNBOTTOM else iVUITEXT_VALIGNTOP;; fun loadZones(obstr)= let 0 -> i in while (i < 256) do ( let getPluginInstanceParam obstr.PTZ_instance (strcat "zone_" (itoa i)) -> id in if (id == nil) then nil else ( let getPluginInstanceParam obstr.PTZ_instance (strcat "zoneName_" (itoa i)) -> name in let atoi (getPluginInstanceParam obstr.PTZ_instance (strcat "zoneLeft_" (itoa i))) -> zleft in let atoi (getPluginInstanceParam obstr.PTZ_instance (strcat "zoneTop_" (itoa i))) -> ztop in let atoi (getPluginInstanceParam obstr.PTZ_instance (strcat "zoneWidth_" (itoa i))) -> zwidth in let atoi (getPluginInstanceParam obstr.PTZ_instance (strcat "zoneHeight_" (itoa i))) -> zheight in let getPluginInstanceParam obstr.PTZ_instance (strcat "zoneFont_" (itoa i)) -> fname in let if fname == nil then "Arial" else fname -> fname in let atoi (getPluginInstanceParam obstr.PTZ_instance (strcat "zoneFontColor_" (itoa i))) -> fcolor in let if fcolor == nil then 0 else fcolor -> fcolor in let atoi (getPluginInstanceParam obstr.PTZ_instance (strcat "zoneFontSize_" (itoa i))) -> fsize in let if fsize == nil then 12 else fsize -> fsize in let atoi (getPluginInstanceParam obstr.PTZ_instance (strcat "zoneFontBold_" (itoa i))) -> fbold in let if fbold == nil then 0 else fbold -> fbold in let atoi (getPluginInstanceParam obstr.PTZ_instance (strcat "zoneFontVertAlign_" (itoa i))) -> fvalign in let if fvalign == nil then iVUITEXT_VALIGNCENTER else getValign fvalign -> fvalign in let atoi (getPluginInstanceParam obstr.PTZ_instance (strcat "zoneFontHorAlign_" (itoa i))) -> fhalign in let if fhalign == nil then iVUITEXT_HALIGNCENTER else getHalign fhalign -> fhalign in let getPluginInstanceParam obstr.PTZ_instance (strcat "zoneContent_" (itoa i)) -> label in let if label == nil then "" else label -> label in let VUIaddFont fname fsize (if fbold then iVUITEXT_BOLD else 0) fcolor 1 1 -> fontstr in let MkStrZone [fontstr label fcolor fvalign|fhalign [zleft ztop zwidth zheight]] -> zstr in ( PluginRegisterAction obstr.PTZ_instance strcat name " set label" mkfun6 @cbSetLabel [obstr zstr]; set obstr.PTZ_lZones = zstr::obstr.PTZ_lZones; ); 0; ); set i = i + 1; ); 0;; fun cbNewOb(inst)= let (getPluginInstanceParam inst "object") -> objname in let (getPluginInstanceParam inst "material") -> matname in let atoi (getPluginInstanceParam inst "technique") -> technique in let if (technique == nil) || (technique < 0) then 0 else technique -> technique in let atoi (getPluginInstanceParam inst "pass") -> pass in let if (pass == nil) || (pass < 0) then 0 else pass -> pass in let atoi (getPluginInstanceParam inst "texture") -> texture in let if (texture == nil) || (texture < 0) then 0 else texture -> texture in let atoi (getPluginInstanceParam inst "istexture") -> istexture in let if istexture == nil then 0 else istexture -> istexture in let (getPluginInstanceParam inst "path") -> path in let atoi (getPluginInstanceParam inst "isurl") -> isurl in let if isurl == nil then 0 else isurl -> isurl in let (getPluginInstanceParam inst "url") -> url in let atoi (getPluginInstanceParam inst "xpercent") -> xpercent in let if xpercent == nil then 0 else xpercent -> xpercent in let atoi (getPluginInstanceParam inst "xalign") -> xalign in let if xalign == nil then 0 else xalign -> xalign in let atoi (getPluginInstanceParam inst "posx") -> posx in let if posx == nil then 0 else posx -> posx in let atoi (getPluginInstanceParam inst "ypercent") -> ypercent in let if ypercent == nil then 0 else ypercent -> ypercent in let atoi (getPluginInstanceParam inst "yalign") -> yalign in let if yalign == nil then 0 else yalign -> yalign in let atoi (getPluginInstanceParam inst "posy") -> posy in let if posy == nil then 0 else posy -> posy in let atoi (getPluginInstanceParam inst "wpercent") -> wpercent in let if wpercent == nil then 1 else wpercent -> wpercent in let atoi (getPluginInstanceParam inst "width") -> width in let if width == nil then 100 else width -> width in let atoi (getPluginInstanceParam inst "hpercent") -> hpercent in let if hpercent == nil then 1 else hpercent -> hpercent in let atoi (getPluginInstanceParam inst "xoffset") -> xoffset in let if xoffset == nil then 0 else xoffset -> xoffset in let atoi (getPluginInstanceParam inst "yoffset") -> yoffset in let if yoffset == nil then 0 else yoffset -> yoffset in let atoi (getPluginInstanceParam inst "woffset") -> woffset in let if woffset == nil then 0 else woffset -> woffset in let atoi (getPluginInstanceParam inst "hoffset") -> hoffset in let if hoffset == nil then 0 else hoffset -> hoffset in let atoi (getPluginInstanceParam inst "height") -> height in let if height == nil then 100 else height -> height in let atoi (getPluginInstanceParam inst "opacity") -> opacity in let if opacity == nil then 100 else opacity -> opacity in let atoi (getPluginInstanceParam inst "transition") -> transition in let if transition == nil then 0 else transition -> transition in let atoi (getPluginInstanceParam inst "transparency") -> trans in let if (trans == nil) then 0 else trans -> trans in let atoi (getPluginInstanceParam inst "show") -> show in let if (show == nil) then 1 else show -> show in let if !isurl then path else url -> file in let atoi (getPluginInstanceParam inst "zorder") -> zorder in let if zorder == nil then 100 else zorder -> zorder in let SO3SceneGetObject (V3DgetSession c3dXsession) objname -> obj in let if !istexture then nil else SO3SceneGetMaterial (V3DgetSession c3dXsession) (SO3EntityGetResourceGroup obj) matname -> mat in let MkPlugTxtZone [inst istexture mat technique pass texture nil nil nil posx posy width height [xpercent ypercent wpercent hpercent xoffset yoffset woffset hoffset] [xalign yalign] trans opacity transition 0.0 isurl file 0 0 0 nil nil zorder] -> obstr in ( if obstr.PTZ_bOnMaterial then nil else setPluginInstanceCbResizeView inst mkfun5 @cbResizeCtrl obstr; loadZones obstr; if show then cbShow inst nil nil nil nil obstr else cbHide inst nil nil nil nil obstr; PluginRegisterAction inst "Show" mkfun6 @cbShow obstr; PluginRegisterAction inst "Hide" mkfun6 @cbHide obstr; PluginRegisterAction inst "Change" mkfun6 @cbChange obstr; PluginRegisterAction inst "Set position" mkfun6 @cbSetPosition obstr; PluginRegisterAction inst "Set size" mkfun6 @cbSetSize obstr; PluginRegisterAction inst "Set opacity" mkfun6 @cbSetOpacity obstr; setPluginInstanceCbDel inst mkfun2 @deleteOb obstr; SendPluginEvent obstr.PTZ_instance "Started" nil nil; ); 0;; fun IniPlug(file)= VUIsetEnable c3dXsession 1; PlugRegister @cbNewOb nil; setPluginEditor @dynamicedit; 0;;