Пример #1
0
        public string AddFrameCommand(idDeclModel modelDef, int frameIndex, idLexer lexer, idDict def)
        {
            // make sure we're within bounds
            if ((frameIndex < 1) || (frameIndex > _anims[0].FrameCount))
            {
                return(string.Format("Frame {0} out of range", frameIndex));
            }

            // frame numbers are 1 based in .def files, but 0 based internally
            frameIndex--;

            idToken token;
            AnimationFrameCommand frameCommand = new AnimationFrameCommand();

            if ((token = lexer.ReadTokenOnLine()) == null)
            {
                return("Unexpected end of line");
            }

            string tokenValue = token.ToString();

            if (tokenValue == "call")
            {
                if ((token = lexer.ReadTokenOnLine()) == null)
                {
                    return("Unexpected end of line");
                }

                tokenValue        = token.ToString();
                frameCommand.Type = AnimationFrameCommandType.ScriptFunction;
                idConsole.Warning("TODO: fc.function = gameLocal.program.FindFunction( token );");

                if (frameCommand.Function == null)
                {
                    return(string.Format("Function '{0}' not found", tokenValue));
                }
            }
            else if (tokenValue == "object_call")
            {
                if ((token = lexer.ReadTokenOnLine()) == null)
                {
                    return("Unexpected end of line");
                }

                tokenValue          = token.ToString();
                frameCommand.Type   = AnimationFrameCommandType.ScriptFunctionObject;
                frameCommand.String = tokenValue;
            }
            else if (tokenValue == "event")
            {
                if ((token = lexer.ReadTokenOnLine()) == null)
                {
                    return("Unexpected end of line");
                }

                tokenValue        = token.ToString();
                frameCommand.Type = AnimationFrameCommandType.EventFunction;

                idConsole.Warning("TODO: idAnim Event");

                /*const idEventDef *ev = idEventDef::FindEvent( token );
                 * if ( !ev ) {
                 *      return va( "Event '%s' not found", token.c_str() );
                 * }
                 * if ( ev->GetNumArgs() != 0 ) {
                 *      return va( "Event '%s' has arguments", token.c_str() );
                 * }*/

                frameCommand.String = tokenValue;
            }
            else if ((tokenValue == "sound") ||
                     (tokenValue == "sound_voice") ||
                     (tokenValue == "sound_voice2") ||
                     (tokenValue == "sound_body") ||
                     (tokenValue == "sound_body2") ||
                     (tokenValue == "sound_body3") ||
                     (tokenValue == "sound_weapon") ||
                     (tokenValue == "sound_global") ||
                     (tokenValue == "sound_item") ||
                     (tokenValue == "sound_chatter"))
            {
                if ((token = lexer.ReadTokenOnLine()) == null)
                {
                    return("Unexpected end of line");
                }

                switch (tokenValue)
                {
                case "sound":
                    frameCommand.Type = AnimationFrameCommandType.Sound;
                    break;

                case "sound_voice":
                    frameCommand.Type = AnimationFrameCommandType.SoundVoice;
                    break;

                case "sound_voice2":
                    frameCommand.Type = AnimationFrameCommandType.SoundVoice2;
                    break;

                case "sound_body":
                    frameCommand.Type = AnimationFrameCommandType.SoundBody;
                    break;

                case "sound_body2":
                    frameCommand.Type = AnimationFrameCommandType.SoundBody2;
                    break;

                case "sound_body3":
                    frameCommand.Type = AnimationFrameCommandType.SoundBody3;
                    break;

                case "sound_weapon":
                    frameCommand.Type = AnimationFrameCommandType.SoundWeapon;
                    break;

                case "sound_global":
                    frameCommand.Type = AnimationFrameCommandType.SoundGlobal;
                    break;

                case "sound_item":
                    frameCommand.Type = AnimationFrameCommandType.SoundItem;
                    break;

                case "sound_chatter":
                    frameCommand.Type = AnimationFrameCommandType.SoundChatter;
                    break;
                }

                tokenValue = token.ToString();

                if (tokenValue.StartsWith("snd_") == true)
                {
                    frameCommand.String = tokenValue;
                }
                else
                {
                    frameCommand.SoundMaterial = idE.DeclManager.FindSound(tokenValue);

                    if (frameCommand.SoundMaterial.State == DeclState.Defaulted)
                    {
                        idConsole.Warning("Sound '{0}' not found", tokenValue);
                    }
                }
            }
            else if (tokenValue == "skin")
            {
                if ((token = lexer.ReadTokenOnLine()) == null)
                {
                    return("Unexpected end of line");
                }

                tokenValue        = token.ToString();
                frameCommand.Type = AnimationFrameCommandType.Skin;

                if (tokenValue == "none")
                {
                    frameCommand.Skin = null;
                }
                else
                {
                    frameCommand.Skin = idE.DeclManager.FindSkin(tokenValue);

                    if (frameCommand.Skin == null)
                    {
                        return(string.Format("Skin '{0}' not found", tokenValue));
                    }
                }
            }
            else if (tokenValue == "fx")
            {
                if ((token = lexer.ReadTokenOnLine()) == null)
                {
                    return("Unexpected end of line");
                }

                tokenValue        = token.ToString();
                frameCommand.Type = AnimationFrameCommandType.Fx;

                if (idE.DeclManager.FindType(DeclType.Fx, tokenValue) == null)
                {
                    return(string.Format("fx '{0}' not found", tokenValue));
                }

                frameCommand.String = tokenValue;
            }
            else if (tokenValue == "trigger")
            {
                if ((token = lexer.ReadTokenOnLine()) == null)
                {
                    return("Unexpected end of line");
                }

                tokenValue          = token.ToString();
                frameCommand.Type   = AnimationFrameCommandType.Trigger;
                frameCommand.String = tokenValue;
            }
            else if (tokenValue == "triggerSmokeParticle")
            {
                if ((token = lexer.ReadTokenOnLine()) == null)
                {
                    return("Unexpected end of line");
                }

                tokenValue          = token.ToString();
                frameCommand.Type   = AnimationFrameCommandType.TriggerSmokeParticle;
                frameCommand.String = tokenValue;
            }
            else if ((tokenValue == "melee") ||
                     (tokenValue == "direct_damage") ||
                     (tokenValue == "attack_begin"))
            {
                if ((token = lexer.ReadTokenOnLine()) == null)
                {
                    return("Unexpected end of line");
                }

                switch (tokenValue)
                {
                case "melee":
                    frameCommand.Type = AnimationFrameCommandType.Melee;
                    break;

                case "direct_damage":
                    frameCommand.Type = AnimationFrameCommandType.DirectDamage;
                    break;

                case "attack_begin":
                    frameCommand.Type = AnimationFrameCommandType.BeginAttack;
                    break;
                }

                tokenValue = token.ToString();

                if (idR.Game.FindEntityDef(tokenValue, false) == null)
                {
                    return(string.Format("Unknown entityDef '{0}'", tokenValue));
                }

                frameCommand.String = tokenValue;
            }
            else if (tokenValue == "attack_end")
            {
                frameCommand.Type = AnimationFrameCommandType.EndAttack;
            }
            else if (tokenValue == "muzzle_flash")
            {
                if ((token = lexer.ReadTokenOnLine()) == null)
                {
                    return("Unexpected end of line");
                }

                tokenValue = token.ToString();

                if ((tokenValue != string.Empty) && (modelDef.FindJoint(tokenValue) == null))
                {
                    return(string.Format("Joint '{0}' not found", tokenValue));
                }

                frameCommand.Type   = AnimationFrameCommandType.MuzzleFlash;
                frameCommand.String = tokenValue;
            }
            else if ((tokenValue == "create_missile") ||
                     (tokenValue == "launch_missile"))
            {
                if ((token = lexer.ReadTokenOnLine()) == null)
                {
                    return("Unexpected end of line");
                }

                switch (tokenValue)
                {
                case "create_missile":
                    frameCommand.Type = AnimationFrameCommandType.CreateMissile;
                    break;

                case "launch_missile":
                    frameCommand.Type = AnimationFrameCommandType.LaunchMissile;
                    break;
                }

                tokenValue          = token.ToString();
                frameCommand.String = tokenValue;

                if (modelDef.FindJoint(tokenValue) == null)
                {
                    return(string.Format("Joint '{0}' not found", tokenValue));
                }
            }
            else if (tokenValue == "fire_missile_at_target")
            {
                if ((token = lexer.ReadTokenOnLine()) == null)
                {
                    return("Unexpected end of line");
                }

                JointInfo jointInfo = modelDef.FindJoint(token.ToString());

                if (jointInfo == null)
                {
                    return(string.Format("Joint '{0}' not found", token.ToString()));
                }

                if ((token = lexer.ReadTokenOnLine()) == null)
                {
                    return("Unexpected end of line");
                }

                frameCommand.Type   = AnimationFrameCommandType.FireMissileAtTarget;
                frameCommand.String = token.ToString();
                frameCommand.Index  = jointInfo.Index;
            }
            else if (tokenValue == "footstep")
            {
                frameCommand.Type = AnimationFrameCommandType.Footstep;
            }
            else if (tokenValue == "leftfoot")
            {
                frameCommand.Type = AnimationFrameCommandType.LeftFoot;
            }
            else if (tokenValue == "rightfoot")
            {
                frameCommand.Type = AnimationFrameCommandType.RightFoot;
            }
            else if (tokenValue == "enableEyeFocus")
            {
                frameCommand.Type = AnimationFrameCommandType.EnableEyeFocus;
            }
            else if (tokenValue == "disableEyeFocus")
            {
                frameCommand.Type = AnimationFrameCommandType.DisableEyeFocus;
            }
            else if (tokenValue == "disableGravity")
            {
                frameCommand.Type = AnimationFrameCommandType.DisableGravity;
            }
            else if (tokenValue == "enableGravity")
            {
                frameCommand.Type = AnimationFrameCommandType.EnableGravity;
            }
            else if (tokenValue == "jump")
            {
                frameCommand.Type = AnimationFrameCommandType.Jump;
            }
            else if (tokenValue == "enableClip")
            {
                frameCommand.Type = AnimationFrameCommandType.EnableClip;
            }
            else if (tokenValue == "disableClip")
            {
                frameCommand.Type = AnimationFrameCommandType.DisableClip;
            }
            else if (tokenValue == "enableWalkIK")
            {
                frameCommand.Type = AnimationFrameCommandType.EnableWalkIk;
            }
            else if (tokenValue == "disableWalkIK")
            {
                frameCommand.Type = AnimationFrameCommandType.DisableWalkIk;
            }
            else if (tokenValue == "enableLegIK")
            {
                if ((token = lexer.ReadTokenOnLine()) == null)
                {
                    return("Unexpected end of file");
                }

                frameCommand.Type  = AnimationFrameCommandType.EnableLegIk;
                frameCommand.Index = int.Parse(token.ToString());
            }
            else if (tokenValue == "disableLegIK")
            {
                if ((token = lexer.ReadTokenOnLine()) == null)
                {
                    return("Unexpected end of file");
                }

                frameCommand.Type  = AnimationFrameCommandType.DisableLegIk;
                frameCommand.Index = int.Parse(token.ToString());
            }
            else if (tokenValue == "recordDemo")
            {
                frameCommand.Type = AnimationFrameCommandType.RecordDemo;

                if ((token = lexer.ReadTokenOnLine()) != null)
                {
                    frameCommand.String = token.ToString();
                }
            }
            else if (tokenValue == "aviGame")
            {
                frameCommand.Type = AnimationFrameCommandType.AviGame;

                if ((token = lexer.ReadTokenOnLine()) != null)
                {
                    frameCommand.String = token.ToString();
                }
            }
            else
            {
                return(string.Format("Unknown command '{0}'", tokenValue));
            }

            // check if we've initialized the frame lookup table
            if (_frameLookups.Count == 0)
            {
                // we haven't, so allocate the table and initialize it

                for (int i = 0; i < _anims[0].FrameCount; i++)
                {
                    _frameLookups.Add(new AnimationFrameLookup());
                }
            }

            // calculate the index of the new command
            int index = _frameLookups[frameIndex].FirstCommand + _frameLookups[frameIndex].Index;
            int count = _frameLookups.Count;

            _frameCommands.Insert(index, frameCommand);

            // fix the indices of any later frames to account for the inserted command
            for (int i = frameIndex + 1; i < count; i++)
            {
                _frameLookups[i].FirstCommand++;
            }

            // increase the number of commands on this frame
            _frameLookups[frameIndex].Index++;

            // return with no error
            return(null);
        }
