|
|
@ -4,21 +4,36 @@ import sys
|
|
|
|
import re
|
|
|
|
import re
|
|
|
|
from geo import Geo
|
|
|
|
from geo import Geo
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
show_triangles = False
|
|
|
|
|
|
|
|
|
|
|
|
def listGeo(fn, fh):
|
|
|
|
def listGeo(fn, fh):
|
|
|
|
geo = Geo()
|
|
|
|
geo = Geo()
|
|
|
|
geo.loadFromFile(fh)
|
|
|
|
geo.loadFromFile(fh)
|
|
|
|
for m in geo.models:
|
|
|
|
for m in geo.models:
|
|
|
|
print("%s : %s" % (geo.header_modelheader_name.decode("utf-8"), m.name.decode("utf-8")))
|
|
|
|
s = "%s : %s" % (geo.header_modelheader_name.decode("utf-8"), m.name.decode("utf-8"))
|
|
|
|
|
|
|
|
if show_triangles:
|
|
|
|
|
|
|
|
s += " : %d" % (m.tris and len(m.tris) or 0, )
|
|
|
|
|
|
|
|
print(s)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def parseOption(opt):
|
|
|
|
|
|
|
|
global show_triangles
|
|
|
|
|
|
|
|
for c in opt[1:]:
|
|
|
|
|
|
|
|
if c == "t":
|
|
|
|
|
|
|
|
show_triangles = True
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if len(sys.argv) <= 1:
|
|
|
|
if len(sys.argv) <= 1:
|
|
|
|
print("Usage:")
|
|
|
|
print("Usage:")
|
|
|
|
print(" %s <infile.geo>" % (sys.argv[0], ))
|
|
|
|
print(" %s [<options>] <infile.geo>" % (sys.argv[0], ))
|
|
|
|
|
|
|
|
print("Options:")
|
|
|
|
|
|
|
|
print(" -t Display triangle count.")
|
|
|
|
exit()
|
|
|
|
exit()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for i in range(1, len(sys.argv)):
|
|
|
|
for i in range(1, len(sys.argv)):
|
|
|
|
|
|
|
|
if sys.argv[i].startswith("-"):
|
|
|
|
|
|
|
|
parseOption(sys.argv[i])
|
|
|
|
|
|
|
|
continue
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
fn = sys.argv[i]
|
|
|
|
fn = sys.argv[i]
|
|
|
|
fh = open(fn, "rb")
|
|
|
|
fh = open(fn, "rb")
|
|
|
|