Created
April 23, 2014 17:05
-
-
Save CapsAdmin/11223746 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| html_material_panels = html_material_panels or {} | |
| function ClearCustomMaterials() | |
| for key, pnl in pairs(html_material_panels) do | |
| if pnl:IsValid() then | |
| pnl:Remove() | |
| end | |
| end | |
| html_material_panels = {} | |
| end | |
| function GetCustomMaterial(url, callback) | |
| local pnl= vgui.Create("HTML") | |
| table.insert(html_material_panels, pnl) | |
| pnl:OpenURL(url) | |
| pnl:Refresh() | |
| pnl:SetSize(100, 100) | |
| pnl:StartAnimate() | |
| --pnl:SetPos(ScrW(),ScrH()) | |
| function pnl.FinishedURL() | |
| callback(pnl:GetHTMLMaterial()) | |
| end | |
| end | |
| ClearCustomMaterials() | |
| GetCustomMaterial("http://www.google.com", function(mat) | |
| local ent = Entity(646) | |
| function ent:RenderOverride() | |
| render.SetMaterial(mat) | |
| self:DrawModel() | |
| end | |
| end) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment