From 981a43b355e44daa7e1b4065b896ea4cd2fec3a2 Mon Sep 17 00:00:00 2001 From: Loren Shih Date: Mon, 23 Aug 2010 16:13:10 -0400 Subject: Created new wearable type. Added debug setting for disabling physics. Added disable-multiwear and disable-camera-reset to wearabletype. --- indra/newview/llagentwearables.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/newview/llagentwearables.cpp') diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index 4c2caae2c6..91a09cd886 100644 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -1717,6 +1717,7 @@ void LLAgentWearables::userRemoveAllClothesStep2(BOOL proceed) gAgentWearables.removeWearable(LLWearableType::WT_SKIRT,true,0); gAgentWearables.removeWearable(LLWearableType::WT_ALPHA,true,0); gAgentWearables.removeWearable(LLWearableType::WT_TATTOO,true,0); + gAgentWearables.removeWearable(LLWearableType::WT_PHYSICS,true,0); } } @@ -2042,8 +2043,9 @@ void LLAgentWearables::editWearable(const LLUUID& item_id) return; } + const BOOL disable_camera_switch = LLWearableType::getDisableCameraSwitch(wearable->getType()); LLPanel* panel = LLSideTray::getInstance()->getPanel("sidepanel_appearance"); - LLSidepanelAppearance::editWearable(wearable, panel); + LLSidepanelAppearance::editWearable(wearable, panel, disable_camera_switch); } // Request editing the item after it gets worn. -- cgit v1.3 From 5e110169701c8438a2c8191f03d3c5a4f080728c Mon Sep 17 00:00:00 2001 From: Loren Shih Date: Wed, 25 Aug 2010 17:51:01 -0400 Subject: Fixed an issue where you go into appearance pose when editing physics if you were formerly in edit outfit. Miscellaneous code cleanup. --- indra/newview/llagentwearables.cpp | 2 +- indra/newview/llagentwearables.h | 2 +- indra/newview/llbreastmotion.cpp | 3 ++- indra/newview/llsidepanelappearance.cpp | 18 +++++++++++++----- 4 files changed, 17 insertions(+), 8 deletions(-) (limited to 'indra/newview/llagentwearables.cpp') diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index 91a09cd886..c1aae867ef 100644 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -821,7 +821,7 @@ void LLAgentWearables::popWearable(const LLWearableType::EType type, U32 index) } } -U32 LLAgentWearables::getWearableIndex(LLWearable *wearable) +U32 LLAgentWearables::getWearableIndex(const LLWearable *wearable) const { if (wearable == NULL) { diff --git a/indra/newview/llagentwearables.h b/indra/newview/llagentwearables.h index d7e77a5a5b..3ef50f14da 100644 --- a/indra/newview/llagentwearables.h +++ b/indra/newview/llagentwearables.h @@ -124,7 +124,7 @@ public: void setWearableOutfit(const LLInventoryItem::item_array_t& items, const LLDynamicArray< LLWearable* >& wearables, BOOL remove); void setWearableName(const LLUUID& item_id, const std::string& new_name); void addLocalTextureObject(const LLWearableType::EType wearable_type, const LLVOAvatarDefines::ETextureIndex texture_type, U32 wearable_index); - U32 getWearableIndex(LLWearable *wearable); + U32 getWearableIndex(const LLWearable *wearable) const; protected: void setWearableFinal(LLInventoryItem* new_item, LLWearable* new_wearable, bool do_append = false); diff --git a/indra/newview/llbreastmotion.cpp b/indra/newview/llbreastmotion.cpp index 8d3571e83d..036aa2ff39 100644 --- a/indra/newview/llbreastmotion.cpp +++ b/indra/newview/llbreastmotion.cpp @@ -42,7 +42,8 @@ #include "llbreastmotion.h" #include "llcharacter.h" #include "llviewercontrol.h" -#include "llviewervisualparam.H" +#include "llviewervisualparam.h" +#include "llvoavatarself.h" // #define OUTPUT_BREAST_DATA diff --git a/indra/newview/llsidepanelappearance.cpp b/indra/newview/llsidepanelappearance.cpp index e8733bf3e4..1422971b52 100644 --- a/indra/newview/llsidepanelappearance.cpp +++ b/indra/newview/llsidepanelappearance.cpp @@ -185,18 +185,26 @@ void LLSidepanelAppearance::onVisibilityChange(const LLSD &new_visibility) { if (new_visibility.asBoolean()) { - bool is_outfit_edit_visible = mOutfitEdit && mOutfitEdit->getVisible(); - bool is_wearable_edit_visible = mEditWearable && mEditWearable->getVisible(); + const BOOL is_outfit_edit_visible = mOutfitEdit && mOutfitEdit->getVisible(); + const BOOL is_wearable_edit_visible = mEditWearable && mEditWearable->getVisible(); if (is_outfit_edit_visible || is_wearable_edit_visible) { - if (!gAgentCamera.cameraCustomizeAvatar() && gSavedSettings.getBOOL("AppearanceCameraMovement")) + const LLWearable *wearable_ptr = mEditWearable->getWearable(); + if (!wearable_ptr) + { + llwarns << "Visibility change to invalid wearable" << llendl; + return; + } + const BOOL disable_camera_motion = LLWearableType::getDisableCameraSwitch(wearable_ptr->getType()); + if (!gAgentCamera.cameraCustomizeAvatar() && + !disable_camera_motion && + gSavedSettings.getBOOL("AppearanceCameraMovement")) { gAgentCamera.changeCameraToCustomizeAvatar(); } if (is_wearable_edit_visible) { - LLWearable *wearable_ptr = mEditWearable->getWearable(); if (gAgentWearables.getWearableIndex(wearable_ptr) == LLAgentWearables::MAX_CLOTHING_PER_TYPE) { // we're no longer wearing the wearable we were last editing, switch back to outfit editor @@ -380,7 +388,7 @@ void LLSidepanelAppearance::toggleWearableEditPanel(BOOL visible, LLWearable *we { gAgentCamera.changeCameraToCustomizeAvatar(); } - mEditWearable->setWearable(wearable); + mEditWearable->setWearable(wearable, disable_camera_switch); mEditWearable->onOpen(LLSD()); // currently no-op, just for consistency } else -- cgit v1.3 From c859923cf63fc66d4f73b04ec57d56a2e4fe6955 Mon Sep 17 00:00:00 2001 From: Loren Shih Date: Tue, 31 Aug 2010 14:42:09 -0400 Subject: Physics no longer perform for avatars that are smaller than some certain screenspace metric. Physics no longer removed when outfits changed. --- indra/newview/llagentwearables.cpp | 1 - indra/newview/llbreastmotion.cpp | 63 ++++++++++++++++++++++---------------- indra/newview/llbreastmotion.h | 3 +- 3 files changed, 38 insertions(+), 29 deletions(-) (limited to 'indra/newview/llagentwearables.cpp') diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index c1aae867ef..34f7e2578f 100644 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -1717,7 +1717,6 @@ void LLAgentWearables::userRemoveAllClothesStep2(BOOL proceed) gAgentWearables.removeWearable(LLWearableType::WT_SKIRT,true,0); gAgentWearables.removeWearable(LLWearableType::WT_ALPHA,true,0); gAgentWearables.removeWearable(LLWearableType::WT_TATTOO,true,0); - gAgentWearables.removeWearable(LLWearableType::WT_PHYSICS,true,0); } } diff --git a/indra/newview/llbreastmotion.cpp b/indra/newview/llbreastmotion.cpp index 5bbab8a0a6..d4d0a78543 100644 --- a/indra/newview/llbreastmotion.cpp +++ b/indra/newview/llbreastmotion.cpp @@ -45,12 +45,10 @@ #include "llviewervisualparam.h" #include "llvoavatarself.h" +#define MIN_REQUIRED_PIXEL_AREA_BREAST_MOTION 1000.f; + // #define OUTPUT_BREAST_DATA -//----------------------------------------------------------------------------- -// LLBreastMotion() -// Class Constructor -//----------------------------------------------------------------------------- LLBreastMotion::LLBreastMotion(const LLUUID &id) : LLMotion(id), mCharacter(NULL), @@ -80,12 +78,6 @@ LLBreastMotion::LLBreastMotion(const LLUUID &id) : mBreastVelocity_local_vec = LLVector3(0,0,0); } - - -//----------------------------------------------------------------------------- -// ~LLBreastMotion() -// Class Destructor -//----------------------------------------------------------------------------- LLBreastMotion::~LLBreastMotion() { } @@ -164,7 +156,11 @@ LLMotion::LLMotionInitStatus LLBreastMotion::onInitialize(LLCharacter *character return STATUS_SUCCESS; } - +F32 LLBreastMotion::getMinPixelArea() +{ + return MIN_REQUIRED_PIXEL_AREA_BREAST_MOTION; +} + F32 LLBreastMotion::calculateTimeDelta() { @@ -243,15 +239,17 @@ BOOL LLBreastMotion::onUpdate(F32 time, U8* joint_mask) return TRUE; } - /* TEST: - 1. Change outfits - 2. FPS effect - 3. Add disable - 4. Disappearing chests - 5. Overwrites breast params - 6. Threshold for not setting param - 7. Switch params or take off wearable makes breasts jump - */ + if (!dynamic_cast(mCharacter)) + { + static int ticks=0; + ticks = (ticks + 1) % 10; + if (!ticks) + llinfos << "Pixel Area: " << mCharacter->getPixelArea() << " rt: " << fsqrtf(mCharacter->getPixelArea()) << llendl; + } + + if (mCharacter->getSex() != SEX_FEMALE) return TRUE; + const F32 time_delta = calculateTimeDelta(); + if (time_delta < .01 || time_delta > 10.0) return TRUE; mBreastMassParam = mCharacter->getVisualParamWeight("Breast_Physics_Mass"); mBreastSmoothingParam = (U32)(mCharacter->getVisualParamWeight("Breast_Physics_Smoothing")); @@ -269,11 +267,9 @@ BOOL LLBreastMotion::onUpdate(F32 time, U8* joint_mask) mBreastMaxVelocityParam[2] = mCharacter->getVisualParamWeight("Breast_Physics_UpDown_Max_Velocity"); mBreastDragParam[2] = mCharacter->getVisualParamWeight("Breast_Physics_UpDown_Drag"); - if (mCharacter->getSex() != SEX_FEMALE) return TRUE; - const F32 time_delta = calculateTimeDelta(); - if (time_delta < .01 || time_delta > 10.0) return TRUE; - + const BOOL is_self = (dynamic_cast(this) != NULL); + LLVector3 breast_user_local_pt(0,0,0); for (U32 i=0; i < 3; i++) @@ -361,7 +357,23 @@ BOOL LLBreastMotion::onUpdate(F32 time, U8* joint_mask) mBreastMassParam ); } + + mBreastLastPosition_local_pt = new_local_pt; + if (!is_self) + { + const F32 area_for_max_settings = 300.0; + const F32 area_for_min_settings = 1400.0; + + const F32 area_for_this_setting = area_for_max_settings + (area_for_min_settings-area_for_max_settings)*(1.0-lod_factor); + const F32 pixel_area = fsqrtf(mCharacter->getPixelArea()); + if (pixel_area < area_for_this_setting) + { + return TRUE; + } + } + + LLVector3 position_diff = mBreastLastUpdatePosition_local_pt-new_local_pt; for (U32 i=0; i < 3; i++) { @@ -370,11 +382,10 @@ BOOL LLBreastMotion::onUpdate(F32 time, U8* joint_mask) { mCharacter->updateVisualParams(); mBreastLastUpdatePosition_local_pt = new_local_pt; - break; + return TRUE; } } - mBreastLastPosition_local_pt = new_local_pt; return TRUE; } diff --git a/indra/newview/llbreastmotion.h b/indra/newview/llbreastmotion.h index 6a2e3788ad..da71962453 100644 --- a/indra/newview/llbreastmotion.h +++ b/indra/newview/llbreastmotion.h @@ -39,7 +39,6 @@ #include "llmotion.h" #include "llframetimer.h" -#define MIN_REQUIRED_PIXEL_AREA_BREAST_MOTION 500.f; #define BREAST_MOTION_FADEIN_TIME 1.0f #define BREAST_MOTION_FADEOUT_TIME 1.0f @@ -85,7 +84,7 @@ public: virtual F32 getEaseOutDuration() { return BREAST_MOTION_FADEOUT_TIME; } // called to determine when a motion should be activated/deactivated based on avatar pixel coverage - virtual F32 getMinPixelArea() { return MIN_REQUIRED_PIXEL_AREA_BREAST_MOTION; } + virtual F32 getMinPixelArea(); // motions must report their priority virtual LLJoint::JointPriority getPriority() { return LLJoint::MEDIUM_PRIORITY; } -- cgit v1.3