summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorBrad Linden <brad@lindenlab.com>2024-06-10 16:22:12 -0700
committerBrad Linden <brad@lindenlab.com>2024-06-10 16:22:12 -0700
commit7c42711ca3a4e67b95473aa5129dce5ff19bea15 (patch)
tree593c0bedf07bffc79ec4640b157839edf61260f5 /scripts
parente0e6e7fd747121442370fc811c84aa34ed612f64 (diff)
parent9f6b8484dfb7dfa981d8a8ac3693d3f68e32bc12 (diff)
Merge remote-tracking branch 'origin/DRTVWR-600-maint-A' into project/gltf_development
Diffstat (limited to 'scripts')
-rw-r--r--scripts/code_tools/fix_whitespace.py2
-rw-r--r--scripts/code_tools/fix_xml_indentations.py2
-rw-r--r--scripts/code_tools/modified-strings.sh14
-rw-r--r--scripts/code_tools/modified_strings.py16
-rw-r--r--scripts/content_tools/anim_tool.py26
-rw-r--r--scripts/content_tools/arche_tool.py6
-rw-r--r--scripts/content_tools/dae_tool.py10
-rw-r--r--scripts/content_tools/skel_tool.py26
-rw-r--r--scripts/metrics/viewer_asset_logs.py8
-rwxr-xr-xscripts/metrics/viewerstats.py16
-rwxr-xr-xscripts/template_verifier.py10
-rwxr-xr-xscripts/templates/template-cpp.cpp2
-rwxr-xr-xscripts/templates/template-h.h2
13 files changed, 70 insertions, 70 deletions
diff --git a/scripts/code_tools/fix_whitespace.py b/scripts/code_tools/fix_whitespace.py
index 91e82f26f4..7a88265479 100644
--- a/scripts/code_tools/fix_whitespace.py
+++ b/scripts/code_tools/fix_whitespace.py
@@ -55,7 +55,7 @@ def convert_tabs_to_spaces(file_path, tab_stop):
new_lines.append(new_line + '\n')
- with open(file_path, 'w') as file:
+ with open(file_path, 'w', newline='\n') as file:
file.writelines(new_lines)
def process_directory(directory, extensions, tab_stop):
diff --git a/scripts/code_tools/fix_xml_indentations.py b/scripts/code_tools/fix_xml_indentations.py
index 9c8a1fc04b..e317e4f7f6 100644
--- a/scripts/code_tools/fix_xml_indentations.py
+++ b/scripts/code_tools/fix_xml_indentations.py
@@ -72,7 +72,7 @@ def save_xml(tree, file_path, xml_decl, indent_text=False, indent_tab=False, rm_
if rm_space:
xml_string = xml_string.replace(' />', '/>')
- xml_decl = (xml_decl if (xml_decl and not rewrite_decl)
+ xml_decl = (xml_decl if (xml_decl and not rewrite_decl)
else '<?xml version="1.0" encoding="utf-8" standalone="yes" ?>')
try:
diff --git a/scripts/code_tools/modified-strings.sh b/scripts/code_tools/modified-strings.sh
index 435dda3f5d..932b0a4bfc 100644
--- a/scripts/code_tools/modified-strings.sh
+++ b/scripts/code_tools/modified-strings.sh
@@ -38,11 +38,11 @@ do
-h|--help)
Action=USAGE
;;
-
+
-v|--verbose)
Verbose=true
;;
-
+
##
## Select the revision to compare against
##
@@ -79,7 +79,7 @@ do
break
fi
;;
- esac
+ esac
shift # always consume 1
done
@@ -107,10 +107,10 @@ then
cat <<USAGE
Usage:
-
+
modified-strings.sh [ { -v | --verbose } ] [-r <revision>] [<path-to-xui>]
- where
+ where
--verbose shows progress messages on stderr (the command takes a while, so this is reassuring)
-r <revision> specifies a git revision (branch, tag, commit, or relative specifier)
@@ -124,9 +124,9 @@ Usage:
the path of a file that has a string change (columns 2 and 3 are empty for lines with a filename)
name
the name attribute of a string or label whose value changed
- English value
+ English value
the current value of the string or label whose value changed
- for strings, newlines are changed to '\n' and tab characters are changed to '\t'
+ for strings, newlines are changed to '\n' and tab characters are changed to '\t'
There is also a column for each of the language directories following the English.
diff --git a/scripts/code_tools/modified_strings.py b/scripts/code_tools/modified_strings.py
index 20ed1b0555..c777fc8c0d 100644
--- a/scripts/code_tools/modified_strings.py
+++ b/scripts/code_tools/modified_strings.py
@@ -49,7 +49,7 @@ into google sheets.
If the --rev revision already contains a translation for the text, it
will be included in the spreadsheet for reference.
-
+
Normally you would want --rev_base to be the last revision to have
translations added, and --rev to be the tip of the current
project. You can find the last commit with translation work using "git log --grep INTL- | head"
@@ -242,7 +242,7 @@ def find_deletions(mod_tree, base_tree, lang, args, f):
mod_filename = transl_filename.replace("/xui/{}/".format(lang), "/xui/{}/".format(args.base_lang))
#print("checking",transl_filename,"against",mod_filename)
try:
- mod_blob = mod_tree[mod_filename]
+ mod_blob = mod_tree[mod_filename]
except:
print(" delete file", transl_filename, file=f)
continue
@@ -257,7 +257,7 @@ def find_deletions(mod_tree, base_tree, lang, args, f):
if not elt_key in mod_dict:
if lines == 0:
print(" in file", transl_filename, file=f)
- lines += 1
+ lines += 1
print(" delete element", elt_key, file=f)
else:
transl_elt = transl_dict[elt_key]
@@ -266,14 +266,14 @@ def find_deletions(mod_tree, base_tree, lang, args, f):
if not a in mod_elt.attrib:
if lines == 0:
print(" in file", transl_filename, file=f)
- lines += 1
+ lines += 1
print(" delete attribute", a, "from", elt_key, file=f)
if transl_elt.text and (not mod_elt.text):
if lines == 0:
print(" in file", transl_filename, file=f)
- lines += 1
+ lines += 1
print(" delete text from", elt_key, file=f)
-
+
def save_translation_file(per_lang_data, aux_data, outfile):
langs = sorted(per_lang_data.keys())
@@ -310,12 +310,12 @@ def save_translation_file(per_lang_data, aux_data, outfile):
# Reference info, not for translation
for aux, data in list(aux_data.items()):
- df = pd.DataFrame(data, columns = ["Key", "Value"])
+ df = pd.DataFrame(data, columns = ["Key", "Value"])
df.to_excel(writer, index=False, sheet_name=aux)
worksheet = writer.sheets[aux]
worksheet.set_column('A:A', 50, bold_wrap_format)
worksheet.set_column('B:B', 80, wrap_format)
-
+
print("Writing", outfile)
writer.save()
diff --git a/scripts/content_tools/anim_tool.py b/scripts/content_tools/anim_tool.py
index 4a0773951e..07159a8052 100644
--- a/scripts/content_tools/anim_tool.py
+++ b/scripts/content_tools/anim_tool.py
@@ -92,7 +92,7 @@ class FilePacker(object):
# Now pad what's left of str out to 'size' with nul bytes.
buf = str + ("\000" * (size-len(str)))
self.buffer.write(buf)
-
+
class FileUnpacker(object):
def __init__(self, filename):
with open(filename,"rb") as f:
@@ -103,7 +103,7 @@ class FileUnpacker(object):
result = struct.unpack_from(fmt, self.buffer, self.offset)
self.offset += struct.calcsize(fmt)
return result
-
+
def unpack_string(self, size=0):
# Nonzero size means we must consider exactly the next 'size'
# characters in self.buffer.
@@ -131,7 +131,7 @@ def F32_to_U16(val, lower, upper):
# make sure that the value is positive and normalized to <0, 1>
val -= lower;
val /= (upper - lower);
-
+
# return the U16
return int(math.floor(val*U16MAX))
@@ -149,7 +149,7 @@ def U16_to_F32(ival, lower, upper):
# make sure that zeroes come through as zero
if abs(val) < max_error:
val = 0.0
- return val;
+ return val;
class RotKey(object):
def __init__(self, time, duration, rot):
@@ -185,7 +185,7 @@ class RotKey(object):
fp.pack("<H",self.time_short)
(x,y,z) = [F32_to_U16(v, -1.0, 1.0) for v in self.rotation]
fp.pack("<HHH",x,y,z)
-
+
class PosKey(object):
def __init__(self, time, duration, pos):
"""
@@ -216,7 +216,7 @@ class PosKey(object):
def dump(self, f):
print(" pos_key: t %.3f" % self.time,"pos ",",".join("%.3f" % f for f in self.position), file=f)
-
+
def pack(self, fp):
fp.pack("<H",self.time_short)
(x,y,z) = [F32_to_U16(v, -LL_MAX_PELVIS_OFFSET, LL_MAX_PELVIS_OFFSET) for v in self.position]
@@ -259,7 +259,7 @@ class Constraint(object):
print(" ease_in_stop",self.ease_in_stop, file=f)
print(" ease_out_start",self.ease_out_start, file=f)
print(" ease_out_stop",self.ease_out_stop, file=f)
-
+
class Constraints(object):
@staticmethod
def unpack(duration, fup):
@@ -340,7 +340,7 @@ class RotationCurve(object):
print(" num_rot_keys", len(self.keys), file=f)
for k in self.keys:
k.dump(f)
-
+
class JointInfo(object):
def __init__(self, name, priority):
self.joint_name = name
@@ -434,11 +434,11 @@ class Anim(object):
# find that parent in list of joints, set its index in index list
self.emote_name = fup.unpack_string()
-
+
(self.loop_in_point, self.loop_out_point, self.loop,
self.ease_in_duration, self.ease_out_duration, self.hand_pose, num_joints) = \
fup.unpack("@ffiffII")
-
+
self.joints = [JointInfo.unpack(self.duration, fup)
for j in range(num_joints)]
if self.verbose:
@@ -446,7 +446,7 @@ class Anim(object):
print("unpacked joint",joint_info.joint_name)
self.constraints = Constraints.unpack(self.duration, fup)
self.buffer = fup.buffer
-
+
def pack(self, fp):
fp.pack("@HHhf", self.version, self.sub_version, self.base_priority, self.duration)
fp.pack_string(self.emote_name, 0)
@@ -475,7 +475,7 @@ class Anim(object):
for j in self.joints:
j.dump(f)
self.constraints.dump(f)
-
+
def write(self, filename):
fp = FilePacker()
self.pack(fp)
@@ -603,7 +603,7 @@ def main(*argv):
# Use sys.argv[0] because (a) this script lives where it lives regardless
# of what our caller passes and (b) we don't expect our caller to pass the
# script name anyway.
- pathname = os.path.dirname(sys.argv[0])
+ pathname = os.path.dirname(sys.argv[0])
# we're in scripts/content_tools; hop back to base of repository clone
path_to_skel = os.path.join(os.path.abspath(pathname),os.pardir,os.pardir,
"indra","newview","character")
diff --git a/scripts/content_tools/arche_tool.py b/scripts/content_tools/arche_tool.py
index 677af62d2f..9979c61b21 100644
--- a/scripts/content_tools/arche_tool.py
+++ b/scripts/content_tools/arche_tool.py
@@ -78,7 +78,7 @@ def compare_trees(file_trees):
compare_matched_nodes(key,items,summary)
print("Summary:")
print(summary)
-
+
def dump_appearance_params(tree):
vals = []
for e in tree.getroot().iter():
@@ -89,8 +89,8 @@ def dump_appearance_params(tree):
#print e.get("id"), e.get("name"), e.get("group"), e.get("u8")
if len(vals)==253:
print(", ".join(vals))
-
-
+
+
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="compare avatar XML archetype files")
diff --git a/scripts/content_tools/dae_tool.py b/scripts/content_tools/dae_tool.py
index 2454fafa46..5286c37de3 100644
--- a/scripts/content_tools/dae_tool.py
+++ b/scripts/content_tools/dae_tool.py
@@ -58,7 +58,7 @@ def mesh_lock_offsets(tree, joints):
floats[11] += 0.0001
matrix_node.text = " ".join([str(f) for f in floats])
print(joint_node.get("name"),matrix_node.tag,"text",matrix_node.text,len(floats),floats)
-
+
def mesh_random_offsets(tree, joints):
print("mesh_random_offsets",tree,joints)
@@ -80,7 +80,7 @@ def mesh_random_offsets(tree, joints):
floats[11] += random.uniform(-1.0,1.0)
matrix_node.text = " ".join([str(f) for f in floats])
print(joint_node.get("name"),matrix_node.tag,"text",matrix_node.text,len(floats),floats)
-
+
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="process SL animations")
@@ -92,7 +92,7 @@ if __name__ == "__main__":
parser.add_argument("--summary", action="store_true", help="print summary info about input file")
args = parser.parse_args()
- mesh = None
+ mesh = None
tree = None
if args.infilename:
@@ -103,7 +103,7 @@ if __name__ == "__main__":
if args.summary:
print("summarizing",args.infilename)
mesh_summary(mesh)
-
+
if args.lock_offsets:
print("locking offsets for",args.lock_offsets)
mesh_lock_offsets(tree, args.lock_offsets)
@@ -116,4 +116,4 @@ if __name__ == "__main__":
print("writing",args.outfilename)
f = open(args.outfilename,"w")
print(etree.tostring(tree, pretty_print=True), file=f) #need update to get: , short_empty_elements=True)
-
+
diff --git a/scripts/content_tools/skel_tool.py b/scripts/content_tools/skel_tool.py
index 696e4e2923..604d2b7db9 100644
--- a/scripts/content_tools/skel_tool.py
+++ b/scripts/content_tools/skel_tool.py
@@ -29,7 +29,7 @@ $/LicenseInfo$
import argparse
from lxml import etree
-
+
def get_joint_names(tree):
joints = [element.get('name') for element in tree.getroot().iter() if element.tag in ['bone','collision_volume']]
print("joints:",joints)
@@ -45,10 +45,10 @@ def get_aliases(tree):
val = element.get('aliases')
aliases[name] = val
return aliases
-
+
def fix_name(element):
pass
-
+
def enforce_precision_rules(element):
pass
@@ -104,7 +104,7 @@ def enforce_symmetry(tree, element, field, fix=False):
def get_element_by_name(tree,name):
if tree is None:
return None
- matches = [elt for elt in tree.getroot().iter() if elt.get("name")==name]
+ matches = [elt for elt in tree.getroot().iter() if elt.get("name")==name]
if len(matches)==1:
return matches[0]
elif len(matches)>1:
@@ -117,7 +117,7 @@ def list_skel_tree(tree):
for element in tree.getroot().iter():
if element.tag == "bone":
print(element.get("name"),"-",element.get("support"))
-
+
def validate_child_order(tree, ogtree, fix=False):
unfixable = 0
@@ -182,7 +182,7 @@ def validate_skel_tree(tree, ogtree, reftree, fix=False):
print("validate_skel_tree")
(num_bones,num_cvs) = (0,0)
unfixable = 0
- defaults = {"connected": "false",
+ defaults = {"connected": "false",
"group": "Face"
}
for element in tree.getroot().iter():
@@ -232,7 +232,7 @@ def validate_skel_tree(tree, ogtree, reftree, fix=False):
if element.get("support")=="extended":
if element.get("pos") != element.get("pivot"):
print("extended joint",element.get("name"),"has mismatched pos, pivot")
-
+
if element.tag == "linden_skeleton":
num_bones = int(element.get("num_bones"))
@@ -253,7 +253,7 @@ def validate_skel_tree(tree, ogtree, reftree, fix=False):
if fix and (unfixable > 0):
print("BAD FILE:", unfixable,"errs could not be fixed")
-
+
def slider_info(ladtree,skeltree):
for param in ladtree.iter("param"):
@@ -287,7 +287,7 @@ def slider_info(ladtree,skeltree):
print(" Offset MaxX", offset_max[0])
print(" Offset MaxY", offset_max[1])
print(" Offset MaxZ", offset_max[2])
-
+
# Check contents of avatar_lad file relative to a specified skeleton
def validate_lad_tree(ladtree,skeltree,orig_ladtree):
print("validate_lad_tree")
@@ -344,7 +344,7 @@ def validate_lad_tree(ladtree,skeltree,orig_ladtree):
expected_offset = tuple([bone_offset[0],-bone_offset[1],bone_offset[2]])
if left_offset != expected_offset:
print("offset mismatch between",bone_name,"and",left_name,"in param",param.get("id","-1"))
-
+
drivers = {}
for driven_param in ladtree.iter("driven"):
driver = driven_param.getparent().getparent()
@@ -380,7 +380,7 @@ def validate_lad_tree(ladtree,skeltree,orig_ladtree):
print("removed",set(orig_message_ids) - set(message_ids))
else:
print("message ids OK")
-
+
def remove_joint_by_name(tree, name):
print("remove joint:",name)
elt = get_element_by_name(tree,name)
@@ -395,7 +395,7 @@ def remove_joint_by_name(tree, name):
elt[:] = []
print("parent now:",[e.get("name") for e in list(parent)])
elt = get_element_by_name(tree,name)
-
+
def compare_skel_trees(atree,btree):
diffs = {}
realdiffs = {}
@@ -513,7 +513,7 @@ if __name__ == "__main__":
if ladtree and tree and args.slider_info:
slider_info(ladtree,tree)
-
+
if args.outfilename:
f = open(args.outfilename,"w")
print(etree.tostring(tree, pretty_print=True), file=f) #need update to get: , short_empty_elements=True)
diff --git a/scripts/metrics/viewer_asset_logs.py b/scripts/metrics/viewer_asset_logs.py
index bd996dff79..4fb9fd15b3 100644
--- a/scripts/metrics/viewer_asset_logs.py
+++ b/scripts/metrics/viewer_asset_logs.py
@@ -63,7 +63,7 @@ def update_stats(stats,rec):
# handle fps record as special case
pass
else:
- #print "field",field
+ #print "field",field
stats.setdefault(field,{})
type_stats = stats.get(field)
newcount = val["resp_count"]
@@ -75,9 +75,9 @@ def update_stats(stats,rec):
type_stats["sum_bytes"] = type_stats.get("sum_bytes",0) + val["resp_count"] * val.get("resp_mean_bytes",0)
type_stats["enqueued"] = type_stats.get("enqueued",0) + val["enqueued"]
type_stats["dequeued"] = type_stats.get("dequeued",0) + val["dequeued"]
-
-
-
+
+
+
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="process metric xml files for viewer asset fetching")
diff --git a/scripts/metrics/viewerstats.py b/scripts/metrics/viewerstats.py
index e64343329c..41bc493aaa 100755
--- a/scripts/metrics/viewerstats.py
+++ b/scripts/metrics/viewerstats.py
@@ -144,7 +144,7 @@ def get_used_strings(root_dir):
#if ext not in [".cpp", ".hpp", ".h", ".xml"]:
# skipped_ext.add(ext)
# continue
-
+
full_name = os.path.join(dir_name,fname)
with open(full_name,"r") as f:
@@ -158,8 +158,8 @@ def get_used_strings(root_dir):
print("skipped extensions", skipped_ext)
print("got used_str", len(used_str))
return used_str
-
-
+
+
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="process tab-separated table containing viewerstats logs")
@@ -184,7 +184,7 @@ if __name__ == "__main__":
if args.preferences:
print("\nSETTINGS.XML")
settings_sd = parse_settings_xml("settings.xml")
- #for skey,svals in settings_sd.items():
+ #for skey,svals in settings_sd.items():
# print skey, "=>", svals
(all_str,_,_,_) = show_stats_by_key(recs,["preferences","settings"],settings_sd)
print()
@@ -211,16 +211,16 @@ if __name__ == "__main__":
print("PREFIX_USED", len(prefix_used), ",".join(list(prefix_used)))
print()
unref_strings = unref_strings - prefix_used
-
+
print("\nUNREF_IN_CODE " + str(len(unref_strings)) + "\n")
print("\n".join(list(unref_strings)))
settings_str = read_raw_settings_xml("settings.xml")
# Do this via direct string munging to generate minimal changeset
settings_edited = remove_settings(settings_str,unref_strings)
write_raw_settings_xml("settings.xml.edit",settings_edited)
-
-
-
+
+
+
diff --git a/scripts/template_verifier.py b/scripts/template_verifier.py
index ee8492db5e..65850f7a28 100755
--- a/scripts/template_verifier.py
+++ b/scripts/template_verifier.py
@@ -73,8 +73,8 @@ from indra.ipc import tokenstream
from indra.ipc import llmessage
def getstatusall(command):
- """ Like commands.getstatusoutput, but returns stdout and
- stderr separately(to get around "killed by signal 15" getting
+ """ Like commands.getstatusoutput, but returns stdout and
+ stderr separately(to get around "killed by signal 15" getting
included as part of the file). Also, works on Windows."""
(input, out, err) = os.popen3(command, 't')
status = input.close() # send no input to the command
@@ -257,7 +257,7 @@ http://wiki.secondlife.com/wiki/Template_verifier.py
elif len(args) == 1:
master_url = None
current_filename = args[0]
- print("master:", options.master_url)
+ print("master:", options.master_url)
print("current:", current_filename)
current_url = 'file://%s' % current_filename
# nothing specified, use defaults for everything
@@ -269,7 +269,7 @@ http://wiki.secondlife.com/wiki/Template_verifier.py
if master_url is None:
master_url = options.master_url
-
+
if current_url is None:
current_filename = local_template_filename()
print("master:", options.master_url)
@@ -307,7 +307,7 @@ http://wiki.secondlife.com/wiki/Template_verifier.py
print("Syntax-checking the local template ONLY, no compatibility check is being run.")
print("Cause: %s\n\n" % e)
return 0
-
+
acceptable, compat = compare(
master_parsed, current_parsed, options.mode)
diff --git a/scripts/templates/template-cpp.cpp b/scripts/templates/template-cpp.cpp
index 35d8441c87..8ee04942bf 100755
--- a/scripts/templates/template-cpp.cpp
+++ b/scripts/templates/template-cpp.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file #filename#.cpp
* @brief Implementation of #filename#
* @author #getpass.getuser()#@lindenlab.com
diff --git a/scripts/templates/template-h.h b/scripts/templates/template-h.h
index ce7b4ddc87..d7677c256b 100755
--- a/scripts/templates/template-h.h
+++ b/scripts/templates/template-h.h
@@ -1,4 +1,4 @@
-/**
+/**
* @file #filename#.h
* @brief Header file for #filename#
* @author #getpass.getuser()#@lindenlab.com