gm_modelinfo - Get info about models

This module allows you to retrieve information about models.

Functions included:

modelinfo.*


GetModelRadius( fileName )
GetModelBounds( fileName )
GetModelRenderBounds( fileName )
GetModelSubs( fileName )
GetModelSequenceCount( fileName )
GetModelSequence( fileName, i )
GetModelAttachments( filename )
GetModelPoseParams( fileName )
GetModelBodyParts( fileName )
GetModelBoneCount( fileName )
GetModelBone( fileName, i )
IsValidModel( fileName )

All of these functions are also available under the Entity metatable. If you use this method, you do not have to supply the file name.

GetModelSubs returns a table of model names that this model inherits. These are mostly files that contain animations. Probably all of Valve’s characters use external animations. The functions that modelinfo exposes do not inherit these models, this means you have to figure out which models contain the animations you want.

If you have any suggestions, please post them.

Download

Nice.

[editline]10:20AM[/editline]

Nicely done.

nice release

Usefull :slight_smile:

Can you get the mass?

And on that note, volume?

You can calculate the volume yourself.

I’m going to add a GetPhysicsInfo function which basically gets stuff like mass, inertia, etc. if I can find out how to parse valve’s keyvalues.

Can you dump the animations the model has in a structure like so:



{
	{
		Sequence = "some sequence",
		SequenceID = 1,
		Frames = 120,
		Framerate = 40,
	},

}


Or alternately duration instead of frames and framerate. I hate having to open each model in model viewer just to find the animations and their lengths on a model.

Would be extremely useful for me.

I also would like this.

[editline]12:06AM[/editline]

Kogitsune, I am loving your avatar! Bioshock is great.

Some thing like this, where you can also get the models bone positions at x frame would be perfect for my body poser.

Wow, Valve really likes to make things overcomplicated. Getting all the sequences of a normal model works… but ragdolls apparently use their own animation system. Any random sequence id points to the default ‘ragdoll’ animation. I’m going to look into that now.

As for JSharpe’s suggestion, there are a few functions for getting bone positions and angles, but I’m not sure if they relate to sequences. Going to look into that as well.

Nevec I love you for this :smiley:

so what type do
GetRenderBounds( nIndex )
and
GetBounds( nIndex )
return?

Linux: http://dl.dropbox.com/u/4266088/facepunch/gm_modelinfo_old_i486.dll

Returns two vector values representing the minimum and maximum bounds.

Stand by for an update next week. It will feature a bunch of new functions.

Edit:

Mainly sequence listing like Kogitsune requested.

Updated Linux binary.

Download: http://dl.dropbox.com/u/4266088/facepunch/gm_modelinfo_i486.dll