From d7a360894329f6a6ebaf050fc3ece34adb5bee8e Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Mon, 17 Mar 2003 19:54:57 +0000 Subject: [PATCH] can now convert v3 models to v6 --- tools/misc/mdl.py | 5 ++-- tools/misc/mdlconv.py | 66 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+), 2 deletions(-) create mode 100644 tools/misc/mdlconv.py diff --git a/tools/misc/mdl.py b/tools/misc/mdl.py index a934948bc..7571b7909 100644 --- a/tools/misc/mdl.py +++ b/tools/misc/mdl.py @@ -6,7 +6,7 @@ model = open(sys.argv[1],"rb").read() m = unpack ("4s l 3f 3f f 3f i i i i i i i", model[:76]) model = model[76:] m = m[0:2] + (m[2:5],) + (m[5:8],) + m[8:9] + (m[9:12],) + m[12:20] -if m[2] == 6: +if m[1] == 6: m = m + unpack ("i f", model[:8]) model = model[8:] pprint (m) @@ -22,6 +22,7 @@ for i in range(m[6]): else: n = unpack ("l", model[:4])[0] model = model [4:] + print n k = (n, unpack (`n`+"f", model[:n*4]), []) model = model [n*4:] for j in range (n): @@ -49,7 +50,7 @@ for i in range (m[11]): t = unpack ("l", model[:4])[0] model = model[4:] if t==0: - if m[2] == 6: + if m[1] == 6: f = (t, unpack ("3B B 3B B 16s", model[:24]), []) model = model[24:] else: diff --git a/tools/misc/mdlconv.py b/tools/misc/mdlconv.py new file mode 100644 index 000000000..71d7691f7 --- /dev/null +++ b/tools/misc/mdlconv.py @@ -0,0 +1,66 @@ +from struct import * +from pprint import * +import sys +import os + +def convert (fname): + f = open (fname, "rb") + model = f.read () + f.close () + if len (model) < 8 or model[:4] != "IDPO" or unpack ("