tpm_deboner_v1

List your programs here (game-related or other software).

Moderators: scallenger, Rebel, madppiper, TresCom Support Team

Post Reply
User avatar
Rebel
-=TresCom Developer=-
-=TresCom Developer=-
Posts: 6112
Joined: Sun Nov 10, 2002 10:26 pm
Location: That country nobody likes (you know the one)
Contact:

tpm_deboner_v1

Post by Rebel »

Sound dirty, doesn't it? :D

Seriously,

Tpm_Debone is a drag n' drop utility that allows you to strip a dinosaur's tpm file of all string model and joint assignments. These stripped .tpm files are then imported, allowing individual characteristics to be assigned to a dinosaur.

Please note, only .tpm files exported by TresEd (check extract bones option) can be used as tpm files created using TPDC or exported from Max use an older tpm format not supported. If target dinosaur uses a shadow mesh, this value must be removed from the tscript and the tscript updated before exporting any basement dinosaur.

Easy to use, but instructions are included -

if interested, click on my signature to visit the page. ..
User avatar
RexHunter99
Albertosaurus
Albertosaurus
Posts: 2197
Joined: Mon Apr 24, 2006 12:12 pm
Location: Australia
Contact:

Re: tpm_deboner_v1

Post by RexHunter99 »

Wait... what exactly can this be used for :? to me it sounds like it only removes the bones (joints) and the vertice assignments :?
~ They told me humans weren't real... I proved them wrong.
ImageAnthropology ~ A beautiful tale.
EpicZen
Carnivores Hub ~ Need the full games without all the hassle of torrents or viruses? Run on over to EpicZen's Carnivores Hub!
User avatar
Rebel
-=TresCom Developer=-
-=TresCom Developer=-
Posts: 6112
Joined: Sun Nov 10, 2002 10:26 pm
Location: That country nobody likes (you know the one)
Contact:

Re: tpm_deboner_v1

Post by Rebel »

Right, that's all it does. I used to manually edit out the data in lieu. I use it to create multiple dinosaur imports. Drac stated he simply exports the dino from tresed, selecting multiple objects (that way, tresed doesn't select $objects or the bones of the dino during export), then I imagine he renamed the file(internal/external names) and simply imported, selecting 'no' when asked if he wanted to replace existing meshes.

I'm sure it works that way, just sounded a bit sloppy to me. My way, I can just drag n' drop and create as many dino tpms as I want in a few seconds.
User avatar
machf
T-Rex Killer
T-Rex Killer
Posts: 12368
Joined: Thu Apr 24, 2003 11:20 pm
Location: Lima, Peru
Contact:

Re: tpm_deboner_v1

Post by machf »

Hmmm... I guess it could be used for generating dinosaur prests for TPDC with a few modifications, maybe.
Visit The Carnivores Saga - a forum devoted to modding Action Forms' Carnivores, Carnivores 2 and Carnivores: Ice Age games
Tres WIP: updated T-Script Reference and File Formats documents
Sound name listings for the Demo (build 117), Retail (build 116), Beta 103, Beta 99, Beta 97, Beta 96, Build 55, PC Gamer Alpha (build 32) and E3 1998 Alpha (build 22) TPA files
User avatar
Rebel
-=TresCom Developer=-
-=TresCom Developer=-
Posts: 6112
Joined: Sun Nov 10, 2002 10:26 pm
Location: That country nobody likes (you know the one)
Contact:

Re: tpm_deboner_v1

Post by Rebel »

I thought the preset files were basically identical copies of a master mesh in .tpm format, no? This strips all of that info out of the tpm so I don't think it'd be of any use in that respect.

The utility itself is of limited use.
User avatar
RexHunter99
Albertosaurus
Albertosaurus
Posts: 2197
Joined: Mon Apr 24, 2006 12:12 pm
Location: Australia
Contact:

Re: tpm_deboner_v1

Post by RexHunter99 »

Still could be nifty ;)
I'm now thinking some careful attention will need to be paid when I get around to the cloning of instances and whatnot, so new dinosaur instances can be made without much hassle.
~ They told me humans weren't real... I proved them wrong.
ImageAnthropology ~ A beautiful tale.
EpicZen
Carnivores Hub ~ Need the full games without all the hassle of torrents or viruses? Run on over to EpicZen's Carnivores Hub!
User avatar
Rebel
-=TresCom Developer=-
-=TresCom Developer=-
Posts: 6112
Joined: Sun Nov 10, 2002 10:26 pm
Location: That country nobody likes (you know the one)
Contact:

Re: tpm_deboner_v1

Post by Rebel »

Yup, what I think TresEd does know is if you clone a dino mesh, it tranfers all $ and joint positions to the new mesh. Preferably want you'd like to do is to clone the mesh and have a dialog come up asking you which string Physics/Mesh should this dinosaur use.

That by itself would eliminate the need for this li' app.

btw, if you have an older version of GeomAdd (one that extracts models as grf files), that might come in handy enabling you to work with a compact data file for testing purposes. ..
User avatar
machf
T-Rex Killer
T-Rex Killer
Posts: 12368
Joined: Thu Apr 24, 2003 11:20 pm
Location: Lima, Peru
Contact:

Re: tpm_deboner_v1

Post by machf »

For presets you sort of need to do the opposit of what your tool currently does, Rebel... that's why I said "with some changes". Here's the Para preset, for example:

Code: Select all

fileinfo
{
 formatversion = 1.0.2
}

bone "$JPara00"
{
 position = (-0.001160,-1.416077,0.225087)
 rotation = (-2.152241,0.000004,179.999985)
}

bone "$JPara01"
{
 position = (-0.001160,-2.791855,0.173384)
 rotation = (2.777937,0.000005,179.999985)
}

bone "$JPara20"
{
 position = (-0.001160,-0.379059,0.368676)
 rotation = (-7.883275,0.000004,179.999985)
}

bone "$JPara19"
{
 position = (-0.806396,-0.888062,-3.451673)
 rotation = (0.000000,0.000000,0.000000)
}

bone "$JPara15"
{
 position = (0.797882,-0.888062,-3.451673)
 rotation = (0.000000,0.000000,0.000000)
}

bone "$JPara14"
{
 position = (0.797882,-1.169418,-2.915619)
 rotation = (-66.512833,0.000001,-0.000001)
}

bone "$JPara16"
{
 position = (-0.806763,-0.379440,0.366283)
 rotation = (-63.394676,-0.010001,-0.005011)
}

bone "$JPara17"
{
 position = (-0.806396,0.504822,-1.250380)
 rotation = (-134.612045,0.007693,-0.007605)
}

bone "$JPara18"
{
 position = (-0.806763,-1.169418,-2.915619)
 rotation = (-66.512863,-0.040160,-0.017451)
}

bone "$JPara09"
{
 position = (-0.001160,4.259277,2.849055)
 rotation = (54.472370,0.000000,0.000000)
}

bone "$JPara10"
{
 position = (0.521301,3.104156,0.069586)
 rotation = (0.000000,0.000000,0.000000)
}

bone "$JPara11"
{
 position = (-0.508942,3.104156,0.069586)
 rotation = (0.000000,0.000000,0.000000)
}

bone "$JPara12"
{
 position = (0.798187,-0.379440,0.366283)
 rotation = (-63.394684,0.008671,0.004348)
}

bone "$JPara13"
{
 position = (0.797882,0.504822,-1.250380)
 rotation = (-134.612045,-0.000003,-0.000008)
}

bone "$JPara05"
{
 position = (-0.001160,2.555084,0.679070)
 rotation = (49.917545,0.000003,-0.000006)
}

bone "$JPara06"
{
 position = (-0.001160,3.156143,1.393292)
 rotation = (53.174740,-0.000000,-0.000001)
}

bone "$JPara07"
{
 position = (-0.001160,3.721481,2.148299)
 rotation = (52.494926,0.000005,-0.000000)
}

bone "$JPara08"
{
 position = (-0.001160,4.259277,2.849055)
 rotation = (54.472370,0.000000,0.000000)
}

bone "$JPara02"
{
 position = (-0.001160,-3.849594,0.224708)
 rotation = (-0.020511,0.000004,-179.999985)
}

bone "$JPara03"
{
 position = (-0.001160,-5.056396,0.224276)
 rotation = (1.598631,0.000005,179.999985)
}

bone "$JPara04"
{
 position = (-0.001160,-6.196304,0.256089)
 rotation = (-0.431965,0.000003,-179.999985)
}

