summaryrefslogtreecommitdiff
path: root/scripts/content_tools
diff options
context:
space:
mode:
authorBennett Goble <signal@lindenlab.com>2024-05-29 08:10:00 -0700
committerBennett Goble <signal@lindenlab.com>2024-05-29 08:10:00 -0700
commita0b3021bdcf76859054fda8e30abb3ed47749e83 (patch)
tree0e1ee5e68334244f4c67455466cc34409725ea7e /scripts/content_tools
parent83e80d79672210355d0291e30bd89bd03c672ca6 (diff)
Trim trailing whitespace
Start trimming trailing whitespace, but limit the blast radius to a handful of file types.
Diffstat (limited to 'scripts/content_tools')
-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
4 files changed, 34 insertions, 34 deletions
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)