diff options
Diffstat (limited to 'indra/newview')
24 files changed, 384 insertions, 181 deletions
diff --git a/indra/newview/VIEWER_VERSION.txt b/indra/newview/VIEWER_VERSION.txt index 9fe9ff9d99..21c8c7b46b 100644 --- a/indra/newview/VIEWER_VERSION.txt +++ b/indra/newview/VIEWER_VERSION.txt @@ -1 +1 @@ -7.0.1 +7.1.1 diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index b9025ef7cd..00b59f9a4d 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -533,6 +533,17 @@ <key>Value</key> <integer>0</integer> </map> + <key>RenderSnapshotNoPost</key> + <map> + <key>Comment</key> + <string>Disable tone mapping and exposure correction when snapshot is being rendered</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> <key>AutomaticFly</key> <map> <key>Comment</key> diff --git a/indra/newview/llfetchedgltfmaterial.cpp b/indra/newview/llfetchedgltfmaterial.cpp index 1a47293523..46b9dffae9 100644 --- a/indra/newview/llfetchedgltfmaterial.cpp +++ b/indra/newview/llfetchedgltfmaterial.cpp @@ -29,6 +29,8 @@ #include "llviewertexturelist.h" #include "llavatarappearancedefines.h" +#include "llviewerobject.h" +#include "llselectmgr.h" #include "llshadermgr.h" #include "pipeline.h" @@ -252,3 +254,55 @@ void LLFetchedGLTFMaterial::materialComplete() materialCompleteCallbacks.clear(); materialCompleteCallbacks.shrink_to_fit(); } + +LLPointer<LLViewerFetchedTexture> LLFetchedGLTFMaterial::getUITexture() +{ + if (mFetching) + { + return nullptr; + } + + auto fetch_texture_for_ui = [](LLPointer<LLViewerFetchedTexture>& img, const LLUUID& id) + { + if (id.notNull()) + { + if (LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::isBakedImageId(id)) + { + LLViewerObject* obj = LLSelectMgr::getInstance()->getSelection()->getFirstObject(); + if (obj) + { + LLViewerTexture* viewerTexture = obj->getBakedTextureForMagicId(id); + img = viewerTexture ? dynamic_cast<LLViewerFetchedTexture*>(viewerTexture) : NULL; + } + + } + else + { + img = LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + } + } + if (img) + { + img->setBoostLevel(LLGLTexture::BOOST_PREVIEW); + img->forceToSaveRawImage(0); + } + }; + + fetch_texture_for_ui(mBaseColorTexture, mTextureId[LLGLTFMaterial::GLTF_TEXTURE_INFO_BASE_COLOR]); + fetch_texture_for_ui(mNormalTexture, mTextureId[LLGLTFMaterial::GLTF_TEXTURE_INFO_NORMAL]); + fetch_texture_for_ui(mMetallicRoughnessTexture, mTextureId[LLGLTFMaterial::GLTF_TEXTURE_INFO_METALLIC_ROUGHNESS]); + fetch_texture_for_ui(mEmissiveTexture, mTextureId[LLGLTFMaterial::GLTF_TEXTURE_INFO_EMISSIVE]); + + if ((mBaseColorTexture && (mBaseColorTexture->getRawImageLevel() != 0)) || + (mNormalTexture && (mNormalTexture->getRawImageLevel() != 0)) || + (mMetallicRoughnessTexture && (mMetallicRoughnessTexture->getRawImageLevel() != 0)) || + (mEmissiveTexture && (mEmissiveTexture->getRawImageLevel() != 0))) + { + return nullptr; + } + + // *HACK: Use one of the PBR texture components as the preview texture for now + mPreviewTexture = mBaseColorTexture; + + return mPreviewTexture; +} diff --git a/indra/newview/llfetchedgltfmaterial.h b/indra/newview/llfetchedgltfmaterial.h index 2559aa46cc..a9e539633d 100644 --- a/indra/newview/llfetchedgltfmaterial.h +++ b/indra/newview/llfetchedgltfmaterial.h @@ -50,6 +50,8 @@ public: bool isFetching() const { return mFetching; } + LLPointer<LLViewerFetchedTexture> getUITexture(); + void addTextureEntry(LLTextureEntry* te) override; void removeTextureEntry(LLTextureEntry* te) override; virtual bool replaceLocalTexture(const LLUUID& tracking_id, const LLUUID& old_id, const LLUUID& new_id) override; @@ -63,6 +65,9 @@ public: std::set<LLTextureEntry*> mTextureEntires; + // Texture used for previewing the material in the UI + LLPointer<LLViewerFetchedTexture> mPreviewTexture; + protected: // Lifetime management diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index 6b9d4580dc..ca2069cbfc 100644 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -461,8 +461,8 @@ void LLFloaterSnapshotBase::ImplBase::onClickAutoSnap(LLUICtrl *ctrl, void* data { LLCheckBoxCtrl *check = (LLCheckBoxCtrl *)ctrl; gSavedSettings.setBOOL( "AutoSnapshot", check->get() ); - - LLFloaterSnapshotBase *view = (LLFloaterSnapshotBase *)data; + + LLFloaterSnapshotBase *view = (LLFloaterSnapshotBase *)data; if (view) { view->impl->checkAutoSnapshot(view->getPreviewView()); @@ -471,6 +471,17 @@ void LLFloaterSnapshotBase::ImplBase::onClickAutoSnap(LLUICtrl *ctrl, void* data } // static +void LLFloaterSnapshotBase::ImplBase::onClickNoPost(LLUICtrl *ctrl, void* data) +{ + BOOL no_post = ((LLCheckBoxCtrl*)ctrl)->get(); + gSavedSettings.setBOOL("RenderSnapshotNoPost", no_post); + + LLFloaterSnapshotBase* view = (LLFloaterSnapshotBase*)data; + view->getPreviewView()->updateSnapshot(TRUE, TRUE); + view->impl->updateControls(view); +} + +// static void LLFloaterSnapshotBase::ImplBase::onClickFilter(LLUICtrl *ctrl, void* data) { LLFloaterSnapshotBase *view = (LLFloaterSnapshotBase *)data; @@ -997,6 +1008,9 @@ BOOL LLFloaterSnapshot::postBuild() getChild<LLUICtrl>("auto_snapshot_check")->setValue(gSavedSettings.getBOOL("AutoSnapshot")); childSetCommitCallback("auto_snapshot_check", ImplBase::onClickAutoSnap, this); + getChild<LLUICtrl>("no_post_check")->setValue(gSavedSettings.getBOOL("RenderSnapshotNoPost")); + childSetCommitCallback("no_post_check", ImplBase::onClickNoPost, this); + getChild<LLButton>("retract_btn")->setCommitCallback(boost::bind(&LLFloaterSnapshot::onExtendFloater, this)); getChild<LLButton>("extend_btn")->setCommitCallback(boost::bind(&LLFloaterSnapshot::onExtendFloater, this)); diff --git a/indra/newview/llfloatersnapshot.h b/indra/newview/llfloatersnapshot.h index 7fc62a2746..89cb2bc809 100644 --- a/indra/newview/llfloatersnapshot.h +++ b/indra/newview/llfloatersnapshot.h @@ -100,6 +100,7 @@ public: static void onClickNewSnapshot(void* data); static void onClickAutoSnap(LLUICtrl *ctrl, void* data); + static void onClickNoPost(LLUICtrl *ctrl, void* data); static void onClickFilter(LLUICtrl *ctrl, void* data); static void onClickUICheck(LLUICtrl *ctrl, void* data); static void onClickHUDCheck(LLUICtrl *ctrl, void* data); diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 8583cca103..05aa2e423f 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -1465,6 +1465,10 @@ U32 LLInventoryModel::updateItem(const LLViewerInventoryItem* item, U32 mask) { mask |= LLInventoryObserver::LABEL; } + if (old_item->getPermissions() != item->getPermissions()) + { + mask |= LLInventoryObserver::INTERNAL; + } old_item->copyViewerItem(item); if (update_parent_on_server) { diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp index a5437f7a88..70e21cae73 100644 --- a/indra/newview/llmaterialeditor.cpp +++ b/indra/newview/llmaterialeditor.cpp @@ -38,6 +38,7 @@ #include "llgltfmateriallist.h" #include "llinventorymodel.h" #include "llinventoryobserver.h" +#include "llinventoryfunctions.h" #include "lllocalgltfmaterials.h" #include "llnotificationsutil.h" #include "lltexturectrl.h" @@ -1495,16 +1496,22 @@ public: return; } + // Name may or may not have already been applied + const bool changed_name = item->getName() != mNewName; // create_inventory_item/copy_inventory_item don't allow presetting some permissions, fix it now - item->setPermissions(mPermissions); - item->updateServer(FALSE); - gInventory.updateItem(item); - gInventory.notifyObservers(); - - if (item->getName() != mNewName) + const bool changed_permissions = item->getPermissions() != mPermissions; + const bool changed = changed_name || changed_permissions; + LLSD updates; + if (changed) { - LLSD updates; - updates["name"] = mNewName; + if (changed_name) + { + updates["name"] = mNewName; + } + if (changed_permissions) + { + updates["permissions"] = ll_create_sd_from_permissions(mPermissions); + } update_inventory_item(inv_item_id, updates, NULL); } @@ -1514,10 +1521,16 @@ public: inv_item_id, LLAssetType::AT_MATERIAL, mAssetData, - [](LLUUID item_id, LLUUID new_asset_id, LLUUID new_item_id, LLSD response) + [changed, updates](LLUUID item_id, LLUUID new_asset_id, LLUUID new_item_id, LLSD response) { // done callback LL_INFOS("Material") << "inventory item uploaded. item: " << item_id << " new_item_id: " << new_item_id << " response: " << response << LL_ENDL; + + // *HACK: Sometimes permissions do not stick in the UI. They are correct on the server-side, though. + if (changed) + { + update_inventory_item(new_item_id, updates, NULL); + } }, nullptr // failure callback, floater already closed ); @@ -2014,8 +2027,49 @@ void LLMaterialEditor::loadLive() } } +namespace +{ + // Which inventory to consult for item permissions + enum class ItemSource + { + // Consult the permissions of the item in the object's inventory. If + // the item is not present, then usage of the asset is allowed. + OBJECT, + // Consult the permissions of the item in the agent's inventory. If + // the item is not present, then usage of the asset is not allowed. + AGENT + }; + + class LLAssetIDMatchesWithPerms : public LLInventoryCollectFunctor + { + public: + LLAssetIDMatchesWithPerms(const LLUUID& asset_id, const std::vector<PermissionBit>& ops) : mAssetID(asset_id), mOps(ops) {} + virtual ~LLAssetIDMatchesWithPerms() {} + bool operator()(LLInventoryCategory* cat, LLInventoryItem* item) + { + if (!item || item->getAssetUUID() != mAssetID) + { + return false; + } + LLPermissions item_permissions = item->getPermissions(); + for (PermissionBit op : mOps) + { + if (!gAgent.allowOperation(op, item_permissions, GP_OBJECT_MANIPULATE)) + { + return false; + } + } + return true; + } + + protected: + LLUUID mAssetID; + std::vector<PermissionBit> mOps; + }; +}; + // *NOTE: permissions_out includes user preferences for new item creation (LLFloaterPerms) -bool can_use_objects_material(LLSelectedTEGetMatData& func, const std::vector<PermissionBit>& ops, LLPermissions& permissions_out, LLViewerInventoryItem*& item_out) +bool can_use_objects_material(LLSelectedTEGetMatData& func, const std::vector<PermissionBit>& ops, const ItemSource item_source, LLPermissions& permissions_out, LLViewerInventoryItem*& item_out) { if (!LLMaterialEditor::capabilitiesAvailable()) { @@ -2028,6 +2082,10 @@ bool can_use_objects_material(LLSelectedTEGetMatData& func, const std::vector<Pe llassert(func.mIsOverride); LLSelectMgr::getInstance()->getSelection()->applyToTEs(&func, true /*first applicable*/); + if (item_source == ItemSource::AGENT) + { + func.mObjectId = LLUUID::null; + } LLViewerObject* selected_object = func.mObject; if (!selected_object) { @@ -2048,19 +2106,47 @@ bool can_use_objects_material(LLSelectedTEGetMatData& func, const std::vector<Pe } } - item_out = selected_object->getInventoryItemByAsset(func.mMaterialId); - - LLPermissions item_permissions; - if (item_out) + // Look for the item to base permissions off of + item_out = nullptr; + const bool blank_material = func.mMaterialId == LLGLTFMaterialList::BLANK_MATERIAL_ASSET_ID; + if (!blank_material) { - item_permissions.set(item_out->getPermissions()); - for (PermissionBit op : ops) + LLAssetIDMatchesWithPerms item_has_perms(func.mMaterialId, ops); + if (item_source == ItemSource::OBJECT) { - if (!gAgent.allowOperation(op, item_permissions, GP_OBJECT_MANIPULATE)) + LLViewerInventoryItem* item = selected_object->getInventoryItemByAsset(func.mMaterialId); + if (item && !item_has_perms(nullptr, item)) { return false; } + item_out = item; } + else + { + llassert(item_source == ItemSource::AGENT); + + LLViewerInventoryCategory::cat_array_t cats; + LLViewerInventoryItem::item_array_t items; + gInventory.collectDescendentsIf(LLUUID::null, + cats, + items, + // *NOTE: PBRPickerAgentListener will need + // to be changed if checking the trash is + // disabled + LLInventoryModel::INCLUDE_TRASH, + item_has_perms); + if (items.empty()) + { + return false; + } + item_out = items[0]; + } + } + + LLPermissions item_permissions; + if (item_out) + { + item_permissions = item_out->getPermissions(); // Update flags for new owner if (!item_permissions.setOwnerAndGroup(LLUUID::null, gAgent.getID(), LLUUID::null, true)) { @@ -2113,13 +2199,24 @@ bool can_use_objects_material(LLSelectedTEGetMatData& func, const std::vector<Pe // creation history when there's no material item present. In that case, // the agent who saved the material will be considered the creator. // -Cosmic,2023-08-07 - if (item_out) + if (item_source == ItemSource::AGENT) { + llassert(blank_material || item_out); // See comment at ItemSource::AGENT definition + permissions_out.set(item_permissions); } else { - permissions_out.set(object_permissions); + llassert(item_source == ItemSource::OBJECT); + + if (item_out) + { + permissions_out.set(item_permissions); + } + else + { + permissions_out.set(object_permissions); + } } permissions_out.accumulate(floater_perm); @@ -2131,7 +2228,7 @@ bool LLMaterialEditor::canModifyObjectsMaterial() LLSelectedTEGetMatData func(true); LLPermissions permissions; LLViewerInventoryItem* item_out; - return can_use_objects_material(func, std::vector({PERM_MODIFY}), permissions, item_out); + return can_use_objects_material(func, std::vector({PERM_MODIFY}), ItemSource::OBJECT, permissions, item_out); } bool LLMaterialEditor::canSaveObjectsMaterial() @@ -2139,7 +2236,7 @@ bool LLMaterialEditor::canSaveObjectsMaterial() LLSelectedTEGetMatData func(true); LLPermissions permissions; LLViewerInventoryItem* item_out; - return can_use_objects_material(func, std::vector({PERM_COPY, PERM_MODIFY}), permissions, item_out); + return can_use_objects_material(func, std::vector({PERM_COPY, PERM_MODIFY}), ItemSource::AGENT, permissions, item_out); } bool LLMaterialEditor::canClipboardObjectsMaterial() @@ -2165,7 +2262,7 @@ bool LLMaterialEditor::canClipboardObjectsMaterial() LLSelectedTEGetMatData func(true); LLPermissions permissions; LLViewerInventoryItem* item_out; - return can_use_objects_material(func, std::vector({PERM_COPY, PERM_MODIFY, PERM_TRANSFER}), permissions, item_out); + return can_use_objects_material(func, std::vector({PERM_COPY, PERM_MODIFY, PERM_TRANSFER}), ItemSource::OBJECT, permissions, item_out); } void LLMaterialEditor::saveObjectsMaterialAs() @@ -2173,7 +2270,7 @@ void LLMaterialEditor::saveObjectsMaterialAs() LLSelectedTEGetMatData func(true); LLPermissions permissions; LLViewerInventoryItem* item = nullptr; - bool allowed = can_use_objects_material(func, std::vector({PERM_COPY, PERM_MODIFY}), permissions, item); + bool allowed = can_use_objects_material(func, std::vector({PERM_COPY, PERM_MODIFY}), ItemSource::AGENT, permissions, item); if (!allowed) { LL_WARNS("MaterialEditor") << "Failed to save GLTF material from object" << LL_ENDL; @@ -2268,62 +2365,9 @@ void LLMaterialEditor::saveObjectsMaterialAs(const LLGLTFMaterial* render_materi } else { - if (item_id.notNull()) - { - // Copy existing item from object inventory, and create new composite asset on top of it - LLNotificationsUtil::add("SaveMaterialAs", args, payload, boost::bind(&LLMaterialEditor::onCopyObjectsMaterialAsMsgCallback, _1, _2, permissions, object_id, item_id)); - } - else - { - LLNotificationsUtil::add("SaveMaterialAs", args, payload, boost::bind(&LLMaterialEditor::onSaveObjectsMaterialAsMsgCallback, _1, _2, permissions)); - } - } -} - -// static -void LLMaterialEditor::onCopyObjectsMaterialAsMsgCallback(const LLSD& notification, const LLSD& response, const LLPermissions& permissions, const LLUUID& object_id, const LLUUID& item_id) -{ - S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - if (0 != option) - { - return; - } - - LLSD asset; - asset["version"] = LLGLTFMaterial::ASSET_VERSION; - asset["type"] = LLGLTFMaterial::ASSET_TYPE; - // This is the string serialized from LLGLTFMaterial::asJSON - asset["data"] = notification["payload"]["data"]; - - std::ostringstream str; - LLSDSerialize::serialize(asset, str, LLSDSerialize::LLSD_BINARY); - - LLViewerObject* object = gObjectList.findObject(object_id); - if (!object) - { - return; + llassert(object_id.isNull()); // Case for copying item from object inventory is no longer implemented + LLNotificationsUtil::add("SaveMaterialAs", args, payload, boost::bind(&LLMaterialEditor::onSaveObjectsMaterialAsMsgCallback, _1, _2, permissions)); } - const LLInventoryItem* item = object->getInventoryItem(item_id); - if (!item) - { - return; - } - - std::string new_name = response["message"].asString(); - LLInventoryObject::correctInventoryName(new_name); - if (new_name.empty()) - { - return; - } - - const LLUUID destination_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MATERIAL); - - LLPointer<LLInventoryCallback> cb = new LLObjectsMaterialItemCallback(permissions, str.str(), new_name); - // NOTE: This should be an item copy. Saving a material to an inventory should be disabled when the associated material is no-copy. - move_or_copy_inventory_from_object(destination_id, - object_id, - item_id, - cb); } // static diff --git a/indra/newview/llmaterialeditor.h b/indra/newview/llmaterialeditor.h index 95a4c4572d..4e0350b4cc 100644 --- a/indra/newview/llmaterialeditor.h +++ b/indra/newview/llmaterialeditor.h @@ -117,7 +117,6 @@ class LLMaterialEditor : public LLPreview, public LLVOInventoryListener static bool canSaveObjectsMaterial(); static bool canClipboardObjectsMaterial(); static void saveObjectsMaterialAs(); - static void onCopyObjectsMaterialAsMsgCallback(const LLSD& notification, const LLSD& response, const LLPermissions& permissions, const LLUUID& object_id, const LLUUID& item_id); static void onSaveObjectsMaterialAsMsgCallback(const LLSD& notification, const LLSD& response, const LLPermissions& permissions); static void onLoadComplete(const LLUUID& asset_uuid, LLAssetType::EType type, void* user_data, S32 status, LLExtStat ext_status); diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 9150b89de3..e7b856f743 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1880,15 +1880,53 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) } } +// One-off listener that updates the build floater UI when the agent inventory adds or removes an item +class PBRPickerAgentListener : public LLInventoryObserver +{ +protected: + bool mChangePending = true; +public: + PBRPickerAgentListener() : LLInventoryObserver() + { + gInventory.addObserver(this); + } + + const bool isListening() + { + return mChangePending; + } + + void changed(U32 mask) override + { + if (!(mask & (ADD | REMOVE))) + { + return; + } + + if (gFloaterTools) + { + gFloaterTools->dirty(); + } + gInventory.removeObserver(this); + mChangePending = false; + } + + ~PBRPickerAgentListener() override + { + gInventory.removeObserver(this); + mChangePending = false; + } +}; + // One-off listener that updates the build floater UI when the prim inventory updates -class PBRPickerItemListener : public LLVOInventoryListener +class PBRPickerObjectListener : public LLVOInventoryListener { protected: LLViewerObject* mObjectp; bool mChangePending = true; public: - PBRPickerItemListener(LLViewerObject* object) + PBRPickerObjectListener(LLViewerObject* object) : mObjectp(object) { registerVOInventoryListener(mObjectp, nullptr); @@ -1912,7 +1950,7 @@ public: mChangePending = false; } - ~PBRPickerItemListener() + ~PBRPickerObjectListener() { removeVOInventoryListener(); mChangePending = false; @@ -1931,9 +1969,9 @@ void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material, // pbr material LLTextureCtrl* pbr_ctrl = findChild<LLTextureCtrl>("pbr_control"); + LLUUID pbr_id; if (pbr_ctrl) { - LLUUID pbr_id; LLSelectedTE::getPbrMaterialId(pbr_id, identical_pbr, has_pbr_material, has_faces_without_pbr); pbr_ctrl->setTentative(identical_pbr ? FALSE : TRUE); @@ -1943,6 +1981,7 @@ void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material, if (objectp->isAttachment()) { pbr_ctrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER | PERM_MODIFY); + pbr_ctrl->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER | PERM_MODIFY); } else { @@ -1956,14 +1995,25 @@ void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material, if (objectp->isInventoryPending()) { // Reuse the same listener when possible - if (!mInventoryListener || !mInventoryListener->isListeningFor(objectp)) + if (!mVOInventoryListener || !mVOInventoryListener->isListeningFor(objectp)) { - mInventoryListener = std::make_unique<PBRPickerItemListener>(objectp); + mVOInventoryListener = std::make_unique<PBRPickerObjectListener>(objectp); } } else { - mInventoryListener = nullptr; + mVOInventoryListener = nullptr; + } + if (!identical_pbr || pbr_id.isNull() || pbr_id == LLGLTFMaterialList::BLANK_MATERIAL_ASSET_ID) + { + mAgentInventoryListener = nullptr; + } + else + { + if (!mAgentInventoryListener || !mAgentInventoryListener->isListening()) + { + mAgentInventoryListener = std::make_unique<PBRPickerAgentListener>(); + } } const bool show_pbr = mComboMatMedia->getCurrentIndex() == MATMEDIA_PBR && mComboMatMedia->getEnabled(); diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h index d36662c11b..5ca6a95699 100644 --- a/indra/newview/llpanelface.h +++ b/indra/newview/llpanelface.h @@ -53,7 +53,8 @@ class LLMaterialID; class LLMediaCtrl; class LLMenuButton; -class PBRPickerItemListener; +class PBRPickerAgentListener; +class PBRPickerObjectListener; // Represents an edit for use in replicating the op across one or more materials in the selection set. // @@ -508,7 +509,8 @@ private: static Selection sMaterialOverrideSelection; - std::unique_ptr<PBRPickerItemListener> mInventoryListener; + std::unique_ptr<PBRPickerAgentListener> mAgentInventoryListener; + std::unique_ptr<PBRPickerObjectListener> mVOInventoryListener; public: #if defined(DEF_GET_MAT_STATE) diff --git a/indra/newview/llpanelvolume.cpp b/indra/newview/llpanelvolume.cpp index d6c36bbfb7..595609b4de 100644 --- a/indra/newview/llpanelvolume.cpp +++ b/indra/newview/llpanelvolume.cpp @@ -746,6 +746,14 @@ void LLPanelVolume::sendIsLight() LL_INFOS() << "update light sent" << LL_ENDL; } +void notify_cant_select_reflection_probe() +{ + if (!gSavedSettings.getBOOL("SelectReflectionProbes")) + { + LLNotificationsUtil::add("CantSelectReflectionProbe"); + } +} + void LLPanelVolume::sendIsReflectionProbe() { LLViewerObject* objectp = mObject; @@ -764,6 +772,20 @@ void LLPanelVolume::sendIsReflectionProbe() } else { + if (value) + { + notify_cant_select_reflection_probe(); + } + else if (objectp->flagPhantom()) + { + LLViewerObject* root = objectp->getRootEdit(); + bool in_linkeset = root != objectp || objectp->numChildren() > 0; + if (in_linkeset) + { + // In linkset with a phantom flag + objectp->setFlags(FLAGS_PHANTOM, FALSE); + } + } volobjp->setIsReflectionProbe(value); } } @@ -780,6 +802,7 @@ void LLPanelVolume::doSendIsReflectionProbe(const LLSD & notification, const LLS } LLVOVolume* volobjp = (LLVOVolume*)objectp; + notify_cant_select_reflection_probe(); volobjp->setIsReflectionProbe(true); { // has become a reflection probe, slam to a 10m sphere and pop up a message @@ -1211,6 +1234,17 @@ void LLPanelVolume::onPasteLight() } else { + if (objectp->flagPhantom()) + { + LLViewerObject* root = objectp->getRootEdit(); + bool in_linkeset = root != objectp || objectp->numChildren() > 0; + if (in_linkeset) + { + // In linkset with a phantom flag + objectp->setFlags(FLAGS_PHANTOM, FALSE); + } + } + volobjp->setIsReflectionProbe(false); } } diff --git a/indra/newview/llsnapshotlivepreview.cpp b/indra/newview/llsnapshotlivepreview.cpp index b7a1832b17..2ff8f50277 100644 --- a/indra/newview/llsnapshotlivepreview.cpp +++ b/indra/newview/llsnapshotlivepreview.cpp @@ -559,6 +559,7 @@ void LLSnapshotLivePreview::generateThumbnailImage(BOOL force_update) mAllowRenderUI && gSavedSettings.getBOOL("RenderUIInSnapshot"), gSavedSettings.getBOOL("RenderHUDInSnapshot"), FALSE, + gSavedSettings.getBOOL("RenderSnapshotNoPost"), mSnapshotBufferType) ) { raw = NULL ; @@ -718,6 +719,7 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview ) previewp->mAllowRenderUI && gSavedSettings.getBOOL("RenderUIInSnapshot"), gSavedSettings.getBOOL("RenderHUDInSnapshot"), FALSE, + gSavedSettings.getBOOL("RenderSnapshotNoPost"), previewp->mSnapshotBufferType, previewp->getMaxImageSize())) { diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index 3988bceb4e..f302426a43 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -719,17 +719,27 @@ void LLFloaterTexturePicker::draw() // If the floater is focused, don't apply its alpha to the texture (STORM-677). const F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency(); - if( mTexturep ) + LLViewerTexture* texture = nullptr; + if (mGLTFMaterial) + { + texture = mGLTFMaterial->getUITexture(); + } + else + { + texture = mTexturep.get(); + } + + if( texture ) { - if( mTexturep->getComponents() == 4 ) + if( texture->getComponents() == 4 ) { gl_rect_2d_checkerboard( interior, alpha ); } - gl_draw_scaled_image( interior.mLeft, interior.mBottom, interior.getWidth(), interior.getHeight(), mTexturep, UI_VERTEX_COLOR % alpha ); + gl_draw_scaled_image( interior.mLeft, interior.mBottom, interior.getWidth(), interior.getHeight(), texture, UI_VERTEX_COLOR % alpha ); // Pump the priority - mTexturep->addTextureStats( (F32)(interior.getWidth() * interior.getHeight()) ); + texture->addTextureStats( (F32)(interior.getWidth() * interior.getHeight()) ); } else if (!mFallbackImage.isNull()) { @@ -2140,11 +2150,21 @@ void LLTextureCtrl::draw() if (texture.isNull()) { - texture = LLViewerTextureManager::getFetchedTexture(mImageAssetID, FTT_DEFAULT, MIPMAP_YES, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + if (mInventoryPickType == LLTextureCtrl::PICK_MATERIAL) + { + LLPointer<LLFetchedGLTFMaterial> material = gGLTFMaterialList.getMaterial(mImageAssetID); + if (material) + { + texture = material->getUITexture(); + } + } + else + { + texture = LLViewerTextureManager::getFetchedTexture(mImageAssetID, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + texture->setBoostLevel(LLGLTexture::BOOST_PREVIEW); + texture->forceToSaveRawImage(0); + } } - - texture->setBoostLevel(LLGLTexture::BOOST_PREVIEW); - texture->forceToSaveRawImage(0) ; mTexturep = texture; } diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 04ca62e0ec..a936012781 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -100,6 +100,7 @@ BOOL gResizeShadowTexture = FALSE; BOOL gWindowResized = FALSE; BOOL gSnapshot = FALSE; BOOL gCubeSnapshot = FALSE; +BOOL gSnapshotNoPost = FALSE; BOOL gShaderProfileFrame = FALSE; // This is how long the sim will try to teleport you before giving up. @@ -410,13 +411,13 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) gResizeShadowTexture = FALSE; } + gSnapshot = for_snapshot; + if (LLPipeline::sRenderDeferred) { //hack to make sky show up in deferred snapshots for_snapshot = FALSE; } - gSnapshot = for_snapshot; - LLGLSDefault gls_default; LLGLDepthTest gls_depth(GL_TRUE, GL_TRUE, GL_LEQUAL); diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 5ee613d49d..1b70e5f84f 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -1658,67 +1658,6 @@ void copy_inventory_from_notecard(const LLUUID& destination_id, } } -void move_or_copy_inventory_from_object(const LLUUID& destination_id, - const LLUUID& object_id, - const LLUUID& item_id, - LLPointer<LLInventoryCallback> cb) -{ - LLViewerObject* object = gObjectList.findObject(object_id); - if (!object) - { - return; - } - const LLInventoryItem* item = object->getInventoryItem(item_id); - if (!item) - { - return; - } - - class LLItemAddedObserver : public LLInventoryObserver - { - public: - LLItemAddedObserver(const LLUUID& copied_asset_id, LLPointer<LLInventoryCallback> cb) - : LLInventoryObserver(), - mAssetId(copied_asset_id), - mCallback(cb) - { - } - - void changed(U32 mask) override - { - if((mask & (LLInventoryObserver::ADD)) == 0) - { - return; - } - for (const LLUUID& changed_id : gInventory.getChangedIDs()) - { - LLViewerInventoryItem* changed_item = gInventory.getItem(changed_id); - if (changed_item->getAssetUUID() == mAssetId) - { - changeComplete(changed_item->getUUID()); - return; - } - } - } - - private: - void changeComplete(const LLUUID& item_id) - { - mCallback->fire(item_id); - gInventory.removeObserver(this); - delete this; - } - - LLUUID mAssetId; - LLPointer<LLInventoryCallback> mCallback; - }; - - const LLUUID& asset_id = item->getAssetUUID(); - LLItemAddedObserver* observer = new LLItemAddedObserver(asset_id, cb); - gInventory.addObserver(observer); - object->moveInventory(destination_id, item_id); -} - void create_new_item(const std::string& name, const LLUUID& parent_id, LLAssetType::EType asset_type, diff --git a/indra/newview/llviewerinventory.h b/indra/newview/llviewerinventory.h index bce8da0a69..e043285ffb 100644 --- a/indra/newview/llviewerinventory.h +++ b/indra/newview/llviewerinventory.h @@ -463,11 +463,6 @@ void copy_inventory_from_notecard(const LLUUID& destination_id, const LLInventoryItem *src, U32 callback_id = 0); -void move_or_copy_inventory_from_object(const LLUUID& destination_id, - const LLUUID& object_id, - const LLUUID& item_id, - LLPointer<LLInventoryCallback> cb); - void menu_create_inventory_item(LLInventoryPanel* root, LLFolderBridge* bridge, const LLSD& userdata, diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index e2791ba128..5461e0f362 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -863,8 +863,9 @@ class LLFileTakeSnapshotToDisk : public view_listener_t S32 width = gViewerWindow->getWindowWidthRaw(); S32 height = gViewerWindow->getWindowHeightRaw(); - bool render_ui = gSavedSettings.getBOOL("RenderUIInSnapshot"); - bool render_hud = gSavedSettings.getBOOL("RenderHUDInSnapshot"); + BOOL render_ui = gSavedSettings.getBOOL("RenderUIInSnapshot"); + BOOL render_hud = gSavedSettings.getBOOL("RenderHUDInSnapshot"); + BOOL render_no_post = gSavedSettings.getBOOL("RenderSnapshotNoPost"); BOOL high_res = gSavedSettings.getBOOL("HighResSnapshot"); if (high_res) @@ -884,6 +885,7 @@ class LLFileTakeSnapshotToDisk : public view_listener_t render_ui, render_hud, FALSE, + render_no_post, LLSnapshotModel::SNAPSHOT_TYPE_COLOR, high_res ? S32_MAX : MAX_SNAPSHOT_IMAGE_SIZE)) //per side { diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index ba2b6e1c7c..ed671fe849 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -229,6 +229,7 @@ extern BOOL gDisplaySwapBuffers; extern BOOL gDepthDirty; extern BOOL gResizeScreenTexture; extern BOOL gCubeSnapshot; +extern BOOL gSnapshotNoPost; LLViewerWindow *gViewerWindow = NULL; @@ -4875,16 +4876,16 @@ void LLViewerWindow::resetSnapshotLoc() const gSavedPerAccountSettings.setString("SnapshotBaseDir", std::string()); } -BOOL LLViewerWindow::thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 preview_height, BOOL show_ui, BOOL show_hud, BOOL do_rebuild, LLSnapshotModel::ESnapshotLayerType type) +BOOL LLViewerWindow::thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 preview_height, BOOL show_ui, BOOL show_hud, BOOL do_rebuild, BOOL no_post, LLSnapshotModel::ESnapshotLayerType type) { - return rawSnapshot(raw, preview_width, preview_height, FALSE, FALSE, show_ui, show_hud, do_rebuild, type); + return rawSnapshot(raw, preview_width, preview_height, FALSE, FALSE, show_ui, show_hud, do_rebuild, no_post, type); } // Saves the image from the screen to a raw image // Since the required size might be bigger than the available screen, this method rerenders the scene in parts (called subimages) and copy // the results over to the final raw image. BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_height, - BOOL keep_window_aspect, BOOL is_texture, BOOL show_ui, BOOL show_hud, BOOL do_rebuild, LLSnapshotModel::ESnapshotLayerType type, S32 max_size) + BOOL keep_window_aspect, BOOL is_texture, BOOL show_ui, BOOL show_hud, BOOL do_rebuild, BOOL no_post, LLSnapshotModel::ESnapshotLayerType type, S32 max_size) { if (!raw) { @@ -4901,6 +4902,7 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei } // PRE SNAPSHOT + gSnapshotNoPost = no_post; gDisplaySwapBuffers = FALSE; glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); // stencil buffer is deprecated | GL_STENCIL_BUFFER_BIT); @@ -5131,6 +5133,7 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei } gDisplaySwapBuffers = FALSE; + gSnapshotNoPost = FALSE; gDepthDirty = TRUE; // POST SNAPSHOT diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h index 6e8a5b2f4e..ccef006a07 100644 --- a/indra/newview/llviewerwindow.h +++ b/indra/newview/llviewerwindow.h @@ -362,7 +362,7 @@ public: BOOL saveSnapshot(const std::string& filename, S32 image_width, S32 image_height, BOOL show_ui = TRUE, BOOL show_hud = TRUE, BOOL do_rebuild = FALSE, LLSnapshotModel::ESnapshotLayerType type = LLSnapshotModel::SNAPSHOT_TYPE_COLOR, LLSnapshotModel::ESnapshotFormat format = LLSnapshotModel::SNAPSHOT_FORMAT_BMP); BOOL rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_height, BOOL keep_window_aspect = TRUE, BOOL is_texture = FALSE, - BOOL show_ui = TRUE, BOOL show_hud = TRUE, BOOL do_rebuild = FALSE, LLSnapshotModel::ESnapshotLayerType type = LLSnapshotModel::SNAPSHOT_TYPE_COLOR, S32 max_size = MAX_SNAPSHOT_IMAGE_SIZE); + BOOL show_ui = TRUE, BOOL show_hud = TRUE, BOOL do_rebuild = FALSE, BOOL no_post = FALSE, LLSnapshotModel::ESnapshotLayerType type = LLSnapshotModel::SNAPSHOT_TYPE_COLOR, S32 max_size = MAX_SNAPSHOT_IMAGE_SIZE); BOOL simpleSnapshot(LLImageRaw *raw, S32 image_width, S32 image_height, const int num_render_passes); @@ -380,7 +380,7 @@ public: // special implementation of simpleSnapshot for reflection maps BOOL reflectionSnapshot(LLImageRaw* raw, S32 image_width, S32 image_height, const int num_render_passes); - BOOL thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 preview_height, BOOL show_ui, BOOL show_hud, BOOL do_rebuild, LLSnapshotModel::ESnapshotLayerType type); + BOOL thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 preview_height, BOOL show_ui, BOOL show_hud, BOOL do_rebuild, BOOL no_post, LLSnapshotModel::ESnapshotLayerType type); BOOL isSnapshotLocSet() const; void resetSnapshotLoc() const; diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 9266c84540..64d247a202 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -211,6 +211,7 @@ extern S32 gBoxFrame; extern BOOL gDisplaySwapBuffers; extern BOOL gDebugGL; extern BOOL gCubeSnapshot; +extern BOOL gSnapshotNoPost; bool gAvatarBacklight = false; @@ -6791,7 +6792,7 @@ void LLPipeline::gammaCorrect(LLRenderTarget* src, LLRenderTarget* dst) { { LL_PROFILE_GPU_ZONE("gamma correct"); - static LLCachedControl<bool> no_post(gSavedSettings, "RenderDisablePostProcessing", false); + static LLCachedControl<bool> buildNoPost(gSavedSettings, "RenderDisablePostProcessing", false); LLGLDepthTest depth(GL_FALSE, GL_FALSE); @@ -6801,7 +6802,8 @@ void LLPipeline::gammaCorrect(LLRenderTarget* src, LLRenderTarget* dst) { LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky(); - LLGLSLShader& shader = no_post && gFloaterTools->isAvailable() ? gNoPostGammaCorrectProgram : // no post (no gamma, no exposure, no tonemapping) + bool no_post = gSnapshotNoPost || (buildNoPost && gFloaterTools->isAvailable()); + LLGLSLShader& shader = no_post ? gNoPostGammaCorrectProgram : // no post (no gamma, no exposure, no tonemapping) psky->getReflectionProbeAmbiance(should_auto_adjust) == 0.f ? gLegacyPostGammaCorrectProgram : gDeferredPostGammaCorrectProgram; diff --git a/indra/newview/skins/default/xui/en/floater_snapshot.xml b/indra/newview/skins/default/xui/en/floater_snapshot.xml index fcd24d83bb..1a1131e24c 100644 --- a/indra/newview/skins/default/xui/en/floater_snapshot.xml +++ b/indra/newview/skins/default/xui/en/floater_snapshot.xml @@ -5,7 +5,7 @@ can_minimize="true" can_resize="false" can_close="true" - height="455" + height="475" layout="topleft" name="Snapshot" single_instance="true" @@ -115,7 +115,7 @@ top_delta="0" width="31" /> <panel - height="159" + height="179" layout="topleft" follows="top|left" left="0" @@ -193,6 +193,14 @@ top_pad="1" width="180" name="auto_snapshot_check" /> + <check_box + label="No post-processing" + layout="topleft" + height="16" + left="10" + top_pad="1" + width="180" + name="no_post_check" /> <text type="string" length="1" @@ -391,8 +399,8 @@ name="thumbnail_placeholder" top="23" left="215" - width="400" - height="400" + width="420" + height="420" follows="top|left"/> <view_border bevel_style="in" diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 0bfdead6e7..2c4b03251a 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -1545,7 +1545,7 @@ function="World.EnvPreset" <menu_item_separator/> <menu_item_check - label="No Post" + label="No Post-processing" name="No Post"> <menu_item_check.on_check control="RenderDisablePostProcessing" /> diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index d1838fc7ef..6c841ac049 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -7014,6 +7014,19 @@ Please try again. </notification> <notification + icon="alertmodal.tga" + name="CantSelectReflectionProbe" + type="alertmodal"> + <unique/> + You have placed a reflection probe, but 'Select Reflection Probes' is disabled. To be able to select reflection probes, check Build > Options > Select Reflection Probes. + <tag>confirm</tag> + <usetemplate + ignoretext="Don't show again." + name="okignore" + yestext="OK"/> + </notification> + + <notification icon="notifytip.tga" name="ScriptMissing" type="notifytip"> |