|
|
|
@ -3,6 +3,10 @@
|
|
|
|
|
import sys
|
|
|
|
|
import re
|
|
|
|
|
from geo import Geo
|
|
|
|
|
try:
|
|
|
|
|
from .bones import *
|
|
|
|
|
except:
|
|
|
|
|
from bones import *
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -13,6 +17,7 @@ if len(sys.argv) < 4:
|
|
|
|
|
print("Operations:")
|
|
|
|
|
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(" swap_left_right <reg_ex> Swap left and right bones for all models matching the regular expression.")
|
|
|
|
|
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.")
|
|
|
|
@ -101,6 +106,18 @@ while arg_i < len(sys.argv):
|
|
|
|
|
break
|
|
|
|
|
if found <= 0:
|
|
|
|
|
print(" **Warning!*** Set model scale failed, no model named '%s'." % (nameold.decode("utf-8"), ))
|
|
|
|
|
elif operation == "swap_left_right":
|
|
|
|
|
reg_exp_str = sys.argv[arg_i]
|
|
|
|
|
arg_i += 1
|
|
|
|
|
reg_exp = re.compile(reg_exp_str)
|
|
|
|
|
for i in range(len(geo.models) - 1, -1, -1):
|
|
|
|
|
name = geo.models[i].name.decode("utf-8")
|
|
|
|
|
if reg_exp.search(name) is not None:
|
|
|
|
|
print("Swapping left and right in: %s" % (name, ))
|
|
|
|
|
model = geo.models[i]
|
|
|
|
|
for j in range(len(model.weight_bones)):
|
|
|
|
|
for k in range(len(model.weight_bones[j])):
|
|
|
|
|
model.weight_bones[j][k] = BONES_SWAP[model.weight_bones[j][k]]
|
|
|
|
|
else:
|
|
|
|
|
print("Unknown operation: '%s'" % (operation, ))
|
|
|
|
|
exit()
|
|
|
|
|