diff --git a/indra/newview/llfloaterprofiletexture.cpp b/indra/newview/llfloaterprofiletexture.cpp index 743685e7d1..bf1f56a6d1 100644 --- a/indra/newview/llfloaterprofiletexture.cpp +++ b/indra/newview/llfloaterprofiletexture.cpp @@ -115,6 +115,16 @@ void LLFloaterProfileTexture::updateDimensions() S32 width = old_floater_rect.getWidth() - old_image_rect.getWidth() + mLastWidth; S32 height = old_floater_rect.getHeight() - old_image_rect.getHeight() + mLastHeight; + const F32 MAX_DIMENTIONS = 512; // most profiles are supposed to be 256x256 + + S32 biggest_dim = llmax(width, height); + if (biggest_dim > MAX_DIMENTIONS) + { + F32 scale_down = MAX_DIMENTIONS / (F32)biggest_dim; + width *= scale_down; + height *= scale_down; + } + //reshape floater reshape(width, height); diff --git a/indra/newview/lloutfitgallery.cpp b/indra/newview/lloutfitgallery.cpp index 11fe7a82c7..75b2307b5e 100644 --- a/indra/newview/lloutfitgallery.cpp +++ b/indra/newview/lloutfitgallery.cpp @@ -1374,6 +1374,7 @@ void LLOutfitGallery::onSelectPhoto(LLUUID selected_outfit_id) texture_floaterp->setOnFloaterCommitCallback(boost::bind(&LLOutfitGallery::onTexturePickerCommit, this, _1, _2)); texture_floaterp->setOnUpdateImageStatsCallback(boost::bind(&LLOutfitGallery::onTexturePickerUpdateImageStats, this, _1)); texture_floaterp->setLocalTextureEnabled(FALSE); + texture_floaterp->setBakeTextureEnabled(FALSE); texture_floaterp->setCanApply(false, true); } diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp index c349c21751..b70d477579 100644 --- a/indra/newview/llpanelprofile.cpp +++ b/indra/newview/llpanelprofile.cpp @@ -171,6 +171,14 @@ void request_avatar_properties_coro(std::string cap_url, LLUUID agent_id) { avatar_data->flags |= AVATAR_ALLOW_PUBLISH; } + if (result["identified"].asBoolean()) + { + avatar_data->flags |= AVATAR_IDENTIFIED; + } + if (result["transacted"].asBoolean()) + { + avatar_data->flags |= AVATAR_TRANSACTED; + } avatar_data->caption_index = 0; if (result.has("charter_member")) // won't be present if "caption" is set @@ -1510,14 +1518,10 @@ void LLProfileImagePicker::notify(const std::vector& filenames) { return; } - - // Crash fix if (filenames.empty()) { return; } - // - std::string file_path = filenames[0]; if (file_path.empty()) { @@ -1647,34 +1651,28 @@ void LLPanelProfileSecondLife::onCommitMenu(const LLSD& userdata) url = LLWeb::expandURLSubstitutions(url, subs); LLUrlAction::openURL(url); } - else if (item_name == "change_photo") + else if (item_name == "upload_photo") { (new LLProfileImagePicker(PROFILE_IMAGE_SL, new LLHandle(getHandle())))->getFile(); + + LLFloater* floaterp = mFloaterTexturePickerHandle.get(); + if (floaterp) + { + floaterp->closeFloater(); + } + } + else if (item_name == "change_photo") + { + onShowTexturePicker(); } else if (item_name == "remove_photo") { - LLSD params; - params["sl_image_id"] = LLUUID::null; + onCommitProfileImage(LLUUID::null); - std::string cap_url = gAgent.getRegionCapability(PROFILE_PROPERTIES_CAP); - if (!cap_url.empty()) + LLFloater* floaterp = mFloaterTexturePickerHandle.get(); + if (floaterp) { - LLCoros::instance().launch("putAgentUserInfoCoro", - boost::bind(put_avatar_properties_coro, cap_url, getAvatarId(), params)); - - mSecondLifePic->setValue("Generic_Person_Large"); - mImageId = LLUUID::null; - - LLFloater *floater = mFloaterProfileTextureHandle.get(); - if (floater) - { - LLFloaterProfileTexture * texture_view = dynamic_cast(floater); - texture_view->resetAsset(); - } - } - else - { - LL_WARNS("AvatarProperties") << "Failed to update profile data, no cap found" << LL_ENDL; + floaterp->closeFloater(); } } } @@ -1725,15 +1723,16 @@ bool LLPanelProfileSecondLife::onEnableMenu(const LLSD& userdata) { return !mAvatarNameCacheConnection.connected(); } - else if (item_name == "change_photo") + else if (item_name == "upload_photo" + || item_name == "change_photo") { std::string cap_url = gAgent.getRegionCapability(PROFILE_IMAGE_UPLOAD_CAP); - return !cap_url.empty() && !mWaitingForImageUpload; + return !cap_url.empty() && !mWaitingForImageUpload && getIsLoaded(); } else if (item_name == "remove_photo") { std::string cap_url = gAgent.getRegionCapability(PROFILE_PROPERTIES_CAP); - return mImageId.notNull() && !cap_url.empty() && !mWaitingForImageUpload; + return mImageId.notNull() && !cap_url.empty() && !mWaitingForImageUpload && getIsLoaded(); } return false; @@ -1909,6 +1908,117 @@ void LLPanelProfileSecondLife::onShowAgentProfileTexture() } } +void LLPanelProfileSecondLife::onShowTexturePicker() +{ + LLFloater* floaterp = mFloaterTexturePickerHandle.get(); + + // Show the dialog + if (!floaterp) + { + LLFloater* parent_floater = gFloaterView->getParentFloater(this); + if (parent_floater) + { + // because inventory construction is somewhat slow + getWindow()->setCursor(UI_CURSOR_WAIT); + LLFloaterTexturePicker* texture_floaterp = new LLFloaterTexturePicker( + this, + mImageId, + LLUUID::null, + mImageId, + FALSE, + FALSE, + "SELECT PHOTO", + PERM_NONE, + PERM_NONE, + PERM_NONE, + FALSE, + NULL); + + mFloaterTexturePickerHandle = texture_floaterp->getHandle(); + + texture_floaterp->setOnFloaterCommitCallback([this](LLTextureCtrl::ETexturePickOp op, LLUUID id) + { + if (op == LLTextureCtrl::TEXTURE_SELECT) + { + LLUUID image_asset_id; + LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterTexturePickerHandle.get(); + if (floaterp) + { + if (id.notNull()) + { + image_asset_id = id; + } + else + { + image_asset_id = floaterp->getAssetID(); + } + } + + onCommitProfileImage(image_asset_id); + } + }); + texture_floaterp->setLocalTextureEnabled(FALSE); + texture_floaterp->setBakeTextureEnabled(FALSE); + texture_floaterp->setCanApply(false, true); + + parent_floater->addDependentFloater(mFloaterTexturePickerHandle); + + texture_floaterp->openFloater(); + texture_floaterp->setFocus(TRUE); + } + } + else + { + floaterp->setMinimized(FALSE); + floaterp->setVisibleAndFrontmost(TRUE); + } +} + +void LLPanelProfileSecondLife::onCommitProfileImage(const LLUUID& id) +{ + if (mImageId == id) + { + return; + } + + std::string cap_url = gAgent.getRegionCapability(PROFILE_PROPERTIES_CAP); + if (!cap_url.empty()) + { + LLSD params; + params["sl_image_id"] = id; + LLCoros::instance().launch("putAgentUserInfoCoro", + boost::bind(put_avatar_properties_coro, cap_url, getAvatarId(), params)); + + mImageId = id; + if (mImageId == LLUUID::null) + { + mSecondLifePic->setValue("Generic_Person_Large"); + } + else + { + mSecondLifePic->setValue(mImageId); + } + + LLFloater *floater = mFloaterProfileTextureHandle.get(); + if (floater) + { + LLFloaterProfileTexture * texture_view = dynamic_cast(floater); + if (mImageId == LLUUID::null) + { + texture_view->resetAsset(); + } + else + { + texture_view->loadAsset(mImageId); + } + } + } + else + { + LL_WARNS("AvatarProperties") << "Failed to update profile data, no cap found" << LL_ENDL; + } +} + void LLPanelProfileSecondLife::onOpenNotes() { LLFloater* parent_floater = gFloaterView->getParentFloater(this); @@ -2083,11 +2193,13 @@ BOOL LLPanelProfileFirstLife::postBuild() mDescriptionEdit = getChild("fl_description_edit"); mPicture = getChild("real_world_pic"); - mChangePhoto = getChild("fl_upload_image"); + mUploadPhoto = getChild("fl_upload_image"); + mChangePhoto = getChild("fl_change_image"); mRemovePhoto = getChild("fl_remove_image"); mSaveChanges = getChild("fl_save_changes"); mDiscardChanges = getChild("fl_discard_changes"); + mUploadPhoto->setCommitCallback([this](LLUICtrl*, void*) { onUploadPhoto(); }, nullptr); mChangePhoto->setCommitCallback([this](LLUICtrl*, void*) { onChangePhoto(); }, nullptr); mRemovePhoto->setCommitCallback([this](LLUICtrl*, void*) { onRemovePhoto(); }, nullptr); mSaveChanges->setCommitCallback([this](LLUICtrl*, void*) { onSaveDescriptionChanges(); }, nullptr); @@ -2112,8 +2224,9 @@ void LLPanelProfileFirstLife::onOpen(const LLSD& key) void LLPanelProfileFirstLife::setProfileImageUploading(bool loading) { + mUploadPhoto->setEnabled(!loading); mChangePhoto->setEnabled(!loading); - mRemovePhoto->setEnabled(!loading); + mRemovePhoto->setEnabled(!loading && mImageId.notNull()); LLLoadingIndicator* indicator = getChild("image_upload_indicator"); indicator->setVisible(loading); @@ -2141,23 +2254,107 @@ void LLPanelProfileFirstLife::commitUnsavedChanges() } } -void LLPanelProfileFirstLife::onChangePhoto() +void LLPanelProfileFirstLife::onUploadPhoto() { (new LLProfileImagePicker(PROFILE_IMAGE_FL, new LLHandle(getHandle())))->getFile(); } +void LLPanelProfileFirstLife::onChangePhoto() +{ + LLFloater* floaterp = mFloaterTexturePickerHandle.get(); + + // Show the dialog + if (!floaterp) + { + LLFloater* parent_floater = gFloaterView->getParentFloater(this); + if (parent_floater) + { + // because inventory construction is somewhat slow + getWindow()->setCursor(UI_CURSOR_WAIT); + LLFloaterTexturePicker* texture_floaterp = new LLFloaterTexturePicker( + this, + mImageId, + LLUUID::null, + mImageId, + FALSE, + FALSE, + "SELECT PHOTO", + PERM_NONE, + PERM_NONE, + PERM_NONE, + FALSE, + NULL); + + mFloaterTexturePickerHandle = texture_floaterp->getHandle(); + + texture_floaterp->setOnFloaterCommitCallback([this](LLTextureCtrl::ETexturePickOp op, LLUUID id) + { + if (op == LLTextureCtrl::TEXTURE_SELECT) + { + LLUUID image_asset_id; + LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterTexturePickerHandle.get(); + if (floaterp) + { + if (id.notNull()) + { + image_asset_id = id; + } + else + { + image_asset_id = floaterp->getAssetID(); + } + } + + onCommitPhoto(image_asset_id); + } + }); + texture_floaterp->setLocalTextureEnabled(FALSE); + texture_floaterp->setCanApply(false, true); + + parent_floater->addDependentFloater(mFloaterTexturePickerHandle); + + texture_floaterp->openFloater(); + texture_floaterp->setFocus(TRUE); + } + } + else + { + floaterp->setMinimized(FALSE); + floaterp->setVisibleAndFrontmost(TRUE); + } +} + void LLPanelProfileFirstLife::onRemovePhoto() { - LLSD params; - params["fl_image_id"] = LLUUID::null; + onCommitPhoto(LLUUID::null); +} + +void LLPanelProfileFirstLife::onCommitPhoto(const LLUUID& id) +{ + if (mImageId == id) + { + return; + } std::string cap_url = gAgent.getRegionCapability(PROFILE_PROPERTIES_CAP); if (!cap_url.empty()) { + LLSD params; + params["fl_image_id"] = id; LLCoros::instance().launch("putAgentUserInfoCoro", boost::bind(put_avatar_properties_coro, cap_url, getAvatarId(), params)); - mPicture->setValue("Generic_Person_Large"); + mImageId = id; + if (mImageId.notNull()) + { + mPicture->setValue(mImageId); + } + else + { + mPicture->setValue("Generic_Person_Large"); + } + + mRemovePhoto->setEnabled(mImageId.notNull()); } else { @@ -2209,14 +2406,18 @@ void LLPanelProfileFirstLife::onDiscardDescriptionChanges() void LLPanelProfileFirstLife::processProperties(const LLAvatarData* avatar_data) { setDescriptionText(avatar_data->fl_about_text); - if (avatar_data->fl_image_id.notNull()) + + mImageId = avatar_data->fl_image_id; + + if (mImageId.notNull()) { - mPicture->setValue(avatar_data->fl_image_id); + mPicture->setValue(mImageId); } else { mPicture->setValue("Generic_Person_Large"); } + setLoaded(); } @@ -2225,6 +2426,7 @@ void LLPanelProfileFirstLife::resetData() mDescriptionEdit->setValue(LLStringUtil::null); mPicture->setValue("Generic_Person_Large"); + mUploadPhoto->setVisible(getSelfProfile()); mChangePhoto->setVisible(getSelfProfile()); mRemovePhoto->setVisible(getSelfProfile()); mSaveChanges->setVisible(getSelfProfile()); @@ -2239,6 +2441,7 @@ void LLPanelProfileFirstLife::setLoaded() { mDescriptionEdit->setEnabled(TRUE); mPicture->setEnabled(TRUE); + mRemovePhoto->setEnabled(mImageId.notNull()); } } diff --git a/indra/newview/llpanelprofile.h b/indra/newview/llpanelprofile.h index 2e8524b789..be3ee2ec1c 100644 --- a/indra/newview/llpanelprofile.h +++ b/indra/newview/llpanelprofile.h @@ -182,6 +182,8 @@ private: void onDiscardDescriptionChanges(); void onShowAgentPermissionsDialog(); void onShowAgentProfileTexture(); + void onShowTexturePicker(); + void onCommitProfileImage(const LLUUID& id); void onOpenNotes(); private: @@ -207,6 +209,7 @@ private: LLHandle mFloaterPermissionsHandle; LLHandle mFloaterProfileTextureHandle; + LLHandle mFloaterTexturePickerHandle; bool mHasUnsavedDescriptionChanges; bool mVoiceStatus; @@ -290,8 +293,10 @@ public: protected: void setLoaded() override; + void onUploadPhoto(); void onChangePhoto(); void onRemovePhoto(); + void onCommitPhoto(const LLUUID& id); void setDescriptionText(const std::string &text); void onSetDescriptionDirty(); void onSaveDescriptionChanges(); @@ -299,12 +304,16 @@ protected: LLTextEditor* mDescriptionEdit; LLIconCtrl* mPicture; + LLButton* mUploadPhoto; LLButton* mChangePhoto; LLButton* mRemovePhoto; LLButton* mSaveChanges; LLButton* mDiscardChanges; - std::string mCurrentDescription; + LLHandle mFloaterTexturePickerHandle; + + std::string mCurrentDescription; + LLUUID mImageId; bool mHasUnsavedChanges; }; diff --git a/indra/newview/skins/default/xui/en/menu_avatar_self.xml b/indra/newview/skins/default/xui/en/menu_avatar_self.xml index a8079e62e4..40d993cc8d 100644 --- a/indra/newview/skins/default/xui/en/menu_avatar_self.xml +++ b/indra/newview/skins/default/xui/en/menu_avatar_self.xml @@ -330,4 +330,11 @@ + + + + diff --git a/indra/newview/skins/default/xui/en/menu_profile_self.xml b/indra/newview/skins/default/xui/en/menu_profile_self.xml index 552c96c60c..d0bd4000f8 100644 --- a/indra/newview/skins/default/xui/en/menu_profile_self.xml +++ b/indra/newview/skins/default/xui/en/menu_profile_self.xml @@ -18,6 +18,17 @@ function="Profile.Commit" parameter="edit_partner"/> + + + +