Garry's Mod Wiki

Revision Difference

Panel:RebuildSpawnIconEx#517758

<function name="RebuildSpawnIconEx" parent="Panel" type="classfunc"> <description> Re-renders a spawn icon with customized cam data. <page>Global.PositionSpawnIcon</page> can be used to easily calculate the necessary camera parameters. <note>This function does **not** accept the standard <page>CamData</page>.</note> </description> <realm>Client</realm> <args> <arg name="data" type="table">A four-membered table containing the information needed to re-render:&#xA;* &lt;page&gt;Vector&lt;/page&gt; cam_pos - The relative camera position the model is viewed from.&#xA;* &lt;page&gt;Angle&lt;/page&gt; cam_ang - The camera angle the model is viewed from.&#xA;* &lt;page&gt;number&lt;/page&gt; cam_fov - The camera&#x27;s field of view (FOV).&#xA;* &lt;page&gt;Entity&lt;/page&gt; ent - The entity object of the model.&#xA;See the example below for how to retrieve these values.</arg>⤶ <arg name="data" type="table">A four-membered table containing the information needed to re-render:⤶ * <page>Vector</page> cam_pos - The relative camera position the model is viewed from.⤶ * <page>Angle</page> cam_ang - The camera angle the model is viewed from.⤶ * <page>number</page> cam_fov - The camera's field of view (FOV).⤶ * <page>Entity</page> ent - The entity object of the model.⤶ See the example below for how to retrieve these values.</arg>⤶ </args> </function> <example> <description>The `RenderIcon` method used by <page>IconEditor</page>. `SpawnIcon` is a <page>SpawnIcon</page> and `ModelPanel` is a <page>DAdjustableModelPanel</page>.</description> <code> 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 </code> </example>