Garry's Mod Wiki

DAdjustableModelPanel

Description

A derivative of the DModelPanel in which the user may modify the perspective of the model with their mouse and keyboard by clicking and dragging.

The keyboard keys w s a d up down left right space and ctrl can be used when the right mouse is held down, with ⇧ shift acting as a speed multiplier. When the left mouse is used, the Shift key holds the current y angle steady.

This is used by IconEditor for modifying spawn icons.

View source

Parent

Derives methods, etc not listed on this page from DModelPanel.

Methods

DAdjustableModelPanel:CaptureMouse()
This is used internally - although you're able to use it you probably shouldn't. Used by the panel to perform mouse capture operations when adjusting the model.
DAdjustableModelPanel:FirstPersonControls()
This is used internally - although you're able to use it you probably shouldn't. Used to adjust the perspective in the model panel via the keyboard, when the right mouse button is used.
boolean DAdjustableModelPanel:GetFirstPerson()
Gets whether mouse and keyboard-based adjustment of the perspective has been enabled. See DAdjustableModelPanel:SetFirstPerson for more information. This is an AccessorFunc
number DAdjustableModelPanel:GetMovementScale()
Returns the movement speed multiplier set by DAdjustableModelPanel:SetMovementScale. An AccessorFunc
DAdjustableModelPanel:SetFirstPerson( boolean enable )
Enables mouse and keyboard-based adjustment of the perspective. This is set to true automatically each time mouse capture is enabled, and hence doesn't serve as a usable setting, other than to disable this functionality after the PANEL:OnMousePressed event. An AccessorFunc
DAdjustableModelPanel:SetMovementScale( number )
Sets the movement speed multiplier. Currently this only affects first person camera controls.

Example

Code used to create the example for derma_controls concmd

local ctrl = vgui.Create( "DAdjustableModelPanel" ) ctrl:SetSize( 300, 300 ) ctrl:SetModel( "models/props_junk/PlasticCrate01a.mdl" ) ctrl:GetEntity():SetSkin( 2 ) ctrl:SetLookAng( Angle( 45, 0, 0 ) ) ctrl:SetCamPos( Vector( -20, 0, 20 ) )
DAdjustableModelPanel.gif