material "$ParaBody-00.mat01"
{
}

material "$ParaHead-00.mat01"
{
}

material "$ParaTail-00.mat01"
{
}

mesh "$ParaBody-00"
{
 m = "$ParaBody-00.mat01"
 v = (0.349565,1,-0.554902)
 v = (0.349565,-1,-0.554902)
 v = (0.349565,1,0.554902)
 v = (0.349565,-1,0.554902)
 v = (-0.349565,1,-0.554902)
 v = (-0.349565,-1,-0.554902)
 v = (-0.349565,1,0.554902)
 v = (-0.349565,-1,0.554902)
 t = (0,0)
 t = (0,0)
 t = (0,0)
 t = (0,0)
 t = (0,0)
 t = (0,0)
 t = (0,0)
 t = (0,0)
 n = (0,1,0)
 n = (0,-1,0)
 n = (0,1,0)
 n = (0,0,1)
 n = (0,1,0)
 n = (0,-1,0)
 n = (0,1,0)
 n = (0,0,1)
 f = (1,3,4),(1,3,4),(1,3,4),1
 f = (4,2,1),(4,2,1),(4,2,1),1
 f = (5,6,8),(5,6,8),(5,6,8),1
 f = (8,7,5),(8,7,5),(8,7,5),1
 f = (1,2,6),(1,2,6),(1,2,6),1
 f = (6,5,1),(6,5,1),(6,5,1),1
 f = (2,4,8),(2,4,8),(2,4,8),1
 f = (8,6,2),(8,6,2),(8,6,2),1
 f = (4,3,7),(4,3,7),(4,3,7),1
 f = (7,8,4),(7,8,4),(7,8,4),1
 f = (3,1,5),(3,1,5),(3,1,5),1
 f = (5,7,3),(5,7,3),(5,7,3),1
}

mesh "$ParaHead-00"
{
 m = "$ParaHead-00.mat01"
 v = (0.316228,1,-0.415143)
 v = (0.316228,-1,-0.415143)
 v = (0.316228,1,0.415143)
 v = (0.316228,-1,0.415143)
 v = (-0.316228,1,-0.415143)
 v = (-0.316228,-1,-0.415143)
 v = (-0.316228,1,0.415143)
 v = (-0.316228,-1,0.415143)
 t = (0,0)
 t = (0,0)
 t = (0,0)
 t = (0,0)
 t = (0,0)
 t = (0,0)
 t = (0,0)
 t = (0,0)
 n = (0,1,0)
 n = (0,-1,0)
 n = (0,1,0)
 n = (0,0,1)
 n = (0,1,0)
 n = (0,-1,0)
 n = (0,1,0)
 n = (0,0,1)
 f = (1,3,4),(1,3,4),(1,3,4),1
 f = (4,2,1),(4,2,1),(4,2,1),1
 f = (5,6,8),(5,6,8),(5,6,8),1
 f = (8,7,5),(8,7,5),(8,7,5),1
 f = (1,2,6),(1,2,6),(1,2,6),1
 f = (6,5,1),(6,5,1),(6,5,1),1
 f = (2,4,8),(2,4,8),(2,4,8),1
 f = (8,6,2),(8,6,2),(8,6,2),1
 f = (4,3,7),(4,3,7),(4,3,7),1
 f = (7,8,4),(7,8,4),(7,8,4),1
 f = (3,1,5),(3,1,5),(3,1,5),1
 f = (5,7,3),(5,7,3),(5,7,3),1
}

