Garry's Mod Wiki

IconEditor

Description

An icon editor that permits a user to modify a SpawnIcon and re-render it. This is used by the spawn menu and is what is shown when you right-click an icon and select Edit Icon.

This makes use of the DAdjustableModelPanel element.

This panel is only available in Sandbox and Sandbox derived gamemodes!

Parent

Derives from DFrame.

Example

Creates a SpawnIcon with model "models/props_borealis/bluebarrel001.mdl" and an IconEditor to modify it.

local frame = vgui.Create( "DFrame" ) -- Container for the SpawnIcon frame:SetPos( 200, 200 ) frame:SetSize( 200, 200 ) frame:SetTitle( "Icon Editor Example" ) frame:MakePopup() local icon = vgui.Create( "SpawnIcon" , frame ) -- SpawnIcon, with blue barrel model icon:Center() -- It is important below to include the SkinID (0 = default skin); the IconEditor will not work otherwise icon:SetModel( "models/props_borealis/bluebarrel001.mdl", 0 ) local editor = vgui.Create( "IconEditor" ) -- Create IconEditor editor:SetIcon( icon ) -- Set the SpawnIcon to modify editor:Refresh() -- Sets up the internal DAdjustableModelPanel and SpawnIcon editor:MakePopup() editor:Center()
Output: A DFrame containing a SpawnIcon, and a window identical to that in the preview above.

Page Links


Special Pages


Wikis

?

Render Time: 33ms

DB GetPage 5
Generate Html 4
SaveChanges (1) 14
Render Body 0
Render Sidebar 6