Garry's Mod Wiki

Panel:RebuildSpawnIconEx

  Panel:RebuildSpawnIconEx( table data )

Description

Re-renders a spawn icon with customized cam data.

PositionSpawnIcon can be used to easily calculate the necessary camera parameters.

This function does not accept the standard CamData structure.

Arguments

1 table data
A four-membered table containing the information needed to re-render:
  • Vector cam_pos - The relative camera position the model is viewed from.
  • Angle cam_ang - The camera angle the model is viewed from.
  • number cam_fov - The camera's field of view (FOV).
  • Entity ent - The entity object of the model. See the example below for how to retrieve these values.

Example

The RenderIcon method used by IconEditor. SpawnIcon is a SpawnIcon and ModelPanel is a DAdjustableModelPanel.

function PANEL:RenderIcon() local ent = self.ModelPanel:GetEntity() local tab = {} tab.ent = ent tab.cam_pos = self.ModelPanel:GetCamPos() tab.cam_ang = self.ModelPanel:GetLookAng() tab.cam_fov = self.ModelPanel:GetFOV() self.SpawnIcon:RebuildSpawnIconEx( tab ) end