mesh "$ParaTail-00"
{
 m = "$ParaTail-00.mat01"
 v = (0.184487,1,-0.186829)
 v = (0.184487,-1,-0.186829)
 v = (0.184487,1,0.186829)
 v = (0.184487,-1,0.186829)
 v = (-0.184487,1,-0.186829)
 v = (-0.184487,-1,-0.186829)
 v = (-0.184487,1,0.186829)
 v = (-0.184487,-1,0.186829)
 t = (0,0)
 t = (0,0)
 t = (0,0)
 t = (0,0)
 t = (0,0)
 t = (0,0)
 t = (0,0)
 t = (0,0)
 n = (0,1,0)
 n = (0,-1,0)
 n = (0,1,0)
 n = (0,0,1)
 n = (0,1,0)
 n = (0,-1,0)
 n = (0,1,0)
 n = (0,0,1)
 f = (1,3,4),(1,3,4),(1,3,4),1
 f = (4,2,1),(4,2,1),(4,2,1),1
 f = (5,6,8),(5,6,8),(5,6,8),1
 f = (8,7,5),(8,7,5),(8,7,5),1
 f = (1,2,6),(1,2,6),(1,2,6),1
 f = (6,5,1),(6,5,1),(6,5,1),1
 f = (2,4,8),(2,4,8),(2,4,8),1
 f = (8,6,2),(8,6,2),(8,6,2),1
 f = (4,3,7),(4,3,7),(4,3,7),1
 f = (7,8,4),(7,8,4),(7,8,4),1
 f = (3,1,5),(3,1,5),(3,1,5),1
 f = (5,7,3),(5,7,3),(5,7,3),1
}

instance "$ParaTail-00"
{
 mesh = "$ParaTail-00"
 position = (-0.0178223,-3.82809,0.222836)
 rotation = (0,0,0)
 scale = 2.47359
}

instance "$ParaHead-00"
{
 mesh = "$ParaHead-00"
 position = (0.0193176,3.43156,2.16377)
 rotation = (65.9665,0,0)
 scale = 1.69019
}

instance "$ParaBody-00"
{
 mesh = "$ParaBody-00"
 position = (0.0257568,0.395157,0.361052)
 rotation = (0,0,0)
 scale = 1.74411
}
But your tool can also be used to generate an unrigged mesh in order to re-rig it in TPDC, I've sometimes had to do that... switching one skeleton for another or something like that.
Visit The Carnivores Saga - a forum devoted to modding Action Forms' Carnivores, Carnivores 2 and Carnivores: Ice Age games
Tres WIP: updated T-Script Reference and File Formats documents
Sound name listings for the Demo (build 117), Retail (build 116), Beta 103, Beta 99, Beta 97, Beta 96, Build 55, PC Gamer Alpha (build 32) and E3 1998 Alpha (build 22) TPA files
User avatar
Rebel
-=TresCom Developer=-
-=TresCom Developer=-
Posts: 6112
Joined: Sun Nov 10, 2002 10:26 pm
Location: That country nobody likes (you know the one)
Contact:

Re: tpm_deboner_v1

Post by Rebel »

Ah, I gotcha. The presets are bones and subobject meshes only tpms. It's been so long since I looked inside them I had forgotten.

@EDIT: the code itself is nothing more than some quick n' dirty c+ string manipulation. I posted it below in case you want to rearrange, restructure or rewrite it to create a preset.

Code: Select all

#include <iostream>
#include <fstream>
#include <stdlib.h>
#include <string>
#include <windows.h>


//Globals - some locals could be used in lieu (too tired to verify)
ifstream bonedig;
std::string FolderIn;
std::string DinoName;
std::string DinoType;
std::string OrigFile;
std::string NoAppend;
std::string UserName;
char Path[MAX_PATH];    /* Default Size - Get Current Direct */
std::string FileInfo = "fileinfo\n" // storage of file header
"{\n"
" formatversion = 1.0.2";

// use old c here for the drag n' drop 

