• surface.DrawPoly tool?
    11 replies, posted
Hello. I am trying to find something like DermaDesigner (except for [URL="http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index4287.html"]surface.DrawPoly[/URL]) Is there a such tool that exists? I really suck with DrawPoly. Thanks.
I can make one real quick probably tonight. Check back tonight and tomorrow. I'll put it here. [EDITLINE] Finished. [/EDITLINE] [video=youtube;zFnwXZhqMGk]http://www.youtube.com/watch?v=zFnwXZhqMGk[/video] [url]https://www.dropbox.com/s/68p2q6znp1tytv7/polyeditor.lua[/url] Run polyedit in the console to open.
[QUOTE=bobbleheadbob;42636958]I can make one real quick probably tonight. Check back tonight and tomorrow. I'll put it here.[/QUOTE] If you can, that would be sick. [B]Thank you[/B] :wink:
You shouldn't need a tool for this... It's as simple as connecting dots. [lua] local polyTable = { [1] = {x = 0, y = 0}, [2] = {x = ScrW(), y = 0}, [3] = {x = ScrW()/2, y = ScrH()/2} } local matWhite = Material("vgui/white") hook.Add("HUDPaint", "HUDPaint", function() surface.SetMaterial(matWhite) surface.SetDrawColor(255,255,255) surface.DrawPoly(polyTable) end) [/lua] Another example: [lua] local padding = 4 local w,h = 500, 100 local polyTable = { [1] = {x = padding, y = ScrH()-padding-h}, [2] = {x = padding+(w*0.75), y = ScrH()-padding-h}, [3] = {x = padding+w, y = ScrH()-padding}, [4] = {x = padding, y = ScrH()-padding} } local matWhite = Material("vgui/white") hook.Add("HUDPaint", "HUDPaint", function() surface.SetMaterial(matWhite) surface.SetDrawColor(255,255,255) surface.DrawPoly(polyTable) end) [/lua]
[QUOTE=brandonj4;42637259]You shouldn't need a tool for this... It's as simple as connecting dots. [lua] local polyTable = { [1] = {x = 0, y = 0}, [2] = {x = ScrW(), y = 0}, [3] = {x = ScrW()/2, y = ScrH()/2} } local matWhite = Material("vgui/white") hook.Add("HUDPaint", "HUDPaint", function() surface.SetMaterial(matWhite) surface.SetDrawColor(255,255,255) surface.DrawPoly(polyTable) end) [/lua] Another example: [lua] local padding = 4 local w,h = 500, 100 local polyTable = { [1] = {x = padding, y = ScrH()-padding-h}, [2] = {x = padding+(w*0.75), y = ScrH()-padding-h}, [3] = {x = padding+w, y = ScrH()-padding}, [4] = {x = padding, y = ScrH()-padding} } local matWhite = Material("vgui/white") hook.Add("HUDPaint", "HUDPaint", function() surface.SetMaterial(matWhite) surface.SetDrawColor(255,255,255) surface.DrawPoly(polyTable) end) [/lua][/QUOTE] More clicking, less picturing shapes in your mind.
[QUOTE=bobbleheadbob;42636958]I can make one real quick probably tonight. Check back tonight and tomorrow. I'll put it here. [EDITLINE] Finished. [/EDITLINE] [URL]https://www.dropbox.com/s/68p2q6znp1tytv7/polyeditor.lua[/URL] Run polyedit in the console to open.[/QUOTE] Why not release it on workshop?
Updated: [video=youtube;QwA6k-Y6TJ8]http://www.youtube.com/watch?v=QwA6k-Y6TJ8[/video] [url]https://www.dropbox.com/s/68p2q6znp1tytv7/polyeditor.lua[/url]
This is still a very cool tool! Granted what Brandon said is true, but I feel like it would be easier for me to use this if I was making really complex shapes or brain storming. Good job Bobbleheadbob!
I used your polyedit but i'm a bit confused as to how to turn it into a HUD, it doesn't seem to show and spams this through console [code]Table not table! (type is number)[/code] What am I doing wrong? [lua] polydata = {} polydata[1] = {} polydata[1][1] = { x = 40, y = 1020 } polydata[1][2] = { x = 40, y = 980 } polydata[1][3] = { x = 400, y = 980 } polydata[1][4] = { x = 460, y = 1020 } polydata[2] = {} polydata[2][1] = { x = 1880, y = 1020 } polydata[2][2] = { x = 1460, y = 1020 } polydata[2][3] = { x = 1520, y = 980 } polydata[2][4] = { x = 1880, y = 980 } polydata[3] = {} polydata[3][1] = { x = 1100, y = 1020 } polydata[3][2] = { x = 780, y = 1020 } polydata[3][3] = { x = 820, y = 980 } polydata[3][4] = { x = 1060, y = 980 } polydata[4] = {} --Put all this stuff OUTSIDE your paint hook. local function HUD() table.foreachi(polydata, surface.DrawPoly) --Put this in your paint hook. end hook.Add( "HUDPaint", "HUD", HUD )[/lua]
[QUOTE=Blackout338;42732957]I used your polyedit but i'm a bit confused as to how to turn it into a HUD, it doesn't seem to show and spams this through console [code]Table not table! (type is number)[/code] What am I doing wrong? [lua] polydata = {} polydata[1] = {} polydata[1][1] = { x = 40, y = 1020 } polydata[1][2] = { x = 40, y = 980 } polydata[1][3] = { x = 400, y = 980 } polydata[1][4] = { x = 460, y = 1020 } polydata[2] = {} polydata[2][1] = { x = 1880, y = 1020 } polydata[2][2] = { x = 1460, y = 1020 } polydata[2][3] = { x = 1520, y = 980 } polydata[2][4] = { x = 1880, y = 980 } polydata[3] = {} polydata[3][1] = { x = 1100, y = 1020 } polydata[3][2] = { x = 780, y = 1020 } polydata[3][3] = { x = 820, y = 980 } polydata[3][4] = { x = 1060, y = 980 } polydata[4] = {} --Put all this stuff OUTSIDE your paint hook. local function HUD() table.foreachi(polydata, surface.DrawPoly) --Put this in your paint hook. end hook.Add( "HUDPaint", "HUD", HUD )[/lua][/QUOTE] Remove that last polydata[4]. It's an empty table. surface.DrawPoly doesn't know what to do with it. At least that's what I'm assuming. There's no other information in the error to indicate otherwise. [editline] Wait [/editline] Wait, I'm stupid. I need to fix the script. Until then just change: [lua] local function HUD() table.foreachi(polydata, surface.DrawPoly) --Put this in your paint hook. end [/lua] to [lua] local function HUD() table.foreachi(polydata, function(k,v) surface.DrawPoly(v) end) --Put this in your paint hook. end [/lua] [B][editline] updated [/editline] Updated: [URL="https://www.dropbox.com/s/68p2q6znp1tytv7/polyeditor.lua"]Download here.[/URL][/B]
So I removed polydata[4] and changed the table but it still doesn't display?
[QUOTE=Blackout338;42738496]So I removed polydata[4] and changed the table but it still doesn't display?[/QUOTE] Use the [URL="https://www.dropbox.com/s/68p2q6znp1tytv7/polyeditor.lua"]updated script[/URL] to generate it OR change your HUD hook to this: [lua] local function HUD() table.foreachi(polydata, function(k,v) surface.DrawPoly(v) end) --Put this in your paint hook. end [/lua]
Sorry, you need to Log In to post a reply to this thread.