tweaked the iqm exporter code to output some custom iqm extensions.

importing tweaked to support importing from multiple mesh files.
bone remapping is supported for animations that have extra/missing bones.
complex commandline deprecated, now supports a proper import script thing, so the fte-specific iqm extension info can be specified.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5039 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2017-01-13 00:42:51 +00:00
parent c4ded89ad7
commit fc7664a69f
6 changed files with 5115 additions and 3951 deletions

View File

@ -8,7 +8,7 @@ UPGRADE_OBJS= \
default: all
all: iqm upgrade
all: iqm #upgrade
clean:
-$(RM) $(IQM_OBJS) $(UPGRADE_OBJS) iqm upgrade

View File

@ -14,7 +14,7 @@ UPGRADE_OBJS= \
default: all
all: iqm.exe upgrade.exe
all: iqm.exe #upgrade.exe
clean:
-$(RM) $(IQM_OBJS) $(UPGRADE_OBJS) iqm.exe upgrade.exe

56
iqm/README.txt Normal file
View File

@ -0,0 +1,56 @@
FTE's fork of Lee Salzman's commandline IQM exporter, based upon 'IQM Developer Kit 2015-08-03'.
there is no blender integration - export your files to a supported format first.
Main changes:
now utilises command files instead of needing the weird commandline stuff (although that should still mostly work).
additional mesh properties and multiple mesh files, providing for proper hitmesh support, as well as some other things.
more verbose text output, additional shader prefixes.
bone renaming+regrouping
animation unpacking, for qc mods that still insist on animating the lame way.
Supported import formats:
.md5mesh
.md5anim
.iqe
.smd
.fbx
.obj
Unless you're doing complex stuff like any of the above, there's probably not all that much difference. There may be some commandline behaviour differences.
Command File Format:
output <FILENAME> - specified the output file name. you should only have one of these.
exec <FILENAME> - exec the specified command file, before parsing the rest of the current file.
hitbox <BODY NUM> <BONE NAME> <MIN POS VECTOR> <MAX POS VECTOR> - generates a hitmesh as a bbox centered around the bone in the base pose (the hitbox will rotate/move with animations). The bodynum will be visible to gamecode, and may merge with other hitboxes with the same group.
modelflags <NAME OR HEX> - enables the specified bit in the iqm header. supported names include q1_rocket, q1_grenade, q1_gib, q1_rotate, q1_tracer1, q1_zomgib, q1_tracer2, q1_tracer3
<MESH PROPERTY> - defined below and applied as the defaults to the following import lines as well as mesh lines.
mesh <NAME> [MESH PROPERTIES LIST] - provides overrides for a single named mesh (properties used will be those as they're already defined, if not otherwise listed).
bone <SOURCENAME> [rename <NEWNAME>] [group <GROUPNUM>] - provides bone renaming and grouping. try to avoid renaming two bones to the same resulting name... groups may have limitations if a parent/child relationship cannot be honoured. lowest group numbers come before higher groups. by default bones will inherit their group from their parent.
<IMPORT PROPERTY> - defined below and applied as the defaults to the following import lines.
import <FILENAME> [IMPORT PROPERTIES] [MESH PROPERTIES] - imports the meshes and animations from the specified file.
Mesh Properties:
contents <NAMES OR 0xBITS> - 'body' or 'empty' are the two that are most likely to be used. 'solid' may also be desired, or possibly also 'corpse'.
surfaceflags <NAMES OR 0xBITS> - 'q3_nodraw/fte_nodraw'
body <NUMBER> - this is the 'body' value reported to gamecode when a trace hits this surface.
geomset <GEOMGROUP> <GEOMID> - by configuring this, you can have models display different body parts for different character models.
lodrange <MINDIST> <MAXDIST> - not yet implemented by the engine. 0 for both is the default.
Anim/Import Properties:
name <NAME> - the imported animations will be assigned this name. May be problematic if the imported file(s) share the same name, so try to avoid using this at global scope.
fps <RATE> - framerate for any imported animations.
loop - flags animations as looping.
clamp - disables looping.
unpack - seperates each pose of the animations into a seperate single-pose animation for compat with q1 or q2-style model animations.
pack - disables unpacking again.
nomesh <1|0> - discards all meshed from the affected files.
noanim <1|0> - discards animations from the affected files, does not disclude the base pose.
materialprefix <PREFIX/> - provides a text prefix on the material name, which should make it easier for editors while still honouring shader paths.
start <FIRSTPOSE> - the fist pose to import.
end <LASTPOSE> - the last pose to import.
rotate <PITCH> <YAW> <ROLL> - rotates the model
scale <SCALER> - rescales the model
origin <X> <Y> <Z> - moves the thing
event [ANIM,]<POSE[.FRAC]> <EVENTCODE> <"EVENTDATA"> - embeds event info within the animation, for stuff like footsteps. How this is used depends on the engine... If used at global scope, can be reset with 'event reset' in order to not apply to later files.

File diff suppressed because it is too large Load Diff

View File

@ -130,5 +130,22 @@ struct iqmextension
unsigned int ofs_extensions; // pointer to next extension
};
struct iqmext_fte_mesh
{
unsigned int contents; //default CONTENTS_BODY
unsigned int surfaceflags; //propagates to trace_surfaceflags
unsigned int body; //the part of the body that this mesh is meant to be from
unsigned int geomset;
unsigned int geomid;
float mindist;
float maxdist;
};
struct iqmext_fte_events
{
unsigned int anim;
float timestamp;
unsigned int evcode;
unsigned int evdata_str;
};
#endif

View File

@ -20,6 +20,7 @@
#define M_PI 3.1415926535897932384626433832795
#endif
#define strcasecmp _stricmp
#define strncasecmp _strnicmp
#endif
typedef unsigned char uchar;
@ -564,12 +565,12 @@ struct stream
virtual long tell() { return -1; }
virtual bool seek(long offset, int whence = SEEK_SET) { return false; }
virtual long size();
virtual int read(void *buf, int len) { return 0; }
virtual int write(const void *buf, int len) { return 0; }
virtual size_t read(void *buf, size_t len) { return 0; }
virtual size_t write(const void *buf, size_t len) { return 0; }
virtual int getchar() { uchar c; return read(&c, 1) == 1 ? c : -1; }
virtual bool putchar(int n) { uchar c = n; return write(&c, 1) == 1; }
virtual bool getline(char *str, int len);
virtual bool putstring(const char *str) { int len = strlen(str); return write(str, len) == len; }
virtual bool getline(char *str, size_t len);
virtual bool putstring(const char *str) { size_t len = strlen(str); return write(str, len) == len; }
virtual bool putline(const char *str) { return putstring(str) && putchar('\n'); }
virtual int printf(const char *fmt, ...) { return -1; }
@ -590,7 +591,7 @@ long stream::size()
return pos == endpos || seek(pos, SEEK_SET) ? endpos : -1;
}
bool stream::getline(char *str, int len)
bool stream::getline(char *str, size_t len)
{
loopi(len-1)
{
@ -623,8 +624,8 @@ struct filestream : stream
bool end() { return feof(file)!=0; }
long tell() { return ftell(file); }
bool seek(long offset, int whence) { return fseek(file, offset, whence) >= 0; }
int read(void *buf, int len) { return fread(buf, 1, len, file); }
int write(const void *buf, int len) { return fwrite(buf, 1, len, file); }
size_t read(void *buf, size_t len) { return fread(buf, 1, len, file); }
size_t write(const void *buf, size_t len) { return fwrite(buf, 1, len, file); }
int getchar() { return fgetc(file); }
bool putchar(int c) { return fputc(c, file)!=EOF; }
bool getline(char *str, int len) { return fgets(str, len, file)!=NULL; }
@ -1038,6 +1039,14 @@ struct Matrix3x4
c += o.c;
return *this;
}
Matrix3x4 operator+(const Vec3 &o) const { return Matrix3x4(*this) += o; }
Matrix3x4 &operator+=(const Vec3 &o)
{
a[3] += o[0];
b[3] += o[1];
c[3] += o[2];
return *this;
}
void invert(const Matrix3x4 &o)
{