[Model Edit] [Request] .m2 file animation ID edit edit menu

User Tag List

Results 1 to 4 of 4
  1. #1
    piloui's Avatar Private
    Reputation
    1
    Join Date
    Apr 2010
    Posts
    4
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [Model Edit] [Request] .m2 file animation ID edit edit

    Hi there.

    Changing animation ID.

    Why : When you swap your character for a crature, some animations are not available, so you need to edit the animation's ID of your .m2 file in order to trigger animations that were not available before.

    Actually, 2 tools allows us to do that, but they are not up to date.
    Glitchy's ME and CryectsTools.

    If you load an old version of .m2 file with both of these programs, all is runnig well
    Glitchy'sME :


    CryectsTools:
    Code:
    Animation Sequences
    0 animID: 0
    
     a - Change Animation
     q - Return to Main Menu
    But if you load a recent .m2 file, everything goes wrong.
    The structure of the last .m2 files has obviously changed.
    Glitchy'sME gives an error message:


    And CryectsTools gives us something that is more understandable :

    Compare yourself.
    Here is the <Animations> section of the .xml fileinfo from a .m2 file given by modelviewer :

    Code:
    - <Animations>
    - <Animation id="0">
      <animID>5</animID> 
      <length>2000</length> 
      <moveSpeed>0</moveSpeed> 
      <flags>32</flags> 
      <probability>32767</probability> 
      <d1>0</d1> 
      <d2>0</d2> 
      <playSpeed>300</playSpeed> 
      <boxA>(0, 0, 0)</boxA> 
      <boxB>(0, 0, 0)</boxB> 
      <rad>15.7619</rad> 
      <NextAnimation>-1</NextAnimation> 
      <Index>0</Index> 
      </Animation>
    - <Animation id="1">
      <animID>0</animID> 
      <length>5333</length> 
      <moveSpeed>0</moveSpeed> 
      <flags>32</flags> 
      <probability>28399</probability> 
      <d1>0</d1> 
      <d2>0</d2> 
      <playSpeed>200</playSpeed> 
      <boxA>(0, 0, 0)</boxA> 
      <boxB>(0, 0, 0)</boxB> 
      <rad>15.5947</rad> 
      <NextAnimation>2</NextAnimation> 
      <Index>1</Index> 
      </Animation>
    - <Animation id="2">
      <animID>0</animID> 
      <length>5333</length> 
      <moveSpeed>0</moveSpeed> 
      <flags>32</flags> 
      <probability>2184</probability> 
      <d1>0</d1> 
      <d2>0</d2> 
      <playSpeed>300</playSpeed> 
      <boxA>(0, 0, 0)</boxA> 
      <boxB>(0, 0, 0)</boxB> 
      <rad>15.5856</rad> 
      <NextAnimation>3</NextAnimation> 
      <Index>2</Index> 
      </Animation>
    - <Animation id="3">
      <animID>0</animID> 
      <length>5333</length> 
      <moveSpeed>0</moveSpeed> 
      <flags>32</flags> 
      <probability>2184</probability> 
      <d1>0</d1> 
      <d2>0</d2> 
      <playSpeed>300</playSpeed> 
      <boxA>(0, 0, 0)</boxA> 
      <boxB>(0, 0, 0)</boxB> 
      <rad>15.9096</rad> 
      <NextAnimation>-1</NextAnimation> 
      <Index>3</Index> 
      </Animation>
    - <Animation id="4">
      <animID>55</animID> 
      <length>5333</length> 
      <moveSpeed>0</moveSpeed> 
      <flags>33</flags> 
      <probability>32766</probability> 
      <d1>0</d1> 
      <d2>0</d2> 
      <playSpeed>300</playSpeed> 
      <boxA>(0, 0, 0)</boxA> 
      <boxB>(0, 0, 0)</boxB> 
      <rad>25.0662</rad> 
      <NextAnimation>-1</NextAnimation> 
      <Index>4</Index> 
      </Animation>
    - <Animation id="5">
      <animID>4</animID> 
      <length>5567</length> 
      <moveSpeed>0</moveSpeed> 
      <flags>32</flags> 
      <probability>32767</probability> 
      <d1>0</d1> 
      <d2>0</d2> 
      <playSpeed>300</playSpeed> 
      <boxA>(0, 0, 0)</boxA> 
      <boxB>(0, 0, 0)</boxB> 
      <rad>15.6194</rad> 
      <NextAnimation>-1</NextAnimation> 
      <Index>5</Index> 
      </Animation>
    - <Animation id="6">
      <animID>25</animID> 
      <length>5333</length> 
      <moveSpeed>0</moveSpeed> 
      <flags>32</flags> 
      <probability>32767</probability> 
      <d1>0</d1> 
      <d2>0</d2> 
      <playSpeed>300</playSpeed> 
      <boxA>(0, 0, 0)</boxA> 
      <boxB>(0, 0, 0)</boxB> 
      <rad>15.3374</rad> 
      <NextAnimation>-1</NextAnimation> 
      <Index>6</Index>
    It gives us more info of the strucutre of a .m2 file.
    The animation's number ( 1 to 67 or more depending of the model you have )
    The animation's ID ( Index found in the AnimationData.dbc of Wow )
    The animation's length
    The animation's speed
    The animation's flag
    etc...

    And here is what CryectsTools M2Modder gives us for the same model :

    Code:
    Animation Sequences
    0 animID: 5
    1 animID: 5333
    2 animID: 0
    3 animID: 32
    4 animID: 32766
    5 animID: 0
    6 animID: 0
    7 animID: 150
    8 animID: -1046460983
    9 animID: -1054514202
    10 animID: -1088620973
    11 animID: 1091728524
    12 animID: 1103797007
    13 animID: 1103122573
    14 animID: 1103785036
    15 animID: 1048575
    16 animID: 64
    17 animID: 3000
    18 animID: 0
    19 animID: 8
    20 animID: 1638
    21 animID: 0
    22 animID: 0
    23 animID: 150
    24 animID: -1047903351
    25 animID: -1042779891
    26 animID: -1053418304
    27 animID: 1089463465
    28 animID: 1104646608
    29 animID: 1088300695
    30 animID: 1098318196
    31 animID: 2162687
    32 animID: 118
    33 animID: 1000
    34 animID: 0
    35 animID: 33
    36 animID: 32767
    37 animID: 0
    38 animID: 0
    39 animID: 150
    40 animID: -1047791161
    41 animID: -1042813855
    42 animID: -1051128938
    43 animID: 1089647382
    44 animID: 1104514957
    45 animID: 1097166925
    46 animID: 1098109730
    47 animID: 3342335
    48 animID: 8
    49 animID: 2633
    50 animID: 0
    51 animID: 33
    52 animID: 32767
    53 animID: 0
    54 animID: 0
    55 animID: 150
    56 animID: -1048726951
    57 animID: -1042609548
    58 animID: -1052462373
    59 animID: 1089826327
    60 animID: 1102304625
    61 animID: 1099545411
    62 animID: 1105765179
    63 animID: 4390911
    64 animID: 1703937
    65 animID: -1
    66 animID: -1
    67 animID: -65511
    As you can see, these numbers do not look like ID numbers
    For anim N°0 : ID = 5 > correct
    For anim N°1 : ID = 5333 > incorrect
    the .xml gives us ID = 0
    5333 is not the ID but the length of the animation N°1
    M2Modder seems to jump for 1 line every animation
    For anim N°2 : ID = 0 > which in fact is the <moveSpeed>, 2 lines under the ID
    For anim N°3 : ID = 32 > which in fact is the <flags>, 3 lines under the ID
    Etc, etc...

    Long post to come to the point of it, but it was necessary.
    I have no solution for Glitchy'sME, just waiting for a new release.
    CryectsTools is good enough to give us the sources of the command line tools in .cpp filles ( C++ )
    I'm not good enough in C++ to update the tool.
    But if some of you could do it, i would be very thankfull
    Here is the sources of M2Modder

    Code:
    #include <stdio.h>
    #include <string.h>
    #include <stdlib.h>
    typedef float	Vec3D[3];
    typedef float	Vec2D[2];
    #include "modelheaders.h"
    
    FILE *Input;
    
    char	*f;
    int		FileSize;
    ModelHeader *header;
    ModelBoneDef		*bones;
    ModelRenderFlags	*rf;
    ModelTextureDef		*tex;
    ModelTexUnit		*texunit;
    ModelView			*view;
    ModelAnimation		*animations;
    ModelParticleEmitterDef	*particles;
    ModelRibbonEmitterDef	*ribbons;
    short	*texUnitMapping;
    bool changed=false;
    
    
    void displayAnimBlock(AnimationBlock *block)
    {
    	int *Times;
    	float *Keys;
    	printf("Interpolation Type: %d NumRange: %d NumTimestamps: %d NumValues: %d\n",block->type,block->nRanges,block->nTimes,block->nKeys);
    	Times=(int *)(f+block->ofsTimes);
    	Keys=(float *)(f+block->ofsKeys);
    	for(int i=0;i<block->nKeys;i++)
    		printf("%d(%d)-  %.3f\n",i,Times[i],Keys[i]);
    }
    
    void displayAnimBlockFFF(AnimationBlock *block)
    {
    	int *Times;
    	float *Keys;
    	printf("Interpolation Type: %d NumRange: %d NumTimestamps: %d NumValues: %d\n",block->type,block->nRanges,block->nTimes,block->nKeys);
    	Times=(int *)(f+block->ofsTimes);
    	Keys=(float *)(f+block->ofsKeys);
    	for(int i=0;i<block->nKeys;i++)
    		printf("%d(%d)-  %8.3f %8.3f %8.3f\n",i,Times[i],Keys[i*3],Keys[i*3+1],Keys[i*3+2]);
    }
    
    void editAnimBlock(AnimationBlock *block)
    {
    	int i;
    	float tf,*Keys;
    	displayAnimBlock(block);
    	Keys=(float *)(f+block->ofsKeys);
    	do{
    		printf("Edit which key? (-1 to return)\n");
    		scanf("%d",&i);
    		if((i>=0)&&(i<block->nKeys))
    		{
    			printf("New Value? (Cur Value %.3f)\n",Keys[i]);
    			scanf("%f",&tf);
    			Keys[i]=tf;
    			changed=true;
    		}
    		else if(i!=-1)
    			printf("Key %d isn't valid\n",i);
    	}while(i!=-1);
    
    void editAnimBlockFFF(AnimationBlock *block)
    {
    	int i;
    	float tf,*Keys;
    	displayAnimBlockFFF(block);
    	Keys=(float *)(f+block->ofsKeys);
    	do{
    		printf("Edit which key? (-1 to return)\n");
    		scanf("%d",&i);
    		if((i>=0)&&(i<block->nKeys))
    		{
    			for(int j=0;j<3;j++)
    			{
    				printf("New Value %d? (Cur Value %.3f)\n",j,Keys[i*3+j]);
    				scanf("%f",&tf);
    				Keys[i*3+j]=tf;
    			}
    			changed=true;
    		}
    		else if(i!=-1)
    			printf("Key %d isn't valid\n",i);
    	}while(i!=-1);
    }
    
    
    
    void editParticles()
    {
    	do{
    		int i,j;
    		char t;
    		
    		system("clear");
    		printf("Textures\n");
    
    		for(i=0;i<header->nParticleEmitters;i++)
    		{
    			setTextureType(tex[i].type);
    			
    			printf("%d Flags: %02x Bone: %d Pos: %.2f %.2f %.2f Texture: %d Blend: %d Type: %d\n",i,particles[i].flags,particles[i].bone,particles[i].pos[0],particles[i].pos[1],particles[i].pos[2],particles[i].texture,particles[i].blend,particles[i].type);
    			printf("\tColors %08x %08x %08x\n",particles[i].p.colors[0],particles[i].p.colors[1],particles[i].p.colors[2]);
    			printf("\tSizes %.2f %.2f %.2f\n",particles[i].p.sizes[0],particles[i].p.sizes[1],particles[i].p.sizes[2]);
    			printf("\tSlowdown %.2f Rotation %.2f\n",particles[i].p.slowdown,particles[i].p.rotation);
    		}
    
    
    		printf("\n f - Change Flags\n n - Change Bones\n p - Change Position\n r - Change Rotation\n t - Change Texture\n c - Change Colors\n b - Change Blending\n y - Change Emitter Type\n s - Change Sizes\n a - Edit Animation Block\n q - Return to Main Menu\n");
    		t=getchar();
    		if(t=='p')
    		{
    			i=-1;
    
    			do{
    				printf("\nChange a postion (number of particle or -1 to quit)\n");
    				scanf ("%d",&i);
    				if((i>=0)&&(i<header->nParticleEmitters))
    				{
    					float Pos[3];
    					printf("New Position (format \"x y z\")\n");
    					scanf ("%f %f %f",&Pos[0],&Pos[1],&Pos[2]);
    					for(j=0;j<3;j++)
    						particles[i].pos[j]=Pos[j];
    					changed=true;
    				}
    			}while(i!=-1);
    		}
    		else if(t=='s')
    		{
    			i=-1;
    
    			do{
    				printf("\nChange the sizes (number of particle or -1 to quit)\n");
    				scanf ("%d",&i);
    				if((i>=0)&&(i<header->nParticleEmitters))
    				{
    					float Size[3];
    					printf("New Sizes (format \"b m e\")\n");
    					scanf ("%f %f %f",&Size[0],&Size[1],&Size[2]);
    					for(j=0;j<3;j++)
    						particles[i].p.sizes[j]=Size[j];
    					changed=true;
    				}
    			}while(i!=-1);
    		}
    		else if(t=='a')
    		{
    			i=-1;
    			printf("Animation Block Types\n");
    			printf("0 - Emission Speed\n");
    			printf("1 - Speed Variation (range 0 to 1)\n");
    			printf("2 - Rotation\\Tumble Spread (range 0 to pi)\n");
    			printf("3 - ? (range: 0 to 2pi)\n");
    			printf("4 - Gravity\n");
    			printf("5 - Lifespan\n");
    			printf("6 - Emission Rate\n");
    			printf("7 - Emission Area Length\n");
    			printf("8 - Emission Area Width\n");
    			printf("9 - Gravity? (much stronger)\n");
    
    			do{
    				printf("Edit Animation Block (number of particle or -1 to quit)\n");
    				scanf ("%d",&i);
    				if((i>=0)&&(i<header->nParticleEmitters))
    				{
    					float Pos[3];
    					printf("Which Block(0-9)\n");
    					scanf ("%d",&j);
    					editAnimBlock(&(particles[i].params[j]));
    				}
    			}while(i!=-1);
    		}
    		if(t=='b')
    		{
    			i=-1;
    
    			do{
    				printf("\nChange a blend mode (number of particle or -1 to quit)\n");
    				scanf ("%d",&i);
    				if((i>=0)&&(i<header->nParticleEmitters))
    				{
    					printf("New Blend Mode (0 - Opaque, 1 - Alpha testing, 2 - Alpha Blending, 3 - Additive, 4 - Additive Alpha, 5 - Modulate, 6 - Deeprun Tram Glass\n");
    					scanf ("%d",&j);
    					particles[i].blend=j;
    					changed=true;
    				}
    			}while(i!=-1);
    		}
    		if(t=='f')
    		{
    			i=-1;
    
    			do{
    				printf("\nChange flags (number of particle or -1 to quit)\n");
    				scanf ("%d",&i);
    				if((i>=0)&&(i<header->nParticleEmitters))
    				{				
    					printf("New Flag\n");
    					scanf ("%x",&j);
    					particles[i].flags=j;
    					changed=true;
    				}
    			}while(i!=-1);
    		}
    		if(t=='r')
    		{
    			i=-1;
    
    			do{
    				printf("\nChange flags (number of particle or -1 to quit)\n");
    				scanf ("%d",&i);
    				if((i>=0)&&(i<header->nParticleEmitters))
    				{				
    					printf("New Rotation\n");
    					scanf ("%f",&(particles[i].p.rotation));
    					changed=true;
    				}
    			}while(i!=-1);
    		}
    		if(t=='n')
    		{
    			i=-1;
    
    			do{
    				printf("\nChange Bones (number of particle or -1 to quit)\n");
    				scanf ("%d",&i);
    				if((i>=0)&&(i<header->nParticleEmitters))
    				{				
    					printf("New Bone\n");
    					scanf ("%d",&j);
    					particles[i].bone=j;
    					changed=true;
    				}
    			}while(i!=-1);
    		}
    		if(t=='y')
    		{
    			i=-1;
    
    			do{
    				printf("\nChange a emitter type (number of particle or -1 to quit)\n");
    				scanf ("%d",&i);
    				if((i>=0)&&(i<header->nParticleEmitters))
    				{
    					printf("New Emitter Type (1 - Plane 2 - Sphere 3 - Unknown\n");
    					scanf ("%d",&j);
    					particles[i].type=j;
    					changed=true;
    				}
    			}while(i!=-1);
    		}
    		if(t=='t')
    		{
    			printf("Textures\n");
    			for(i=0;i<header->nTextures;i++)
    				printf(" %d - %s\n",i,(char *)(f+tex[i].nameOfs));
    
    			i=-1;
    
    			do{
    				printf("\nChange a texture (number of particle or -1 to quit)\n");
    				scanf ("%d",&i);
    				if((i>=0)&&(i<header->nParticleEmitters))
    				{
    					printf("New Texture\n");
    
    					scanf ("%d",&j);
    					particles[i].texture=j;
    					changed=true;
    				}
    			}while(i!=-1);
    		}
    		if(t=='c')
    		{
    			i=-1;
    
    			do{
    				printf("\nChange particle colors (number of particle or -1 to quit)\n");
    				scanf ("%d",&i);
    				if((i>=0)&&(i<header->nParticleEmitters))
    				{
    					printf("Current Colors %08x %08x %08x\n",particles[i].p.colors[0],particles[i].p.colors[1],particles[i].p.colors[2]);
    
    					printf("New Start Color\n");
    					scanf ("%x",&j);
    					particles[i].p.colors[0]=j;
    
    					printf("New Middle Color\n");
    					scanf ("%x",&j);
    					particles[i].p.colors[1]=j;
    
    					printf("New End Color\n");
    					scanf ("%x",&j);
    					particles[i].p.colors[2]=j;
    
    					changed=true;
    				}
    			}while(i!=-1);
    		}
    		if(t=='q')
    			return;
    
    
    	}while(1);
    }
    
    
    
    
    
    
    int main(int argc, char **argv)
    {
    	char t;
    	int i,j;
    
    	if(argc<2)
    	{
    		printf("M2Modder V1.0 (April 7th, 2006) by John 'Cryect' Rittenhouse\n"); 
    		printf(" m2modder <filename.m2>\n");
    		return 0;
    	}
    
    	printf("M2Modder V1.0 (April 7th, 2006) by John 'Cryect' Rittenhouse\n"); 
    	printf(" Loading Model %s\n",argv[1]);
    	Input=fopen(argv[1],"rb+");
    
    	if(Input==NULL)
    	{
    		printf(" ERROR: Could not load file %s\n",argv[1]);
    		return 0;
    	}
    
    	fseek(Input,0,SEEK_END);
    	FileSize=ftell(Input);
    	fseek(Input,0,SEEK_SET);
    
    	f=new char[FileSize];
    	
    	fread(f,FileSize,1,Input);
    	fclose(Input);
    
    	header=(ModelHeader *)f;
    	rf=(ModelRenderFlags *)(f+header->ofsTexFlags);
    	tex=(ModelTextureDef *)(f+header->ofsTextures);
    	view= (ModelView*)(f+ header->ofsViews);
    	texunit=(ModelTexUnit *)(f+view->ofsTex);
    	animations=(ModelAnimation *)(f+header->ofsAnimations);
    	particles=(ModelParticleEmitterDef *)(f+header->ofsParticleEmitters);
    	bones=(ModelBoneDef *)(f+header->ofsBones);
    	ribbons=(ModelRibbonEmitterDef *)(f+header->ofsRibbonEmitters);
    	texUnitMapping=(short *)(f+header->ofsTexUnitLookup);
    
    
    	
    	do{
    		system("clear");
    		printf("M2Modder V1.0 (April 7th, 2006) by John 'Cryect' Rittenhouse\n"); 
    		printf(" Currently Editing %s ",argv[1]);
    
    		if(changed)
    			printf("which has changed\n");
    		else
    			printf("which has not changed\n");
    
    		printf("\n t - Edit Textures Definations\n u - Edit Texture Units\n b - Edit Bones\n a - Edit Animation IDs(a)\n p - Edit Particles\n r - Edit Ribbons\n q - Quit\n x - Quit Without Saving\n\n");
    		t=getchar();
    
    		if(t=='t')
    			editTextures();
    		else if(t=='u')
    			editTextureUnits();
    		else if(t=='b')
    			editBones();
    		else if(t=='a')
    			editAnimations();
    		else if(t=='p')
    			editParticles();
    		else if(t=='r')
    			editRibbons();
    		else if(t=='q')
    			break;
    		else if(t=='x')
    			return 0;
    
    	}while(1);
    	
    
    	if(changed)
    	{
    		printf("Saving Changes\n");
    		Input=fopen(argv[1],"wb");
    		fwrite(f,FileSize,1,Input);
    		fclose(Input);
    	}
    
    	return 0;
    }
    Thanks for reading, and hope someone could help.
    Bye

    [Model Edit] [Request] .m2 file animation ID edit edit
  2. #2
    Tigurius's Avatar Member
    Reputation
    300
    Join Date
    Jun 2008
    Posts
    519
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    M2/WotLK - WoW.Dev Wiki <-complete M2 format
    +
    http://www.mmowned.com/forums/model-...scriptlib.html <-python lib to access m2 files.
    Like my work? Support Me! ;D

  3. #3
    piloui's Avatar Private
    Reputation
    1
    Join Date
    Apr 2010
    Posts
    4
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi !
    Thanks for your answer friend
    I have already seen this pages, and last days, i burned my brain trying to understand your python scritp, but i couldn't ^^
    The WoW.Dev Wiki's pages are full of informations, but if like me you are not good enough in programmation, you are still stuck to the same point.
    I get your .py files and succes to have .pyc files, but i don't know what to do with.
    If you have a link for a step by step/noob/friend tutorial, it would be great to put it here, please.
    Thanks again.

  4. #4
    piloui's Avatar Private
    Reputation
    1
    Join Date
    Apr 2010
    Posts
    4
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just a little up

Similar Threads

  1. [Request] [Model Swap] Requesting WoW beta animations!
    By MadameGrip in forum WoW ME Questions and Requests
    Replies: 2
    Last Post: 08-28-2010, 04:34 PM
  2. Model Editing Request for Race Conversion and Other
    By #ClumsyWizard in forum WoW ME Questions and Requests
    Replies: 1
    Last Post: 10-03-2006, 10:27 PM
  3. Model editing idea and request
    By Spown in forum WoW ME Questions and Requests
    Replies: 0
    Last Post: 09-10-2006, 10:20 AM
  4. REQUEST: model edit mac
    By dued02 in forum WoW ME Questions and Requests
    Replies: 1
    Last Post: 08-24-2006, 01:01 PM
  5. --Weapon Model Editing Request--
    By zomgwarlock in forum World of Warcraft General
    Replies: 2
    Last Post: 08-15-2006, 04:26 PM
All times are GMT -5. The time now is 01:05 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search