Added a -t option to geo_list.py for displaying the triangle count of a model.

master
TigerKat 5 years ago
parent aae2cbc339
commit cbefa340bf

@ -4,21 +4,36 @@ import sys
import re
from geo import Geo
show_triangles = False
def listGeo(fn, fh):
geo = Geo()
geo.loadFromFile(fh)
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:
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()
for i in range(1, len(sys.argv)):
if sys.argv[i].startswith("-"):
parseOption(sys.argv[i])
continue
try:
fn = sys.argv[i]
fh = open(fn, "rb")

Loading…
Cancel
Save