diff options
| author | Callum Prentice <callum@lindenlab.com> | 2025-08-22 17:12:03 -0700 | 
|---|---|---|
| committer | Callum Prentice <callum@lindenlab.com> | 2025-08-22 17:12:03 -0700 | 
| commit | e935a8aebca4ae014b5f6b438612ac5674678fe6 (patch) | |
| tree | 531498d040a62c01d444fe91eb99afb091c7fff4 /indra/newview/llmaterialeditor.cpp | |
| parent | bebd1b208e1b342fabf59844851124a91513e83b (diff) | |
| parent | cefee59b0e5fff683a50fe61633a9c14493d7145 (diff) | |
Merge branch 'develop' into callum/viewer-cef-2025-08
Diffstat (limited to 'indra/newview/llmaterialeditor.cpp')
| -rw-r--r-- | indra/newview/llmaterialeditor.cpp | 28 | 
1 files changed, 17 insertions, 11 deletions
diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp index 3cab060357..3e5d6d1171 100644 --- a/indra/newview/llmaterialeditor.cpp +++ b/indra/newview/llmaterialeditor.cpp @@ -1415,7 +1415,7 @@ bool LLMaterialEditor::saveIfNeeded()          }          std::string res_desc = buildMaterialDescription(); -        createInventoryItem(buffer, mMaterialName, res_desc, local_permissions); +        createInventoryItem(buffer, mMaterialName, res_desc, local_permissions, mUploadFolder);          // We do not update floater with uploaded asset yet, so just close it.          closeFloater(); @@ -1585,12 +1585,12 @@ private:      std::string mNewName;  }; -void LLMaterialEditor::createInventoryItem(const std::string &buffer, const std::string &name, const std::string &desc, const LLPermissions& permissions) +void LLMaterialEditor::createInventoryItem(const std::string &buffer, const std::string &name, const std::string &desc, const LLPermissions& permissions, const LLUUID& upload_folder)  {      // gen a new uuid for this asset      LLTransactionID tid;      tid.generate();     // timestamp-based randomization + uniquification -    LLUUID parent = gInventory.findUserDefinedCategoryUUIDForType(LLFolderType::FT_MATERIAL); +    LLUUID parent = upload_folder.isNull() ? gInventory.findUserDefinedCategoryUUIDForType(LLFolderType::FT_MATERIAL) : upload_folder;      const U8 subtype = NO_INV_SUBTYPE;  // TODO maybe use AT_SETTINGS and LLSettingsType::ST_MATERIAL ?      LLPointer<LLObjectsMaterialItemCallback> cb = new LLObjectsMaterialItemCallback(permissions, buffer, name); @@ -1904,7 +1904,11 @@ static void pack_textures(      }  } -void LLMaterialEditor::uploadMaterialFromModel(const std::string& filename, tinygltf::Model& model_in, S32 index) +void LLMaterialEditor::uploadMaterialFromModel( +    const std::string& filename, +    tinygltf::Model& model_in, +    S32 index, +    const LLUUID& dest)  {      if (index < 0 || !LLMaterialEditor::capabilitiesAvailable())      { @@ -1927,12 +1931,13 @@ void LLMaterialEditor::uploadMaterialFromModel(const std::string& filename, tiny      // This uses 'filename' to make sure multiple bulk uploads work      // instead of fighting for a single instance.      LLMaterialEditor* me = (LLMaterialEditor*)LLFloaterReg::getInstance("material_editor", LLSD().with("filename", filename).with("index", LLSD::Integer(index))); +    me->mUploadFolder = dest;      me->loadMaterial(model_in, filename, index, false);      me->saveIfNeeded();  } -void LLMaterialEditor::loadMaterialFromFile(const std::string& filename, S32 index) +void LLMaterialEditor::loadMaterialFromFile(const std::string& filename, S32 index, const LLUUID& dest_folder)  {      LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; @@ -2432,17 +2437,17 @@ void LLMaterialEditor::onSaveObjectsMaterialAsMsgCallback(const LLSD& notificati          return;      } -    createInventoryItem(str.str(), new_name, std::string(), permissions); +    createInventoryItem(str.str(), new_name, std::string(), permissions, LLUUID::null);  } -const void upload_bulk(const std::vector<std::string>& filenames, LLFilePicker::ELoadFilter type, bool allow_2k); +void upload_bulk(const std::vector<std::string>& filenames, LLFilePicker::ELoadFilter type, bool allow_2k, const LLUUID& dest);  void LLMaterialEditor::loadMaterial(const tinygltf::Model &model_in, const std::string &filename, S32 index, bool open_floater)  {      if (index == model_in.materials.size())      {          // bulk upload all the things -        upload_bulk({ filename }, LLFilePicker::FFLOAD_MATERIAL, true); +        upload_bulk({ filename }, LLFilePicker::FFLOAD_MATERIAL, true, LLUUID::null);          return;      } @@ -2872,10 +2877,10 @@ void LLMaterialEditor::setFromGltfMetaData(const std::string& filename, const ti      }  } -void LLMaterialEditor::importMaterial() +void LLMaterialEditor::importMaterial(const LLUUID dest_folder)  {      LLFilePickerReplyThread::startPicker( -        [](const std::vector<std::string>& filenames, LLFilePicker::ELoadFilter load_filter, LLFilePicker::ESaveFilter save_filter) +        [dest_folder](const std::vector<std::string>& filenames, LLFilePicker::ELoadFilter load_filter, LLFilePicker::ESaveFilter save_filter)              {                  if (LLAppViewer::instance()->quitRequested())                  { @@ -2885,7 +2890,7 @@ void LLMaterialEditor::importMaterial()                  {                      if (filenames.size() > 0)                      { -                        LLMaterialEditor::loadMaterialFromFile(filenames[0], -1); +                        LLMaterialEditor::loadMaterialFromFile(filenames[0], -1, dest_folder);                      }                  }                  catch (std::bad_alloc&) @@ -3573,6 +3578,7 @@ void LLMaterialEditor::saveTexture(LLImageJ2C* img, const std::string& name, con          LLFloaterPerms::getGroupPerms("Uploads"),          LLFloaterPerms::getEveryonePerms("Uploads"),          expected_upload_cost, +        mUploadFolder,          false,          cb,          failed_upload));  | 
