--BUG LIST --******** --Information panel reverts to a colour used by another opened dialog?! --TO DO LIST --********** --GameTools title page - produce and implement --GameTools help file - produce and implement --RECENTLY ADDED/FIXED --******************** --'Do you want to add a bitmap to the diffuse map slot?' message box when adding a new material --'Wire' and '2-Sided' checkboxes implemented --Compress Materials not working? Ensure it updates GameTools UI once completed --'Is this Alpha imbedded' querybox for alpha textures --'select all polys using current ID number" - implement --open editablemesh/poly ID selection - implement --Reload Texture button - implement --Resource collecting of materials bitmaps - implement --Reroot textures - implement include "rockstar/export/settings.ms" global LBut=0, RealignToggle=0, DialogOffset=[0,0], resizetoggle=0 global ButtonNumber=0 -- DHM -- 10/01/2007 -- 3DS Max 9 Upgrade (#image returns user image directory, not system) -- MWW -- 12/01/2010 -- Now maps this to wildwest directory global ImageDir=( getdir #scripts + "rockstar\\util\\uvtools\\images\\" ) global GameToolsBackdropBuffer=( openbitmap (ImageDir+"\GameToolsBackdrop.bmp") ) global GameToolsBackdropClicked=( openbitmap (ImageDir+"\GameToolsBackdropClicked.bmp") ) global GameToolsBackdropMASK=( openbitmap (ImageDir+"\GameToolsBackdropMASK.bmp") ) global GameToolsBackdrop=( openbitmap (ImageDir+"\GameToolsBackdrop.bmp") ) global EmptySlot=bitmap 52 49 global DrawPressedButton global GameToolsExecutiveRoll global UVOldFaceSel=0 global ForceUpdate=1 global UpdateError=0 global MessageMousePos=[0,0] global DialogScale=[95,256] global FaceBuffer=#(), FaceIDs=#() global OBJ, ALLBITS, matval global texture=bitmap 45 45, otexture=bitmap 45 45 global newtext=0, addmatsup=0, copiedmaterial global StoredUVCoords=#(), StoredObject global UndoNo, StoredUVCount, StoredFaces=#(), StoredID=#() global ThumbToggle=0, ThumbToggleUV=0 global oops=0 global ShowTexTog=0 global VXMin=0.0 global VXMax=1.0 global VYMin=0.0 global VYMax=1.0 global VertList=#() global ButtonBoundingBox=#( --minimise and close buttons [2,2], [20,20], [2,22],[20,40], [2,42],[20,60], --UVTools buttons [24,7],[57,40],[59,7],[92,40], [24,43],[57,76],[59,43],[92,76], [24,78],[57,111],[59,78],[92,111], [24,113],[57,146],[59,113],[92,146], [24,148],[57,181],[59,148],[92,181], [24,183],[57,216],[59,183],[92,216], [24,218],[57,251],[59,218],[92,251], --Wire/2-sided tick boxes [131,88],[141,98], [181,88],[191,98], --Face Selection - Editablemesh selection+select faces by ID [173,168],[186,180], [188,168],[201,180], --Material Editor Buttons [111,198],[137,224], [139,198],[165,224], [167,198],[193,224], [195,198],[221,224], [223,198],[249,224], [111,226],[137,252], [139,226],[165,252], [167,226],[193,252], [195,226],[221,252], [223,226],[249,252], --bitmap [198,85],[249,137] ) -- AM - Moved this here as globals weren't initialised before the functions were evaluated - required -- UV Tools to be closed and then reopened until it worked properly. filein ( "rockstar\\util\\uvtools\\Scripts\\GTs-UVToolsExecFunctions.ms" ) --*********************************************************************************************************************************************** fn DrawPressedButton ButtonNo = ( --added GRS ButtonNumber = ((ButtonNumber as string) as integer) --end of added GRS tmpval=(ButtonNo*2)-1 for Loop=ButtonBoundingBox[tmpval].y to ButtonBoundingBox[(tmpval+1)].y do ( tmppixels=getpixels GameToolsBackdropClicked [(ButtonBoundingBox[tmpval].x),Loop] (ButtonBoundingBox[(tmpval+1)].x-ButtonBoundingBox[tmpval].x) setpixels GameToolsBackdrop [(ButtonBoundingBox[tmpVal].x),Loop] tmppixels ) GameToolsBackdrop )--fn DrawPressedButton --*********************************************************************************************************************************************** rollout GameToolsExecutiveRoll "" ( bitmap GT_UI "" pos:[-2,-4] bitmap:gametoolsbackdrop enabled:false edittext MultiMatName "" width:143 pos:[104,14] bold:true progressbar ProgressB "" pos:[-100,0] orient:#vertical width:15 height:90 color:(color 255 255 0) edittext SubMatName "" width:143 pos:[104,62] bitmap SubMatBit "" pos:[196,83] bitmap:EmptySlot spinner SelfIllumVal "" type:#integer range:[0,100,0] pos:[150,100] width:43 height:20 spinner OpacityVal "" type:#integer range:[0,100,0] pos:[150,120] width:43 height:20 dropdownlist MapType "" pos:[108,140] width:85 height:100 items:#("Diffuse","Opacity","Bump","Reflection","_______________","Ambient","_______________","Specular","Glossiness","Soften") spinner LevelVal "" type:#integer range:[0,999,0] pos:[131,165] width:39 height:20 colorpicker MapColor "" pos:[192,140] width:56 color:(color 0 0 255) spinner IDVal "" type:#integer range:[0,9999,1] pos:[211,165] width:37 height:20 label UVInformation "UVToolsV3.0 - Written by A.Oakley" pos:[3,257] align:#left checkbox WireChk "" pos:[129,83] width:13 height:14 checkbox TwoSidedChk "" pos:[179,83] width:13 height:14 timer UVWatch "" pos:[-100,-100] interval:100 on WireChk changed state do ( try ( local LevNode case (MultiMatName.enabled) of ( true: LevNode=$selection[1].material[IDVal.value] false: LevNode=$selection[1].material ) LevNode.wire=WireChk.state ) catch() ) on TwoSidedChk changed state do ( try ( local LevNode case (MultiMatName.enabled) of ( true: LevNode=$selection[1].material[IDVal.value] false: LevNode=$selection[1].material ) LevNode.TwoSided=TwoSidedChk.state ) catch() ) on MapColor changed ColVal do ( try ( local LevNode case (MultiMatName.enabled) of ( true: LevNode=$selection[1].material[IDVal.value] false: LevNode=$selection[1].material ) case (MapType.selected) of ( "Diffuse": LevNode.diffuse=ColVal "Ambient": LevNode.Ambient=ColVal "Specular": LevNode.specular=ColVal ) ) catch() ) on LevelVal changed LevVal do ( try ( local LevNode case (MultiMatName.enabled) of ( true: LevNode=$selection[1].material[IDVal.value] false: LevNode=$selection[1].material ) case (MapType.selected) of ( "Opacity": (LevNode.opacity=LevVal ; if LevVal>100.0 do LevelVal.value=100.0 ) "Specular": LevNode.specularlevel=LevVal "Glossiness": (LevNode.glossiness=LevVal ; if LevVal>100.0 do LevelVal.value=100.0 ) "Bump": LevNode.BumpMapAmount=LevVal "Reflection": LevNode.ReflectionMapAmount=LevVal "Soften": (LevNode.soften=(LevVal/100.0) ; if LevVal>100.0 do LevelVal.value=100.0 ) ) ) catch() ) on OpacityVal changed OpacVal do ( try ( case (MultiMatName.enabled) of ( true: ($selection[1].material[IDVal.value].opacity=OpacVal) false: ($selection[1].material.opacity=OpacVal) ) ) catch() ) on SelfIllumVal changed IllumVal do ( try ( case (MultiMatName.enabled) of ( true: ($selection[1].material[IDVal.value].selfIllumAmount=IllumVal) false: ($selection[1].material.selfIllumAmount=IllumVal) ) ) catch() ) on MultiMatName changed MultiText do ( try($selection[1].material.name=MultiText);catch() ) on SubMatName changed SubMatText do ( try ( case (classof $selection[1].material) of ( Standardmaterial: $selection[1].material.name=SubMatText Multimaterial: $selection[1].material[IDVal.value].name=SubMatText ) ) catch() ) on bitmap pressed do selectbitmap() on MapType selected tmp do ForceUpdate=1 on UVWatch tick do ( try ( if $selection[1].selectedfaces[1].index!=UVOldFaceSel or ForceUpdate==1 do ( UpdateError=0 IDVal.value=UpdateMaterialUI() UVOldFaceSel=$selection[1].selectedfaces[1].index ForceUpdate=0 ) ) catch( if UpDateError==0 do (UVOldFaceSel=0 ; UpDateError=1 ; UpdateMaterialUI() ; ForceUpdate=0 ) ) ) on IDVal changed state do ( local TotMats=1 try ( local MatN=$selection[1] try ( if (classof $selection[1].material)==multimaterial then ( TotMats=$selection[1].material.count IDVal.value=mod IDVal.value $selection[1].material.count if IDVal.value==0 do IDVal.value=$selection[1].material.count ) else ( IDVal.value=1 ) ) catch(IDVal.value=1) UpdateMaterialUI() case (classof MatN) of ( Editable_mesh: ( try(for Loop in MatN.selectedfaces do (setfacematID MatN Loop.index IDVal.value) );catch()) Editable_Poly: (try(for Loop in MatN.selectedfaces do (polyop.setfacematID MatN Loop.index IDVal.value) );catch()) ) update MatN ForceUpdate=1 UVInformation.text="Materials: "+(IDVal.value as string)+" of "+(TotMats as string) ) catch() ) on GameToolsExecutiveRoll mousemove tmp do ( if LBut==1 and ButtonNumber==0 do ( if RealignToggle==1 then (RealignToggle=0 ; DialogOffset=tmp) else (setdialogPos GameToolsExecutiveRoll (mouse.screenpos-DialogOffset)) ) )--on GameToolsExecutiveRoll mousemove... on GameToolsExecutiveRoll lbuttondown tmp do ( try(destroydialog MessageRollout);catch() disablesceneredraw() LBut=1 ; RealignToggle=1 local PickColour=getpixels GameToolsBackdropMASK tmp 1 if (PickColour[1].r)!=0 do ( ButtonNumber=PickColour[1].r UVInformation.pos=UVInformation.pos MultiMatName.pos=MultiMatName.pos SubMatName.pos=SubMatName.pos SubMatBit.pos=SubMatBit.pos SelfIllumVal.pos=SelfIllumVal.pos OpacityVal.pos=OpacityVal.pos MapType.pos=MapType.pos LevelVal.pos=LevelVal.pos MapColor.pos=MapColor.pos IDVal.pos=IDVal.pos WireChk.pos=WireChk.pos TwoSidedChk.pos=TwoSidedChk.pos --removed GRS --GT_UI.bitmap=copy (DrawPressedButton PickColour[1].r) --end of removed GRS ) enablesceneredraw() ) on GameToolsExecutiveRoll lbuttonup tmp do ( local PickColour=getpixels GameToolsBackdropMASK tmp 1 try(if PickColour[1].r!=ButtonNumber do ButtonNumber=0);catch(ButtonNumber=0) disablesceneredraw() --*0 = No button pressed --*1 = Close button pressed --*2 = Reduce UVTools UI to show only UV tool buttons --*3 = Minimise button pressed --*4 = Copy UV Coordinates --5 = Paste UV Coordinates --6 = Flip UV Coordinates Horizontally --7 = Flip UV Coordinates Vertically --8 = Rotate UV Coordinates in 90 degree increments --9 = Compress selected objects Vertex colour table --10 = Compress selected objects Texture Vertex table --11= Toggle display of alpha textures on selected object --12= Apply an unwrap modifier to the selected object --13= Undo UVTools operation --14= Information regarding UVTools Exec edtion --15= Align selected faces to viewport --16= View map selected faces --*29= Copy material to designated material editor slot --*30= Clear out material editor LBut=0 try ( -- added by GRS ButtonNumber = ((ButtonNumber as string) as integer) -- end of added by GRS case (ButtonNumber as integer) of ( 0 : () 1 : ( destroydialog GameToolsExecutiveRoll ; close GameToolsBackdrop ; gc light:true ) 2 : ( if GameToolsExecutiveRoll.width!=95 then ( GameToolsExecutiveRoll.height=256 ; GameToolsExecutiveRoll.width=95 ; DialogScale=[95,256]) else ( GameToolsExecutiveRoll.width=256 ; GameToolsExecutiveRoll.height=272 ; DialogScale=[256,272]) ) 3 : ( if GameToolsExecutiveRoll.width