____________TOP_______________: Rem * Title : Limb Inspector Rem * Author : Scorpyo Rem * Date : August 2013 rem =============================================== sync on:sync rate 60 global Sw,Sh rem Sw=1920:Sh=1080 rem set display mode Sw,Sh,32 load dll "user32.dll",1 Sw=call dll(1,"GetSystemMetrics",0) Sh=call dll(1,"GetSystemMetrics",1) delete dll 1 set display mode Sw,Sh,32,1 autocam off set global collision off gosub makebarimg red=50:green=50:blu=200 color backdrop rgb(red,green,blu) backdrop on set ambient light 80 sync rem ---------------------------------------------------------------------- global xpos,ypos,xspan,yspan,stripe$,maxrows,maxcolumns,itemscount,columnx,columny global mousexpos,mouseypos,stripe,selection$,columns,rows global x#,h#,a#,cx#,cz#,numberoflimbs,limbtexture$,size#,sizex#,sizey#,sizez#,tf,itemscount global dirnum,objnum,totalbjects,objcount,totalfiles,dircount,subdir,tempname$,stage,countitems global rotangle#,offsetx#,offsety#,offsetz#,cax# rem ----------------------------------------------------------------------- maxcolumns=6:maxrows=50:itemmax=maxrows*maxcolumns itemscount=0:yspan=14:xspan=300:stripe$="" hideflag=0:loaded=0:tf=0:loaded=0:numberoflimbs=0:l=0:totalfiles=0:objcount=0 objnum=0:dirnum=0:dircount=0:subdir=0:hideflag=0:stage=0:xpos=0:ypos=0:hidecflag=0 cax#=0:ca#=0:camrot=0 t=0:l=0:numberoflimbs=0 red=0:green=0:blu=0 x#=0:h#=0:z#=0:a#=0:cx#=0:cz#=-300 anispeed=100 dim dirname$(itemmax):dirnum=0:totaldirs=0 dim objname$(itemmax):objnum=0:totalfiles=0 dim objcount(itemmax):dim stripe$(itemmax+1) Rootpath$=get dir$() dim Path$(10) Path$(0)=Rootpath$ stage=1 gosub make_matrix set text opaque position mouse 600,900 _________DO__LOOP__________: do if stage=1 then cd Path$(subdir):gosub countdirs if stage=2 then gosub countobjects if stage=3 then gosub countitems if stage=4 then gosub selectfile:wait 200 if stage=5 then gosub checklimbs:gosub limbtextures if stage=6 if inkey$()="l" if hideflag=0 then gosub hidelimbs hide limb 1,l gosub showlimb:wait 500 endif if inkey$()="i" then anispeed=anispeed+1:set object speed 1,anispeed if inkey$()="u" then anispeed=anispeed-1:set object speed 1,anispeed if inkey$()="p" then loop object 1:wait 100 if inkey$()="o" then stop object 1:set object frame 1,0:wait 100 if inkey$()="t" then gosub settransparency if inkey$()="r" then gosub resetobj if mouseclick()=4 then gosub resetobj if inkey$()="s" then gosub showobject if inkey$()="a" then gosub showlimbs if inkey$()="h" then gosub hide_show_limb if controlkey()=1 then delete object 1:delete object 10:gosub resetvalues:stage=1 if inkey$()="y" then ya#=wrapvalue(ya#+1.0):yrotate object 1,ya# if inkey$()="c" then gosub hidecenter if inkey$()="k" then gosub keysinfo if inkey$()="f" then sync rate 0:wait 100 if inkey$()="F" then sync rate 60:wait 100 if inkey$()="w" then gosub setwire if inkey$()="9" then set object filter 1,1:wait 100 if inkey$()="0" then set object filter 1,0:wait 100 if scancode()=59 and saved=0 then save object objectname$+".dbo",1:saved=1:text 800,900," OBJECT SAVED AS DBO ":sync:wait 3000:rem F1 if scancode()=59 and saved=1 then text 800,900," OBJECT ALREADY SAVED AS DBO ":sync:wait 3000:rem F1 gosub rotlimb gosub scroll_limb gosub offset_limb gosub update_camera gosub printdata if scancode()=56 then gosub shownames if shiftkey()=1 if object exist(1) then delete object 1:delete object 10 gosub resetvalues:gosub deletesprites if subdir>0 then subdir=subdir-1 stage=1:wait 200 endif endif gosub changecolor if inkey$()="ò" then gosub resetscreencolor sync loop ______SELECTION_ROUTINES___: resetvalues: loaded=0:selected=0:numberoflimbs=0:l=0:totalfiles=0:totaldirs=0:objcount=0 objnum=0:dirnum=0:dircount=0:hideflag=0:yspan=14:xspan=300:itemscount=0 countitems=0:selection=0:colums=0:rows=0:spritescount=0:saved=0 for n=1 to itemmax dirname$(n)="":objname$(n)="":stripe$(n)="":objcount(n)=0 next n return rem stage 1 countdirs: perform checklist for files totalfiles=checklist quantity() find first filetype=get file type() if filetype=1 tempname$=get file name$() if left$(tempname$,1)<>"." then dircount=1:dirname$(dircount)=get file name$() endif for d=2 to totalfiles find next filetype=get file type() if filetype=1 tempname$=get file name$() if left$(tempname$,1)<>"." then dircount=dircount+1:dirname$(dircount)=get file name$() endif next d stage=2 return rem stage 2 countobjects: perform checklist for files totalfiles=checklist quantity() for f=1 to totalfiles objname$(f)=checklist string$(f) next f objcount=0 for f=1 to totalfiles if right$(objname$(f),2)=".x" or right$(objname$(f),4)=".dbo" or right$(objname$(f),2)=".X" or right$(objname$(f),4)=".DBO" or right$(objname$(f),4)=".3ds" or right$(objname$(f),4)=".3DS" objcount=objcount+1:objname$(objcount)=objname$(f) endif next f stage=3 return rem stage 3 countitems: itemscount=dircount+objcount if itemscount>itemmax then text 400,300,"TOO MANY ITEMS":wait key for n=1 to dircount stripe$(n)=dirname$(n) next n for n=1 to objcount stripe$(n+dircount)=objname$(n) next n if itemscount<50 rows=itemscount else rows=50 endif if itemscount<=50 then columns=1 if itemscount>50 then columns=int(itemscount)/50+1 spritescount=itemscount stage=4 return rem stage 4 selectfile: countitems=0:ypos=0:xpos=0 for m=1 to columns for n=1 to rows countitems=countitems+1 text xpos,ypos," "+stripe$(countitems) if countitems<=itemscount then sprite countitems,xpos,ypos,1 if countitems<=itemscount then set sprite alpha countitems,70 ypos=ypos+yspan next n ypos=0 xpos=xpos+xspan next m mousexpos=mousex():mouseypos=mousey() if mousexposspritescount then selection=0 if selected>0 and selected<=dircount then selection=1 if selected>0 and selected>dircount and selected<=spritescount then selection=2 if selection=1 cd dirname$(stripe):subdir=subdir+1 Path$(subdir)=get dir$() gosub deletesprites: gosub resetvalues stage=1 return endif if selection=2 gosub deletesprites load object stripe$(selected),1 objectname$=stripe$(selected) fsize=file size(objectname$) set object speed 1,anispeed set object 1,1,1,0,1,1,1,1 set object transparency 1,tf position object 1,x#,h#,z# objnum=0:loaded=1 size#=object size(1) sizex#=object size x(1) sizey#=object size y(1) sizez#=object size z(1) selection=1 stage=5 gosub resetcam gosub setcenter endif if shiftkey()=1 if object exist(1) then delete object 1 gosub deletesprites: gosub resetvalues if subdir>0 then subdir=subdir-1 cls:stage=1:wait 200 endif return _______LIMBS_ROUTINES_______: rem stage 5 checklimbs: rem Find out how many limbs the object has perform checklist for object limbs 1 numberoflimbs=checklist quantity() dim limbs$(numberoflimbs+1) dim limbtexture$(numberoflimbs+1) for n=1 to numberoflimbs limbs$(n)=checklist string$(n) next n stage=6 return limbtextures: cls for t=0 to numberoflimbs-1 show limb 1,t limbtexture$=limb texture name(1,t) limbtexture$(t)=limbtexture$ next t return rem stage 6 showlimb: rem Scroll through object limbs if l=numberoflimbs-1 then l=-1 l=l+1 rem Clear the screen cls limbtexture$=limb texture name(1,l) limbtexture$(l)=limbtexture$ rem Show each limb as it is viewed show limb 1,l return rotlimb: if object exist(1) if inkey$()="1" then rotangle#=wrapvalue(rotangle#+1.0):rotate limb 1,l,rotangle#,0.0,0.0 if inkey$()="2" then rotangle#=wrapvalue(rotangle#+1.0):rotate limb 1,l,0.0,rotangle#,0.0 if inkey$()="3" then rotangle#=wrapvalue(rotangle#+1.0):rotate limb 1,l,0.0,0.0,rotangle# if inkey$()="0" then rotangle#=0.0:rotate limb 1,l,rotangle#,rotangle#,rotangle#:wait 10 endif return offset_limb: if object exist(1) if inkey$()="4" then offsetx#=offsetx#+1.0 if inkey$()="5" then offsetx#=offsetx#-1.0 if inkey$()="6" then offsety#=offsety#+1.0 if inkey$()="7" then offsety#=offsety#-1.0 if inkey$()="8" then offsetz#=offsetz#+1.0 if inkey$()="9" then offsetz#=offsetz#-1.0 if inkey$()="0" then offsetx#=0.0:offsety#=0.0:offsetz#=0.0 offset limb 1,l,offsetx#,offsety#,offsetz#:wait 10 endif return scroll_limb: if inkey$()="-" then scroll limb texture 1,l,0.002,0.0 if inkey$()="." then scroll limb texture 1,l,0.0,0.002 return showobject: cls hideflag=0 for t=0 to numberoflimbs-1 show limb 1,t set cursor 0,0 print " " set cursor 0,0 print t next t l=0 return showlimbs: cls hideflag=0 for t=0 to numberoflimbs-1 show limb 1,t set cursor 0,0 print " " set cursor 0,0 print t next t return hidelimbs: cls hideflag=1 for t=0 to numberoflimbs-1 hide limb 1,t set cursor 0,0 print " " set cursor 0,0 print t next t return hide_show_limb: if hideflag=1 then show limb 1,l:hideflag=0:wait 200:return if hideflag=0 then hide limb 1,l:hideflag=1:wait 200:return return shownames: set cursor 0,0 for n=1 to numberoflimbs print " limb ",n-1," ",limbs$(n) print " limb ",n-1," texture ",limbtexture$(n-1) print next n return _______PRINT__ROUTINES______: printdata: if scancode()=37 then return if scancode()=56 then return rem Print information about object set cursor 0,0 print " FPS = ",screen fps() print " Scene polys = ",statistic(1) print " Model polys (hide center with c)= ",statistic(1)-mtxpolys print " RootDir ",Rootpath$ print " Current Dir ",Path$(subdir) print " ----------------------------------" print " Object name = ",objectname$ print " Object size = ",size# print " Object height = ",sizey# print " Object width = ",sizex# print " Object length = ",sizez# print " file size = ",fsize print " ---------------------------------" print " Total Limbs: ";numberoflimbs print " Active Limb Number: ";l print " Active Limb Name: ",limbs$(l+1) print " Active Limb Texture: ",limbtexture$ print " ---------------------------------" if object exist(1) print " limb offset x = ";limb offset x(1,l) print " limb offset y = ";limb offset y(1,l) print " limb offset z = ";limb offset z(1,l) print " limb angle x = ";limb angle x(1,l) print " limb angle y = ";limb angle y(1,l) print " limb angle z = ";limb angle z(1,l) print " limb world position x = ";limb position x(1,l) print " limb world position y = ";limb position y(1,l) print " limb world position z = ";limb position z(1,l) endif print " ---------------------------------" print " current transparency mode = ",tf print " ---------------------------------" print " animation speed = ",anispeed print " ---------------------------------" print " l = browse limbs" print " a to see all limbs keeping current" print " h to hide/show current limb" print "(not working with boned objects)" print " s = show full object" print " p = play object" print " o = stop object" print " i and u to increase/decrease animation speed" print " t for transparency settings" print " y for rotating whole object" print " r or mousewheel click = RESET ALL" print " c to hide/show center" print " w to toggle wireframe on/off" print " ---------------------------------" print " SHIFT = select new object dir" print " CTRL = load next object" print " ---------------------------------" print " 1 = x rotate current limb" print " 2 = y rotate current limb" print " 3 = z rotate current limb" print " 0 to reset limb offsets/rotations" print " ---------------------------------" print " 4,5 = x offset current limb" print " 6,7 = y offset current limb" print " 8,9 = z offset current limb" print " 0 to reset limb offsets/rotations" print "----------------------------------" print " - to xscroll actual limb texture" print " . to yscroll actual limb texture" print "----------------------------------" print " Press k for keyboard usage" print " F1 to save object as .dbo" return keysinfo: set cursor 0,0 print " L-mouse + mouse move x for camera turn" print " R-mouse + mouse move y for camera pitch" print " Mousewheel or < + mousewheel = camera distance" print " Mousewheel + z = camera height" print " up/down arrow = move forward / backwards" print " left/right arrow = turn camera" print " Space = Camdist 0" print " r = RESET CAMERA AND OBJECT/LIMBS POSITION AND ANGLES" print print " i and u to increase/decrease animation speed" print print " Left Alt = List Limb Names" print print " Press f to unlock screen framerate" print " Press F to reset framerate to 60" print print " change screen color - rgb " print " keys ^ and ? = red +/-" print " keys [ and ] = green +/-" print " keys ° and § = blu +/-" print " Press @ to reset default color" print print " red=",red," green=",green," blu=",blu return ______SCREEN_COLORS________: changecolor: if inkey$()="'" and red<250 then red=red+20:color backdrop rgb(red,green,blu):wait 200 if inkey$()="ì" and red>0 then red=red-20:color backdrop rgb(red,green,blu):wait 200 if inkey$()="è" and green<250 then green=green+20:color backdrop rgb(red,green,blu):wait 200 if inkey$()="+" and green>0 then green=green-20:color backdrop rgb(red,green,blu):wait 200 if inkey$()="à" and blu<250 then blu=blu+20:color backdrop rgb(red,green,blu):wait 200 if inkey$()="ù" and blu>0 then blu=blu-20:color backdrop rgb(red,green,blu):wait 200 return __________CAMERA____________: update_camera: if spacekey()=1 then camdist#=0.0 if upkey()=1 s#=s#+2.0 x#=newxvalue(x#,a#,s#) z#=newzvalue(z#,a#,s#) endif if downkey()=1 s#=s#-2.0 x#=newxvalue(x#,a#,s#) z#=newzvalue(z#,a#,s#) endif if upkey()=0 and downkey()=0 then s#=0.0 if leftkey()=1 then a#=wrapvalue(a#-1.0) if rightkey()=1 then a#=wrapvalue(a#+1.0) if mouseclick()=1 mymousex=mousemovex() if mymousex>0 then a#=wrapvalue(a#+3.0) if mymousex<0 then a#=wrapvalue(a#-3.0) endif if mouseclick()=2 mymousey=mousemovey() if mymousey>0 then cax#=wrapvalue(cax#+2.0) if mymousey<0 then cax#=wrapvalue(cax#-2.0) endif if mouseclick()=0 mymousez=mousemovez() if mymousez>0 and scancode()=44 then camhgt#=camhgt#+(sizey#*0.1):rem z if mymousez<0 and scancode()=44 then camhgt#=camhgt#-(sizey#*0.1) if mymousez>0 and scancode()=0 then camdist#=camdist#+(sizez#*0.2) if mymousez<0 and scancode()=0 then camdist#=camdist#-(sizez#*0.2) if mymousez>0 and scancode()=86 then camdist#=camdist#+5.0:rem < if mymousez<0 and scancode()=86 then camdist#=camdist#-5.0 endif cx#=newxvalue(x#,a#,camdist#) cz#=newzvalue(z#,a#,camdist#) position camera cx#,cy#+camhgt#,cz# ca#=wrapvalue(a#+camrot) yrotate camera ca# xrotate camera cax# rem Point camera at object rem point camera x#,cy#+camhgt#,z# return resetcam: set camera range 1,50000 if object exist(1) size#=object size(1) sizex#=object size x(1) sizey#=object size y(1) sizez#=object size z(1) endif cy#=sizey#/2 if sizez#6 then tf=0 set object transparency 1,tf wait 200 return ________SPRITES___________: deletesprites: for n=1 to spritescount delete sprite n next n return makebarimg: cls rgb(240,240,0) get image 1,0,0,290,13 return __________OTHER___________: resetscreencolor: red=50:green=50:blu=200 color backdrop rgb(red,green,blu) return make_matrix: mtxsize=10000 mtxgrid=30 make matrix 1,mtxsize,mtxsize,mtxgrid,mtxgrid mtxpolys=mtxgrid*mtxgrid*2:rem 1800 polygons position matrix 1,-5000,0,-5000 return printdirs: for n=1 to dircount text 500,n*14,str$(n)+" "+dirname$(n) next n for n=1 to objcount text 500,n*dircount*14+14,str$(n)+" "+objname$(n) next n return printstripes: for n=1 to itemscount text 400,n*20,stripe$(n) next n return setcenter: make object sphere 10,10 if int(size#)<1000 then scale=int(size#)+1:scale object 10,scale,scale,scale color object 10,rgb(1,250,1) set object 10,1,1,0,1,1,0 position object 10,0,0,0 return hidecenter: if hidecflag=0 then hide object 10:hidecflag=1:wait 200:return if hidecflag=1 then show object 10:hidecflag=0:wait 200:return return setwire: if wireflag=0 then set object 1,0,1,0,1,1,1,1:wireflag=1:set object transparency 1,0:wait 200:return if wireflag=1 then set object 1,1,1,0,1,1,1,1:wireflag=0:set object transparency 1,0:wait 200:return return end