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 methods, etc not listed on this page from DFrame.
Methods
IconEditor:AboveLayout()
Applies the top-down view camera settings for the model in the DAdjustableModelPanel.
Called when a user clicks the Above (third) button (See IconEditor).
IconEditor:BestGuessLayout()
Applies the best camera settings for the model in the DAdjustableModelPanel, using the values returned by PositionSpawnIcon.
Called when a user clicks the wand button (See the ) and when IconEditor:Refresh is called.
IconEditor:FillAnimations( Entity ent )
This is used internally - although you're able to use it you probably shouldn't.
Fills the DListView on the left of the editor with the model entity's animation list. Called by IconEditor:Refresh.
IconEditor:FullFrontalLayout()
Applies the front view camera settings for the model in the DAdjustableModelPanel.
Called when a user clicks the Front (second) button (See the ).
IconEditor:OriginLayout()
Places the camera at the origin (0,0,0), relative to the entity, in the DAdjustableModelPanel.
Called when a user clicks the Center (fifth) button (See the ).
IconEditor:Refresh()
Updates the internal DAdjustableModelPanel and SpawnIcon.
This should be called immediately after setting the SpawnIcon with IconEditor:SetIcon.
IconEditor:RenderIcon()
Re-renders the SpawnIcon.
Called when a user clicks the RENDER button, this retrieves the render data from the internal DAdjustableModelPanel and passes it as a table to Panel:RebuildSpawnIconEx.
IconEditor:RightLayout()
Applies the right side view camera settings for the model in the DAdjustableModelPanel.
Called when a user clicks the Right (fourth) button (See the ). (Note: The icon for this points left. )
IconEditor:SetDefaultLighting()
This is used internally - although you're able to use it you probably shouldn't.
Sets up the default ambient and directional lighting for the DAdjustableModelPanel. Called by IconEditor:Refresh.
IconEditor:SetFromEntity( Entity ent )
Sets the editor's model and icon from an entity. Alternative to IconEditor:SetIcon, with uses a SpawnIcon.
You do not need to call IconEditor:Refresh after this.
Sets the SpawnIcon to modify. You should call Panel:Refresh immediately after this, as the user will not be able to make changes to the icon beforehand.
IconEditor:UpdateEntity( Entity ent )
This is used internally - although you're able to use it you probably shouldn't.
Updates the entity being rendered in the internal DAdjustableModelPanel. Called by the model panel's DModelPanel:LayoutEntity method.
Example
Creates a SpawnIcon with model "models/props_borealis/bluebarrel001.mdl" and an IconEditor to modify it.