From 641ec3da61221ffd13cb7d1777c28505a54e2d58 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 10 Jun 2010 14:50:48 -0700 Subject: EXT-7701 language change --- indra/newview/skins/default/xui/en/widgets/flat_list_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/skins/default/xui/en/widgets/flat_list_view.xml b/indra/newview/skins/default/xui/en/widgets/flat_list_view.xml index a71b293f31..e05ddf9815 100644 --- a/indra/newview/skins/default/xui/en/widgets/flat_list_view.xml +++ b/indra/newview/skins/default/xui/en/widgets/flat_list_view.xml @@ -11,6 +11,6 @@ name="no_items_msg" v_pad="10" h_pad="10" - value="There are no any items in the list" + value="No matches found" wrap="true" /> \ No newline at end of file -- cgit v1.2.3 From 9669923a7c370d43136cfc04b34247689aad1d3a Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 10 Jun 2010 14:59:24 -0700 Subject: EXT-7239 - Double-click on outfit title should wear outfit, Double-click on item should wear item decision was to remove double click behavior --- indra/newview/lloutfitslist.cpp | 15 --------------- indra/newview/lloutfitslist.h | 1 - indra/newview/llwearableitemslist.h | 7 ------- 3 files changed, 23 deletions(-) (limited to 'indra') diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index e20b2e26be..caa29db9d3 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -266,9 +266,6 @@ void LLOutfitsList::refreshList(const LLUUID& category_id) tab->setRightMouseDownCallback(boost::bind(&LLOutfitsList::onAccordionTabRightClick, this, _1, _2, _3, cat_id)); - tab->setDoubleClickCallback(boost::bind(&LLOutfitsList::onAccordionTabDoubleClick, this, - _1, _2, _3, cat_id)); - // Setting tab focus callback to monitor currently selected outfit. tab->setFocusReceivedCallback(boost::bind(&LLOutfitsList::changeOutfitSelection, this, list, cat_id)); @@ -610,18 +607,6 @@ void LLOutfitsList::onAccordionTabRightClick(LLUICtrl* ctrl, S32 x, S32 y, const } } -void LLOutfitsList::onAccordionTabDoubleClick(LLUICtrl* ctrl, S32 x, S32 y, const LLUUID& cat_id) -{ - LLAccordionCtrlTab* tab = dynamic_cast(ctrl); - if(is_tab_header_clicked(tab, y) && cat_id.notNull()) - { - LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id); - if (!cat) return; - - LLAppearanceMgr::instance().wearInventoryCategory( cat, FALSE, FALSE ); - } -} - void LLOutfitsList::onWearableItemsListRightClick(LLUICtrl* ctrl, S32 x, S32 y) { LLWearableItemsList* list = dynamic_cast(ctrl); diff --git a/indra/newview/lloutfitslist.h b/indra/newview/lloutfitslist.h index bb516446d2..3f4a65a6e6 100644 --- a/indra/newview/lloutfitslist.h +++ b/indra/newview/lloutfitslist.h @@ -121,7 +121,6 @@ private: void applyFilter(const std::string& new_filter_substring); void onAccordionTabRightClick(LLUICtrl* ctrl, S32 x, S32 y, const LLUUID& cat_id); - void onAccordionTabDoubleClick(LLUICtrl* ctrl, S32 x, S32 y, const LLUUID& cat_id); void onWearableItemsListRightClick(LLUICtrl* ctrl, S32 x, S32 y); void onSelectionChange(LLUICtrl* ctrl); diff --git a/indra/newview/llwearableitemslist.h b/indra/newview/llwearableitemslist.h index f03336186c..73a176d061 100644 --- a/indra/newview/llwearableitemslist.h +++ b/indra/newview/llwearableitemslist.h @@ -83,14 +83,7 @@ class LLPanelWearableOutfitItem : public LLPanelInventoryListItemBase public: static LLPanelWearableOutfitItem* create(LLViewerInventoryItem* item); - /** - * Puts item on if it is not worn by agent - * otherwise takes it off on double click. - */ - /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask); - protected: - LLPanelWearableOutfitItem(LLViewerInventoryItem* item); }; -- cgit v1.2.3 From 512cd85e09db1b7103458bd5828c6f21b3e5bf83 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 10 Jun 2010 15:22:37 -0700 Subject: EXT-7239 FIX Double-click on outfit title should wear outfit, Double-click on item should wear item decision was to remove double click behavior --- indra/newview/llwearableitemslist.cpp | 20 -------------------- 1 file changed, 20 deletions(-) (limited to 'indra') diff --git a/indra/newview/llwearableitemslist.cpp b/indra/newview/llwearableitemslist.cpp index d56a331000..58a0ea8ef5 100644 --- a/indra/newview/llwearableitemslist.cpp +++ b/indra/newview/llwearableitemslist.cpp @@ -107,26 +107,6 @@ LLPanelWearableOutfitItem* LLPanelWearableOutfitItem::create(LLViewerInventoryIt return list_item; } -BOOL LLPanelWearableOutfitItem::handleDoubleClick(S32 x, S32 y, MASK mask) -{ - LLViewerInventoryItem* item = getItem(); - if (item) - { - LLUUID id = item->getUUID(); - - if (get_is_item_worn(id)) - { - LLAppearanceMgr::getInstance()->removeItemFromAvatar(id); - } - else - { - LLAppearanceMgr::getInstance()->wearItemOnAvatar(id, true, false); - } - } - - return LLUICtrl::handleDoubleClick(x, y, mask); -} - LLPanelWearableOutfitItem::LLPanelWearableOutfitItem(LLViewerInventoryItem* item) : LLPanelInventoryListItemBase(item) { -- cgit v1.2.3 From 92768103af4e90dd3e0017cf2048c4a8641391b7 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 10 Jun 2010 15:30:32 -0700 Subject: EXT-7781 WIP Editing Shape: Labels on the previews are unreadable --- indra/newview/skins/default/xui/en/panel_scrolling_param.xml | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra') diff --git a/indra/newview/skins/default/xui/en/panel_scrolling_param.xml b/indra/newview/skins/default/xui/en/panel_scrolling_param.xml index 19eb4bb0d6..9aa0ff1ea1 100644 --- a/indra/newview/skins/default/xui/en/panel_scrolling_param.xml +++ b/indra/newview/skins/default/xui/en/panel_scrolling_param.xml @@ -12,6 +12,7 @@ layout="topleft" left="12" name="min param text" + text_color="EmphasisColor" top="120" width="120" /> Date: Thu, 10 Jun 2010 17:07:45 -0700 Subject: EXT-7750 - Wearing list does not need to be bold or show link or worn --- indra/newview/llfolderview.cpp | 1 + indra/newview/llfolderview.h | 3 +++ indra/newview/llfolderviewitem.cpp | 7 +++++-- indra/newview/llinventorypanel.cpp | 5 ++--- indra/newview/llinventorypanel.h | 7 ++++--- indra/newview/skins/default/xui/en/panel_outfits_inventory.xml | 1 + 6 files changed, 16 insertions(+), 8 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp index a87f7288fa..5682e691cd 100644 --- a/indra/newview/llfolderview.cpp +++ b/indra/newview/llfolderview.cpp @@ -181,6 +181,7 @@ LLFolderView::LLFolderView(const Params& p) mRenameItem( NULL ), mNeedsScroll( FALSE ), mEnableScroll( true ), + mUseLabelSuffix(p.use_label_suffix), mPinningSelectedItem(FALSE), mNeedsAutoSelect( FALSE ), mAutoSelectOverride(FALSE), diff --git a/indra/newview/llfolderview.h b/indra/newview/llfolderview.h index 0dfdbd364b..55eb543f5f 100644 --- a/indra/newview/llfolderview.h +++ b/indra/newview/llfolderview.h @@ -96,6 +96,7 @@ public: Mandatory parent_panel; Optional task_id; Optional title; + Optional use_label_suffix; }; LLFolderView(const Params&); virtual ~LLFolderView( void ); @@ -273,6 +274,7 @@ public: virtual S32 notify(const LLSD& info) ; void setEnableScroll(bool enable_scroll) { mEnableScroll = enable_scroll; } + bool useLabelSuffix() { return mUseLabelSuffix; } private: void updateRenamerPosition(); @@ -309,6 +311,7 @@ protected: BOOL mNeedsAutoSelect; BOOL mAutoSelectOverride; BOOL mNeedsAutoRename; + bool mUseLabelSuffix; BOOL mDebugFilters; U32 mSortOrder; diff --git a/indra/newview/llfolderviewitem.cpp b/indra/newview/llfolderviewitem.cpp index 0c437cf035..50b35bfc69 100644 --- a/indra/newview/llfolderviewitem.cpp +++ b/indra/newview/llfolderviewitem.cpp @@ -289,8 +289,11 @@ void LLFolderViewItem::refreshFromListener() mCreationDate = mListener->getCreationDate(); dirtyFilter(); } - mLabelStyle = mListener->getLabelStyle(); - mLabelSuffix = mListener->getLabelSuffix(); + if (mRoot->useLabelSuffix()) + { + mLabelStyle = mListener->getLabelStyle(); + mLabelSuffix = mListener->getLabelSuffix(); + } } } diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 7d81cf18aa..a20bf366c5 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -110,7 +110,7 @@ LLInventoryPanel::LLInventoryPanel(const LLInventoryPanel::Params& p) : } } -BOOL LLInventoryPanel::postBuild() +void LLInventoryPanel::initFromParams(const LLInventoryPanel::Params& params) { LLMemType mt(LLMemType::MTYPE_INVENTORY_POST_BUILD); @@ -128,6 +128,7 @@ BOOL LLInventoryPanel::postBuild() p.rect = folder_rect; p.parent_panel = this; p.tool_tip = p.name; + p.use_label_suffix = params.use_label_suffix; mFolderRoot = LLUICtrlFactory::create(p); mFolderRoot->setAllowMultiSelect(mAllowMultiSelect); } @@ -174,8 +175,6 @@ BOOL LLInventoryPanel::postBuild() setSortOrder(gSavedSettings.getU32(DEFAULT_SORT_ORDER)); } mFolderRoot->setSortOrder(getFilter()->getSortOrder()); - - return TRUE; } LLInventoryPanel::~LLInventoryPanel() diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h index 67c8904868..ad17227d56 100644 --- a/indra/newview/llinventorypanel.h +++ b/indra/newview/llinventorypanel.h @@ -87,6 +87,7 @@ public: Optional show_item_link_overlays; Optional filter; Optional start_folder; + Optional use_label_suffix; Params() : sort_order_setting("sort_order_setting"), @@ -94,7 +95,8 @@ public: allow_multi_select("allow_multi_select", true), show_item_link_overlays("show_item_link_overlays", false), filter("filter"), - start_folder("start_folder") + start_folder("start_folder"), + use_label_suffix("use_label_suffix", true) {} }; @@ -103,6 +105,7 @@ public: //-------------------------------------------------------------------- protected: LLInventoryPanel(const Params&); + void initFromParams(const Params&); friend class LLUICtrlFactory; public: virtual ~LLInventoryPanel(); @@ -110,8 +113,6 @@ public: public: LLInventoryModel* getModel() { return mInventory; } - BOOL postBuild(); - // LLView methods void draw(); BOOL handleHover(S32 x, S32 y, MASK mask); diff --git a/indra/newview/skins/default/xui/en/panel_outfits_inventory.xml b/indra/newview/skins/default/xui/en/panel_outfits_inventory.xml index de1f2cf31b..7a7f910171 100644 --- a/indra/newview/skins/default/xui/en/panel_outfits_inventory.xml +++ b/indra/newview/skins/default/xui/en/panel_outfits_inventory.xml @@ -48,6 +48,7 @@ mouse_opaque="true" name="cof_tab" start_folder="Current Outfit" + use_label_suffix="false" width="315" /> Date: Thu, 10 Jun 2010 17:08:45 -0700 Subject: EXT-7781 FIX Editing Shape: Labels on the previews are unreadable --- indra/newview/skins/default/xui/en/panel_scrolling_param.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/skins/default/xui/en/panel_scrolling_param.xml b/indra/newview/skins/default/xui/en/panel_scrolling_param.xml index 9aa0ff1ea1..78d64620a5 100644 --- a/indra/newview/skins/default/xui/en/panel_scrolling_param.xml +++ b/indra/newview/skins/default/xui/en/panel_scrolling_param.xml @@ -12,7 +12,8 @@ layout="topleft" left="12" name="min param text" - text_color="EmphasisColor" + text_color="EmphasisColor" + font_shadow="hard" top="120" width="120" /> Date: Tue, 15 Jun 2010 15:56:46 -0400 Subject: EXT-7829 FIXED Corrupted graphics in inventory side panel (gray box) Took out ensemble folder icon use, replaced with default icons. --- indra/newview/llviewerfoldertype.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'indra') diff --git a/indra/newview/llviewerfoldertype.cpp b/indra/newview/llviewerfoldertype.cpp index 56b5d7467c..3105a6ec43 100644 --- a/indra/newview/llviewerfoldertype.cpp +++ b/indra/newview/llviewerfoldertype.cpp @@ -110,8 +110,6 @@ protected: LLViewerFolderDictionary::LLViewerFolderDictionary() { - initEnsemblesFromFile(); - // NEW CATEGORY NAME FOLDER OPEN FOLDER CLOSED QUIET? // |-------------------------|-----------------------|----------------------|-----------| addEntry(LLFolderType::FT_TEXTURE, new ViewerFolderEntry("Textures", "Inv_SysOpen", "Inv_SysClosed", FALSE)); @@ -137,6 +135,15 @@ LLViewerFolderDictionary::LLViewerFolderDictionary() addEntry(LLFolderType::FT_INBOX, new ViewerFolderEntry("Inbox", "Inv_SysOpen", "Inv_SysClosed", FALSE)); addEntry(LLFolderType::FT_NONE, new ViewerFolderEntry("New Folder", "Inv_FolderOpen", "Inv_FolderClosed", FALSE, "default")); + +#if SUPPORT_ENSEMBLES + initEnsemblesFromFile(); +#else + for (U32 type = (U32)LLFolderType::FT_ENSEMBLE_START; type <= (U32)LLFolderType::FT_ENSEMBLE_END; ++type) + { + addEntry((LLFolderType::EType)type, new ViewerFolderEntry("New Folder", "Inv_FolderOpen", "Inv_FolderClosed", FALSE)); + } +#endif } bool LLViewerFolderDictionary::initEnsemblesFromFile() @@ -231,6 +238,15 @@ const std::string &LLViewerFolderType::lookupIconName(LLFolderType::EType folder else return entry->mIconNameClosed; } + + // Error condition. Return something so that we don't show a grey box in inventory view. + const ViewerFolderEntry *default_entry = LLViewerFolderDictionary::getInstance()->lookup(LLFolderType::FT_NONE); + if (default_entry) + { + return default_entry->mIconNameClosed; + } + + // Should not get here unless there's something corrupted with the FT_NONE entry. return badLookup(); } -- cgit v1.2.3 From f12aa928c557230664666ced9b55ef643bbfb7c2 Mon Sep 17 00:00:00 2001 From: Loren Shih Date: Tue, 15 Jun 2010 15:56:54 -0400 Subject: EXT-7758 FIXED Take out "Change FolderType" for viewer2.1. Change folder type is now keyed off of SUPPORT_ENSEMBLES versus being available in non-release viewers. --- indra/newview/llinventorybridge.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 7ce96a6ac1..413f329ce9 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -2581,9 +2581,9 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags) mItems.push_back(std::string("New Clothes")); mItems.push_back(std::string("New Body Parts")); - // Changing folder types is just a debug feature; this is fairly unsupported +#if SUPPORT_ENSEMBLES + // Changing folder types is an unfinished unsupported feature // and can lead to unexpected behavior if enabled. -#if !LL_RELEASE_FOR_DOWNLOAD mItems.push_back(std::string("Change Type")); const LLViewerInventoryCategory *cat = getCategory(); if (cat && LLFolderType::lookupIsProtectedType(cat->getPreferredType())) -- cgit v1.2.3 From 8b95793c35c2fe1bf8ddf100fb4481b674ddfc63 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 15 Jun 2010 13:53:40 -0700 Subject: EXT-6953 WIP fixed walk cycle foot slip feedback to not speed up animation so much also, made camera default target and offset live-settable for debugging reviewed by vir --- indra/llcharacter/llkeyframewalkmotion.cpp | 268 ++++++++++++----------------- indra/llcharacter/llkeyframewalkmotion.h | 8 +- indra/newview/llagentcamera.cpp | 16 +- indra/newview/llagentcamera.h | 5 +- 4 files changed, 121 insertions(+), 176 deletions(-) (limited to 'indra') diff --git a/indra/llcharacter/llkeyframewalkmotion.cpp b/indra/llcharacter/llkeyframewalkmotion.cpp index f814618fc1..0587e5642c 100644 --- a/indra/llcharacter/llkeyframewalkmotion.cpp +++ b/indra/llcharacter/llkeyframewalkmotion.cpp @@ -44,32 +44,31 @@ //----------------------------------------------------------------------------- // Macros //----------------------------------------------------------------------------- -const F32 MAX_WALK_PLAYBACK_SPEED = 8.f; // max m/s for which we adjust walk cycle speed - -const F32 MIN_WALK_SPEED = 0.1f; // minimum speed at which we use velocity for down foot detection -const F32 MAX_TIME_DELTA = 2.f; //max two seconds a frame for calculating interpolation -F32 SPEED_ADJUST_MAX = 2.5f; // maximum adjustment of walk animation playback speed -F32 SPEED_ADJUST_MAX_SEC = 3.f; // maximum adjustment to walk animation playback speed for a second -F32 ANIM_SPEED_MAX = 10.0f; // absolute upper limit on animation speed -F32 ANIM_SPEED_MIN = 0.0f; // absolute lower limit on animation speed -const F32 DRIFT_COMP_MAX_TOTAL = 0.07f;//0.55f; // maximum drift compensation overall, in any direction -const F32 DRIFT_COMP_MAX_SPEED = 4.f; // speed at which drift compensation total maxes out +const F32 MAX_WALK_PLAYBACK_SPEED = 8.f; // max m/s for which we adjust walk cycle speed + +const F32 MIN_WALK_SPEED = 0.1f; // minimum speed at which we use velocity for down foot detection +const F32 TIME_EPSILON = 0.001f; // minumum frame time +const F32 MAX_TIME_DELTA = 2.f; // max two seconds a frame for calculating interpolation +F32 SPEED_ADJUST_MAX_SEC = 2.f; // maximum adjustment to walk animation playback speed for a second +F32 ANIM_SPEED_MAX = 1.5f; // absolute upper limit on animation speed +const F32 DRIFT_COMP_MAX_TOTAL = 0.1f; // maximum drift compensation overall, in any direction +const F32 DRIFT_COMP_MAX_SPEED = 4.f; // speed at which drift compensation total maxes out const F32 MAX_ROLL = 0.6f; +const F32 PELVIS_COMPENSATION_WIEGHT = 0.7f; // proportion of foot drift that is compensated by moving the avatar directly +const F32 SPEED_ADJUST_TIME_CONSTANT = 0.1f; // time constant for speed adjustment interpolation //----------------------------------------------------------------------------- // LLKeyframeWalkMotion() // Class Constructor //----------------------------------------------------------------------------- LLKeyframeWalkMotion::LLKeyframeWalkMotion(const LLUUID &id) - : LLKeyframeMotion(id), - +: LLKeyframeMotion(id), mCharacter(NULL), mCyclePhase(0.0f), mRealTimeLast(0.0f), mAdjTimeLast(0.0f), mDownFoot(0) -{ -} +{} //----------------------------------------------------------------------------- @@ -77,8 +76,7 @@ LLKeyframeWalkMotion::LLKeyframeWalkMotion(const LLUUID &id) // Class Destructor //----------------------------------------------------------------------------- LLKeyframeWalkMotion::~LLKeyframeWalkMotion() -{ -} +{} //----------------------------------------------------------------------------- @@ -149,15 +147,12 @@ BOOL LLKeyframeWalkMotion::onUpdate(F32 time, U8* joint_mask) LLWalkAdjustMotion::LLWalkAdjustMotion(const LLUUID &id) : LLMotion(id), mLastTime(0.f), - mAvgCorrection(0.f), - mSpeedAdjust(0.f), mAnimSpeed(0.f), - mAvgSpeed(0.f), + mAdjustedSpeed(0.f), mRelativeDir(0.f), mAnkleOffset(0.f) { mName = "walk_adjust"; - mPelvisState = new LLJointState; } @@ -189,15 +184,16 @@ LLMotion::LLMotionInitStatus LLWalkAdjustMotion::onInitialize(LLCharacter *chara //----------------------------------------------------------------------------- BOOL LLWalkAdjustMotion::onActivate() { - mAvgCorrection = 0.f; - mSpeedAdjust = 0.f; mAnimSpeed = 0.f; - mAvgSpeed = 0.f; + mAdjustedSpeed = 0.f; mRelativeDir = 1.f; mPelvisState->setPosition(LLVector3::zero); // store ankle positions for next frame - mLastLeftAnklePos = mCharacter->getPosGlobalFromAgent(mLeftAnkleJoint->getWorldPosition()); - mLastRightAnklePos = mCharacter->getPosGlobalFromAgent(mRightAnkleJoint->getWorldPosition()); + mLastLeftFootGlobalPos = mCharacter->getPosGlobalFromAgent(mLeftAnkleJoint->getWorldPosition()); + mLastLeftFootGlobalPos.mdV[VZ] = 0.0; + + mLastRightFootGlobalPos = mCharacter->getPosGlobalFromAgent(mRightAnkleJoint->getWorldPosition()); + mLastRightFootGlobalPos.mdV[VZ] = 0.0; F32 leftAnkleOffset = (mLeftAnkleJoint->getWorldPosition() - mCharacter->getCharacterPosition()).magVec(); F32 rightAnkleOffset = (mRightAnkleJoint->getWorldPosition() - mCharacter->getCharacterPosition()).magVec(); @@ -211,164 +207,120 @@ BOOL LLWalkAdjustMotion::onActivate() //----------------------------------------------------------------------------- BOOL LLWalkAdjustMotion::onUpdate(F32 time, U8* joint_mask) { - LLVector3 footCorrection; - LLVector3 vel = mCharacter->getCharacterVelocity() * mCharacter->getTimeDilation(); - F32 deltaTime = llclamp(time - mLastTime, 0.f, MAX_TIME_DELTA); + // delta_time is guaranteed to be non zero + F32 delta_time = llclamp(time - mLastTime, TIME_EPSILON, MAX_TIME_DELTA); mLastTime = time; - LLQuaternion inv_rotation = ~mPelvisJoint->getWorldRotation(); + // find the avatar motion vector in the XY plane + LLVector3 avatar_velocity = mCharacter->getCharacterVelocity() * mCharacter->getTimeDilation(); + avatar_velocity.mV[VZ] = 0.f; - // get speed and normalize velocity vector - LLVector3 ang_vel = mCharacter->getCharacterAngularVelocity() * mCharacter->getTimeDilation(); - F32 speed = llmin(vel.normVec(), MAX_WALK_PLAYBACK_SPEED); - mAvgSpeed = lerp(mAvgSpeed, speed, LLCriticalDamp::getInterpolant(0.2f)); + F32 speed = llclamp(avatar_velocity.magVec(), 0.f, MAX_WALK_PLAYBACK_SPEED); - // calculate facing vector in pelvis-local space - // (either straight forward or back, depending on velocity) - LLVector3 localVel = vel * inv_rotation; - if (localVel.mV[VX] > 0.f) - { - mRelativeDir = 1.f; - } - else if (localVel.mV[VX] < 0.f) - { - mRelativeDir = -1.f; - } + // grab avatar->world transforms + LLQuaternion avatar_to_world_rot = mCharacter->getRootJoint()->getWorldRotation(); - // calculate world-space foot drift - LLVector3 leftFootDelta; - LLVector3 leftFootWorldPosition = mLeftAnkleJoint->getWorldPosition(); - LLVector3d leftFootGlobalPosition = mCharacter->getPosGlobalFromAgent(leftFootWorldPosition); - leftFootDelta.setVec(mLastLeftAnklePos - leftFootGlobalPosition); - mLastLeftAnklePos = leftFootGlobalPosition; + LLQuaternion world_to_avatar_rot(avatar_to_world_rot); + world_to_avatar_rot.conjugate(); - LLVector3 rightFootDelta; - LLVector3 rightFootWorldPosition = mRightAnkleJoint->getWorldPosition(); - LLVector3d rightFootGlobalPosition = mCharacter->getPosGlobalFromAgent(rightFootWorldPosition); - rightFootDelta.setVec(mLastRightAnklePos - rightFootGlobalPosition); - mLastRightAnklePos = rightFootGlobalPosition; + LLVector3 foot_slip_vector; // find foot drift along velocity vector - if (mAvgSpeed > 0.1) - { - // walking/running - F32 leftFootDriftAmt = leftFootDelta * vel; - F32 rightFootDriftAmt = rightFootDelta * vel; - - if (rightFootDriftAmt > leftFootDriftAmt) - { - footCorrection = rightFootDelta; - } else - { - footCorrection = leftFootDelta; - } - } - else - { - mAvgSpeed = ang_vel.magVec() * mAnkleOffset; - mRelativeDir = 1.f; - - // standing/turning - // find the lower foot - if (leftFootWorldPosition.mV[VZ] < rightFootWorldPosition.mV[VZ]) - { - // pivot on left foot - footCorrection = leftFootDelta; - } + if (speed > MIN_WALK_SPEED) + { // walking/running + + // calculate world-space foot drift + // use global coordinates to seamlessly handle region crossings + LLVector3d leftFootGlobalPosition = mCharacter->getPosGlobalFromAgent(mLeftAnkleJoint->getWorldPosition()); + leftFootGlobalPosition.mdV[VZ] = 0.0; + LLVector3 leftFootDelta(leftFootGlobalPosition - mLastLeftFootGlobalPos); + mLastLeftFootGlobalPos = leftFootGlobalPosition; + + LLVector3d rightFootGlobalPosition = mCharacter->getPosGlobalFromAgent(mRightAnkleJoint->getWorldPosition()); + rightFootGlobalPosition.mdV[VZ] = 0.0; + LLVector3 rightFootDelta(rightFootGlobalPosition - mLastRightFootGlobalPos); + mLastRightFootGlobalPos = rightFootGlobalPosition; + + // get foot drift along avatar direction of motion + F32 left_foot_slip_amt = leftFootDelta * avatar_velocity; + F32 right_foot_slip_amt = rightFootDelta * avatar_velocity; + + // if right foot is pushing back faster than left foot... + if (right_foot_slip_amt < left_foot_slip_amt) + { //...use it to calculate optimal animation speed + foot_slip_vector = rightFootDelta; + } else - { - // pivot on right foot - footCorrection = rightFootDelta; + { // otherwise use the left foot + foot_slip_vector = leftFootDelta; } - } - // rotate into avatar coordinates - footCorrection = footCorrection * inv_rotation; + // calculate ideal pelvis offset so that foot is glued to ground and damp towards it + // this will soak up transient slippage + // + // FIXME: this interacts poorly with speed adjustment + // mPelvisOffset compensates for foot drift by moving the avatar pelvis in the opposite + // direction of the drift, up to a certain limited distance + // but this will cause the animation playback rate calculation below to + // kick in too slowly and sometimes start playing the animation in reverse. - // calculate ideal pelvis offset so that foot is glued to ground and damp towards it - // the amount of foot slippage this frame + the offset applied last frame - mPelvisOffset = mPelvisState->getPosition() + lerp(LLVector3::zero, footCorrection, LLCriticalDamp::getInterpolant(0.2f)); + //mPelvisOffset -= PELVIS_COMPENSATION_WIEGHT * (foot_slip_vector * world_to_avatar_rot);//lerp(LLVector3::zero, -1.f * (foot_slip_vector * world_to_avatar_rot), LLCriticalDamp::getInterpolant(0.1f)); - // pelvis drift (along walk direction) - mAvgCorrection = lerp(mAvgCorrection, footCorrection.mV[VX] * mRelativeDir, LLCriticalDamp::getInterpolant(0.1f)); + ////F32 drift_comp_max = DRIFT_COMP_MAX_TOTAL * (llclamp(speed, 0.f, DRIFT_COMP_MAX_SPEED) / DRIFT_COMP_MAX_SPEED); + //F32 drift_comp_max = DRIFT_COMP_MAX_TOTAL; - // calculate average velocity of foot slippage - F32 footSlipVelocity = (deltaTime != 0.f) ? (-mAvgCorrection / deltaTime) : 0.f; + //// clamp pelvis offset to a 90 degree arc behind the nominal position + //// NB: this is an ADDITIVE amount that is accumulated every frame, so clamping it alone won't do the trick + //// must clamp with absolute position of pelvis in mind + //LLVector3 currentPelvisPos = mPelvisState->getJoint()->getPosition(); + //mPelvisOffset.mV[VX] = llclamp( mPelvisOffset.mV[VX], -drift_comp_max, drift_comp_max ); + //mPelvisOffset.mV[VY] = llclamp( mPelvisOffset.mV[VY], -drift_comp_max, drift_comp_max ); + //mPelvisOffset.mV[VZ] = 0.f; + // + //mLastRightFootGlobalPos += LLVector3d(mPelvisOffset * avatar_to_world_rot); + //mLastLeftFootGlobalPos += LLVector3d(mPelvisOffset * avatar_to_world_rot); - F32 newSpeedAdjust = 0.f; - - // modulate speed by dot products of facing and velocity - // so that if we are moving sideways, we slow down the animation - // and if we're moving backward, we walk backward + //foot_slip_vector -= mPelvisOffset; - F32 directional_factor = localVel.mV[VX] * mRelativeDir; + LLVector3 avatar_movement_dir = avatar_velocity; + avatar_movement_dir.normalize(); - if (speed > 0.1f) - { - // calculate ratio of desired foot velocity to detected foot velocity - newSpeedAdjust = llclamp(footSlipVelocity - mAvgSpeed * (1.f - directional_factor), - -SPEED_ADJUST_MAX, SPEED_ADJUST_MAX); - newSpeedAdjust = lerp(mSpeedAdjust, newSpeedAdjust, LLCriticalDamp::getInterpolant(0.2f)); + // planted foot speed is avatar velocity - foot slip amount along avatar movement direction + F32 foot_speed = speed - ((foot_slip_vector * avatar_movement_dir) / delta_time); - F32 speedDelta = newSpeedAdjust - mSpeedAdjust; - speedDelta = llclamp(speedDelta, -SPEED_ADJUST_MAX_SEC * deltaTime, SPEED_ADJUST_MAX_SEC * deltaTime); + // multiply animation playback rate so that foot speed matches avatar speed + F32 desired_speed_multiplier = llclamp(speed / foot_speed, 0.f, ANIM_SPEED_MAX); - mSpeedAdjust = mSpeedAdjust + speedDelta; - } - else - { - mSpeedAdjust = lerp(mSpeedAdjust, 0.f, LLCriticalDamp::getInterpolant(0.2f)); - } + // blend towards new speed adjustment value + F32 new_speed_adjust = lerp(mAdjustedSpeed, desired_speed_multiplier, LLCriticalDamp::getInterpolant(SPEED_ADJUST_TIME_CONSTANT)); - mAnimSpeed = (mAvgSpeed + mSpeedAdjust) * mRelativeDir; - if (mAnimSpeed>0) - { - mAnimSpeed = llclamp(mAnimSpeed, ANIM_SPEED_MIN, ANIM_SPEED_MAX); + // limit that rate at which the speed adjustment changes + F32 speedDelta = llclamp(new_speed_adjust - mAdjustedSpeed, -SPEED_ADJUST_MAX_SEC * delta_time, SPEED_ADJUST_MAX_SEC * delta_time); + mAdjustedSpeed += speedDelta; + + // modulate speed by dot products of facing and velocity + // so that if we are moving sideways, we slow down the animation + // and if we're moving backward, we walk backward + // do this at the end to be more responsive to direction changes instead of in the above speed calculations + F32 directional_factor = (avatar_movement_dir * world_to_avatar_rot).mV[VX]; + + mAnimSpeed = mAdjustedSpeed * directional_factor; } else - { - mAnimSpeed = llclamp(mAnimSpeed, -ANIM_SPEED_MAX, -ANIM_SPEED_MIN); - } -// char debug_text[64]; -// sprintf(debug_text, "Foot slip vel: %.2f", footSlipVelocity); -// mCharacter->addDebugText(debug_text); -// sprintf(debug_text, "Speed: %.2f", mAvgSpeed); -// mCharacter->addDebugText(debug_text); -// sprintf(debug_text, "Speed Adjust: %.2f", mSpeedAdjust); -// mCharacter->addDebugText(debug_text); -// sprintf(debug_text, "Animation Playback Speed: %.2f", mAnimSpeed); -// mCharacter->addDebugText(debug_text); - mCharacter->setAnimationData("Walk Speed", &mAnimSpeed); - if (mCharacter->getMotionController().mIsSelf) - { -// F32 elapsed = mCharacter->getMotionController().getFrameTimer().getElapsedTimeF32(); -// llinfos << "PLOT elapsed: " << elapsed -// << " footSlipVelocity: " << footSlipVelocity -// << " mAvgCorrection: " << mAvgCorrection -// << " mAvgSpeed: " << mAvgSpeed -// << " mAnimSpeed: " << mAnimSpeed -// << " ANIM_SPEED_MAX: " << ANIM_SPEED_MAX -// << " ANIM_SPEED_MIN: " << ANIM_SPEED_MIN -// << llendl; - } - - // clamp pelvis offset to a 90 degree arc behind the nominal position - F32 drift_comp_max = llclamp(speed, 0.f, DRIFT_COMP_MAX_SPEED) / DRIFT_COMP_MAX_SPEED; - drift_comp_max *= DRIFT_COMP_MAX_TOTAL; + { // standing/turning - LLVector3 currentPelvisPos = mPelvisState->getJoint()->getPosition(); + // damp out speed adjustment to 0 + mAnimSpeed = lerp(mAnimSpeed, 1.f, LLCriticalDamp::getInterpolant(0.2f)); + //mPelvisOffset = lerp(mPelvisOffset, LLVector3::zero, LLCriticalDamp::getInterpolant(0.2f)); + } - // NB: this is an ADDITIVE amount that is accumulated every frame, so clamping it alone won't do the trick - // must clamp with absolute position of pelvis in mind - mPelvisOffset.mV[VX] = llclamp( mPelvisOffset.mV[VX], -drift_comp_max - currentPelvisPos.mV[VX], drift_comp_max - currentPelvisPos.mV[VX] ); - mPelvisOffset.mV[VY] = llclamp( mPelvisOffset.mV[VY], -drift_comp_max - currentPelvisPos.mV[VY], drift_comp_max - currentPelvisPos.mV[VY]); - mPelvisOffset.mV[VZ] = 0.f; + // broadcast walk speed change + mCharacter->setAnimationData("Walk Speed", &mAnimSpeed); // set position + // need to update *some* joint to keep this animation active mPelvisState->setPosition(mPelvisOffset); - mCharacter->setAnimationData("Pelvis Offset", &mPelvisOffset); - return TRUE; } @@ -438,14 +390,8 @@ BOOL LLFlyAdjustMotion::onUpdate(F32 time, U8* joint_mask) // roll is critically damped interpolation between current roll and angular velocity-derived target roll mRoll = lerp(mRoll, target_roll, LLCriticalDamp::getInterpolant(0.1f)); -// llinfos << mRoll << llendl; - LLQuaternion roll(mRoll, LLVector3(0.f, 0.f, 1.f)); mPelvisState->setRotation(roll); -// F32 lerp_amt = LLCriticalDamp::getInterpolant(0.2f); -// -// LLVector3 pelvis_correction = mPelvisState->getPosition() - lerp(LLVector3::zero, mPelvisState->getJoint()->getPosition() + mPelvisState->getPosition(), lerp_amt); -// mPelvisState->setPosition(pelvis_correction); return TRUE; } diff --git a/indra/llcharacter/llkeyframewalkmotion.h b/indra/llcharacter/llkeyframewalkmotion.h index 90dd4dbcac..b507e9423a 100644 --- a/indra/llcharacter/llkeyframewalkmotion.h +++ b/indra/llcharacter/llkeyframewalkmotion.h @@ -126,13 +126,11 @@ public: LLJoint* mRightAnkleJoint; LLPointer mPelvisState; LLJoint* mPelvisJoint; - LLVector3d mLastLeftAnklePos; - LLVector3d mLastRightAnklePos; + LLVector3d mLastLeftFootGlobalPos; + LLVector3d mLastRightFootGlobalPos; F32 mLastTime; - F32 mAvgCorrection; - F32 mSpeedAdjust; + F32 mAdjustedSpeed; F32 mAnimSpeed; - F32 mAvgSpeed; F32 mRelativeDir; LLVector3 mPelvisOffset; F32 mAnkleOffset; diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp index 977f1c9fa8..3fc5e88633 100644 --- a/indra/newview/llagentcamera.cpp +++ b/indra/newview/llagentcamera.cpp @@ -207,13 +207,13 @@ void LLAgentCamera::init() mCameraPreset = (ECameraPreset) gSavedSettings.getU32("CameraPreset"); - mCameraOffsetInitial[CAMERA_PRESET_REAR_VIEW] = gSavedSettings.getVector3("CameraOffsetRearView"); - mCameraOffsetInitial[CAMERA_PRESET_FRONT_VIEW] = gSavedSettings.getVector3("CameraOffsetFrontView"); - mCameraOffsetInitial[CAMERA_PRESET_GROUP_VIEW] = gSavedSettings.getVector3("CameraOffsetGroupView"); + mCameraOffsetInitial[CAMERA_PRESET_REAR_VIEW] = gSavedSettings.getControl("CameraOffsetRearView"); + mCameraOffsetInitial[CAMERA_PRESET_FRONT_VIEW] = gSavedSettings.getControl("CameraOffsetFrontView"); + mCameraOffsetInitial[CAMERA_PRESET_GROUP_VIEW] = gSavedSettings.getControl("CameraOffsetGroupView"); - mFocusOffsetInitial[CAMERA_PRESET_REAR_VIEW] = gSavedSettings.getVector3d("FocusOffsetRearView"); - mFocusOffsetInitial[CAMERA_PRESET_FRONT_VIEW] = gSavedSettings.getVector3d("FocusOffsetFrontView"); - mFocusOffsetInitial[CAMERA_PRESET_GROUP_VIEW] = gSavedSettings.getVector3d("FocusOffsetGroupView"); + mFocusOffsetInitial[CAMERA_PRESET_REAR_VIEW] = gSavedSettings.getControl("FocusOffsetRearView"); + mFocusOffsetInitial[CAMERA_PRESET_FRONT_VIEW] = gSavedSettings.getControl("FocusOffsetFrontView"); + mFocusOffsetInitial[CAMERA_PRESET_GROUP_VIEW] = gSavedSettings.getControl("FocusOffsetGroupView"); mCameraCollidePlane.clearVec(); mCurrentCameraDistance = getCameraOffsetInitial().magVec() * gSavedSettings.getF32("CameraOffsetScale"); @@ -1643,7 +1643,7 @@ LLVector3d LLAgentCamera::calcThirdPersonFocusOffset() agent_rot *= ((LLViewerObject*)(gAgentAvatarp->getParent()))->getRenderRotation(); } - focus_offset = mFocusOffsetInitial[mCameraPreset] * agent_rot; + focus_offset = convert_from_llsd(mFocusOffsetInitial[mCameraPreset]->get(), TYPE_VEC3D, ""); return focus_offset; } @@ -1978,7 +1978,7 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit) LLVector3 LLAgentCamera::getCameraOffsetInitial() { - return mCameraOffsetInitial[mCameraPreset]; + return convert_from_llsd(mCameraOffsetInitial[mCameraPreset]->get(), TYPE_VEC3, ""); } diff --git a/indra/newview/llagentcamera.h b/indra/newview/llagentcamera.h index 5cbb1de6f4..7afb5c0ed9 100644 --- a/indra/newview/llagentcamera.h +++ b/indra/newview/llagentcamera.h @@ -39,6 +39,7 @@ class LLPickInfo; class LLVOAvatarSelf; +class LLControlVariable; //-------------------------------------------------------------------- // Types @@ -121,10 +122,10 @@ private: ECameraPreset mCameraPreset; /** Initial camera offsets */ - std::map mCameraOffsetInitial; + std::map > mCameraOffsetInitial; /** Initial focus offsets */ - std::map mFocusOffsetInitial; + std::map > mFocusOffsetInitial; //-------------------------------------------------------------------- // Position -- cgit v1.2.3