From 8c0163bcb48df56112a625550d411741c20c5846 Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Wed, 13 Apr 2022 12:32:58 -0600 Subject: SL-17214 initial loader class skeleton --- indra/newview/llviewermenufile.cpp | 7 ------- 1 file changed, 7 deletions(-) (limited to 'indra/newview/llviewermenufile.cpp') diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index 28ff69eaf5..32fdfe282d 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -277,9 +277,6 @@ void LLMediaFilePicker::notify(const std::vector& filenames) static std::string SOUND_EXTENSIONS = "wav"; static std::string IMAGE_EXTENSIONS = "tga bmp jpg jpeg png"; static std::string ANIM_EXTENSIONS = "bvh anim"; -#ifdef _CORY_TESTING -static std::string GEOMETRY_EXTENSIONS = "slg"; -#endif static std::string XML_EXTENSIONS = "xml"; static std::string SLOBJECT_EXTENSIONS = "slobject"; #endif @@ -301,10 +298,6 @@ std::string build_extensions_string(LLFilePicker::ELoadFilter filter) return SLOBJECT_EXTENSIONS; case LLFilePicker::FFLOAD_MODEL: return MODEL_EXTENSIONS; -#ifdef _CORY_TESTING - case LLFilePicker::FFLOAD_GEOMETRY: - return GEOMETRY_EXTENSIONS; -#endif case LLFilePicker::FFLOAD_XML: return XML_EXTENSIONS; case LLFilePicker::FFLOAD_ALL: -- cgit v1.2.3 From f5d66e79eec07384ef6f4fd3f516f7a9d010fb9e Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 15 Jun 2022 17:03:38 -0500 Subject: SL-17605 WIP - Upload->Material now lets you pick a GLTF file and imports the first material in the GLTF file to the Material Editor --- indra/newview/llviewermenufile.cpp | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'indra/newview/llviewermenufile.cpp') diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index 32fdfe282d..975e3b97ec 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -37,6 +37,7 @@ #include "llbuycurrencyhtml.h" #include "llfloatermap.h" #include "llfloatermodelpreview.h" +#include "llmaterialeditor.h" #include "llfloatersnapshot.h" #include "llfloateroutfitsnapshot.h" #include "llimage.h" @@ -101,6 +102,20 @@ class LLFileEnableUploadModel : public view_listener_t } }; +class LLFileEnableUploadMaterial : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + LLMaterialEditor* me = (LLMaterialEditor*)LLFloaterReg::findInstance("material_editor"); + if (me && me->isShown()) + { + return false; + } + + return true; + } +}; + class LLMeshEnabled : public view_listener_t { bool handleEvent(const LLSD& userdata) @@ -282,6 +297,7 @@ static std::string SLOBJECT_EXTENSIONS = "slobject"; #endif static std::string ALL_FILE_EXTENSIONS = "*.*"; static std::string MODEL_EXTENSIONS = "dae"; +static std::string MATERIAL_EXTENSIONS = "gltf glb"; std::string build_extensions_string(LLFilePicker::ELoadFilter filter) { @@ -298,6 +314,8 @@ std::string build_extensions_string(LLFilePicker::ELoadFilter filter) return SLOBJECT_EXTENSIONS; case LLFilePicker::FFLOAD_MODEL: return MODEL_EXTENSIONS; + case LLFilePicker::FFLOAD_MATERIAL: + return MATERIAL_EXTENSIONS; case LLFilePicker::FFLOAD_XML: return XML_EXTENSIONS; case LLFilePicker::FFLOAD_ALL: @@ -566,7 +584,20 @@ class LLFileUploadModel : public view_listener_t return TRUE; } }; - + +class LLFileUploadMaterial : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + LLMaterialEditor* me = (LLMaterialEditor*)LLFloaterReg::getInstance("material_editor"); + if (me) + { + me->importMaterial(); + } + return TRUE; + } +}; + class LLFileUploadSound : public view_listener_t { bool handleEvent(const LLSD& userdata) @@ -1097,6 +1128,7 @@ void init_menu_file() view_listener_t::addCommit(new LLFileUploadSound(), "File.UploadSound"); view_listener_t::addCommit(new LLFileUploadAnim(), "File.UploadAnim"); view_listener_t::addCommit(new LLFileUploadModel(), "File.UploadModel"); + view_listener_t::addCommit(new LLFileUploadMaterial(), "File.UploadMaterial"); view_listener_t::addCommit(new LLFileUploadBulk(), "File.UploadBulk"); view_listener_t::addCommit(new LLFileCloseWindow(), "File.CloseWindow"); view_listener_t::addCommit(new LLFileCloseAllWindows(), "File.CloseAllWindows"); -- cgit v1.2.3 From 0d217dc73c6530dcbceb306c4609e2d72da6d70b Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Sat, 20 Aug 2022 01:04:42 +0300 Subject: SL-17653 Local gltf materials #2 --- indra/newview/llviewermenufile.cpp | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'indra/newview/llviewermenufile.cpp') diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index 148a76d93b..ffa2ce865e 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -249,6 +249,16 @@ LLFilePickerReplyThread::~LLFilePickerReplyThread() delete mFailureSignal; } +void LLFilePickerReplyThread::startPicker(const file_picked_signal_t::slot_type & cb, LLFilePicker::ELoadFilter filter, bool get_multiple, const file_picked_signal_t::slot_type & failure_cb) +{ + (new LLFilePickerReplyThread(cb, filter, get_multiple, failure_cb))->getFile(); +} + +void LLFilePickerReplyThread::startPicker(const file_picked_signal_t::slot_type & cb, LLFilePicker::ESaveFilter filter, const std::string & proposed_name, const file_picked_signal_t::slot_type & failure_cb) +{ + (new LLFilePickerReplyThread(cb, filter, proposed_name, failure_cb))->getFile(); +} + void LLFilePickerReplyThread::notify(const std::vector& filenames) { if (filenames.empty()) @@ -571,7 +581,7 @@ class LLFileUploadImage : public view_listener_t { gAgentCamera.changeCameraToDefault(); } - (new LLFilePickerReplyThread(boost::bind(&upload_single_file, _1, _2), LLFilePicker::FFLOAD_IMAGE, false))->getFile(); + LLFilePickerReplyThread::startPicker(boost::bind(&upload_single_file, _1, _2), LLFilePicker::FFLOAD_IMAGE, false); return true; } }; @@ -589,11 +599,7 @@ class LLFileUploadMaterial : public view_listener_t { bool handleEvent(const LLSD& userdata) { - LLMaterialEditor* me = (LLMaterialEditor*)LLFloaterReg::getInstance("material_editor"); - if (me) - { - me->importMaterial(); - } + LLMaterialEditor::importMaterial(); return TRUE; } }; @@ -606,7 +612,7 @@ class LLFileUploadSound : public view_listener_t { gAgentCamera.changeCameraToDefault(); } - (new LLFilePickerReplyThread(boost::bind(&upload_single_file, _1, _2), LLFilePicker::FFLOAD_WAV, false))->getFile(); + LLFilePickerReplyThread::startPicker(boost::bind(&upload_single_file, _1, _2), LLFilePicker::FFLOAD_WAV, false); return true; } }; @@ -619,7 +625,7 @@ class LLFileUploadAnim : public view_listener_t { gAgentCamera.changeCameraToDefault(); } - (new LLFilePickerReplyThread(boost::bind(&upload_single_file, _1, _2), LLFilePicker::FFLOAD_ANIM, false))->getFile(); + LLFilePickerReplyThread::startPicker(boost::bind(&upload_single_file, _1, _2), LLFilePicker::FFLOAD_ANIM, false); return true; } }; @@ -632,7 +638,7 @@ class LLFileUploadBulk : public view_listener_t { gAgentCamera.changeCameraToDefault(); } - (new LLFilePickerReplyThread(boost::bind(&upload_bulk, _1, _2), LLFilePicker::FFLOAD_ALL, true))->getFile(); + LLFilePickerReplyThread::startPicker(boost::bind(&upload_bulk, _1, _2), LLFilePicker::FFLOAD_ALL, true); return true; } }; -- cgit v1.2.3 From 094a8876d6e030b5dc618ea28250e15022030c78 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Mon, 31 Oct 2022 20:12:53 +0200 Subject: SL-18446 Material override arrival filtering --- indra/newview/llviewermenufile.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llviewermenufile.cpp') diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index ffa2ce865e..25eb3eff1d 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -106,8 +106,7 @@ class LLFileEnableUploadMaterial : public view_listener_t { bool handleEvent(const LLSD& userdata) { - LLMaterialEditor* me = (LLMaterialEditor*)LLFloaterReg::findInstance("material_editor"); - if (me && me->isShown()) + if (!gAgent.getRegionCapability("UpdateMaterialAgentInventory").empty()) { return false; } @@ -1145,6 +1144,7 @@ void init_menu_file() view_listener_t::addEnable(new LLFileEnableUpload(), "File.EnableUpload"); view_listener_t::addEnable(new LLFileEnableUploadModel(), "File.EnableUploadModel"); + view_listener_t::addEnable(new LLFileEnableUploadMaterial(), "File.EnableUploadMaterial"); view_listener_t::addMenu(new LLMeshEnabled(), "File.MeshEnabled"); view_listener_t::addMenu(new LLMeshUploadVisible(), "File.VisibleUploadModel"); -- cgit v1.2.3 From e73c5e4ee38dee244d56f3b58e9595d7d976834a Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Mon, 31 Oct 2022 23:15:10 +0200 Subject: SL-18448 Do not show editor when saving material inworld, only a name prompt --- indra/newview/llviewermenufile.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llviewermenufile.cpp') diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index 25eb3eff1d..c028a663ea 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -106,7 +106,7 @@ class LLFileEnableUploadMaterial : public view_listener_t { bool handleEvent(const LLSD& userdata) { - if (!gAgent.getRegionCapability("UpdateMaterialAgentInventory").empty()) + if (gAgent.getRegionCapability("UpdateMaterialAgentInventory").empty()) { return false; } -- cgit v1.2.3 From 321c7895d00b0b88675c06b8f1cef063632fd686 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 1 Dec 2022 21:54:49 +0200 Subject: SL-18741 Basic bulk upload for gltf materials #1 --- indra/newview/llviewermenufile.cpp | 81 +++++++++++++++++++++++++++++++------- 1 file changed, 67 insertions(+), 14 deletions(-) (limited to 'indra/newview/llviewermenufile.cpp') diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index c028a663ea..33c7240fe0 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -38,6 +38,7 @@ #include "llfloatermap.h" #include "llfloatermodelpreview.h" #include "llmaterialeditor.h" +#include "llfloaterperms.h" #include "llfloatersnapshot.h" #include "llfloateroutfitsnapshot.h" #include "llimage.h" @@ -49,9 +50,9 @@ #include "llinventorymodel.h" // gInventory #include "llpluginclassmedia.h" #include "llresourcedata.h" -#include "lltoast.h" -#include "llfloaterperms.h" #include "llstatusbar.h" +#include "lltinygltfhelper.h" +#include "lltoast.h" #include "llviewercontrol.h" // gSavedSettings #include "llviewertexturelist.h" #include "lluictrlfactory.h" @@ -471,19 +472,33 @@ void do_bulk_upload(std::vector filenames, const LLSD& notification if (LLResourceUploadInfo::findAssetTypeAndCodecOfExtension(ext, asset_type, codec) && LLAgentBenefitsMgr::current().findUploadCost(asset_type, expected_upload_cost)) { - LLResourceUploadInfo::ptr_t uploadInfo(new LLNewFileResourceUploadInfo( - filename, - asset_name, - asset_name, 0, - LLFolderType::FT_NONE, LLInventoryType::IT_NONE, - LLFloaterPerms::getNextOwnerPerms("Uploads"), - LLFloaterPerms::getGroupPerms("Uploads"), - LLFloaterPerms::getEveryonePerms("Uploads"), - expected_upload_cost)); + LLResourceUploadInfo::ptr_t uploadInfo(new LLNewFileResourceUploadInfo( + filename, + asset_name, + asset_name, 0, + LLFolderType::FT_NONE, LLInventoryType::IT_NONE, + LLFloaterPerms::getNextOwnerPerms("Uploads"), + LLFloaterPerms::getGroupPerms("Uploads"), + LLFloaterPerms::getEveryonePerms("Uploads"), + expected_upload_cost)); + + upload_new_resource(uploadInfo); + } - upload_new_resource(uploadInfo); - } -} + // gltf does not use normal upload procedure + if (ext == "gltf" || ext == "glb") + { + S32 materials_in_file = LLTinyGLTFHelper::getMaterialCountFromFile(filename); + + for (S32 i = 0; i < materials_in_file; i++) + { + // Todo: + // 1. Decouple bulk upload from material editor + // 2. Take into account possiblity of identical textures + LLMaterialEditor::uploadMaterialFromFile(filename, i); + } + } + } } bool get_bulk_upload_expected_cost(const std::vector& filenames, S32& total_cost, S32& file_count, S32& bvh_count) @@ -511,6 +526,44 @@ bool get_bulk_upload_expected_cost(const std::vector& filenames, S3 total_cost += cost; file_count++; } + + if (ext == "gltf" || ext == "glb") + { + S32 texture_upload_cost = LLAgentBenefitsMgr::current().getTextureUploadCost(); + S32 materials_in_file = LLTinyGLTFHelper::getMaterialCountFromFile(filename); + + for (S32 i = 0; i < materials_in_file; i++) + { + LLPointer material = new LLFetchedGLTFMaterial(); + std::string material_name; + bool decode_successful = LLTinyGLTFHelper::getMaterialFromFile(filename, i, material.get(), material_name); + + if (decode_successful) + { + // Todo: make it account for possibility of same texture in different + // materials and even in scope of same material + S32 texture_count = 0; + if (material->mBaseColorId.notNull()) + { + texture_count++; + } + if (material->mMetallicRoughnessId.notNull()) + { + texture_count++; + } + if (material->mNormalId.notNull()) + { + texture_count++; + } + if (material->mEmissiveId.notNull()) + { + texture_count++; + } + total_cost += texture_count * texture_upload_cost; + file_count++; + } + } + } } return file_count > 0; -- cgit v1.2.3 From d6841c07983a46ff805ed23a7318efbf9cca3b24 Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Thu, 9 Feb 2023 15:04:46 -0800 Subject: SL-19080: Update GLTF Material asset upload to v1.1, with stricter GLTF compliance and removal of unsupported features --- indra/newview/llviewermenufile.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/newview/llviewermenufile.cpp') diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index 84b0010545..9743f00ab8 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -543,19 +543,19 @@ bool get_bulk_upload_expected_cost(const std::vector& filenames, S3 // Todo: make it account for possibility of same texture in different // materials and even in scope of same material S32 texture_count = 0; - if (material->mBaseColorId.notNull()) + if (material->mTextureId[LLGLTFMaterial::GLTF_TEXTURE_INFO_BASE_COLOR].notNull()) { texture_count++; } - if (material->mMetallicRoughnessId.notNull()) + if (material->mTextureId[LLGLTFMaterial::GLTF_TEXTURE_INFO_METALLIC_ROUGHNESS].notNull()) { texture_count++; } - if (material->mNormalId.notNull()) + if (material->mTextureId[LLGLTFMaterial::GLTF_TEXTURE_INFO_NORMAL].notNull()) { texture_count++; } - if (material->mEmissiveId.notNull()) + if (material->mTextureId[LLGLTFMaterial::GLTF_TEXTURE_INFO_EMISSIVE].notNull()) { texture_count++; } -- cgit v1.2.3 From b9b913a60ada97fc61bf2176e443dc72c8359ccb Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 7 Mar 2023 09:38:43 -0600 Subject: SL-19349 Fix for hang on bulk upload of materials, add bulk upload option to material selector, incidental decruft. --- indra/newview/llviewermenufile.cpp | 74 +++++++++++++++++++++----------------- 1 file changed, 42 insertions(+), 32 deletions(-) (limited to 'indra/newview/llviewermenufile.cpp') diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index 9743f00ab8..fb5c548b2a 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -488,14 +488,18 @@ void do_bulk_upload(std::vector filenames, const LLSD& notification // gltf does not use normal upload procedure if (ext == "gltf" || ext == "glb") { - S32 materials_in_file = LLTinyGLTFHelper::getMaterialCountFromFile(filename); - - for (S32 i = 0; i < materials_in_file; i++) + tinygltf::Model model; + if (LLTinyGLTFHelper::loadModel(filename, model)) { - // Todo: - // 1. Decouple bulk upload from material editor - // 2. Take into account possiblity of identical textures - LLMaterialEditor::uploadMaterialFromFile(filename, i); + S32 materials_in_file = model.materials.size(); + + for (S32 i = 0; i < materials_in_file; i++) + { + // Todo: + // 1. Decouple bulk upload from material editor + // 2. Take into account possiblity of identical textures + LLMaterialEditor::uploadMaterialFromModel(filename, model, i); + } } } } @@ -530,37 +534,43 @@ bool get_bulk_upload_expected_cost(const std::vector& filenames, S3 if (ext == "gltf" || ext == "glb") { S32 texture_upload_cost = LLAgentBenefitsMgr::current().getTextureUploadCost(); - S32 materials_in_file = LLTinyGLTFHelper::getMaterialCountFromFile(filename); + + tinygltf::Model model; - for (S32 i = 0; i < materials_in_file; i++) + if (LLTinyGLTFHelper::loadModel(filename, model)) { - LLPointer material = new LLFetchedGLTFMaterial(); - std::string material_name; - bool decode_successful = LLTinyGLTFHelper::getMaterialFromFile(filename, i, material.get(), material_name); + S32 materials_in_file = model.materials.size(); - if (decode_successful) + for (S32 i = 0; i < materials_in_file; i++) { - // Todo: make it account for possibility of same texture in different - // materials and even in scope of same material - S32 texture_count = 0; - if (material->mTextureId[LLGLTFMaterial::GLTF_TEXTURE_INFO_BASE_COLOR].notNull()) - { - texture_count++; - } - if (material->mTextureId[LLGLTFMaterial::GLTF_TEXTURE_INFO_METALLIC_ROUGHNESS].notNull()) - { - texture_count++; - } - if (material->mTextureId[LLGLTFMaterial::GLTF_TEXTURE_INFO_NORMAL].notNull()) - { - texture_count++; - } - if (material->mTextureId[LLGLTFMaterial::GLTF_TEXTURE_INFO_EMISSIVE].notNull()) + LLPointer material = new LLFetchedGLTFMaterial(); + std::string material_name; + bool decode_successful = LLTinyGLTFHelper::getMaterialFromModel(filename, model, i, material.get(), material_name); + + if (decode_successful) { - texture_count++; + // Todo: make it account for possibility of same texture in different + // materials and even in scope of same material + S32 texture_count = 0; + if (material->mTextureId[LLGLTFMaterial::GLTF_TEXTURE_INFO_BASE_COLOR].notNull()) + { + texture_count++; + } + if (material->mTextureId[LLGLTFMaterial::GLTF_TEXTURE_INFO_METALLIC_ROUGHNESS].notNull()) + { + texture_count++; + } + if (material->mTextureId[LLGLTFMaterial::GLTF_TEXTURE_INFO_NORMAL].notNull()) + { + texture_count++; + } + if (material->mTextureId[LLGLTFMaterial::GLTF_TEXTURE_INFO_EMISSIVE].notNull()) + { + texture_count++; + } + total_cost += texture_count * texture_upload_cost; + file_count++; } - total_cost += texture_count * texture_upload_cost; - file_count++; } } } -- cgit v1.2.3 From 70eda83fb08c5c4e8b0ea95868243d744c6e88e9 Mon Sep 17 00:00:00 2001 From: Alexander Gavriliuk Date: Mon, 20 Nov 2023 21:25:06 +0100 Subject: SL-20563 Add 'No Post' option to Snapshot floater --- indra/newview/llviewermenufile.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'indra/newview/llviewermenufile.cpp') 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 { -- cgit v1.2.3