int main(int argc, char * argv[])
{
 if(argv[1]>0){
    OrigFile=argv[1]; //Grab file path/name - transfer to $
    NoAppend=argv[1];
    int cutoff = NoAppend.rfind("\\");
    NoAppend.erase(0,cutoff+1); /* cutoff the file pathway */
    int noext = NoAppend.find(".");
    NoAppend.erase(noext,4); /* chop off the tpm extension */
    
    /* Dependency, windows.h */
    GetModuleFileName(NULL, Path, MAX_PATH);
     
    FolderIn=Path;
    string::size_type locFolder= FolderIn.find_last_of("\\");
    FolderIn.erase(locFolder+1);  /* Retain full pathway  */

}

    /* Alreaady using the windows lib., might as well use it again */
    
     else {
    MessageBox(NULL,"No File!  Please drag n' drop .tpm file "
     "onto tpm_debone window.","Program failed to launch. ..", MB_OK);
     return 0;
     } // kill the program x x
       //                   _

std::cout<< "Enter new file name (Example: MyDino-00)\n";
std::cin>> DinoName;
DinoType = DinoName;
UserName = DinoType;
DinoName+=".tpm"; /*append file extension to new name */

/* Skipping incorrect file_type inclusion . .. */

FolderIn+=DinoName; 

/* create file, write out initial .tpm file header  */

fstream out(FolderIn.c_str(), ios::app |ios::bin);
out<<FileInfo<<std::endl; 

/* open (read only) our original [drop] file */

bonedig.open(OrigFile.c_str(), ios::in |ios::bin);
bonedig.unsetf(ios::skipws);   /* read spaces */       
         
   bonedig.seekg( 0, ios::end ) ;
   int size = bonedig.tellg()   ;
   bonedig.seekg( 0, ios::beg ) ;
  
   char buffer [size];
   bonedig.read( buffer, size) ;

   buffer[size] = 0 ;
   string TPM_File(buffer, size-1) ;
   
   //File buffered - transferred to std::string for editing. ..

   // Search out and write only material listings first and ignor
   // any bone data along the way - remove data from stored string 

    int search = TPM_File.rfind("bone") ;
    
    TPM_File.erase(0,search);
    int search2 = TPM_File.find("}");
    TPM_File.erase(0,search2);
    
    // Replace 'skin' with 'mesh'
    
        std::string Mesh = "mesh";
        int search3 = TPM_File.find("skin");
        TPM_File.replace(search3,Mesh.length(),Mesh);
        
    /* Loop through and erase bone vertices assignments */
    /* dependent upon most current .tpm formatting */    
  
    int search4 = TPM_File.find("), ");
    while (search4>0){
    TPM_File.erase(search4+1,4);
    search4 = TPM_File.find("), ");
    }
    
    /* locate original file name throughout, replace with user
    name and loop through until current search fails [at 0] */
    
        int search6 = TPM_File.find(NoAppend.c_str());
        while (search6>0){
        TPM_File.replace(search6,NoAppend.length(),DinoType);
        search6 = TPM_File.find(NoAppend.c_str());
        }
    /* location specific, dependency.  Remove $material list 
    from inside our stored .tpm file [stored string data] */
    
    int search9 = TPM_File.find("material") ;
    TPM_File.erase(0,search9);
    search9 = TPM_File.find("}");
    TPM_File.erase(0,search9);
    
        search9 = TPM_File.find("material") ;
        TPM_File.erase(0,search9);
        search9 = TPM_File.find("}");
        TPM_File.erase(0,search9);
    
    search9 = TPM_File.find("material") ;
    TPM_File.erase(0,search9);
    search9 = TPM_File.find("}");
    TPM_File.erase(0,search9);
    
    /* Remove mesh data ($Sub_Objects)
    3 times the charm here. .. */
    
    string::size_type wipe_SUB;
	wipe_SUB = TPM_File.find("mesh");
  
    	if (wipe_SUB != string::npos)
		{
			TPM_File.erase(wipe_SUB, TPM_File.find("}", wipe_SUB)-wipe_SUB+5);
		}
		
     	    if (wipe_SUB != string::npos)
    		{
    			TPM_File.erase(wipe_SUB, TPM_File.find("}", wipe_SUB)-wipe_SUB+5);
    		}
		
         	    if (wipe_SUB != string::npos)
        		{
        			TPM_File.erase(wipe_SUB, TPM_File.find("}", wipe_SUB)-wipe_SUB+5);
        		}
		
	
	// continue.. . erase final $model eof entries
	
      string::size_type one_String, two_String, last_String;
      
	  one_String = TPM_File.find("\"$");
  
    	if (one_String != string::npos)
		{
			TPM_File.erase(one_String, TPM_File.find("}", one_String)-one_String+14);
		}
		
        two_String = TPM_File.find("\"$");
		
     	    if (two_String != string::npos)
    		{
    			TPM_File.erase(two_String, TPM_File.find("}", two_String)-two_String+14);
    		}
		
        last_String = TPM_File.find("\"$");
		
 	    if (last_String != string::npos)
		{
			TPM_File.erase(last_String-10, TPM_File.find("}", last_String)-last_String+14);
		}
		
   
   out<<TPM_File<<std::endl; //write out edited string to newly created file
   
   out.close();
   bonedig.close();   // close both files, let's get the hell out of here. ..

      return 0;
    }
Post Reply