ImportSkeleton() public method

public ImportSkeleton ( Stream stream, Skeleton skeleton ) : void
stream Stream
skeleton Axiom.Animating.Skeleton
return void
        /// <summary>
        ///		Loads the mesh data.
        /// </summary>
        /// <summary>
        ///    Generic load, called by SkeletonManager.
        /// </summary>
        public override void Load()
        {
            if (isLoaded) {
                Unload();
                isLoaded = false;
            }

            skeletonLoadMeter.Enter();

            LogManager.Instance.Write("Skeleton: Loading '{0}'...", name);

            // load the skeleton file
            Stream data = SkeletonManager.Instance.FindResourceData(name);

            string extension = Path.GetExtension(name);

            if (extension == ".skeleton") {
                // instantiate a new skeleton reader
                OgreSkeletonSerializer reader = new OgreSkeletonSerializer();
                reader.ImportSkeleton(data, this);
            } else if (extension == ".xml") {
                // instantiate a new skeleton reader
                OgreXmlSkeletonReader reader = new OgreXmlSkeletonReader(data);
                reader.Import(this);
            } else {
                data.Close();
                throw new Exception("Unsupported skeleton file format '" + extension + "'");
            }
            data.Close();

            isLoaded = true;

            skeletonLoadMeter.Exit();
        }
Example #2
0
 private static Skeleton ReadSkeleton( Matrix4 transform, string srcDir, string skelFile )
 {
     Stream skelData = new FileStream( srcDir + skelFile, FileMode.Open );
     Skeleton skeleton = new Skeleton( skelFile );
     if( skelFile.EndsWith( ".skeleton" ) )
     {
         OgreSkeletonSerializer skelReader = new OgreSkeletonSerializer();
         skelReader.ImportSkeleton( skelData, skeleton );
     }
     else if( skelFile.EndsWith( ".skeleton.xml" ) )
     {
         OgreXmlSkeletonReader skelReader = new OgreXmlSkeletonReader( skelData );
         skelReader.Import( skeleton );
     }
     else
     {
         skelData.Close();
         string extension = Path.GetExtension( skelFile );
         throw new AxiomException( "Unsupported skeleton format '{0}'", extension );
     }
     skelData.Close();
     return skeleton;
 }
Example #3
0
		/// <summary>
		///    Generic load, called by SkeletonManager.
		/// </summary>
		protected override void load()
		{
			if ( IsLoaded )
			{
				return;
			}

			LogManager.Instance.Write( "Skeleton: Loading '{0}'...", Name );

			// load the skeleton file
			var data = ResourceGroupManager.Instance.OpenResource( Name, Group, true, this );

			// instantiate a new skeleton reader
			var reader = new OgreSkeletonSerializer();
			reader.ImportSkeleton( data, this );

			var extension = Path.GetExtension( Name );

			//TODO: Load any linked skeletons
			//LinkedSkeletonAnimSourceList::iterator i;
			//for (i = mLinkedSkeletonAnimSourceList.begin();
			//    i != mLinkedSkeletonAnimSourceList.end(); ++i)
			//{
			//    i->pSkeleton = SkeletonManager::getSingleton().load(
			//        i->skeletonName, mGroup);
			//}
		}
        /// <summary>
        ///    Generic load, called by SkeletonManager.
        /// </summary>
        protected override void LoadImpl()
        {
            LogManager.Instance.Write("Skeleton: Loading '{0}'...", name);
            skeletonLoadMeter.Enter();

            // load the skeleton file
            Stream data = SkeletonManager.Instance.FindResourceData(name);

            OgreSkeletonSerializer reader = new OgreSkeletonSerializer();
            reader.ImportSkeleton(data, this);
            // TODO: linkedSkeletonAnimSourceList
            data.Close();
            skeletonLoadMeter.Exit();
        }