Axiom.Core.Entity.GetAnimationState C# (CSharp) Method

GetAnimationState() public method

For entities based on animated meshes, gets the AnimationState object for a single animation.
You animate an entity by updating the animation state objects. Each of these represents the current state of each animation available to the entity. The AnimationState objects are initialized from the Mesh object.
public GetAnimationState ( string name ) : AnimationState
name string
return AnimationState
		public AnimationState GetAnimationState( string name )
		{
			Debug.Assert( this.animationState.HasAnimationState( name ), "animationState.ContainsKey(name)" );

			return this.animationState.GetAnimationState( name );
		}

Usage Example

        private void LoadMesh(string filename)
        {
            int lastBackslash = filename.LastIndexOf('\\');
            string clippedFilename = filename.Substring(lastBackslash + 1);
            string srcDir = filename.Substring(0, lastBackslash + 1);
            SetAnimation(null);
            UpdateAnimationListBox();

            if (boneDisplay != null) {
                boneDisplay.Close();
                boneDisplay = null;
            }

            if (loadedModel != null)
            {
                // clean up the last model if we are loading a new one
                RemoveCollisionObjects(0);
                CleanupSockets();
                CleanupBones();
                CleanupNormalsRenderable();
                Debug.Assert(attachedNodes.Count == 0);
                modelNode.DetachObject(loadedModel);
                sceneManager.RemoveEntity(loadedModel);
            }
            CleanupGroundPlaneRenderable();

            Mesh mesh = ReadMesh(Matrix4.Identity, srcDir, clippedFilename);
            SetupPoseAnimation(mesh);
            //             // Create the list of triangles used to query mouse hits
            // 			mesh.CreateTriangleIntersector();
            loadedMesh = mesh;

            loadedModel = sceneManager.CreateEntity("model", mesh);
            Text = "ModelViewer: " + filename;

            // move the camera focus to the middle of the new model
            ModelHeight = loadedModel.BoundingBox.Maximum.y - loadedModel.BoundingBox.Minimum.y;

            if (CameraRadius < loadedModel.BoundingRadius)
            {
                CameraRadius = loadedModel.BoundingRadius;
            }

            PositionCamera();

            modelNode.AttachObject(loadedModel);

            AddCollisionObject(loadedModel, modelNode, 0,
                               Path.GetFileNameWithoutExtension(clippedFilename) + ".physics");

            //modelNode.DetachObject(loadedModel);
            loadedModel.ShowBoundingBox = showBoundingBox;

            if (loadedModel.Mesh != null && loadedModel.Mesh.ContainsAnimation("manual")) {
                AnimationState manualAnimState = loadedModel.GetAnimationState("manual");
                manualAnimState.Time = 0;
                manualAnimState.IsEnabled = true;
            }

            PopulateSubMeshListBox();
            PopulateAnimationListBox();
            PopulateSocketListBox();
            PopulateBonesListBox();

            // disable the fields
            parentBoneLabel.Visible = false;
            parentBoneValueLabel.Text = "";
            parentBoneValueLabel.Visible = false;
        }