Merge axon

master
Ansariel 2018-09-25 17:45:20 +02:00
commit d5fdcd67ab
11 changed files with 181 additions and 58 deletions

View File

@ -510,7 +510,7 @@ namespace LLError
mPrintLocation(false),
mDefaultLevel(LLError::LEVEL_DEBUG),
mLogAlwaysFlush(true),
mEnabledLogTypesMask(0xFFFFFFFF),
mEnabledLogTypesMask(255),
mFunctionLevelMap(),
mClassLevelMap(),
mFileLevelMap(),

View File

@ -85,7 +85,7 @@ add_custom_command(
COMMAND ${CMAKE_COMMAND}
ARGS
-E
copy_directory
copy_if_different
${CMAKE_CURRENT_SOURCE_DIR}/CrashReporter.nib
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/mac-crash-logger.app/Contents/Resources/CrashReporter.nib
)

View File

@ -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.
-->
<key>enabled-log-types-mask</key> <integer>0xFFFFFFFF</integer>
<key>enabled-log-types-mask</key> <integer>255</integer>
<key>settings</key>
<array>
<!-- Suppress anything but ERROR for some very verbose components -->

View File

@ -3825,6 +3825,39 @@
<key>Value</key>
<integer>0</integer>
</map>
<key>AnimatedObjectsGlobalScale</key>
<map>
<key>Comment</key>
<string>Temporary testing: allow an extra scale factor to be forced on animated objects.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>F32</string>
<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>

View File

@ -1037,6 +1037,16 @@ void LLAgent::setRegion(LLViewerRegion *regionp)
{
gSky.mVOGroundp->setRegion(regionp);
}
if (regionp->capabilitiesReceived())
{
regionp->requestSimulatorFeatures();
}
else
{
regionp->setCapabilitiesReceivedCallback(boost::bind(&LLViewerRegion::requestSimulatorFeatures, regionp));
}
}
else
{

View File

@ -35,12 +35,16 @@
#include "llviewerregion.h"
#include "llskinningutil.h"
const F32 LLControlAvatar::MAX_LEGAL_OFFSET = 3.0f;
const F32 LLControlAvatar::MAX_LEGAL_SIZE = 64.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,64 @@ void LLControlAvatar::initInstance()
mInitFlags |= 1<<4;
}
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();
// 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.
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, 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 = 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)
{
new_pos_fixup = mPositionConstraintFixup * 0.9;
LL_DEBUGS("ConstraintFix") << getFullname() << " pos fixup reduced "
<< new_pos_fixup << " was " << mPositionConstraintFixup << LL_ENDL;
}
else
{
new_pos_fixup = mPositionConstraintFixup;
}
if (max_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;
}
}
}
void LLControlAvatar::matchVolumeTransform()
{
if (mRootVolp)
@ -96,37 +158,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 +193,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 +415,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

View File

@ -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<LLUUID, S32> signaled_animation_map_t;

View File

@ -913,12 +913,14 @@ void LLDrawable::updateDistance(LLCamera& camera, bool force_update)
LLVector3 cam_region_pos = LLVector3(cam_pos - volume->getRegion()->getOriginGlobal());
LLVector3 cam_to_box_offset = point_to_box_offset(cam_region_pos, av_box);
//LL_DEBUGS("DynamicBox") << volume->getAvatar()->getFullname()
// << " pos (ignored) " << pos
// << " cam pos " << cam_pos
// << " cam region pos " << cam_region_pos
// << " box " << av_box[0] << "," << av_box[1] << LL_ENDL;
mDistanceWRTCamera = ll_round(cam_to_box_offset.magVec(), 0.01f);
mDistanceWRTCamera = llmax(0.01f, ll_round(cam_to_box_offset.magVec(), 0.01f));
LL_DEBUGS("DynamicBox") << volume->getAvatar()->getFullname()
<< " pos (ignored) " << pos
<< " cam pos " << cam_pos
<< " cam region pos " << cam_region_pos
<< " box " << av_box[0] << "," << av_box[1]
<< " -> dist " << mDistanceWRTCamera
<< LL_ENDL;
mVObjp->updateLOD();
return;
}

View File

