SL-966 - animated object size/pos constraints cont, including some settings for debugging. additional options to anim_tool.py for making test animations
parent
d6cec8d68d
commit
e4e4ad3c09
|
|
@ -2237,6 +2237,28 @@
|
|||
<key>Value</key>
|
||||
<real>1.00</real>
|
||||
</map>
|
||||
<key>AnimatedObjectsMaxLegalOffset</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Max visual offset between object position and rendered position</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>F32</string>
|
||||
<key>Value</key>
|
||||
<real>3.0</real>
|
||||
</map>
|
||||
<key>AnimatedObjectsMaxLegalSize</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Max bounding box size for animated object's rendered position</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>F32</string>
|
||||
<key>Value</key>
|
||||
<real>64.0</real>
|
||||
</map>
|
||||
<key>AvatarBoundingBoxComplexity</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
|
|
|
|||
|
|
@ -74,6 +74,18 @@ void LLControlAvatar::initInstance()
|
|||
|
||||
void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_scale_fixup) const
|
||||
{
|
||||
|
||||
F32 max_legal_offset = MAX_LEGAL_OFFSET;
|
||||
if (gSavedSettings.getControl("AnimatedObjectsMaxLegalOffset"))
|
||||
{
|
||||
max_legal_offset = gSavedSettings.getF32("AnimatedObjectsMaxLegalOffset");
|
||||
}
|
||||
F32 max_legal_size = MAX_LEGAL_SIZE;
|
||||
if (gSavedSettings.getControl("AnimatedObjectsMaxLegalSize"))
|
||||
{
|
||||
max_legal_size = gSavedSettings.getF32("AnimatedObjectsMaxLegalSize");
|
||||
}
|
||||
|
||||
new_pos_fixup = LLVector3();
|
||||
new_scale_fixup = 1.0f;
|
||||
LLVector3 vol_pos = mRootVolp->getRenderPosition();
|
||||
|
|
@ -90,16 +102,16 @@ void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_
|
|||
const LLVector3 *extents = getLastAnimExtents();
|
||||
LLVector3 box_dims = extents[1]-extents[0];
|
||||
F32 max_size = llmax(box_dims[0],box_dims[1],box_dims[2]);
|
||||
LLVector3 pos_box_offset = point_to_box_offset(vol_pos, getLastAnimExtents());
|
||||
LLVector3 pos_box_offset = point_to_box_offset(vol_pos, extents);
|
||||
F32 offset_dist = pos_box_offset.length();
|
||||
if (offset_dist > MAX_LEGAL_OFFSET)
|
||||
if (offset_dist > max_legal_offset)
|
||||
{
|
||||
F32 target_dist = (offset_dist - MAX_LEGAL_OFFSET);
|
||||
F32 target_dist = (offset_dist - max_legal_offset);
|
||||
new_pos_fixup = mPositionConstraintFixup + (target_dist/offset_dist)*pos_box_offset;
|
||||
LL_DEBUGS("ConstraintFix") << getFullname() << " pos fix, offset_dist " << offset_dist << " pos fixup "
|
||||
<< new_pos_fixup << " was " << mPositionConstraintFixup << LL_ENDL;
|
||||
}
|
||||
else if (offset_dist < MAX_LEGAL_OFFSET-1 && mPositionConstraintFixup.length()>0.01f)
|
||||
else if (offset_dist < max_legal_offset-1 && mPositionConstraintFixup.length()>0.01f)
|
||||
{
|
||||
new_pos_fixup = mPositionConstraintFixup * 0.9;
|
||||
LL_DEBUGS("ConstraintFix") << getFullname() << " pos fixup reduced "
|
||||
|
|
@ -109,9 +121,9 @@ void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_
|
|||
{
|
||||
new_pos_fixup = mPositionConstraintFixup;
|
||||
}
|
||||
if (max_size/mScaleConstraintFixup > MAX_LEGAL_SIZE)
|
||||
if (max_size/mScaleConstraintFixup > max_legal_size)
|
||||
{
|
||||
new_scale_fixup = mScaleConstraintFixup*MAX_LEGAL_SIZE/max_size;
|
||||
new_scale_fixup = mScaleConstraintFixup*max_legal_size/max_size;
|
||||
LL_DEBUGS("ConstraintFix") << getFullname() << " scale fix, max_size " << max_size << " fixup "
|
||||
<< mScaleConstraintFixup << " -> " << new_scale_fixup << LL_ENDL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -524,11 +524,14 @@ if __name__ == "__main__":
|
|||
|
||||
parser = argparse.ArgumentParser(description="process SL animations")
|
||||
parser.add_argument("--verbose", help="verbose flag", action="store_true")
|
||||
parser.add_argument("--dump", help="dump to specified file")
|
||||
parser.add_argument("--dump", help="dump to stdout", action="store_true")
|
||||
parser.add_argument("--rot", help="specify sequence of rotations", type=float_triple, nargs="+")
|
||||
parser.add_argument("--rand_pos", help="request random positions", action="store_true")
|
||||
parser.add_argument("--rand_pos", help="request random positions within specified scale", type=float)
|
||||
parser.add_argument("--reset_pos", help="request original positions", action="store_true")
|
||||
parser.add_argument("--pos", help="specify sequence of positions", type=float_triple, nargs="+")
|
||||
parser.add_argument("--duration", help="specify duration", type=float)
|
||||
parser.add_argument("--loop_in", help="specify loop in time", type=float)
|
||||
parser.add_argument("--loop_out", help="specify loop out time", type=float)
|
||||
parser.add_argument("--num_pos", help="number of positions to create", type=int, default=2)
|
||||
parser.add_argument("--delete_joints", help="specify joints to be deleted", nargs="+")
|
||||
parser.add_argument("--joints", help="specify joints to be added or modified", nargs="+")
|
||||
|
|
@ -572,15 +575,21 @@ if __name__ == "__main__":
|
|||
for name in joints:
|
||||
anim.add_joint(name,0)
|
||||
if args.delete_joints:
|
||||
for name in args.delete_joints:
|
||||
del_joints = resolve_joints(args.delete_joints, skel_tree, lad_tree)
|
||||
if args.verbose:
|
||||
print "delete_joints resolved to",del_joints
|
||||
for name in del_joints:
|
||||
anim.delete_joint(name)
|
||||
joints.remove(name)
|
||||
if joints and args.rot:
|
||||
anim.add_rot(joints, args.rot)
|
||||
if joints and args.pos:
|
||||
anim.add_pos(joints, args.pos)
|
||||
if joints and args.rand_pos:
|
||||
print "joints ",joints,"rand_pos",args.rand_pos,"num_pos",args.num_pos
|
||||
if joints and args.rand_pos is not None:
|
||||
print "rand_pos",args.rand_pos
|
||||
for joint in joints:
|
||||
pos_array = list(tuple(random.uniform(-1,1) for i in xrange(3)) for j in xrange(args.num_pos))
|
||||
pos_array = list(tuple(random.uniform(-args.rand_pos,args.rand_pos) for i in xrange(3)) for j in xrange(args.num_pos))
|
||||
pos_array.append(pos_array[0])
|
||||
anim.add_pos([joint], pos_array)
|
||||
if joints and args.reset_pos:
|
||||
|
|
@ -605,8 +614,17 @@ if __name__ == "__main__":
|
|||
print "set joint priority",args.joint_priority
|
||||
for joint in anim.joints:
|
||||
joint.joint_priority = args.joint_priority
|
||||
if args.duration is not None:
|
||||
print "set duration",args.duration
|
||||
anim.duration = args.duration
|
||||
if args.loop_in is not None:
|
||||
print "set loop_in",args.loop_in
|
||||
anim.loop_in_point = args.loop_in
|
||||
if args.loop_out is not None:
|
||||
print "set loop_out",args.loop_out
|
||||
anim.loop_out_point = args.loop_out
|
||||
if args.dump:
|
||||
anim.dump(args.dump)
|
||||
anim.dump("-")
|
||||
if args.summary:
|
||||
anim.summary()
|
||||
if args.outfilename:
|
||||
|
|
|
|||
Loading…
Reference in New Issue