Modelclass

A model.

objectResourceModel
Namespace
Sandbox
Assembly
Sandbox.Engine
Declaration
public sealed class Sandbox.Model : Sandbox.Resource

Methods29

Showing 29 methods

public System.Collections.Generic.Dictionary`2<Sandbox.BoneCollection.Bone,Sandbox.GameObject> CreateBoneObjects(Sandbox.GameObject root)PUBLIC

Creates a dictionary of bone names to game objects, where each game object is a bone object in the scene.

ParameterTypeDescription
rootGameObject
Returns:Dictionary<Bone,GameObject>

public string GetAnimationName(int animationIndex)PUBLIC

Returns name of an animation at given animation index.

ParameterTypeDescription
animationIndexintAnimation index to get name of, starting at 0.
Returns:stringName of the animation.

Exceptions

ExceptionCondition
ArgumentOutOfRangeExceptionThrown when given index exceeds range of [0,AnimationCount-1]

public string GetAttachmentName(int index)PUBLICOBSOLETE

Returns name of an attachment at given index.

Obsolete: This API member is obsolete.

ParameterTypeDescription
indexintIndex of the attachment to look up, starting at 0.
Returns:stringThe name of the attachment at given index.

Exceptions

ExceptionCondition
ArgumentOutOfRangeExceptionThrown when given index exceeds range of [0,AttachmentCount-1]

public int GetBaseVertex(int drawcall)PUBLIC

ParameterTypeDescription
drawcallint
Returns:int

public string GetBoneName(int boneIndex)PUBLIC

Returns name of a bone at given bone index.

ParameterTypeDescription
boneIndexintBone index to get name of, starting at 0.
Returns:stringName of the bone.

Exceptions

ExceptionCondition
ArgumentOutOfRangeExceptionThrown when given index exceeds range of [0,BoneCount-1]

public int GetBoneParent(int boneIndex)PUBLIC

Returns the id of given bone's parent bone.

ParameterTypeDescription
boneIndexintThe bone to look up parent of.
Returns:intThe id of the parent bone, or -1 if given bone has no parent.

Exceptions

ExceptionCondition
ArgumentOutOfRangeExceptionThrown when given index exceeds range of [0,BoneCount-1]

public System.Collections.Generic.Dictionary`2<string,string[]> GetBreakCommands()PUBLIC

Internal function used to get a list of break commands the model has.

Returns:Dictionary<string,string[]>

public T GetData()PUBLIC

Extracts data from model based on the given type's ModelDoc.GameDataAttribute.

Returns:T

public int GetIndexCount(int drawcall)PUBLIC

ParameterTypeDescription
drawcallint
Returns:int

public int GetIndexStart(int drawcall)PUBLIC

ParameterTypeDescription
drawcallint
Returns:int

public uint[] GetIndices()PUBLIC

Experimental!

Returns:uint[]

public int GetMaterialGroupIndex(string groupIndex)PUBLIC

Retrieves the index of a material group given its name.

ParameterTypeDescription
groupIndexstringThe name of the material group.
Returns:intThe index of the material group, or a negative value if the group does not exist.

public string GetMaterialGroupName(int groupIndex)PUBLIC

Returns name of a material group at given group index.

ParameterTypeDescription
groupIndexintGroup index to get name of, starting at 0.
Returns:stringName of the group.

Exceptions

ExceptionCondition
ArgumentOutOfRangeExceptionThrown when given index exceeds range of [0,MaterialGroupCount-1]

public string GetMorphName(int morph)PUBLIC

Returns name of a morph controller at given index.

ParameterTypeDescription
morphintMorph controller index to get name of, starting at 0.
Returns:stringName of the morph controller at given index.

Exceptions

ExceptionCondition
ArgumentOutOfRangeExceptionThrown when given index exceeds range of [0,MorphCount-1]

public Sandbox.Vertex[] GetVertices()PUBLIC

Experimental!

Returns:Vertex[]

public float GetVisemeMorph(string viseme, int morph)PUBLIC

Get morph weight for viseme.

ParameterTypeDescription
visemestring
morphint
Returns:float

public bool HasData()PUBLIC

Tests if this model has generic data based on given type's ModelDoc.GameDataAttribute. This will be faster than testing this via GetData]]>()

Returns:bool

public static Sandbox.Model Load(string filename)PUBLICSTATIC

Load a model by file path.

ParameterTypeDescription
filenamestringThe file path to load as a model.
Returns:ModelThe loaded model, or null

