MatSelect
Description
The panel used by Material & Lamp Sandbox tools for texture selection. Despite being only used in Sandbox, it is not exclusive to that gamemode.
See also PropSelect for the prop selecting alternative.
Parent
Derives methods, etc not listed on this page from ContextBase.
Implements
Implements or overrides the following hooks/methods. If you want to override these, you probably want to call the original function too.
Events
MatSelect:OnRightClick( Panel pnl )
Called when the player right clicks a material.
By default, this opens a menu that lets the player copy the material path.
Defines a paint over function for a DImageButton when it is selected.
self in the context of this function is the DImageButton!
Methods
Adds a new material to the selection list.
Adds a new material to the selection list, with some extra options.
MatSelect:FindAndSelectMaterial( string mat )
Find a material and selects it, if it exists in this panel.
Find a DImageButton panel based on the input material path.
boolean MatSelect:GetAutoHeight()
Returns whether the panel would set its own height to fit all materials within its height.
MatSelect:SelectMaterial( DImageButton mat )
This is used internally - although you're able to use it you probably shouldn't.
Use MatSelect:FindAndSelectMaterial instead.
Selects a given material panel.
MatSelect:SetAutoHeight( boolean autoSize )
Sets whether the panel should set its own height to fit all materials within its height.
MatSelect:SetItemHeight( number height )
Sets the height of a single material in pixels.
MatSelect:SetItemWidth( number width )
Sets the width of a single material in pixels.
MatSelect:SetNumRows( number rows )
Sets the target height of the panel, in number of rows.
Example
Example usage of the panel.
Output: