From f55667397e75991348fa25b6ad581a36de99acf0 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 6 Jul 2017 01:25:10 +0100 Subject: SL-722 - handle per-object animation requests, combine for control avatar animation state. --- indra/newview/app_settings/logcontrol.xml | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/app_settings') diff --git a/indra/newview/app_settings/logcontrol.xml b/indra/newview/app_settings/logcontrol.xml index ecd7c4bc36..ddd07dba80 100644 --- a/indra/newview/app_settings/logcontrol.xml +++ b/indra/newview/app_settings/logcontrol.xml @@ -50,6 +50,7 @@ tags + AXON default-level INFO print-location false + log-always-flush true + + enabled-log-types-mask 0xFFFFFFFF settings -- cgit v1.3 From 795aedf4a922f17aac667afc0c368e7fe18b0e03 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 6 Sep 2018 19:47:51 +0100 Subject: SL-966 - size and pos limit calcs moved to sep method. Global scale option for testing of size limits. --- indra/newview/app_settings/settings.xml | 11 ++++ indra/newview/llcontrolavatar.cpp | 91 +++++++++++++++++++++------------ indra/newview/llcontrolavatar.h | 7 ++- 3 files changed, 76 insertions(+), 33 deletions(-) (limited to 'indra/newview/app_settings') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index f911008879..0277d09ae1 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -2226,6 +2226,17 @@ Value 0 + AnimatedObjectsGlobalScale + + Comment + Temporary testing: allow an extra scale factor to be forced on animated objects. + Persist + 1 + Type + F32 + Value + 1.00 + AvatarBoundingBoxComplexity Comment diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 83d42f6ccf..fdef60612f 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -35,12 +35,16 @@ #include "llviewerregion.h" #include "llskinningutil.h" +const F32 LLControlAvatar::MAX_LEGAL_OFFSET = 3.0f; +const F32 LLControlAvatar::MAX_LEGAL_SIZE = 16.0f; + LLControlAvatar::LLControlAvatar(const LLUUID& id, const LLPCode pcode, LLViewerRegion* regionp) : LLVOAvatar(id, pcode, regionp), mPlaying(false), mGlobalScale(1.0f), mMarkedForDeath(false), - mRootVolp(NULL) + mRootVolp(NULL), + mScaleConstraintFixup(1.0) { mIsDummy = TRUE; mIsControlAvatar = true; @@ -68,6 +72,44 @@ void LLControlAvatar::initInstance() mInitFlags |= 1<<4; } +void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_scale_fixup) const +{ + new_pos_fixup = LLVector3(); + new_scale_fixup = 1.0f; + LLVector3 vol_pos = mRootVolp->getRenderPosition(); + + // Fix up position if needed to prevent visual encroachment + if (box_valid_and_non_zero(getLastAnimExtents())) // wait for state to settle down + { + // The goal here is to ensure that the extent of the avatar's + // bounding box does not wander too far from the + // official position of the corresponding volume. We + // do this by tracking the distance and applying a + // correction to the control avatar position if + // needed. + LLVector3 uncorrected_extents[2]; + uncorrected_extents[0] = (getLastAnimExtents()[0] - mPositionConstraintFixup)/mScaleConstraintFixup; + uncorrected_extents[1] = (getLastAnimExtents()[1] - mPositionConstraintFixup)/mScaleConstraintFixup; + LLVector3 uncorrected_size = uncorrected_extents[1]-uncorrected_extents[0]; + F32 uncorrected_max_size = llmax(uncorrected_size[0],uncorrected_size[1],uncorrected_size[2]); + LLVector3 pos_box_offset = point_to_box_offset(vol_pos, uncorrected_extents); + F32 offset_dist = pos_box_offset.length(); + if (offset_dist > MAX_LEGAL_OFFSET) + { + F32 target_dist = (offset_dist - MAX_LEGAL_OFFSET); + new_pos_fixup = (target_dist/offset_dist)*pos_box_offset; + LL_INFOS("ConstraintFix") << "pos fix, offset_dist " << offset_dist << " pos fixup " + << new_pos_fixup << LL_ENDL; + } + if (uncorrected_max_size > MAX_LEGAL_SIZE) + { + new_scale_fixup = MAX_LEGAL_SIZE/uncorrected_max_size; + LL_INFOS("ConstraintFix") << "scale fix, uncorrected_size " << uncorrected_size << " fixup " + << mScaleConstraintFixup << LL_ENDL; + } + } +} + void LLControlAvatar::matchVolumeTransform() { if (mRootVolp) @@ -96,37 +138,16 @@ void LLControlAvatar::matchVolumeTransform() } else { - LLVector3 vol_pos = mRootVolp->getRenderPosition(); - LLVector3 pos_box_offset; - LLVector3 box_offset; - // Fix up position if needed to prevent visual encroachment - if (box_valid_and_non_zero(getLastAnimExtents())) // wait for state to settle down - { - const F32 MAX_LEGAL_OFFSET = 3.0; - - // The goal here is to ensure that the extent of the avatar's - // bounding box does not wander too far from the - // official position of the corresponding volume. We - // do this by tracking the distance and applying a - // correction to the control avatar position if - // needed. - LLVector3 uncorrected_extents[2]; - uncorrected_extents[0] = getLastAnimExtents()[0] - mPositionConstraintFixup; - uncorrected_extents[1] = getLastAnimExtents()[1] - mPositionConstraintFixup; - pos_box_offset = point_to_box_offset(vol_pos, uncorrected_extents); - F32 offset_dist = pos_box_offset.length(); - if (offset_dist > MAX_LEGAL_OFFSET) - { - F32 target_dist = (offset_dist - MAX_LEGAL_OFFSET); - box_offset = (target_dist/offset_dist)*pos_box_offset; - } - } + LLVector3 new_pos_fixup; + F32 new_scale_fixup; + getNewConstraintFixups(new_pos_fixup, new_scale_fixup); - mPositionConstraintFixup = box_offset; - - // Currently if you're doing something like playing an + mPositionConstraintFixup = new_pos_fixup; + mScaleConstraintFixup = new_scale_fixup; + + // FIXME: Currently if you're doing something like playing an // animation that moves the pelvis (on an avatar or // animated object), the name tag and debug text will be // left behind. Ideally setPosition() would follow the @@ -152,6 +173,9 @@ void LLControlAvatar::matchVolumeTransform() mRoot->setWorldRotation(bind_rot*obj_rot); setPositionAgent(vol_pos); mRoot->setPosition(vol_pos + mPositionConstraintFixup); + + F32 global_scale = gSavedSettings.getF32("AnimatedObjectsGlobalScale"); + setGlobalScale(global_scale * mScaleConstraintFixup); } } } @@ -371,10 +395,13 @@ void LLControlAvatar::updateDebugText() addDebugText(llformat("tris %d (est %.1f, streaming %.1f), verts %d", total_tris, est_tris, est_streaming_tris, total_verts)); addDebugText(llformat("pxarea %s rank %d", LLStringOps::getReadableNumber(getPixelArea()).c_str(), getVisibilityRank())); addDebugText(llformat("lod_radius %s dists %s", LLStringOps::getReadableNumber(lod_radius).c_str(),cam_dist_string.c_str())); - if (mPositionConstraintFixup.length() > 0.0f) + if (mPositionConstraintFixup.length() > 0.0f || mScaleConstraintFixup != 1.0f) { - addDebugText(llformat("pos fix (%.1f %.1f %.1f)", - mPositionConstraintFixup[0], mPositionConstraintFixup[1], mPositionConstraintFixup[2])); + addDebugText(llformat("pos fix (%.1f %.1f %.1f) scale %f", + mPositionConstraintFixup[0], + mPositionConstraintFixup[1], + mPositionConstraintFixup[2], + mScaleConstraintFixup)); } #if 0 diff --git a/indra/newview/llcontrolavatar.h b/indra/newview/llcontrolavatar.h index c72dc03efc..9924697938 100644 --- a/indra/newview/llcontrolavatar.h +++ b/indra/newview/llcontrolavatar.h @@ -40,9 +40,10 @@ public: virtual void initInstance(); // Called after construction to initialize the class. virtual ~LLControlAvatar(); + void getNewConstraintFixups(LLVector3& new_pos_constraint, F32& new_scale_constraint) const; void matchVolumeTransform(); void updateVolumeGeom(); - + void setGlobalScale(F32 scale); void recursiveScaleJoint(LLJoint *joint, F32 factor); static LLControlAvatar *createControlAvatar(LLVOVolume *obj); @@ -81,7 +82,11 @@ public: bool mMarkedForDeath; LLVector3 mPositionConstraintFixup; + F32 mScaleConstraintFixup; + static const F32 MAX_LEGAL_OFFSET; + static const F32 MAX_LEGAL_SIZE; + }; typedef std::map signaled_animation_map_t; -- cgit v1.3 From 007a126256219e47c9dd3ba0eafeffe4e6f12ef8 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 7 Sep 2018 14:32:48 +0100 Subject: SL-944 - logcontrol.xml update --- indra/newview/app_settings/logcontrol.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/app_settings') diff --git a/indra/newview/app_settings/logcontrol.xml b/indra/newview/app_settings/logcontrol.xml index 08741327a5..482012cdd6 100644 --- a/indra/newview/app_settings/logcontrol.xml +++ b/indra/newview/app_settings/logcontrol.xml @@ -17,7 +17,7 @@ For example, value of 10 = 2|8 would enable logging only to SecondLife.log and the viewer debug console. Note: RecordToFile is always enabled in release builds. --> - enabled-log-types-mask 0xFFFFFFFF + enabled-log-types-mask 255 settings -- cgit v1.3 From e4e4ad3c09bdc06f738f60bbfd7899036ad6553f Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 10 Sep 2018 20:13:35 +0100 Subject: SL-966 - animated object size/pos constraints cont, including some settings for debugging. additional options to anim_tool.py for making test animations --- indra/newview/app_settings/settings.xml | 22 ++++++++++++++++++++++ indra/newview/llcontrolavatar.cpp | 24 ++++++++++++++++++------ scripts/content_tools/anim_tool.py | 30 ++++++++++++++++++++++++------ 3 files changed, 64 insertions(+), 12 deletions(-) (limited to 'indra/newview/app_settings') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 0277d09ae1..3ad8b6cded 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -2237,6 +2237,28 @@ Value 1.00 + AnimatedObjectsMaxLegalOffset + + Comment + Max visual offset between object position and rendered position + Persist + 1 + Type + F32 + Value + 3.0 + + AnimatedObjectsMaxLegalSize + + Comment + Max bounding box size for animated object's rendered position + Persist + 1 + Type + F32 + Value + 64.0 + AvatarBoundingBoxComplexity Comment diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 54b1a0dcaf..96cdb7f01d 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -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; } diff --git a/scripts/content_tools/anim_tool.py b/scripts/content_tools/anim_tool.py index 77bf731ae6..b7585112c5 100644 --- a/scripts/content_tools/anim_tool.py +++ b/scripts/content_tools/anim_tool.py @@ -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: -- cgit v1.3 From 8078b30574fc0a317b8dc7aadfc09516d3638ab0 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 3 Oct 2018 13:11:50 +0100 Subject: SL-966 - bug fixes, added lerp control for algorithm tweaking --- indra/newview/app_settings/settings.xml | 11 +++++++++++ indra/newview/llcontrolavatar.cpp | 8 +++++++- 2 files changed, 18 insertions(+), 1 deletion(-) (limited to 'indra/newview/app_settings') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 3ad8b6cded..bacd2c992b 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -2259,6 +2259,17 @@ Value 64.0 + AnimatedObjectsPosLerp + + Comment + How strongly to weight new position vs. previous frame in position constraints. + Persist + 1 + Type + F32 + Value + 1.0 + AvatarBoundingBoxComplexity Comment diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 64f8423a66..96aaab80fa 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -87,6 +87,11 @@ void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_ { max_legal_size = gSavedSettings.getF32("AnimatedObjectsMaxLegalSize"); } + F32 lerp_weight = 0.5f; // hysteresis. 1.0 = immediately slam to new value, 0.0 = ignore new value + if (gSavedSettings.getControl("AnimatedObjectsPosLerp")) + { + lerp_weight = gSavedSettings.getF32("AnimatedObjectsPosLerp"); + } new_pos_fixup = LLVector3(); new_scale_fixup = 1.0f; @@ -102,7 +107,7 @@ void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_ // correction to the control avatar position if // needed. const LLVector3 *extents = getLastAnimExtents(); - LLVector unshift_extents; + LLVector3 unshift_extents[2]; unshift_extents[0] = extents[0] - mPositionConstraintFixup; unshift_extents[1] = extents[1] - mPositionConstraintFixup; LLVector3 box_dims = extents[1]-extents[0]; @@ -116,6 +121,7 @@ void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_ LL_DEBUGS("ConstraintFix") << getFullname() << " pos fix, offset_dist " << offset_dist << " pos fixup " << new_pos_fixup << " was " << mPositionConstraintFixup << LL_ENDL; } + new_pos_fixup = lerp_weight * new_pos_fixup + (1.0f - lerp_weight)*mPositionConstraintFixup; if (max_size/mScaleConstraintFixup > max_legal_size) { new_scale_fixup = mScaleConstraintFixup*max_legal_size/max_size; -- cgit v1.3 From 2fc7dcf22f6c04614a5dfc09104e919220f30525 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 3 Oct 2018 20:48:57 +0100 Subject: SL-966 - added scale constraints for animated object attachments --- indra/newview/app_settings/settings.xml | 11 ------- indra/newview/llcontrolavatar.cpp | 57 +++++++++++++++++---------------- 2 files changed, 29 insertions(+), 39 deletions(-) (limited to 'indra/newview/app_settings') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index bacd2c992b..3ad8b6cded 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -2259,17 +2259,6 @@ Value 64.0 - AnimatedObjectsPosLerp - - Comment - How strongly to weight new position vs. previous frame in position constraints. - Persist - 1 - Type - F32 - Value - 1.0 - AvatarBoundingBoxComplexity Comment diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 96aaab80fa..4b70d625d4 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -87,15 +87,10 @@ void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_ { max_legal_size = gSavedSettings.getF32("AnimatedObjectsMaxLegalSize"); } - F32 lerp_weight = 0.5f; // hysteresis. 1.0 = immediately slam to new value, 0.0 = ignore new value - if (gSavedSettings.getControl("AnimatedObjectsPosLerp")) - { - lerp_weight = gSavedSettings.getF32("AnimatedObjectsPosLerp"); - } new_pos_fixup = LLVector3(); new_scale_fixup = 1.0f; - LLVector3 vol_pos = mRootVolp->getRenderPosition(); + LLVector3 vol_pos = mRootVolp->getRenderPosition(); // Fix up position if needed to prevent visual encroachment if (box_valid_and_non_zero(getLastAnimExtents())) // wait for state to settle down @@ -111,22 +106,26 @@ void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_ unshift_extents[0] = extents[0] - mPositionConstraintFixup; unshift_extents[1] = extents[1] - mPositionConstraintFixup; 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, unshift_extents); - F32 offset_dist = pos_box_offset.length(); - if (offset_dist > max_legal_offset) - { - F32 target_dist = (offset_dist - max_legal_offset); - new_pos_fixup = (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; - } - new_pos_fixup = lerp_weight * new_pos_fixup + (1.0f - lerp_weight)*mPositionConstraintFixup; - if (max_size/mScaleConstraintFixup > max_legal_size) + F32 box_size = llmax(box_dims[0],box_dims[1],box_dims[2]); + + if (!mRootVolp->isAttachment()) + { + LLVector3 pos_box_offset = point_to_box_offset(vol_pos, unshift_extents); + F32 offset_dist = pos_box_offset.length(); + if (offset_dist > max_legal_offset || mPositionConstraintFixup != LLVector3()) + { + F32 target_dist = (offset_dist - max_legal_offset); + new_pos_fixup = (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; + } + } + if (box_size/mScaleConstraintFixup > max_legal_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; + new_scale_fixup = mScaleConstraintFixup*max_legal_size/box_size; + LL_DEBUGS("ConstraintFix") << getFullname() << " scale fix, box_size " << box_size << " fixup " + << mScaleConstraintFixup << " max legal " << max_legal_size + << " -> new scale " << new_scale_fixup << LL_ENDL; } } } @@ -135,6 +134,12 @@ void LLControlAvatar::matchVolumeTransform() { if (mRootVolp) { + LLVector3 new_pos_fixup; + F32 new_scale_fixup; + getNewConstraintFixups(new_pos_fixup, new_scale_fixup); + mPositionConstraintFixup = new_pos_fixup; + mScaleConstraintFixup = new_scale_fixup; + if (mRootVolp->isAttachment()) { LLVOAvatar *attached_av = mRootVolp->getAvatarAncestor(); @@ -151,6 +156,9 @@ void LLControlAvatar::matchVolumeTransform() mRoot->setWorldPosition(obj_pos + joint_pos); mRoot->setWorldRotation(obj_rot * joint_rot); setRotation(mRoot->getRotation()); + + F32 global_scale = gSavedSettings.getF32("AnimatedObjectsGlobalScale"); + setGlobalScale(global_scale * mScaleConstraintFixup); } else { @@ -161,13 +169,6 @@ void LLControlAvatar::matchVolumeTransform() { LLVector3 vol_pos = mRootVolp->getRenderPosition(); - LLVector3 new_pos_fixup; - F32 new_scale_fixup; - getNewConstraintFixups(new_pos_fixup, new_scale_fixup); - - mPositionConstraintFixup = new_pos_fixup; - mScaleConstraintFixup = new_scale_fixup; - // FIXME: Currently if you're doing something like playing an // animation that moves the pelvis (on an avatar or // animated object), the name tag and debug text will be -- cgit v1.3