|
|
@ -14,6 +14,8 @@ if len(sys.argv) < 4:
|
|
|
|
print(" del_model <reg_ex_filter> Delete models with the name matching regular expression.")
|
|
|
|
print(" del_model <reg_ex_filter> Delete models with the name matching regular expression.")
|
|
|
|
print(" geo_name <geo_name> Rename the name of the .geo .")
|
|
|
|
print(" geo_name <geo_name> Rename the name of the .geo .")
|
|
|
|
print(" rename_model <old> <new> Rename model <old> to <new>.")
|
|
|
|
print(" rename_model <old> <new> Rename model <old> to <new>.")
|
|
|
|
|
|
|
|
print(" rename_texture <old> <new> Rename texture <old> to <new>.")
|
|
|
|
|
|
|
|
print(" rescale_all <scale> Rescale all models by the given amount.")
|
|
|
|
exit()
|
|
|
|
exit()
|
|
|
|
|
|
|
|
|
|
|
|
fn_in = sys.argv[1]
|
|
|
|
fn_in = sys.argv[1]
|
|
|
@ -54,7 +56,7 @@ while arg_i < len(sys.argv):
|
|
|
|
nameold = bytes(sys.argv[arg_i], "utf-8")
|
|
|
|
nameold = bytes(sys.argv[arg_i], "utf-8")
|
|
|
|
namenew = bytes(sys.argv[arg_i+1], "utf-8")
|
|
|
|
namenew = bytes(sys.argv[arg_i+1], "utf-8")
|
|
|
|
arg_i += 2
|
|
|
|
arg_i += 2
|
|
|
|
renamed = False
|
|
|
|
renamed = 0
|
|
|
|
for m in geo.models:
|
|
|
|
for m in geo.models:
|
|
|
|
if m.name == nameold:
|
|
|
|
if m.name == nameold:
|
|
|
|
m.name = namenew
|
|
|
|
m.name = namenew
|
|
|
@ -63,6 +65,26 @@ while arg_i < len(sys.argv):
|
|
|
|
break
|
|
|
|
break
|
|
|
|
if renamed <= 0:
|
|
|
|
if renamed <= 0:
|
|
|
|
print(" **Warning!*** Rename failed, no model name matched '%s'." % (nameold.decode("utf-8"), ))
|
|
|
|
print(" **Warning!*** Rename failed, no model name matched '%s'." % (nameold.decode("utf-8"), ))
|
|
|
|
|
|
|
|
elif operation == "rename_texture":
|
|
|
|
|
|
|
|
nameold = bytes(sys.argv[arg_i], "utf-8")
|
|
|
|
|
|
|
|
namenew = bytes(sys.argv[arg_i+1], "utf-8")
|
|
|
|
|
|
|
|
arg_i += 2
|
|
|
|
|
|
|
|
renamed = 0
|
|
|
|
|
|
|
|
for i, t in enumerate(geo.header_texnames):
|
|
|
|
|
|
|
|
if t == nameold:
|
|
|
|
|
|
|
|
geo.header_texnames[i] = namenew
|
|
|
|
|
|
|
|
print("Renamed texture '%s' to '%s'" % (nameold.decode("utf-8"), namenew.decode("utf-8")))
|
|
|
|
|
|
|
|
renamed += 1
|
|
|
|
|
|
|
|
break
|
|
|
|
|
|
|
|
if renamed <= 0:
|
|
|
|
|
|
|
|
print(" **Warning!*** Rename failed, no texture name matched '%s'." % (nameold.decode("utf-8"), ))
|
|
|
|
|
|
|
|
elif operation == "rescale_all":
|
|
|
|
|
|
|
|
scale = float(sys.argv[arg_i])
|
|
|
|
|
|
|
|
arg_i += 1
|
|
|
|
|
|
|
|
for m in geo.models:
|
|
|
|
|
|
|
|
for i in range(len(m.verts)):
|
|
|
|
|
|
|
|
for j in range(3):
|
|
|
|
|
|
|
|
m.verts[i][j] *= scale
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
print("Unknown operation: '%s'" % (operation, ))
|
|
|
|
print("Unknown operation: '%s'" % (operation, ))
|
|
|
|
exit()
|
|
|
|
exit()
|
|
|
|