Merge branch 'DRTVWR-591-maint-X' of https://github.com/secondlife/viewer

# Conflicts:
#	indra/llappearance/llavatarappearance.cpp
#	indra/llappearance/llwearable.cpp
#	indra/newview/llinventorymodel.cpp
master
Ansariel 2023-12-12 14:53:58 +01:00
commit e6f3c39327
6 changed files with 61 additions and 80 deletions

View File

@ -510,67 +510,21 @@ void LLAvatarAppearance::computeBodySize()
mCurrBodySizeState["mAnkleLeft scale"] = mAnkleLeftp->getScale();
mCurrBodySizeState["mFootLeft pos"] = mFootLeftp->getPosition();
LLVector3 pelvis_scale = mPelvisp->getScale();
// some of the joints have not been cached
LLVector3 skull = mSkullp->getPosition();
//LLVector3 skull_scale = mSkullp->getScale();
LLVector3 neck = mNeckp->getPosition();
LLVector3 neck_scale = mNeckp->getScale();
LLVector3 chest = mChestp->getPosition();
LLVector3 chest_scale = mChestp->getScale();
// the rest of the joints have been cached
LLVector3 head = mHeadp->getPosition();
LLVector3 head_scale = mHeadp->getScale();
LLVector3 torso = mTorsop->getPosition();
LLVector3 torso_scale = mTorsop->getScale();
LLVector3 hip = mHipLeftp->getPosition();
LLVector3 hip_scale = mHipLeftp->getScale();
LLVector3 knee = mKneeLeftp->getPosition();
LLVector3 knee_scale = mKneeLeftp->getScale();
LLVector3 ankle = mAnkleLeftp->getPosition();
LLVector3 ankle_scale = mAnkleLeftp->getScale();
LLVector3 foot = mFootLeftp->getPosition();
F32 old_height = mBodySize.mV[VZ];
F32 old_offset = mAvatarOffset.mV[VZ];
// TODO: Measure the real depth and width
mPelvisToFoot = computePelvisToFoot();
F32 new_height = computeBodyHeight();
mBodySize.set(DEFAULT_AGENT_DEPTH, DEFAULT_AGENT_WIDTH, new_height);
// [RLVa:KB] - Checked: 2013-03-03 (RLVa-1.4.8)
mAvatarOffset.mV[VZ] = getAvatarOffset();
F32 new_offset = getAvatarOffset();
// [/RLVa:KB]
// mAvatarOffset.mV[VZ] = getVisualParamWeight(AVATAR_HOVER);
// F32 new_offset = getVisualParamWeight(AVATAR_HOVER);
mAvatarOffset.set(0, 0, new_offset);
mPelvisToFoot = hip.mV[VZ] * pelvis_scale.mV[VZ] -
knee.mV[VZ] * hip_scale.mV[VZ] -
ankle.mV[VZ] * knee_scale.mV[VZ] -
foot.mV[VZ] * ankle_scale.mV[VZ];
LLVector3 new_body_size;
new_body_size.mV[VZ] = mPelvisToFoot +
// the sqrt(2) correction below is an approximate
// correction to get to the top of the head
F_SQRT2 * (skull.mV[VZ] * head_scale.mV[VZ]) +
head.mV[VZ] * neck_scale.mV[VZ] +
neck.mV[VZ] * chest_scale.mV[VZ] +
chest.mV[VZ] * torso_scale.mV[VZ] +
torso.mV[VZ] * pelvis_scale.mV[VZ];
// TODO -- measure the real depth and width
new_body_size.mV[VX] = DEFAULT_AGENT_DEPTH;
new_body_size.mV[VY] = DEFAULT_AGENT_WIDTH;
mAvatarOffset.mV[VX] = 0.0f;
mAvatarOffset.mV[VY] = 0.0f;
if (new_body_size != mBodySize || old_offset != mAvatarOffset.mV[VZ])
if (mBodySize.mV[VZ] != old_height || new_offset != old_offset)
{
mBodySize = new_body_size;
// <FS:Ansariel> [Legacy Bake]
bodySizeChanged();
@ -578,6 +532,29 @@ void LLAvatarAppearance::computeBodySize()
}
}
F32 LLAvatarAppearance::computeBodyHeight()
{
F32 result = mPelvisToFoot +
// all these relative positions usually are positive
mPelvisp->getScale().mV[VZ] * mTorsop->getPosition().mV[VZ] +
mTorsop->getScale().mV[VZ] * mChestp->getPosition().mV[VZ] +
mChestp->getScale().mV[VZ] * mNeckp->getPosition().mV[VZ] +
mNeckp->getScale().mV[VZ] * mHeadp->getPosition().mV[VZ] +
mHeadp->getScale().mV[VZ] * mSkullp->getPosition().mV[VZ] * 2;
return result;
}
F32 LLAvatarAppearance::computePelvisToFoot()
{
F32 result =
// all these relative positions usually are negative
mPelvisp->getScale().mV[VZ] * mHipLeftp->getPosition().mV[VZ] +
mHipLeftp->getScale().mV[VZ] * mKneeLeftp->getPosition().mV[VZ] +
mKneeLeftp->getScale().mV[VZ] * mAnkleLeftp->getPosition().mV[VZ] +
mAnkleLeftp->getScale().mV[VZ] * mFootLeftp->getPosition().mV[VZ] / 2;
return -result;
}
// [RLVa:KB] - Checked: 2013-03-03 (RLVa-1.4.8)
F32 LLAvatarAppearance::getAvatarOffset() /*const*/
{

View File

@ -152,7 +152,9 @@ public:
joint_state_map_t mCurrBodySizeState;
void compareJointStateMaps(joint_state_map_t& last_state,
joint_state_map_t& curr_state);
void computeBodySize();
void computeBodySize();
F32 computeBodyHeight();
F32 computePelvisToFoot();
public:
typedef std::vector<LLAvatarJoint*> avatar_joint_list_t;

View File

@ -554,8 +554,8 @@ void LLWearable::revertValues()
{
F32 value = vp_pair.second;
// <FS:Ansariel> [Legacy Bake]
//setVisualParamWeight(id, value);
setVisualParamWeight(id, value, TRUE);
//param->setWeight(value);
param->setWeight(value, TRUE);
mSavedVisualParamMap[id] = param->getWeight();
}
}

View File

@ -1900,12 +1900,10 @@ void LLInventoryModel::changeItemParent(LLViewerInventoryItem* item,
}
// </FS>
LLInventoryModel::update_list_t update;
LLInventoryModel::LLCategoryUpdate old_folder(item->getParentUUID(),-1);
update.push_back(old_folder);
LLInventoryModel::LLCategoryUpdate new_folder(new_parent_id, 1);
update.push_back(new_folder);
accountForUpdate(update);
LLInventoryModel::LLCategoryUpdate old_folder(item->getParentUUID(), -1);
accountForUpdate(old_folder);
LLInventoryModel::LLCategoryUpdate new_folder(new_parent_id, 1, false);
accountForUpdate(new_folder);
LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
new_item->setParent(new_parent_id);
@ -1948,12 +1946,10 @@ void LLInventoryModel::changeCategoryParent(LLViewerInventoryCategory* cat,
<< " from " << make_inventory_info(cat->getParentUUID())
<< " to " << make_inventory_info(new_parent_id) << LL_ENDL;
LLInventoryModel::update_list_t update;
LLInventoryModel::LLCategoryUpdate old_folder(cat->getParentUUID(), -1);
update.push_back(old_folder);
LLInventoryModel::LLCategoryUpdate new_folder(new_parent_id, 1);
update.push_back(new_folder);
accountForUpdate(update);
accountForUpdate(old_folder);
LLInventoryModel::LLCategoryUpdate new_folder(new_parent_id, 1, false);
accountForUpdate(new_folder);
LLPointer<LLViewerInventoryCategory> new_cat = new LLViewerInventoryCategory(cat);
new_cat->setParent(new_parent_id);
@ -2726,7 +2722,10 @@ void LLInventoryModel::accountForUpdate(const LLCategoryUpdate& update) const
{
descendents_actual += update.mDescendentDelta;
cat->setDescendentCount(descendents_actual);
cat->setVersion(++version);
if (update.mChangeVersion)
{
cat->setVersion(++version);
}
LL_DEBUGS(LOG_INV) << "accounted: '" << cat->getName() << "' "
<< version << " with " << descendents_actual
<< " descendents." << LL_ENDL;
@ -2754,7 +2753,7 @@ void LLInventoryModel::accountForUpdate(const LLCategoryUpdate& update) const
}
void LLInventoryModel::accountForUpdate(
const LLInventoryModel::update_list_t& update)
const LLInventoryModel::update_list_t& update) const
{
update_list_t::const_iterator it = update.begin();
update_list_t::const_iterator end = update.end();
@ -2765,7 +2764,7 @@ void LLInventoryModel::accountForUpdate(
}
void LLInventoryModel::accountForUpdate(
const LLInventoryModel::update_map_t& update)
const LLInventoryModel::update_map_t& update) const
{
LLCategoryUpdate up;
update_map_t::const_iterator it = update.begin();

View File

@ -562,12 +562,14 @@ public:
// Represents the number of items added or removed from a category.
struct LLCategoryUpdate
{
LLCategoryUpdate() : mDescendentDelta(0) {}
LLCategoryUpdate(const LLUUID& category_id, S32 delta) :
LLCategoryUpdate() : mDescendentDelta(0), mChangeVersion(true) {}
LLCategoryUpdate(const LLUUID& category_id, S32 delta, bool change_version = true) :
mCategoryID(category_id),
mDescendentDelta(delta) {}
mDescendentDelta(delta),
mChangeVersion(change_version) {}
LLUUID mCategoryID;
S32 mDescendentDelta;
bool mChangeVersion;
};
typedef std::vector<LLCategoryUpdate> update_list_t;
@ -585,8 +587,8 @@ public:
// Call when there are category updates. Call them *before* the
// actual update so the method can do descendent accounting correctly.
void accountForUpdate(const LLCategoryUpdate& update) const;
void accountForUpdate(const update_list_t& updates);
void accountForUpdate(const update_map_t& updates);
void accountForUpdate(const update_list_t& updates) const;
void accountForUpdate(const update_map_t& updates) const;
// Return (yes/no/maybe) child status of category children.
EHasChildren categoryHasChildren(const LLUUID& cat_id) const;

View File

@ -1468,9 +1468,10 @@ void LLPanelEditWearable::updateTypeSpecificControls(LLWearableType::EType type)
if (type == LLWearableType::WT_SHAPE)
{
// Update avatar height
// The .195 is a fudge factor derived by measuring against
// prims inworld, and carried forward from Phoenix. -- TS
F32 new_size = gAgentAvatarp->mBodySize.mV[VZ] + .195f;
// The .08 is a fudge factor derived by measuring against
// prims inworld, carried forward from Phoenix and adjusted
// after LL's calculation change for shape sizes. -- TS
F32 new_size = gAgentAvatarp->mBodySize.mV[VZ] + .08f;
if (gSavedSettings.getBOOL("HeightUnits") == FALSE)
{