@ -2307,6 +2307,8 @@ void LLViewerRegion::getInfo(LLSD& info)
void LLViewerRegion::requestSimulatorFeatures()
{
LL_DEBUGS("SimulatorFeatures") << "region " << getName() << " ptr " << this
<< " trying to request SimulatorFeatures" << LL_ENDL;
// kick off a request for simulator features
std::string url = getCapability("SimulatorFeatures");
if (!url.empty())
@ -2353,7 +2355,7 @@ void LLViewerRegion::setSimulatorFeatures(const LLSD& sim_features)
std::stringstream str;
LLSDSerialize::toPrettyXML(sim_features, str);
LL_INFOS() << "Region ID " << getRegionID().asString() << ": " << str.str() << LL_ENDL;
LL_INFOS() << "region " << getName() << " " << str.str() << LL_ENDL;
mSimulatorFeatures = sim_features;
setSimulatorFeaturesReceived(true);

View File

@ -1493,24 +1493,22 @@ BOOL LLVOVolume::calcLOD()
const LLVector3* box = avatar->getLastAnimExtents();
LLVector3 diag = box[1] - box[0];
radius = diag.magVec() * 0.5f;
//LL_DEBUGS("DynamicBox") << avatar->getFullname() << " diag " << diag << " radius " << radius << LL_ENDL;
LL_DEBUGS("DynamicBox") << avatar->getFullname() << " diag " << diag << " radius " << radius << LL_ENDL;
}
else
{
// Volume in a rigged mesh attached to a regular avatar.
#if 0
// Note this isn't really a radius, so distance calcs are off by factor of 2
radius = avatar->getBinRadius();
#else
//radius = avatar->getBinRadius();
// SL-937: add dynamic box handling for rigged mesh on regular avatars.
const LLVector3* box = avatar->getLastAnimExtents();
LLVector3 diag = box[1] - box[0];
radius = diag.magVec(); // preserve old BinRadius behavior - 2x off
#endif
LL_DEBUGS("DynamicBox") << avatar->getFullname() << " diag " << diag << " radius " << radius << LL_ENDL;
}
if (distance <= 0.f || radius <= 0.f)
{
LL_DEBUGS("CalcLOD") << "avatar distance/radius uninitialized, skipping" << LL_ENDL;
LL_DEBUGS("DynamicBox","CalcLOD") << "avatar distance/radius uninitialized, skipping" << LL_ENDL;
return FALSE;
}
}
@ -1520,7 +1518,7 @@ BOOL LLVOVolume::calcLOD()
radius = getVolume() ? getVolume()->mLODScaleBias.scaledVec(getScale()).length() : getScale().length();
if (distance <= 0.f || radius <= 0.f)
{
LL_DEBUGS("CalcLOD") << "non-avatar distance/radius uninitialized, skipping" << LL_ENDL;
LL_DEBUGS("DynamicBox","CalcLOD") << "non-avatar distance/radius uninitialized, skipping" << LL_ENDL;
return FALSE;
}
}
@ -1563,7 +1561,15 @@ BOOL LLVOVolume::calcLOD()
mLODAdjustedDistance = distance;
cur_detail = computeLODDetail(ll_round(distance, 0.01f), ll_round(radius, 0.01f), lod_factor);
if (isHUDAttachment())
{
// HUDs always show at highest detail
cur_detail = 3;
}
else
{
cur_detail = computeLODDetail(ll_round(distance, 0.01f), ll_round(radius, 0.01f), lod_factor);
}
if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TRIANGLE_COUNT) && mDrawable->getFace(0))
{
@ -1590,7 +1596,7 @@ BOOL LLVOVolume::calcLOD()
if (cur_detail != mLOD)
{
LL_DEBUGS("CalcLOD") << "new LOD " << cur_detail << " change from " << mLOD
LL_DEBUGS("DynamicBox","CalcLOD") << "new LOD " << cur_detail << " change from " << mLOD
<< " distance " << distance << " radius " << radius << " rampDist " << rampDist
<< " drawable rigged? " << (mDrawable ? (S32) mDrawable->isState(LLDrawable::RIGGED) : (S32) -1)
<< " mRiggedVolume " << (void*)getRiggedVolume()

View File

@ -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: