From c355fb98d3f4040196b7b8586dc9328fccb906d2 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Mon, 3 Sep 2012 06:12:50 +0000 Subject: Extracted texture baking system into llappearance library. --- indra/newview/llwearablelist.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'indra/newview/llwearablelist.cpp') diff --git a/indra/newview/llwearablelist.cpp b/indra/newview/llwearablelist.cpp index 6f6411ce3c..9f04fbecf0 100644 --- a/indra/newview/llwearablelist.cpp +++ b/indra/newview/llwearablelist.cpp @@ -42,7 +42,7 @@ struct LLWearableArrivedData { LLWearableArrivedData(LLAssetType::EType asset_type, const std::string& wearable_name, - void(*asset_arrived_callback)(LLWearable*, void* userdata), + void(*asset_arrived_callback)(LLViewerWearable*, void* userdata), void* userdata) : mAssetType( asset_type ), mCallback( asset_arrived_callback ), @@ -52,7 +52,7 @@ struct LLWearableArrivedData {} LLAssetType::EType mAssetType; - void (*mCallback)(LLWearable*, void* userdata); + void (*mCallback)(LLViewerWearable*, void* userdata); void* mUserdata; std::string mName; S32 mRetries; @@ -72,10 +72,10 @@ void LLWearableList::cleanup() mList.clear(); } -void LLWearableList::getAsset(const LLAssetID& assetID, const std::string& wearable_name, LLAssetType::EType asset_type, void(*asset_arrived_callback)(LLWearable*, void* userdata), void* userdata) +void LLWearableList::getAsset(const LLAssetID& assetID, const std::string& wearable_name, LLAssetType::EType asset_type, void(*asset_arrived_callback)(LLViewerWearable*, void* userdata), void* userdata) { llassert( (asset_type == LLAssetType::AT_CLOTHING) || (asset_type == LLAssetType::AT_BODYPART) ); - LLWearable* instance = get_if_there(mList, assetID, (LLWearable*)NULL ); + LLViewerWearable* instance = get_if_there(mList, assetID, (LLViewerWearable*)NULL ); if( instance ) { asset_arrived_callback( instance, userdata ); @@ -95,7 +95,7 @@ void LLWearableList::processGetAssetReply( const char* filename, const LLAssetID { BOOL isNewWearable = FALSE; LLWearableArrivedData* data = (LLWearableArrivedData*) userdata; - LLWearable* wearable = NULL; // NULL indicates failure + LLViewerWearable* wearable = NULL; // NULL indicates failure if( !filename ) { @@ -111,7 +111,7 @@ void LLWearableList::processGetAssetReply( const char* filename, const LLAssetID } else { - wearable = new LLWearable(uuid); + wearable = new LLViewerWearable(uuid); bool res = wearable->importFile( fp ); if (!res) { @@ -203,11 +203,11 @@ void LLWearableList::processGetAssetReply( const char* filename, const LLAssetID } -LLWearable* LLWearableList::createCopy(const LLWearable* old_wearable, const std::string& new_name) +LLViewerWearable* LLWearableList::createCopy(const LLViewerWearable* old_wearable, const std::string& new_name) { lldebugs << "LLWearableList::createCopy()" << llendl; - LLWearable *wearable = generateNewWearable(); + LLViewerWearable *wearable = generateNewWearable(); wearable->copyDataFrom(old_wearable); LLPermissions perm(old_wearable->getPermissions()); @@ -222,11 +222,11 @@ LLWearable* LLWearableList::createCopy(const LLWearable* old_wearable, const std return wearable; } -LLWearable* LLWearableList::createNewWearable( LLWearableType::EType type ) +LLViewerWearable* LLWearableList::createNewWearable( LLWearableType::EType type ) { lldebugs << "LLWearableList::createNewWearable()" << llendl; - LLWearable *wearable = generateNewWearable(); + LLViewerWearable *wearable = generateNewWearable(); wearable->setType( type ); std::string name = LLTrans::getString( LLWearableType::getTypeDefaultNewName(wearable->getType()) ); @@ -251,13 +251,13 @@ LLWearable* LLWearableList::createNewWearable( LLWearableType::EType type ) return wearable; } -LLWearable *LLWearableList::generateNewWearable() +LLViewerWearable *LLWearableList::generateNewWearable() { LLTransactionID tid; tid.generate(); LLAssetID new_asset_id = tid.makeAssetID(gAgent.getSecureSessionID()); - LLWearable* wearable = new LLWearable(tid); + LLViewerWearable* wearable = new LLViewerWearable(tid); mList[new_asset_id] = wearable; return wearable; } -- cgit v1.2.3 From 7b4385420edf3f431ddc4a7042bbc9623ffedd34 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Tue, 4 Sep 2012 04:24:47 +0000 Subject: More clean-up to closer match original file order. For llavatarappearance diffs --- indra/newview/llwearablelist.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llwearablelist.cpp') diff --git a/indra/newview/llwearablelist.cpp b/indra/newview/llwearablelist.cpp index 9f04fbecf0..6c4790ad77 100644 --- a/indra/newview/llwearablelist.cpp +++ b/indra/newview/llwearablelist.cpp @@ -112,8 +112,8 @@ void LLWearableList::processGetAssetReply( const char* filename, const LLAssetID else { wearable = new LLViewerWearable(uuid); - bool res = wearable->importFile( fp ); - if (!res) + LLWearable::EImportResult result = wearable->importFile( fp ); + if (LLWearable::SUCCESS != result) { if (wearable->getType() == LLWearableType::WT_COUNT) { -- cgit v1.2.3 From f1d6052e36ed6d817faedf9b32cb9d889395cd88 Mon Sep 17 00:00:00 2001 From: "Nyx (Neal Orman)" Date: Tue, 11 Sep 2012 11:59:45 -0400 Subject: SH-3264 Moved over a few more items to llappearance moved over: isWearingWearableType wearable::writeToAvatar wearable::mTEMap (stores LocalTextureObject*) more from wearable::import/export wearable::createVisualParams, etc --- indra/newview/llwearablelist.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'indra/newview/llwearablelist.cpp') diff --git a/indra/newview/llwearablelist.cpp b/indra/newview/llwearablelist.cpp index 6c4790ad77..50beaaec3f 100644 --- a/indra/newview/llwearablelist.cpp +++ b/indra/newview/llwearablelist.cpp @@ -42,13 +42,15 @@ struct LLWearableArrivedData { LLWearableArrivedData(LLAssetType::EType asset_type, const std::string& wearable_name, + LLAvatarAppearance* avatarp, void(*asset_arrived_callback)(LLViewerWearable*, void* userdata), void* userdata) : mAssetType( asset_type ), mCallback( asset_arrived_callback ), mUserdata( userdata ), mName( wearable_name ), - mRetries(0) + mRetries(0), + mAvatarp(avatarp) {} LLAssetType::EType mAssetType; @@ -56,6 +58,7 @@ struct LLWearableArrivedData void* mUserdata; std::string mName; S32 mRetries; + LLAvatarAppearance *mAvatarp; }; //////////////////////////////////////////////////////////////////////////// @@ -72,7 +75,7 @@ void LLWearableList::cleanup() mList.clear(); } -void LLWearableList::getAsset(const LLAssetID& assetID, const std::string& wearable_name, LLAssetType::EType asset_type, void(*asset_arrived_callback)(LLViewerWearable*, void* userdata), void* userdata) +void LLWearableList::getAsset(const LLAssetID& assetID, const std::string& wearable_name, LLAvatarAppearance* avatarp, LLAssetType::EType asset_type, void(*asset_arrived_callback)(LLViewerWearable*, void* userdata), void* userdata) { llassert( (asset_type == LLAssetType::AT_CLOTHING) || (asset_type == LLAssetType::AT_BODYPART) ); LLViewerWearable* instance = get_if_there(mList, assetID, (LLViewerWearable*)NULL ); @@ -85,7 +88,7 @@ void LLWearableList::getAsset(const LLAssetID& assetID, const std::string& weara gAssetStorage->getAssetData(assetID, asset_type, LLWearableList::processGetAssetReply, - (void*)new LLWearableArrivedData( asset_type, wearable_name, asset_arrived_callback, userdata ), + (void*)new LLWearableArrivedData( asset_type, wearable_name, avatarp, asset_arrived_callback, userdata ), TRUE); } } @@ -96,11 +99,16 @@ void LLWearableList::processGetAssetReply( const char* filename, const LLAssetID BOOL isNewWearable = FALSE; LLWearableArrivedData* data = (LLWearableArrivedData*) userdata; LLViewerWearable* wearable = NULL; // NULL indicates failure + LLAvatarAppearance *avatarp = data->mAvatarp; if( !filename ) { LL_WARNS("Wearable") << "Bad Wearable Asset: missing file." << LL_ENDL; } + else if(!avatarp) + { + LL_WARNS("Wearable") << "Bad asset request: missing avatar pointer." << LL_ENDL; + } else if (status >= 0) { // read the file @@ -112,7 +120,7 @@ void LLWearableList::processGetAssetReply( const char* filename, const LLAssetID else { wearable = new LLViewerWearable(uuid); - LLWearable::EImportResult result = wearable->importFile( fp ); + LLWearable::EImportResult result = wearable->importFile( fp, avatarp ); if (LLWearable::SUCCESS != result) { if (wearable->getType() == LLWearableType::WT_COUNT) @@ -222,12 +230,12 @@ LLViewerWearable* LLWearableList::createCopy(const LLViewerWearable* old_wearabl return wearable; } -LLViewerWearable* LLWearableList::createNewWearable( LLWearableType::EType type ) +LLViewerWearable* LLWearableList::createNewWearable( LLWearableType::EType type, LLAvatarAppearance *avatarp ) { lldebugs << "LLWearableList::createNewWearable()" << llendl; LLViewerWearable *wearable = generateNewWearable(); - wearable->setType( type ); + wearable->setType( type, avatarp ); std::string name = LLTrans::getString( LLWearableType::getTypeDefaultNewName(wearable->getType()) ); wearable->setName( name ); -- cgit v1.2.3 From 7153d1db11c00245a379fa9601f092020152ea73 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Thu, 20 Sep 2012 04:29:17 +0000 Subject: Partial rewrite of llifstream and llofstream (Windows implementation pending). Moved more functionality from llviewerwearable to llwearable --- indra/newview/llwearablelist.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/newview/llwearablelist.cpp') diff --git a/indra/newview/llwearablelist.cpp b/indra/newview/llwearablelist.cpp index 50beaaec3f..3dfacd70f3 100644 --- a/indra/newview/llwearablelist.cpp +++ b/indra/newview/llwearablelist.cpp @@ -112,15 +112,16 @@ void LLWearableList::processGetAssetReply( const char* filename, const LLAssetID else if (status >= 0) { // read the file - LLFILE* fp = LLFile::fopen(std::string(filename), "rb"); /*Flawfinder: ignore*/ - if( !fp ) + llifstream ifs(filename, llifstream::binary); + if( !ifs.is_open() ) { LL_WARNS("Wearable") << "Bad Wearable Asset: unable to open file: '" << filename << "'" << LL_ENDL; } else { wearable = new LLViewerWearable(uuid); - LLWearable::EImportResult result = wearable->importFile( fp, avatarp ); + LLWearable::EImportResult result = wearable->importStream( + ifs, avatarp ); if (LLWearable::SUCCESS != result) { if (wearable->getType() == LLWearableType::WT_COUNT) @@ -131,7 +132,6 @@ void LLWearableList::processGetAssetReply( const char* filename, const LLAssetID wearable = NULL; } - fclose( fp ); if(filename) { LLFile::remove(std::string(filename)); -- cgit v1.2.3 From 6a94c257a1c030978f4f7705ade39be4abb50b39 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 7 Nov 2012 18:54:20 -0500 Subject: Fixed a temp file deletion problem found by inspection of SL log file --- indra/newview/llwearablelist.cpp | 4 ++++ 1 file changed, 4 insertions(+) mode change 100644 => 100755 indra/newview/llwearablelist.cpp (limited to 'indra/newview/llwearablelist.cpp') diff --git a/indra/newview/llwearablelist.cpp b/indra/newview/llwearablelist.cpp old mode 100644 new mode 100755 index 3dfacd70f3..507ce57e79 --- a/indra/newview/llwearablelist.cpp +++ b/indra/newview/llwearablelist.cpp @@ -134,6 +134,10 @@ void LLWearableList::processGetAssetReply( const char* filename, const LLAssetID if(filename) { + if (ifs.is_open()) + { + ifs.close(); + } LLFile::remove(std::string(filename)); } } -- cgit v1.2.3 From 3e5599a827238faa4fcccfad9702428ce4ea6f46 Mon Sep 17 00:00:00 2001 From: Nyx Linden Date: Fri, 1 Mar 2013 19:39:47 -0500 Subject: SH-3649 WIP newly created pants do not show up on mac/windows. Added an initializer for the wearable definition version when creating a new wearable. Should fix the issue but need to test. --- indra/newview/llwearablelist.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/llwearablelist.cpp') diff --git a/indra/newview/llwearablelist.cpp b/indra/newview/llwearablelist.cpp index 507ce57e79..ef1a953f59 100755 --- a/indra/newview/llwearablelist.cpp +++ b/indra/newview/llwearablelist.cpp @@ -249,6 +249,8 @@ LLViewerWearable* LLWearableList::createNewWearable( LLWearableType::EType type, perm.initMasks(PERM_ALL, PERM_ALL, PERM_NONE, PERM_NONE, PERM_MOVE | PERM_TRANSFER); wearable->setPermissions(perm); + wearable->setDefinitionVersion(LLWearable::getCurrentDefinitionVersion()); + // Description and sale info have default values. wearable->setParamsToDefaults(); wearable->setTexturesToDefaults(); -- cgit v1.2.3