public static System.Threading.Tasks.Task`1<Sandbox.Model> LoadAsync(string filename)PUBLICSTATIC

Load a model by file path.

ParameterTypeDescription
filenamestringThe file path to load as a model.
Returns:Task<Model>The loaded model, or null

public byte[] SaveToVmdl()PUBLIC

Returns:byte[]

public System.Threading.Tasks.Task`1<byte[]> SaveToVmdlAsync()PUBLIC

Returns:Task<byte[]>

Properties33

Showing 33 properties

public int Sandbox.Model.AnimationCount { get; set; }PUBLICGETSET

Number of animations this model has.

Returns:int

public System.Collections.Generic.IReadOnlyList`1<string> Sandbox.Model.AnimationNames { get; set; }PUBLICGETSET

Returns:IReadOnlyList<string>

public int Sandbox.Model.AttachmentCount { get; set; }PUBLICGETSETOBSOLETE

Returns amount of attachment points this model has.

Obsolete: This API member is obsolete.

Returns:int

public int Sandbox.Model.BodyGroupCount { get; set; }PUBLICGETSETOBSOLETE

Obsolete: Use Parts

Returns:int

public System.Collections.Generic.IEnumerable`1<Sandbox.Model.BodyPart> Sandbox.Model.BodyParts { get; set; }PUBLICGETSETOBSOLETE

Obsolete: Use Parts

Returns:IEnumerable<BodyPart>

public int Sandbox.Model.BoneCount { get; set; }PUBLICGETSET

Number of bones this model has.

Returns:int

public BBox Sandbox.Model.Bounds { get; set; }PUBLICGETSET

Total bounds of all the meshes.

Returns:BBox

public static Sandbox.ModelBuilder Sandbox.Model.Builder { get; set; }PUBLICSTATICGETSET

Returns a static `Sandbox.ModelBuilder` instance, allowing for runtime model creation.

Returns:ModelBuilder

public static Sandbox.Model Sandbox.Model.Cube { get; set; }PUBLICSTATICGETSET

A cube model

Returns:Model

public ulong Sandbox.Model.DefaultBodyGroupMask { get; set; }PUBLICGETSETOBSOLETE

Obsolete: Use Parts

Returns:ulong

public static Sandbox.Model Sandbox.Model.Error { get; set; }PUBLICSTATICGETSET

An error model

Returns:Model

public bool Sandbox.Model.IsError { get; set; }PUBLICGETSET

Whether this model is an error model or invalid or not.

Returns:bool

public bool Sandbox.Model.IsProcedural { get; set; }PUBLICGETSET

Whether this model is procedural, i.e. it was created at runtime via `Sandbox.ModelBuilder.Create`.

Returns:bool

public virtual bool Sandbox.Model.IsValid { get; set; }PUBLICVIRTUALGETSET

Returns:bool

public int Sandbox.Model.MaterialGroupCount { get; set; }PUBLICGETSET

Number of material groups this model has.

Returns:int