Пример #2
0
        public override bool Parse(string text)
        {
            if (this.Disposed == true)
            {
                throw new ObjectDisposedException(this.GetType().Name);
            }

            idLexer lexer = new idLexer(idDeclFile.LexerOptions);

            lexer.LoadMemory(text, this.FileName, this.LineNumber);
            lexer.SkipUntilString("{");

            int     defaultAnimationCount = 0;
            idToken token;
            idToken token2;
            string  tokenValue;
            string  fileName;
            string  extension;
            int     count;

            idMD5Joint[] md5Joints;

            while (true)
            {
                if ((token = lexer.ReadToken()) == null)
                {
                    break;
                }

                tokenValue = token.ToString();

                if (tokenValue == "}")
                {
                    break;
                }

                if (tokenValue == "inherit")
                {
                    idConsole.WriteLine("TODO: inherit");

                    /*if( !src.ReadToken( &token2 ) ) {
                     *      src.Warning( "Unexpected end of file" );
                     *      MakeDefault();
                     *      return false;
                     * }
                     *
                     * const idDeclModelDef *copy = static_cast<const idDeclModelDef *>( declManager->FindType( DECL_MODELDEF, token2, false ) );
                     * if ( !copy ) {
                     *      common->Warning( "Unknown model definition '%s'", token2.c_str() );
                     * } else if ( copy->GetState() == DS_DEFAULTED ) {
                     *      common->Warning( "inherited model definition '%s' defaulted", token2.c_str() );
                     *      MakeDefault();
                     *      return false;
                     * } else {
                     *      CopyDecl( copy );
                     *      numDefaultAnims = anims.Num();
                     * }*/
                }
                else if (tokenValue == "skin")
                {
                    if ((token2 = lexer.ReadToken()) == null)
                    {
                        lexer.Warning("Unexpected end of file");
                        MakeDefault();

                        return(false);
                    }

                    _skin = idE.DeclManager.FindSkin(token2.ToString());

                    if (_skin == null)
                    {
                        lexer.Warning("Skin '{0}' not found", token2.ToString());
                        MakeDefault();

                        return(false);
                    }
                }
                else if (tokenValue == "mesh")
                {
                    if ((token2 = lexer.ReadToken()) == null)
                    {
                        lexer.Warning("Unexpected end of file");
                        MakeDefault();

                        return(false);
                    }

                    fileName  = token2.ToString();
                    extension = Path.GetExtension(fileName);

                    if (extension != idRenderModel_MD5.MeshExtension)
                    {
                        lexer.Warning("Invalid model for MD5 mesh");
                        MakeDefault();

                        return(false);
                    }

                    _model = idE.RenderModelManager.FindModel(fileName);

                    if (_model == null)
                    {
                        lexer.Warning("Model '{0}' not found", fileName);
                        MakeDefault();

                        return(false);
                    }
                    else if (_model.IsDefault == true)
                    {
                        lexer.Warning("Model '{0}' defaulted", fileName);
                        MakeDefault();

                        return(false);
                    }

                    // get the number of joints
                    count = _model.JointCount;

                    if (count == 0)
                    {
                        lexer.Warning("Model '{0}' has no joints", fileName);
                    }

                    // set up the joint hierarchy
                    md5Joints = _model.Joints;

                    _joints           = new JointInfo[count];
                    _jointParents     = new int[count];
                    _channelJoints    = new int[(int)AnimationChannel.Count][];
                    _channelJoints[0] = new int[count];

                    for (int i = 0; i < count; i++)
                    {
                        _joints[i]         = new JointInfo();
                        _joints[i].Channel = AnimationChannel.All;
                        _joints[i].Index   = i;

                        if (md5Joints[i].Parent != null)
                        {
                            _joints[i].ParentIndex = _model.GetJointIndex(md5Joints[i].Parent);
                        }
                        else
                        {
                            _joints[i].ParentIndex = -1;
                        }

                        _jointParents[i]     = _joints[i].ParentIndex;
                        _channelJoints[0][i] = i;
                    }
                }
                else if (tokenValue == "remove")
                {
                    idConsole.Warning("TODO: remove");

                    // removes any anims whos name matches

                    /*if( !src.ReadToken( &token2 ) ) {
                     *      src.Warning( "Unexpected end of file" );
                     *      MakeDefault();
                     *      return false;
                     * }
                     * num = 0;
                     * for( i = 0; i < anims.Num(); i++ ) {
                     *      if ( ( token2 == anims[ i ]->Name() ) || ( token2 == anims[ i ]->FullName() ) ) {
                     *              delete anims[ i ];
                     *              anims.RemoveIndex( i );
                     *              if ( i >= numDefaultAnims ) {
                     *                      src.Warning( "Anim '%s' was not inherited.  Anim should be removed from the model def.", token2.c_str() );
                     *                      MakeDefault();
                     *                      return false;
                     *              }
                     *              i--;
                     *              numDefaultAnims--;
                     *              num++;
                     *              continue;
                     *      }
                     * }
                     * if ( !num ) {
                     *      src.Warning( "Couldn't find anim '%s' to remove", token2.c_str() );
                     *      MakeDefault();
                     *      return false;
                     * }*/
                }
                else if (tokenValue == "anim")
                {
                    if (_model == null)
                    {
                        lexer.Warning("Must specify mesh before defining anims");
                        MakeDefault();

                        return(false);
                    }
                    else if (ParseAnimation(lexer, defaultAnimationCount) == false)
                    {
                        MakeDefault();

                        return(false);
                    }
                }
                else if (tokenValue == "offset")
                {
                    float[] tmp = lexer.Parse1DMatrix(3);

                    if (tmp == null)
                    {
                        lexer.Warning("Expected vector following 'offset'");
                        MakeDefault();
                        return(false);
                    }

                    _offset = new Vector3(tmp[0], tmp[1], tmp[2]);
                }
                else if (tokenValue == "channel")
                {
                    if (_model == null)
                    {
                        lexer.Warning("Must specify mesh before defining channels");
                        MakeDefault();

                        return(false);
                    }

                    // set the channel for a group of joints
                    if ((token2 = lexer.ReadToken()) == null)
                    {
                        lexer.Warning("Unexpected end of file");
                        MakeDefault();

                        return(false);
                    }

                    if (lexer.CheckTokenString("(") == false)
                    {
                        lexer.Warning("Expected { after '{0}'", token2.ToString());
                        MakeDefault();

                        return(false);
                    }

                    int i;
                    int channelCount = (int)AnimationChannel.Count;

                    for (i = (int)AnimationChannel.All + 1; i < channelCount; i++)
                    {
                        if (ChannelNames[i].Equals(token2.ToString(), StringComparison.OrdinalIgnoreCase) == true)
                        {
                            break;
                        }
                    }

                    if (i >= channelCount)
                    {
                        lexer.Warning("Unknown channel '{0}'", token2.ToString());
                        MakeDefault();

                        return(false);
                    }

                    int           channel    = i;
                    StringBuilder jointNames = new StringBuilder();
                    string        token2Value;

                    while (lexer.CheckTokenString(")") == false)
                    {
                        if ((token2 = lexer.ReadToken()) == null)
                        {
                            lexer.Warning("Unexpected end of file");
                            MakeDefault();

                            return(false);
                        }

                        token2Value = token2.ToString();
                        jointNames.Append(token2Value);

                        if ((token2Value != "*") && (token2Value != "-"))
                        {
                            jointNames.Append(" ");
                        }
                    }

                    int[] jointList   = GetJointList(jointNames.ToString());
                    int   jointLength = jointList.Length;

                    List <int> channelJoints = new List <int>();

                    for (count = i = 0; i < jointLength; i++)
                    {
                        int jointIndex = jointList[i];

                        if (_joints[jointIndex].Channel != AnimationChannel.All)
                        {
                            lexer.Warning("Join '{0}' assigned to multiple channels", _model.GetJointName(jointIndex));
                            continue;
                        }

                        _joints[jointIndex].Channel = (AnimationChannel)channel;
                        channelJoints.Add(jointIndex);
                    }

                    _channelJoints[channel] = channelJoints.ToArray();
                }
                else
                {
                    lexer.Warning("unknown token '{0}'", token.ToString());
                    MakeDefault();

                    return(false);
                }
            }

            return(true);
        }
Пример #3
0
		public override bool Parse(string text)
		{
			if(this.Disposed == true)
			{
				throw new ObjectDisposedException(this.GetType().Name);
			}

			idLexer lexer = new idLexer(idDeclFile.LexerOptions);
			lexer.LoadMemory(text, this.FileName, this.LineNumber);
			lexer.SkipUntilString("{");

			int defaultAnimationCount = 0;
			idToken token;
			idToken token2;
			string tokenValue;
			string fileName;
			string extension;
			int count;
			idMD5Joint[] md5Joints;

			while(true)
			{
				if((token = lexer.ReadToken()) == null)
				{
					break;
				}

				tokenValue = token.ToString();

				if(tokenValue == "}")
				{
					break;
				}

				if(tokenValue == "inherit")
				{
					idConsole.WriteLine("TODO: inherit");

					/*if( !src.ReadToken( &token2 ) ) {
						src.Warning( "Unexpected end of file" );
						MakeDefault();
						return false;
					}
			
					const idDeclModelDef *copy = static_cast<const idDeclModelDef *>( declManager->FindType( DECL_MODELDEF, token2, false ) );
					if ( !copy ) {
						common->Warning( "Unknown model definition '%s'", token2.c_str() );
					} else if ( copy->GetState() == DS_DEFAULTED ) {
						common->Warning( "inherited model definition '%s' defaulted", token2.c_str() );
						MakeDefault();
						return false;
					} else {
						CopyDecl( copy );
						numDefaultAnims = anims.Num();
					}*/
				} 
				else if(tokenValue == "skin") 
				{
					if((token2 = lexer.ReadToken()) == null)
					{
						lexer.Warning("Unexpected end of file");
						MakeDefault();

						return false;
					}

					_skin = idE.DeclManager.FindSkin(token2.ToString());

					if(_skin == null)
					{
						lexer.Warning("Skin '{0}' not found", token2.ToString());
						MakeDefault();

						return false;
					}
				} 
				else if(tokenValue == "mesh")
				{
					if((token2 = lexer.ReadToken()) == null)
					{
						lexer.Warning("Unexpected end of file");
						MakeDefault();

						return false;
					}

					fileName = token2.ToString();
					extension = Path.GetExtension(fileName);

					if(extension != idRenderModel_MD5.MeshExtension)
					{
						lexer.Warning("Invalid model for MD5 mesh");
						MakeDefault();

						return false;
					}

					_model = idE.RenderModelManager.FindModel(fileName);

					if(_model == null)
					{
						lexer.Warning("Model '{0}' not found", fileName);
						MakeDefault();

						return false;
					}
					else if(_model.IsDefault == true)
					{
						lexer.Warning("Model '{0}' defaulted", fileName);
						MakeDefault();

						return false;
					}

					// get the number of joints
					count = _model.JointCount;

					if(count == 0)
					{
						lexer.Warning("Model '{0}' has no joints", fileName);
					}

					// set up the joint hierarchy
					md5Joints = _model.Joints;

					_joints = new JointInfo[count];
					_jointParents = new int[count];
					_channelJoints = new int[(int) AnimationChannel.Count][];
					_channelJoints[0] = new int[count];

					for(int i = 0; i < count; i++)
					{
						_joints[i] = new JointInfo();
						_joints[i].Channel = AnimationChannel.All;
						_joints[i].Index = i;

						if(md5Joints[i].Parent != null)
						{
							_joints[i].ParentIndex = _model.GetJointIndex(md5Joints[i].Parent);
						}
						else
						{
							_joints[i].ParentIndex = -1;
						}

						_jointParents[i] = _joints[i].ParentIndex;
						_channelJoints[0][i] = i;
					}
				}
				else if(tokenValue == "remove")
				{
					idConsole.Warning("TODO: remove");

					// removes any anims whos name matches
					/*if( !src.ReadToken( &token2 ) ) {
						src.Warning( "Unexpected end of file" );
						MakeDefault();
						return false;
					}
					num = 0;
					for( i = 0; i < anims.Num(); i++ ) {
						if ( ( token2 == anims[ i ]->Name() ) || ( token2 == anims[ i ]->FullName() ) ) {
							delete anims[ i ];
							anims.RemoveIndex( i );
							if ( i >= numDefaultAnims ) {
								src.Warning( "Anim '%s' was not inherited.  Anim should be removed from the model def.", token2.c_str() );
								MakeDefault();
								return false;
							}
							i--;
							numDefaultAnims--;
							num++;
							continue;
						}
					}
					if ( !num ) {
						src.Warning( "Couldn't find anim '%s' to remove", token2.c_str() );
						MakeDefault();
						return false;
					}*/
				} 
				else if(tokenValue == "anim") 
				{
					if(_model == null)
					{
						lexer.Warning("Must specify mesh before defining anims");
						MakeDefault();

						return false;
					}
					else if(ParseAnimation(lexer, defaultAnimationCount) == false)
					{
						MakeDefault();

						return false;
					}
				} 
				else if(tokenValue == "offset") 
				{
					float[] tmp = lexer.Parse1DMatrix(3);

					if(tmp == null)
					{
						lexer.Warning("Expected vector following 'offset'");
						MakeDefault();
						return false;
					}

					_offset = new Vector3(tmp[0], tmp[1], tmp[2]);
				} 
				else if(tokenValue == "channel") 
				{
					if(_model == null)
					{
						lexer.Warning("Must specify mesh before defining channels");
						MakeDefault();

						return false;
					}

					// set the channel for a group of joints
					if((token2 = lexer.ReadToken()) == null)
					{
						lexer.Warning("Unexpected end of file");
						MakeDefault();

						return false;
					}

					if(lexer.CheckTokenString("(") == false)
					{
						lexer.Warning("Expected { after '{0}'", token2.ToString());
						MakeDefault();

						return false;
					}

					int i;
					int channelCount = (int) AnimationChannel.Count;

					for(i = (int) AnimationChannel.All + 1; i < channelCount; i++)
					{
						if(ChannelNames[i].Equals(token2.ToString(), StringComparison.OrdinalIgnoreCase) == true)
						{
							break;
						}
					}

					if(i >= channelCount)
					{
						lexer.Warning("Unknown channel '{0}'", token2.ToString());
						MakeDefault();

						return false;
					}

					int channel = i;
					StringBuilder jointNames = new StringBuilder();
					string token2Value;

					while(lexer.CheckTokenString(")") == false)
					{
						if((token2 = lexer.ReadToken()) == null)
						{
							lexer.Warning("Unexpected end of file");
							MakeDefault();

							return false;
						}

						token2Value = token2.ToString();
						jointNames.Append(token2Value);

						if((token2Value != "*") && (token2Value != "-"))
						{
							jointNames.Append(" ");
						}
					}

					int[] jointList = GetJointList(jointNames.ToString());
					int jointLength = jointList.Length;

					List<int> channelJoints = new List<int>();
					
					for(count = i = 0; i < jointLength; i++)
					{
						int jointIndex = jointList[i];

						if(_joints[jointIndex].Channel != AnimationChannel.All)
						{
							lexer.Warning("Join '{0}' assigned to multiple channels", _model.GetJointName(jointIndex));
							continue;
						}

						_joints[jointIndex].Channel = (AnimationChannel) channel;
						channelJoints.Add(jointIndex);
					}

					_channelJoints[channel] = channelJoints.ToArray();
				}
				else
				{
					lexer.Warning("unknown token '{0}'", token.ToString());
					MakeDefault();

					return false;
				}
			}
		
			return true;
		}