Python1320

MatExt Dbg

Sep 2nd, 2011
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.21 KB | None | 0 0
  1. local function Dbg(...)
  2.     Msg"[MatExt] "
  3.     local res={}
  4.     for k,obj in pairs({...}) do
  5.         local add="ERR"
  6.         if type(obj)=="IMaterial" then
  7.             table.insert(res,"<MAT")
  8.             if obj:IsError() then
  9.                 table.insert(res,"ERROR")
  10.             end
  11.             if obj:GetName() then
  12.                 table.insert(res,"'"..obj:GetName().."'")
  13.             end
  14.             if obj:GetShader() then
  15.                 table.insert(res,"'"..obj:GetShader().."'")
  16.             end
  17.             if obj:GetMaterialString("$basetexture")then
  18.                 table.insert(res,"'"..obj:GetMaterialString("$basetexture").."'")
  19.             end
  20.             local a=obj:GetMaterialTexture("$hdrbaseTexture")
  21.             local b=obj:GetMaterialTexture("$hdrcompressedTexture")
  22.             if a then
  23.                 table.insert(res,"HDR")
  24.             end        
  25.             if b then
  26.                 table.insert(res,"COMPRESSED")
  27.             end
  28.             table.insert(res,">")
  29.         elseif type(obj)=="ITexture" then
  30.             table.insert(res,"<Tex")
  31.             if obj:IsError() then
  32.                 table.insert(res,"ERROR")
  33.             end
  34.             if obj:GetName() then
  35.                 table.insert(res,"'"..obj:GetName().."'")
  36.             end
  37.             table.insert(res,">")
  38.         elseif type(obj)=="string" then
  39.             table.insert(res,obj)
  40.         elseif type(obj)=="nil" then
  41.             table.insert(res,tostring("<nil>"))
  42.         else
  43.             table.insert(res,tostring(obj))
  44.         end
  45.     end
  46.     print(table.concat(res," "))
  47. end
Advertisement
Add Comment
Please, Sign In to add comment