public System.Collections.Immutable.ImmutableArray`1<Sandbox.Material> Sandbox.Model.Materials { get; set; }PUBLICGETSET

Retrieves an enumerable collection of all Materials on the meshes. This is fast, and cached. The order of these items is the same order used in ModelRenderer.Materials etc

Returns:ImmutableArray<Material>An ImmutableArray of Materials.

public int Sandbox.Model.MeshCount { get; set; }PUBLICGETSET

Total number of meshes this model is made out of.

Returns:int

public int Sandbox.Model.MorphCount { get; set; }PUBLICGETSET

Number of morph controllers this model has.

Returns:int

public string Sandbox.Model.Name { get; set; }PUBLICGETSET

Name of the model, usually being its file path.

Returns:string

public Sandbox.ModelParts Sandbox.Model.Parts { get; set; }PUBLICGETSET

Access to body parts of this model.

Returns:ModelParts

public BBox Sandbox.Model.PhysicsBounds { get; set; }PUBLICGETSET

Total bounds of all the physics shapes.

Returns:BBox

public static Sandbox.Model Sandbox.Model.Plane { get; set; }PUBLICSTATICGETSET

A plane model

Returns:Model

public BBox Sandbox.Model.RenderBounds { get; set; }PUBLICGETSET

Render view bounds.

Returns:BBox

public static Sandbox.Model Sandbox.Model.Sphere { get; set; }PUBLICSTATICGETSET

A sphere model

Returns:Model

On this page

Methodspublic System.Collections.Generic.Dictionary`2<Sandbox.BoneCollection.Bone,Sandbox.GameObject> CreateBoneObjects(Sandbox.GameObject root)public System.String GetAnimationName(System.Int32 animationIndex)public System.Nullable`1<Transform> GetAttachment(System.Int32 index)public System.Nullable`1<Transform> GetAttachment(System.String name)public System.String GetAttachmentName(System.Int32 index)public System.Int32 GetBaseVertex(System.Int32 drawcall)public System.String GetBoneName(System.Int32 boneIndex)public System.Int32 GetBoneParent(System.Int32 boneIndex)public Transform GetBoneTransform(System.Int32 boneIndex)public Transform GetBoneTransform(System.String bone)public System.Collections.Generic.Dictionary`2<System.String,System.String[]> GetBreakCommands()public T GetData()public System.Int32 GetIndexCount(System.Int32 drawcall)public System.Int32 GetIndexStart(System.Int32 drawcall)public System.UInt32[] GetIndices()public System.Int32 GetMaterialGroupIndex(System.String groupIndex)public System.String GetMaterialGroupName(System.Int32 groupIndex)public System.Collections.Generic.IEnumerable`1<Sandbox.Material> GetMaterials(System.Int32 groupIndex)public System.Collections.Generic.IEnumerable`1<Sandbox.Material> GetMaterials(System.String groupName)public System.String GetMorphName(System.Int32 morph)public Sandbox.Vertex[] GetVertices()public System.Single GetVisemeMorph(System.String viseme, System.Int32 morph)public System.Boolean HasData()public static Sandbox.Model Load(System.String filename)public static System.Threading.Tasks.Task`1<Sandbox.Model> LoadAsync(System.String filename)public System.Byte[] SaveToVmdl()public System.Threading.Tasks.Task`1<System.Byte[]> SaveToVmdlAsync()public System.Boolean TryGetData(System.Type t, System.Object data)public System.Boolean TryGetData(T data)Propertiespublic System.Int32 Sandbox.Model.AnimationCount { get; set; }public System.Collections.Generic.IReadOnlyList`1<System.String> Sandbox.Model.AnimationNames { get; set; }public Sandbox.AnimationGraph Sandbox.Model.AnimGraph { get; set; }public System.Int32 Sandbox.Model.AttachmentCount { get; set; }public Sandbox.ModelAttachments Sandbox.Model.Attachments { get; set; }public System.Int32 Sandbox.Model.BodyGroupCount { get; set; }public System.Collections.Generic.IEnumerable`1<Sandbox.Model.BodyPart> Sandbox.Model.BodyParts { get; set; }public System.Int32 Sandbox.Model.BoneCount { get; set; }public Sandbox.BoneCollection Sandbox.Model.Bones { get; set; }public BBox Sandbox.Model.Bounds { get; set; }public static Sandbox.ModelBuilder Sandbox.Model.Builder { get; set; }public static Sandbox.Model Sandbox.Model.Cube { get; set; }public Sandbox.Model.CommonData Sandbox.Model.Data { get; set; }public System.UInt64 Sandbox.Model.DefaultBodyGroupMask { get; set; }public static Sandbox.Model Sandbox.Model.Error { get; set; }public Sandbox.HitboxSet Sandbox.Model.HitboxSet { get; set; }public System.Boolean Sandbox.Model.IsError { get; set; }public System.Boolean Sandbox.Model.IsProcedural { get; set; }public virtual System.Boolean Sandbox.Model.IsValid { get; set; }public System.Int32 Sandbox.Model.MaterialGroupCount { get; set; }public System.Collections.Immutable.ImmutableArray`1<Sandbox.Material> Sandbox.Model.Materials { get; set; }public System.Int32 Sandbox.Model.MeshCount { get; set; }public Sandbox.Model.ModelMeshInfo Sandbox.Model.MeshInfo { get; set; }public System.Int32 Sandbox.Model.MorphCount { get; set; }public Sandbox.ModelMorphs Sandbox.Model.Morphs { get; set; }public System.String Sandbox.Model.Name { get; set; }public Sandbox.ModelParts Sandbox.Model.Parts { get; set; }public Sandbox.PhysicsGroupDescription Sandbox.Model.Physics { get; set; }public BBox Sandbox.Model.PhysicsBounds { get; set; }public static Sandbox.Model Sandbox.Model.Plane { get; set; }public BBox Sandbox.Model.RenderBounds { get; set; }public static Sandbox.Model Sandbox.Model.Sphere { get; set; }public Sandbox.Engine.Utility.RayTrace.MeshTraceRequest Sandbox.Model.Trace { get; set; }Metadata