/* CamEdit.pkg : Editor of camera plugin */ /* Rev. Nov. 2003 - by BLG - Code cleaning */ /* - BLG_GetParam() function added */ /* - Multiple Editor openings OK */ /* - Parameters handling improved */ typeof plugin = S;; typeof class = S;; /* Camera position */ typeof IVecCamX = I;; typeof IVecCamY = I;; typeof IVecCamZ = I;; typeof IAngCamX = I;; typeof IAngCamY = I;; typeof IAngCamZ = I;; typeof PositionCamStatic = ObjText;; /* Distance from screen */ typeof LDistance = ObjText;; typeof LDistX = ObjText;; typeof EDistX = ObjText;; typeof LDistY = ObjText;; typeof EDistY = ObjText;; /* Screen size */ typeof LSize = ObjText;; typeof LSizeX = ObjText;; typeof ESizeX = ObjText;; typeof LSizeY = ObjText;; typeof ESizeY = ObjText;; /* clipping parameters */ typeof LClipping = ObjText;; typeof LClippingDist = ObjText;; typeof EClippingDist = ObjText;; typeof LFogDist = ObjText;; typeof EFogDist = ObjText;; typeof LFaraway = ObjText;; typeof EFaraway = ObjText;; /* Render */ typeof ChkframeRate = ObjCheck;; typeof LBrenderAuthorised = ObjText;; typeof ELrenderAuthorised = ObjText;; typeof FrameParam = S;; /* Registered clients */ typeof RegOnly = ObjCheck;; proto cbSave = fun [[Inst r1]] [[S r1] [S r1] [[S r1] r1] [[S r1] r1]];; fun InstName(UI) = UI.nameInst;; fun EnableFR(chk, p, status) = _ENtext LBrenderAuthorised status; _ENtext ELrenderAuthorised status; 0;; fun UpdatePosCam(but, p) = let EDIT3D_GetCameraPosAngle -> [[x y z] [a b c]] in ( set IVecCamX = x; set IVecCamY = y; set IVecCamZ = z; set IAngCamX = a; set IAngCamY = b; set IAngCamZ = c; _SETtext PositionCamStatic strcatn "("::(itoa x)::","::(itoa y)::","::(itoa z)::")"::nil; );; fun BLG_GetParam(l, keyword, default_value) = let getInfo l keyword -> string in if (nil == string) then default_value else string;; fun cbOpenEdit(win, param)= let strextr param -> l in ( /* Distance from screen in X and Y */ set LDistance = _CRtext _channel win 5 5+30 120 16 ET_ALIGN_LEFT "Distance from screen : "; set LDistX = _CRtext _channel win 10 25+30 80 16 ET_ALIGN_LEFT "X Distance : "; set EDistX = _CReditLine _channel win 90 25+30 50 18 ET_DOWN|ET_NUMBER (BLG_GetParam l "DistX" "350"); set LDistY = _CRtext _channel win 160 25+30 80 16 ET_ALIGN_LEFT "Y Distance : "; set EDistY = _CReditLine _channel win 245 25+30 50 18 ET_DOWN|ET_NUMBER (BLG_GetParam l "DistY" "350"); /* Camera position */ _CRtext _channel win 5 5 80 16 ET_ALIGN_LEFT "Position :"; let _CRbutton _channel win 90 5 50 18 PB_DEFAULT "Select" -> Button in _CBbutton Button @UpdatePosCam nil; set PositionCamStatic = _CRtext _channel win 150 5 150 16 ET_ALIGN_LEFT (BLG_GetParam l "posCam" "Aucune"); set IVecCamX = atoi getInfo l "VecCam1"; set IVecCamY = atoi getInfo l "VecCam2"; set IVecCamZ = atoi getInfo l "VecCam3"; set IAngCamX = atoi getInfo l "AngCam1"; set IAngCamY = atoi getInfo l "AngCam2"; set IAngCamZ = atoi getInfo l "AngCam3"; /* Screen size */ set LSize = _CRtext _channel win 5 55+30 120 16 ET_ALIGN_LEFT "Screen size : "; set LSizeX = _CRtext _channel win 10 75+30 80 16 ET_ALIGN_LEFT "Half width : "; set ESizeX = _CReditLine _channel win 90 75+30 50 18 ET_DOWN|ET_NUMBER (BLG_GetParam l "Width" "200"); set LSizeY = _CRtext _channel win 160 75+30 80 16 ET_ALIGN_LEFT "Half height : "; set ESizeY = _CReditLine _channel win 245 75+30 50 18 ET_DOWN|ET_NUMBER (BLG_GetParam l "Height" "150"); /* Clipping parameters */ set LClipping = _CRtext _channel win 5 105+30 120 16 ET_ALIGN_LEFT "Clipping parameters : "; set LClippingDist = _CRtext _channel win 10 125+30 80 16 ET_ALIGN_LEFT "Clipping dist. : "; set EClippingDist = _CReditLine _channel win 90 125+30 50 18 ET_DOWN|ET_NUMBER (BLG_GetParam l "ClippingDist" "20"); set LFogDist = _CRtext _channel win 160 125+30 80 16 ET_ALIGN_LEFT "Fog distance : "; set EFogDist = _CReditLine _channel win 245 125+30 50 18 ET_DOWN|ET_NUMBER (BLG_GetParam l "FogDist" "80000"); set LFaraway = _CRtext _channel win 315 125+30 80 16 ET_ALIGN_LEFT "Faraway dist. : "; set EFaraway = _CReditLine _channel win 400 125+30 50 18 ET_DOWN|ET_NUMBER (BLG_GetParam l "Faraway" "130000"); /* Render */ set ChkframeRate = _CRcheck _channel win 10 165+30 160 16 0 "Select a frame rate /s"; _SETcheck ChkframeRate (if !strcmpi getInfo l "a" "auto" then 0 else 1); set LBrenderAuthorised = _CRtext _channel win 35 195+30 160 16 ET_ALIGN_LEFT "Time Render Authorised (ms) : "; set ELrenderAuthorised = _CReditLine _channel win 200 195+30 40 18 ET_DOWN (BLG_GetParam l "a" "auto"); _ENtext LBrenderAuthorised _GETcheck ChkframeRate; _ENtext ELrenderAuthorised _GETcheck ChkframeRate; _CBcheck ChkframeRate @EnableFR nil; set RegOnly = _CRcheck _channel win 5 220+30 300 20 0 "Camera render activated for registered clients only"; _SETcheck RegOnly (if !strcmpi getInfo l "registeredClientsOnly" "yes" then 1 else 0); 0; ); 0;; fun cbCloseEdit()= if (_GETcheck ChkframeRate) == 1 then set FrameParam =_GETtext ELrenderAuthorised else set FrameParam = "auto" ; strbuild ("DistX"::(_GETtext EDistX)::nil):: ("DistY"::(_GETtext EDistY)::nil):: ("Width"::(_GETtext ESizeX)::nil):: ("Height"::(_GETtext ESizeY)::nil):: ("ClippingDist"::(_GETtext EClippingDist)::nil):: ("FogDist"::(_GETtext EFogDist)::nil):: ("Faraway"::(_GETtext EFaraway)::nil):: ("a"::FrameParam::nil):: ("registeredClientsOnly"::(let _GETcheck RegOnly -> x in if x then "yes" else "no")::nil):: ("VecCam1"::(itoa IVecCamX)::nil):: ("VecCam2"::(itoa IVecCamY)::nil):: ("VecCam3"::(itoa IVecCamZ)::nil):: ("AngCam1"::(itoa IAngCamX)::nil):: ("AngCam2"::(itoa IAngCamY)::nil):: ("AngCam3"::(itoa IAngCamZ)::nil):: ("posCam"::(_GETtext PositionCamStatic)::nil):: nil;; fun suppactions(l)= if (l == nil) then nil else let l -> [UI nl] in let (InstName UI) -> name in ("actionC"::(strcatn name::".register"::nil)::nil):: ("actionC"::(strcatn name::".unregister"::nil)::nil):: (suppactions nl);; fun cbSave(l)= if (l == nil) then [nil nil nil nil] else [ /* registerF */ nil /* register */ nil /* supplemental dat */ ("plugin"::plugin::nil)::nil /* supplemental dmi */ /*listcat*/ (suppactions l) /*(suppevents l)*/ ];; fun IniPlug(file)= set plugin = file; set class = getInfo strextr _getpack _checkpack file "name"; PlugRegister class @cbSave nil @cbOpenEdit @cbCloseEdit;;