From 017648566c2701be5b404b96400d16b3b4efa676 Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Thu, 5 May 2011 08:17:49 -0700 Subject: changed several lldebugs to LL_DEBUGS(Inventory) --- linden/indra/newview/llinventorymodel.cpp | 56 +++++++++++++++---------------- 1 file changed, 28 insertions(+), 28 deletions(-) (limited to 'linden/indra') diff --git a/linden/indra/newview/llinventorymodel.cpp b/linden/indra/newview/llinventorymodel.cpp index 1c7a049..5c1ae22 100644 --- a/linden/indra/newview/llinventorymodel.cpp +++ b/linden/indra/newview/llinventorymodel.cpp @@ -404,7 +404,7 @@ LLUUID LLInventoryModel::createNewCategory(const LLUUID& parent_id, if(preferred_type == LLAssetType::AT_SIMSTATE) { - lldebugs << "Attempt to create simstate category." << llendl; + LL_DEBUGS("Inventory") << "Attempt to create simstate category." << LL_ENDL; return id; } @@ -761,7 +761,7 @@ void LLInventoryModel::updateCategory(const LLViewerInventoryCategory* cat) void LLInventoryModel::moveObject(const LLUUID& object_id, const LLUUID& cat_id) { - lldebugs << "LLInventoryModel::moveObject()" << llendl; + LL_DEBUGS("Inventory") << "LLInventoryModel::moveObject()" << LL_ENDL; if(!isInventoryUsable()) { llwarns << "Inventory is broken." << llendl; @@ -803,11 +803,11 @@ void LLInventoryModel::moveObject(const LLUUID& object_id, const LLUUID& cat_id) // Delete a particular inventory object by ID. void LLInventoryModel::deleteObject(const LLUUID& id) { - lldebugs << "LLInventoryModel::deleteObject()" << llendl; + LL_DEBUGS("Inventory") << "LLInventoryModel::deleteObject()" << LL_ENDL; LLPointer obj = getObject(id); if(obj) { - lldebugs << "Deleting inventory object " << id << llendl; + LL_DEBUGS("Inventory") << "Deleting inventory object " << id << LL_ENDL; mLastItem = NULL; LLUUID parent_id = obj->getParentUUID(); mCategoryMap.erase(id); @@ -1103,8 +1103,8 @@ void LLInventoryModel::fetchInventoryResponder::result(const LLSD& content) LLPointer titem = new LLViewerInventoryItem; titem->unpackMessage(content["items"][i]); - lldebugs << "LLInventoryModel::messageUpdateCore() item id:" - << titem->getUUID() << llendl; + LL_DEBUGS("Inventory") << "LLInventoryModel::messageUpdateCore() item id:" + << titem->getUUID() << LL_ENDL; items.push_back(titem); // examine update for changes. LLViewerInventoryItem* itemp = gInventory.getItem(titem->getUUID()); @@ -1673,8 +1673,8 @@ void LLInventoryModel::cache( const LLUUID& parent_folder_id, const LLUUID& agent_id) { - lldebugs << "Caching " << parent_folder_id << " for " << agent_id - << llendl; + LL_DEBUGS("Inventory") << "Caching " << parent_folder_id << " for " << agent_id + << LL_ENDL; LLViewerInventoryCategory* root_cat = getCategory(parent_folder_id); if(!root_cat) return; cat_array_t categories; @@ -1699,7 +1699,7 @@ void LLInventoryModel::cache( gzip_filename.append(".gz"); if(gzip_file(inventory_filename, gzip_filename)) { - lldebugs << "Successfully compressed " << inventory_filename << llendl; + LL_DEBUGS("Inventory") << "Successfully compressed " << inventory_filename << LL_ENDL; LLFile::remove(inventory_filename); } else @@ -1781,8 +1781,8 @@ void LLInventoryModel::accountForUpdate(const LLCategoryUpdate& update) } if(!accounted) { - lldebugs << "No accounting for: '" << cat->getName() << "' " - << version << llendl; + LL_DEBUGS("Inventory") << "No accounting for: '" << cat->getName() << "' " + << version << LL_ENDL; } } else @@ -1918,7 +1918,7 @@ bool LLInventoryModel::loadSkeleton( const LLInventoryModel::options_t& options, const LLUUID& owner_id) { - lldebugs << "importing inventory skeleton for " << owner_id << llendl; + LL_DEBUGS("Inventory") << "importing inventory skeleton for " << owner_id << LL_ENDL; typedef std::set, InventoryIDPtrLess> cat_set_t; cat_set_t temp_cats; @@ -2709,8 +2709,8 @@ bool LLInventoryModel::messageUpdateCore(LLMessageSystem* msg, bool account) { LLPointer titem = new LLViewerInventoryItem; titem->unpackMessage(msg, _PREHASH_InventoryData, i); - lldebugs << "LLInventoryModel::messageUpdateCore() item id:" - << titem->getUUID() << llendl; + LL_DEBUGS("Inventory") << "LLInventoryModel::messageUpdateCore() item id:" + << titem->getUUID() << LL_ENDL; items.push_back(titem); // examine update for changes. LLViewerInventoryItem* itemp = gInventory.getItem(titem->getUUID()); @@ -2759,7 +2759,7 @@ bool LLInventoryModel::messageUpdateCore(LLMessageSystem* msg, bool account) // static void LLInventoryModel::processRemoveInventoryItem(LLMessageSystem* msg, void**) { - lldebugs << "LLInventoryModel::processRemoveInventoryItem()" << llendl; + LL_DEBUGS("Inventory") << "LLInventoryModel::processRemoveInventoryItem()" << LL_ENDL; LLUUID agent_id, item_id; msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id); if(agent_id != gAgent.getID()) @@ -2796,7 +2796,7 @@ void LLInventoryModel::processRemoveInventoryItem(LLMessageSystem* msg, void**) void LLInventoryModel::processUpdateInventoryFolder(LLMessageSystem* msg, void**) { - lldebugs << "LLInventoryModel::processUpdateInventoryFolder()" << llendl; + LL_DEBUGS("Inventory") << "LLInventoryModel::processUpdateInventoryFolder()" << LL_ENDL; LLUUID agent_id, folder_id, parent_id; //char name[DB_INV_ITEM_NAME_BUF_SIZE]; msg->getUUIDFast(_PREHASH_FolderData, _PREHASH_AgentID, agent_id); @@ -2856,7 +2856,7 @@ void LLInventoryModel::processUpdateInventoryFolder(LLMessageSystem* msg, void LLInventoryModel::processRemoveInventoryFolder(LLMessageSystem* msg, void**) { - lldebugs << "LLInventoryModel::processRemoveInventoryFolder()" << llendl; + LL_DEBUGS("Inventory") << "LLInventoryModel::processRemoveInventoryFolder()" << LL_ENDL; LLUUID agent_id, folder_id; msg->getUUIDFast(_PREHASH_FolderData, _PREHASH_AgentID, agent_id); if(agent_id != gAgent.getID()) @@ -2905,8 +2905,8 @@ void LLInventoryModel::processSaveAssetIntoInventory(LLMessageSystem* msg, // The viewer ignores the asset id because this message is only // used for attachments/objects, so the asset id is not used in // the viewer anyway. - lldebugs << "LLInventoryModel::processSaveAssetIntoInventory itemID=" - << item_id << llendl; + LL_DEBUGS("Inventory") << "LLInventoryModel::processSaveAssetIntoInventory itemID=" + << item_id << LL_ENDL; LLViewerInventoryItem* item = gInventory.getItem( item_id ); if( item ) { @@ -3173,7 +3173,7 @@ void LLInventoryModel::processInventoryDescendents(LLMessageSystem* msg,void**) // static void LLInventoryModel::processMoveInventoryItem(LLMessageSystem* msg, void**) { - lldebugs << "LLInventoryModel::processMoveInventoryItem()" << llendl; + LL_DEBUGS("Inventory") << "LLInventoryModel::processMoveInventoryItem()" << LL_ENDL; LLUUID agent_id; msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id); if(agent_id != gAgent.getID()) @@ -3198,8 +3198,8 @@ void LLInventoryModel::processMoveInventoryItem(LLMessageSystem* msg, void**) msg->getUUIDFast(_PREHASH_InventoryData, _PREHASH_FolderID, folder_id, i); msg->getString("InventoryData", "NewName", new_name, i); - lldebugs << "moving item " << item_id << " to folder " - << folder_id << llendl; + LL_DEBUGS("Inventory") << "moving item " << item_id << " to folder " + << folder_id << LL_ENDL; update_list_t update; LLCategoryUpdate old_folder(item->getParentUUID(), -1); update.push_back(old_folder); @@ -3759,7 +3759,7 @@ void LLInventoryFetchComboObserver::fetch( const folder_ref_t& folder_ids, const item_ref_t& item_ids) { - lldebugs << "LLInventoryFetchComboObserver::fetch()" << llendl; + LL_DEBUGS("Inventory") << "LLInventoryFetchComboObserver::fetch()" << LL_ENDL; for(folder_ref_t::const_iterator fit = folder_ids.begin(); fit != folder_ids.end(); ++fit) { LLViewerInventoryCategory* cat = gInventory.getCategory(*fit); @@ -3767,13 +3767,13 @@ void LLInventoryFetchComboObserver::fetch( if(!gInventory.isCategoryComplete(*fit)) { cat->fetchDescendents(); - lldebugs << "fetching folder " << *fit <isComplete()) { // It's complete, so put it on the complete container. mCompleteItems.push_back(*iit); - lldebugs << "completing item " << *iit << llendl; + LL_DEBUGS("Inventory") << "completing item " << *iit << LL_ENDL; continue; } else @@ -3812,7 +3812,7 @@ void LLInventoryFetchComboObserver::fetch( } else { - lldebugs << "not worrying about " << *iit << llendl; + LL_DEBUGS("Inventory") << "not worrying about " << *iit << LL_ENDL; } } fetch_items_from_llsd(items_llsd); -- cgit v1.1 From 7dd70e2f154c537689926795e2177cfb4843631c Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Sat, 7 May 2011 18:27:37 -0700 Subject: Committing some more useful debugging lines --- linden/indra/newview/llinventorymodel.cpp | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'linden/indra') diff --git a/linden/indra/newview/llinventorymodel.cpp b/linden/indra/newview/llinventorymodel.cpp index 5c1ae22..ede54a3 100644 --- a/linden/indra/newview/llinventorymodel.cpp +++ b/linden/indra/newview/llinventorymodel.cpp @@ -2528,6 +2528,7 @@ bool LLInventoryModel::loadFromFile(const std::string& filename, // *NOTE: This buffer size is hard coded into scanf() below. char buffer[MAX_STRING]; /*Flawfinder: ignore*/ char keyword[MAX_STRING]; /*Flawfinder: ignore*/ + static S32 item_count_total = 0; while(!feof(file) && fgets(buffer, MAX_STRING, file)) { sscanf(buffer, " %254s", keyword); /* Flawfinder: ignore */ @@ -2552,16 +2553,17 @@ bool LLInventoryModel::loadFromFile(const std::string& filename, // *FIX: Need a better solution, this prevents the // application from freezing, but breaks inventory // caching. - if(inv_item->getUUID().isNull()) - { - //delete inv_item; // automatic when inv_cat is reassigned or destroyed - llwarns << "Ignoring inventory with null item id: " - << inv_item->getName() << llendl; - - } - else + //if(inv_item->getUUID().isNull())MCCABE + //{ + // //delete inv_item; // automatic when inv_cat is reassigned or destroyed + // llwarns << "Ignoring inventory with null item id: " + // << inv_item->getName() << llendl; + // + //} + //else { items.put(inv_item); + item_count_total++; } } else @@ -2576,6 +2578,7 @@ bool LLInventoryModel::loadFromFile(const std::string& filename, << llendl; } } + LL_DEBUGS("Inventory") << "Inventory items loaded from file: " << item_count_total << LL_ENDL; fclose(file); return true; } @@ -2598,6 +2601,9 @@ bool LLInventoryModel::saveToFile(const std::string& filename, return false; } + static S32 count_total = 0; + static S32 category_total = 0; + S32 count = categories.count(); S32 i; for(i = 0; i < count; ++i) @@ -2606,6 +2612,7 @@ bool LLInventoryModel::saveToFile(const std::string& filename, if(cat->getVersion() != LLViewerInventoryCategory::VERSION_UNKNOWN) { cat->exportFileLocal(file); + category_total++; } } @@ -2613,8 +2620,11 @@ bool LLInventoryModel::saveToFile(const std::string& filename, for(i = 0; i < count; ++i) { items[i]->exportFile(file); + count_total++; } + LL_DEBUGS("Inventory") << "Cached " << category_total << " categories and " << count_total << " inventory items" << LL_ENDL; + fclose(file); return true; } -- cgit v1.1 From 8b16e68226ad5b4291a6acbbfb77cd272b8271cb Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Mon, 9 May 2011 09:37:31 -0700 Subject: Always show lldebugs for inventory for now. Logs will be our best debugging tool for the test build --- linden/indra/newview/app_settings/logcontrol.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'linden/indra') diff --git a/linden/indra/newview/app_settings/logcontrol.xml b/linden/indra/newview/app_settings/logcontrol.xml index 92d477f..50f8ba5 100644 --- a/linden/indra/newview/app_settings/logcontrol.xml +++ b/linden/indra/newview/app_settings/logcontrol.xml @@ -53,8 +53,8 @@ + Inventory - -- cgit v1.1 From b6403a457e5ccb2269b89da3ada852d6cd361a5f Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Mon, 9 May 2011 11:06:41 -0700 Subject: Inv cleanup phase 2: death to goto --- linden/indra/newview/llinventorymodel.cpp | 278 +++++++++++++++++++++--------- 1 file changed, 197 insertions(+), 81 deletions(-) (limited to 'linden/indra') diff --git a/linden/indra/newview/llinventorymodel.cpp b/linden/indra/newview/llinventorymodel.cpp index ede54a3..ceebc19 100644 --- a/linden/indra/newview/llinventorymodel.cpp +++ b/linden/indra/newview/llinventorymodel.cpp @@ -1914,9 +1914,8 @@ bool LLInventoryModel::isCategoryComplete(const LLUUID& cat_id) const return false; } -bool LLInventoryModel::loadSkeleton( - const LLInventoryModel::options_t& options, - const LLUUID& owner_id) +bool LLInventoryModel::loadSkeleton(const LLInventoryModel::options_t& options, + const LLUUID& owner_id) { LL_DEBUGS("Inventory") << "importing inventory skeleton for " << owner_id << LL_ENDL; @@ -1924,30 +1923,63 @@ bool LLInventoryModel::loadSkeleton( cat_set_t temp_cats; update_map_t child_counts; - LLUUID id; LLAssetType::EType preferred_type; bool rv = true; - for(options_t::const_iterator it = options.begin(); it < options.end(); ++it) + bool clean_cat = false; + + for (options_t::const_iterator it = options.begin(); it < options.end(); ++it) { LLPointer cat = new LLViewerInventoryCategory(owner_id); + response_t::const_iterator no_response = (*it).end(); response_t::const_iterator skel; + + clean_cat = false; + skel = (*it).find("name"); - if(skel == no_response) goto clean_cat; - cat->rename(std::string((*skel).second)); + if (skel == no_response) + { + clean_cat = true; + } + else + { + cat->rename(std::string((*skel).second)); + } + skel = (*it).find("folder_id"); - if(skel == no_response) goto clean_cat; - id.set((*skel).second); + if (skel == no_response) + { + clean_cat = true; + } + else + { + id.set((*skel).second); + } + // if an id is null, it locks the viewer. - if(id.isNull()) goto clean_cat; - cat->setUUID(id); + if (id.isNull()) + { + clean_cat = true; + } + else + { + cat->setUUID(id); + } + skel = (*it).find("parent_id"); - if(skel == no_response) goto clean_cat; - id.set((*skel).second); - cat->setParent(id); + if (skel == no_response) + { + clean_cat = true; + } + else + { + id.set((*skel).second); + cat->setParent(id); + } + skel = (*it).find("type_default"); - if(skel == no_response) + if (skel == no_response) { preferred_type = LLAssetType::AT_NONE; } @@ -1957,38 +1989,62 @@ bool LLInventoryModel::loadSkeleton( preferred_type = (LLAssetType::EType)t; } cat->setPreferredType(preferred_type); + skel = (*it).find("version"); - if(skel == no_response) goto clean_cat; - cat->setVersion(atoi((*skel).second.c_str())); - temp_cats.insert(cat); - continue; - clean_cat: - llwarns << "Unable to import near " << cat->getName() << llendl; - rv = false; - //delete cat; // automatic when cat is reasigned or destroyed + if (skel == no_response) + { + clean_cat = true; + } + else + { + cat->setVersion(atoi((*skel).second.c_str())); + } + + if (clean_cat) + { + llwarns << "Unable to import near " << cat->getName() << llendl; + rv = false; + //delete cat; // automatic when cat is reasigned or destroyed + temp_cats.clear(); + break; + } + else + { + temp_cats.insert(cat); + } } S32 cached_category_count = 0; S32 cached_item_count = 0; - if(!temp_cats.empty()) + if (temp_cats.empty()) + { + LL_WARNS("Inventory") << "No categories found! Cannot continue!" << LL_ENDL; + } + else { cat_array_t categories; item_array_t items; std::string owner_id_str; owner_id.toString(owner_id_str); + std::string path(gDirUtilp->getExpandedFilename(LL_PATH_CACHE, owner_id_str)); std::string inventory_filename; inventory_filename = llformat(CACHE_FORMAT_STRING, path.c_str()); + const S32 NO_VERSION = LLViewerInventoryCategory::VERSION_UNKNOWN; + std::string gzip_filename(inventory_filename); gzip_filename.append(".gz"); LLFILE* fp = LLFile::fopen(gzip_filename, "rb"); + bool remove_inventory_file = false; - if(fp) + + // try to ungzip the inventory -- MC + if (fp) { fclose(fp); fp = NULL; - if(gunzip_file(gzip_filename, inventory_filename)) + if (gunzip_file(gzip_filename, inventory_filename)) { // we only want to remove the inventory file if it was // gzipped before we loaded, and we successfully @@ -2000,7 +2056,9 @@ bool LLInventoryModel::loadSkeleton( llinfos << "Unable to gunzip " << gzip_filename << llendl; } } - if(loadFromFile(inventory_filename, categories, items)) + + // begin cache loading -- MC + if (loadFromFile(inventory_filename, categories, items)) { // We were able to find a cache of files. So, use what we // found to generate a set of categories we should add. We @@ -2009,10 +2067,11 @@ bool LLInventoryModel::loadSkeleton( S32 count = categories.count(); cat_set_t::iterator not_cached = temp_cats.end(); std::set cached_ids; - for(S32 i = 0; i < count; ++i) + for (S32 i = 0; i < count; ++i) { LLViewerInventoryCategory* cat = categories[i]; cat_set_t::iterator cit = temp_cats.find(cat); + if (cit == temp_cats.end()) { continue; // cache corruption?? not sure why this happens -SJB @@ -2021,11 +2080,12 @@ bool LLInventoryModel::loadSkeleton( // we can safely ignore anything loaded from file, but // not sent down in the skeleton. - if(cit == not_cached) + if (cit == not_cached) { continue; } - if(cat->getVersion() != tcat->getVersion()) + + if (cat->getVersion() != tcat->getVersion()) { // if the cached version does not match the server version, // throw away the version we have so we can fetch the @@ -2041,9 +2101,9 @@ bool LLInventoryModel::loadSkeleton( // go ahead and add the cats returned during the download std::set::iterator not_cached_id = cached_ids.end(); cached_category_count = cached_ids.size(); - for(cat_set_t::iterator it = temp_cats.begin(); it != temp_cats.end(); ++it) + for (cat_set_t::iterator it = temp_cats.begin(); it != temp_cats.end(); ++it) { - if(cached_ids.find((*it)->getUUID()) == not_cached_id) + if (cached_ids.find((*it)->getUUID()) == not_cached_id) { // this check is performed so that we do not // mark new folders in the skeleton (and not in cache) @@ -2059,14 +2119,14 @@ bool LLInventoryModel::loadSkeleton( // category with a correctly cached parent count = items.count(); cat_map_t::iterator unparented = mCategoryMap.end(); - for(int i = 0; i < count; ++i) + for (int i = 0; i < count; ++i) { cat_map_t::iterator cit = mCategoryMap.find(items[i]->getParentUUID()); - if(cit != unparented) + if (cit != unparented) { LLViewerInventoryCategory* cat = cit->second; - if(cat->getVersion() != NO_VERSION) + if (cat->getVersion() != NO_VERSION) { addItem(items[i]); cached_item_count += 1; @@ -2079,7 +2139,7 @@ bool LLInventoryModel::loadSkeleton( { // go ahead and add everything after stripping the version // information. - for(cat_set_t::iterator it = temp_cats.begin(); it != temp_cats.end(); ++it) + for (cat_set_t::iterator it = temp_cats.begin(); it != temp_cats.end(); ++it) { LLViewerInventoryCategory *llvic = (*it); llvic->setVersion(NO_VERSION); @@ -2092,13 +2152,13 @@ bool LLInventoryModel::loadSkeleton( // needlessly fetch descendents for categories which we have. update_map_t::iterator no_child_counts = child_counts.end(); update_map_t::iterator the_count; - for(cat_set_t::iterator it = temp_cats.begin(); it != temp_cats.end(); ++it) + for (cat_set_t::iterator it = temp_cats.begin(); it != temp_cats.end(); ++it) { LLViewerInventoryCategory* cat = (*it); - if(cat->getVersion() != NO_VERSION) + if (cat->getVersion() != NO_VERSION) { the_count = child_counts.find(cat->getUUID()); - if(the_count != no_child_counts) + if (the_count != no_child_counts) { cat->setDescendentCount((*the_count).second.mValue); } @@ -2109,7 +2169,7 @@ bool LLInventoryModel::loadSkeleton( } } - if(remove_inventory_file) + if (remove_inventory_file) { // clean up the gunzipped file. LLFile::remove(inventory_filename); @@ -2118,53 +2178,98 @@ bool LLInventoryModel::loadSkeleton( } LL_DEBUGS("Inventory") << "Successfully loaded " << cached_category_count - << " categories and " << cached_item_count << " items from cache." + << " categories and " << cached_item_count << " items from cache skeleton." << LL_ENDL; return rv; } -bool LLInventoryModel::loadMeat( - const LLInventoryModel::options_t& options, const LLUUID& owner_id) +bool LLInventoryModel::loadMeat(const LLInventoryModel::options_t& options, + const LLUUID& owner_id) { llinfos << "importing inventory for " << owner_id << llendl; LLPermissions default_perm; default_perm.init(LLUUID::null, owner_id, LLUUID::null, LLUUID::null); LLPointer item; LLUUID id; - LLAssetType::EType type; + LLAssetType::EType type = LLAssetType::AT_NONE; LLInventoryType::EType inv_type; + bool rv = true; - for(options_t::const_iterator it = options.begin(); it < options.end(); ++it) + bool clean_item = false; + static S32 cached_meat_count = 0; + + for (options_t::const_iterator it = options.begin(); it < options.end(); ++it) { item = new LLViewerInventoryItem; + response_t::const_iterator no_response = (*it).end(); response_t::const_iterator meat; + + clean_item = false; + meat = (*it).find("name"); - if(meat == no_response) goto clean_item; - item->rename(std::string((*meat).second)); + if (meat == no_response) + { + clean_item = true; + } + else + { + item->rename(std::string((*meat).second)); + } + meat = (*it).find("item_id"); - if(meat == no_response) goto clean_item; - id.set((*meat).second); - item->setUUID(id); + if (meat == no_response) + { + clean_item = true; + } + else + { + id.set((*meat).second); + item->setUUID(id); + } + meat = (*it).find("parent_id"); - if(meat == no_response) goto clean_item; - id.set((*meat).second); - item->setParent(id); + if (meat == no_response) + { + clean_item = true; + } + else + { + id.set((*meat).second); + item->setParent(id); + } + meat = (*it).find("type"); - if(meat == no_response) goto clean_item; - type = (LLAssetType::EType)atoi((*meat).second.c_str()); - item->setType(type); + if (meat == no_response) + { + clean_item = true; + } + else + { + type = (LLAssetType::EType)atoi((*meat).second.c_str()); + item->setType(type); + } + + // Do we want to clean if there's no inv_type too? -- MC meat = (*it).find("inv_type"); - if(meat != no_response) + if (meat != no_response) { inv_type = (LLInventoryType::EType)atoi((*meat).second.c_str()); item->setInventoryType(inv_type); } + meat = (*it).find("data_id"); - if(meat == no_response) goto clean_item; - id.set((*meat).second); - if(LLAssetType::AT_CALLINGCARD == type) + if (meat == no_response) + { + clean_item = true; + } + else + { + id.set((*meat).second); + } + + if (LLAssetType::AT_CALLINGCARD == type) { LLPermissions perm; perm.init(id, owner_id, LLUUID::null, LLUUID::null); @@ -2173,37 +2278,48 @@ bool LLInventoryModel::loadMeat( else { meat = (*it).find("perm_mask"); - if(meat != no_response) + if (meat != no_response) { PermissionMask perm_mask = atoi((*meat).second.c_str()); - default_perm.initMasks( - perm_mask, perm_mask, perm_mask, perm_mask, perm_mask); + default_perm.initMasks(perm_mask, perm_mask, perm_mask, perm_mask, perm_mask); } else { - default_perm.initMasks( - PERM_NONE, PERM_NONE, PERM_NONE, PERM_NONE, PERM_NONE); + default_perm.initMasks(PERM_NONE, PERM_NONE, PERM_NONE, PERM_NONE, PERM_NONE); } item->setPermissions(default_perm); item->setAssetUUID(id); } + meat = (*it).find("flags"); - if(meat != no_response) + if (meat != no_response) { item->setFlags(strtoul((*meat).second.c_str(), NULL, 0)); } + meat = (*it).find("time"); - if(meat != no_response) + if (meat != no_response) { item->setCreationDate(atoi((*meat).second.c_str())); } - addItem(item); - continue; - clean_item: - llwarns << "Unable to import near " << item->getName() << llendl; - rv = false; - //delete item; // automatic when item is reassigned or destroyed + + if (clean_item) + { + llwarns << "Unable to import near " << item->getName() << llendl; + rv = false; + //delete item; // automatic when item is reassigned or destroyed + break; + } + else + { + addItem(item); + cached_meat_count++; + } } + + LL_DEBUGS("Inventory") << "Successfully added " << cached_meat_count << " items from cache." + << LL_ENDL; + return rv; } @@ -2553,14 +2669,14 @@ bool LLInventoryModel::loadFromFile(const std::string& filename, // *FIX: Need a better solution, this prevents the // application from freezing, but breaks inventory // caching. - //if(inv_item->getUUID().isNull())MCCABE - //{ - // //delete inv_item; // automatic when inv_cat is reassigned or destroyed - // llwarns << "Ignoring inventory with null item id: " - // << inv_item->getName() << llendl; - // - //} - //else + if(inv_item->getUUID().isNull()) + { + //delete inv_item; // automatic when inv_cat is reassigned or destroyed + llwarns << "Ignoring inventory with null item id: " + << inv_item->getName() << llendl; + + } + else { items.put(inv_item); item_count_total++; -- cgit v1.1 From 74732c7d109cb0e7e675ca91e83cf321d6966d44 Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Mon, 9 May 2011 19:01:48 -0700 Subject: Fixed unitiliazed variables in llinventorymodel class --- linden/indra/newview/llinventorymodel.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'linden/indra') diff --git a/linden/indra/newview/llinventorymodel.cpp b/linden/indra/newview/llinventorymodel.cpp index ceebc19..962b93d 100644 --- a/linden/indra/newview/llinventorymodel.cpp +++ b/linden/indra/newview/llinventorymodel.cpp @@ -186,7 +186,15 @@ LLInventoryModel gInventory; // Default constructor LLInventoryModel::LLInventoryModel() : mModifyMask(LLInventoryObserver::ALL), + mChangedItemIDs(), + mCategoryMap(), + mItemMap(), + mCategoryLock(), + mItemLock(), mLastItem(NULL), + mParentChildCategoryTree(), + mParentChildItemTree(), + mObservers(), mIsAgentInvUsable(false) { } -- cgit v1.1 From a3f818336cf4aa6de78aab144bb7b2b11b617822 Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Tue, 10 May 2011 12:44:23 -0700 Subject: Committing fix for #0000302: inventory reloads on every login. Needs more testing than just a few people --- linden/indra/newview/llinventorymodel.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'linden/indra') diff --git a/linden/indra/newview/llinventorymodel.cpp b/linden/indra/newview/llinventorymodel.cpp index 962b93d..9794dfa 100644 --- a/linden/indra/newview/llinventorymodel.cpp +++ b/linden/indra/newview/llinventorymodel.cpp @@ -2093,14 +2093,18 @@ bool LLInventoryModel::loadSkeleton(const LLInventoryModel::options_t& options, continue; } - if (cat->getVersion() != tcat->getVersion()) + // We insert them anyway to keep the cache from breaking. + // If we delete or add a folder (aka "category") then the server + // increments the version and we reload the items on next login anyway + // this *may* result in duplicates that are cleared on relog-- MC + /*if (cat->getVersion() != tcat->getVersion()) { // if the cached version does not match the server version, // throw away the version we have so we can fetch the // correct contents the next time the viewer opens the folder. tcat->setVersion(NO_VERSION); } - else + else*/ { cached_ids.insert(tcat->getUUID()); } @@ -2126,12 +2130,11 @@ bool LLInventoryModel::loadSkeleton(const LLInventoryModel::options_t& options, // Add all the items loaded which are parented to a // category with a correctly cached parent count = items.count(); - cat_map_t::iterator unparented = mCategoryMap.end(); for (int i = 0; i < count; ++i) { cat_map_t::iterator cit = mCategoryMap.find(items[i]->getParentUUID()); - if (cit != unparented) + if (cit != mCategoryMap.end()) { LLViewerInventoryCategory* cat = cit->second; if (cat->getVersion() != NO_VERSION) -- cgit v1.1 From 0517495bf6caedc08fc7ae45cefc6a1a2cb8fe62 Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Tue, 10 May 2011 13:39:41 -0700 Subject: Now that the cache persists, start background fetching on login. We begin with the Animations folder uuid sent in the skeleton to hopefully make the AO work as soon as possible --- linden/indra/newview/llinventorymodel.cpp | 28 ++++++++++++++++++---------- linden/indra/newview/llinventorymodel.h | 5 +++++ linden/indra/newview/llstartup.cpp | 12 ++++++++++++ 3 files changed, 35 insertions(+), 10 deletions(-) (limited to 'linden/indra') diff --git a/linden/indra/newview/llinventorymodel.cpp b/linden/indra/newview/llinventorymodel.cpp index 9794dfa..75c5162 100644 --- a/linden/indra/newview/llinventorymodel.cpp +++ b/linden/indra/newview/llinventorymodel.cpp @@ -192,6 +192,7 @@ LLInventoryModel::LLInventoryModel() : mCategoryLock(), mItemLock(), mLastItem(NULL), + mAnimationsFolderUUID(LLUUID::null), mParentChildCategoryTree(), mParentChildItemTree(), mObservers(), @@ -1945,16 +1946,6 @@ bool LLInventoryModel::loadSkeleton(const LLInventoryModel::options_t& options, clean_cat = false; - skel = (*it).find("name"); - if (skel == no_response) - { - clean_cat = true; - } - else - { - cat->rename(std::string((*skel).second)); - } - skel = (*it).find("folder_id"); if (skel == no_response) { @@ -1986,6 +1977,16 @@ bool LLInventoryModel::loadSkeleton(const LLInventoryModel::options_t& options, cat->setParent(id); } + skel = (*it).find("name"); + if (skel == no_response) + { + clean_cat = true; + } + else + { + cat->rename(std::string((*skel).second)); + } + skel = (*it).find("type_default"); if (skel == no_response) { @@ -1995,6 +1996,13 @@ bool LLInventoryModel::loadSkeleton(const LLInventoryModel::options_t& options, { S32 t = atoi((*skel).second.c_str()); preferred_type = (LLAssetType::EType)t; + + // This UUID is different for each avatar and "Animations" is hardcoded into the skeleton -- MC + if (LLAssetType::AT_ANIMATION == preferred_type && cat->getName() == "Animations") + { + //llinfos << "Animations folder uuid from skeleton: " << cat->getUUID() << llendl; + mAnimationsFolderUUID = id; + } } cat->setPreferredType(preferred_type); diff --git a/linden/indra/newview/llinventorymodel.h b/linden/indra/newview/llinventorymodel.h index fee509b..7222c60 100644 --- a/linden/indra/newview/llinventorymodel.h +++ b/linden/indra/newview/llinventorymodel.h @@ -452,6 +452,9 @@ protected: // cache recent lookups mutable LLPointer mLastItem; + // UUID of the 'Animations' folder in 'My Inventory' + LLUUID mAnimationsFolderUUID; + // This last set of indices is used to map parents to children. typedef std::map parent_cat_map_t; typedef std::map parent_item_map_t; @@ -474,6 +477,8 @@ protected: bool mIsAgentInvUsable; public: + // Returns the UUID of the 'Animations' folder in 'My Inventory' sent from the server at startup + LLUUID getAnimationsFolderUUID() const { return mAnimationsFolderUUID; } // *NOTE: DEBUG functionality void dumpInventory(); static bool isBulkFetchProcessingComplete(); diff --git a/linden/indra/newview/llstartup.cpp b/linden/indra/newview/llstartup.cpp index 083a082..a2ed9fc 100644 --- a/linden/indra/newview/llstartup.cpp +++ b/linden/indra/newview/llstartup.cpp @@ -2450,6 +2450,18 @@ bool idle_startup() } } + // start background fetching for animations here in case the cache is empty. + // We do this to improve AO support (that's Animatoni Overrider, not LL's + // silly "AO" acronym -- MC + if (gInventory.getAnimationsFolderUUID() != LLUUID::null) + { + gInventory.startBackgroundFetch(gInventory.getAnimationsFolderUUID()); + } + else + { + gInventory.startBackgroundFetch(); + } + options.clear(); if(LLUserAuth::getInstance()->getOptions("buddy-list", options)) { -- cgit v1.1 From 24f857c0eee78243549690b8659b09ec27cae872 Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Tue, 10 May 2011 14:41:08 -0700 Subject: Fixed inventory not background fetching on startup when inventory window was open on quit --- linden/indra/newview/llstartup.cpp | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'linden/indra') diff --git a/linden/indra/newview/llstartup.cpp b/linden/indra/newview/llstartup.cpp index a2ed9fc..922cfa3 100644 --- a/linden/indra/newview/llstartup.cpp +++ b/linden/indra/newview/llstartup.cpp @@ -2588,19 +2588,6 @@ bool idle_startup() llinfos << "Requesting Agent Data" << llendl; gAgent.sendAgentDataUpdateRequest(); - bool shown_at_exit = gSavedSettings.getBOOL("ShowInventory"); - - // Create the inventory views - llinfos << "Creating Inventory Views" << llendl; - LLInventoryView::showAgentInventory(); - llinfos << "Inventory Views Created" << llendl; - - // Hide the inventory if it wasn't shown at exit - if(!shown_at_exit) - { - LLInventoryView::toggleVisibility(NULL); - } - // [RLVa:KB] - Checked: 2009-11-27 (RLVa-1.1.0f) | Added: RLVa-1.1.0f if (rlv_handler_t::isEnabled()) { @@ -2991,6 +2978,17 @@ bool idle_startup() // Clean up the userauth stuff. LLUserAuth::getInstance()->reset(); + // Show the inventory if it was shown at exit + // Don't do this before here or we screw up inv loading -- MC + if (gSavedSettings.getBOOL("ShowInventory")) + { + // Create the inventory views + llinfos << "Creating Inventory Views" << llendl; + LLInventoryView::showAgentInventory(); + llinfos << "Inventory Views Created" << llendl; + //LLInventoryView::toggleVisibility(NULL); + } + LLStartUp::setStartupState( STATE_STARTED ); LLStartUp::setStartedOnce(true); LLStartUp::setLoginFailed(false); -- cgit v1.1 From fd64f21f40d1ac154dc7352a5e92c3f1932bf7a5 Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Thu, 5 May 2011 10:04:43 -0700 Subject: Always show an item count in the inventory --- linden/indra/newview/llinventoryview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'linden/indra') diff --git a/linden/indra/newview/llinventoryview.cpp b/linden/indra/newview/llinventoryview.cpp index f8fb439..ec14cb3 100644 --- a/linden/indra/newview/llinventoryview.cpp +++ b/linden/indra/newview/llinventoryview.cpp @@ -681,7 +681,7 @@ LLInventoryView::~LLInventoryView( void ) void LLInventoryView::draw() { - if (LLInventoryModel::isEverythingFetched()) + if (!LLInventoryModel::backgroundFetchActive()) { S32 item_count = gInventory.getItemCount(); -- cgit v1.1 From 8225622fd40a14afdb041f6231811d4b00cf357d Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Sat, 7 May 2011 18:27:37 -0700 Subject: Committing some more useful debugging lines --- linden/indra/newview/llinventorymodel.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'linden/indra') diff --git a/linden/indra/newview/llinventorymodel.cpp b/linden/indra/newview/llinventorymodel.cpp index 75c5162..58a2bdc 100644 --- a/linden/indra/newview/llinventorymodel.cpp +++ b/linden/indra/newview/llinventorymodel.cpp @@ -2688,14 +2688,14 @@ bool LLInventoryModel::loadFromFile(const std::string& filename, // *FIX: Need a better solution, this prevents the // application from freezing, but breaks inventory // caching. - if(inv_item->getUUID().isNull()) - { - //delete inv_item; // automatic when inv_cat is reassigned or destroyed - llwarns << "Ignoring inventory with null item id: " - << inv_item->getName() << llendl; - - } - else + //if(inv_item->getUUID().isNull())MCCABE + //{ + // //delete inv_item; // automatic when inv_cat is reassigned or destroyed + // llwarns << "Ignoring inventory with null item id: " + // << inv_item->getName() << llendl; + // + //} + //else { items.put(inv_item); item_count_total++; -- cgit v1.1 From 890ae756b4b694ee84d70813cbe166933876541a Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Wed, 8 Jun 2011 22:19:20 -0700 Subject: Re-enabled fetchinventoryonlogin setting and renamed it to fetchinventoryonlogin2 so it's enabled for users of previous versions --- linden/indra/newview/app_settings/settings.xml | 4 ++-- linden/indra/newview/llstartup.cpp | 22 ++++++++++------------ 2 files changed, 12 insertions(+), 14 deletions(-) (limited to 'linden/indra') diff --git a/linden/indra/newview/app_settings/settings.xml b/linden/indra/newview/app_settings/settings.xml index e571988..57c2065 100644 --- a/linden/indra/newview/app_settings/settings.xml +++ b/linden/indra/newview/app_settings/settings.xml @@ -512,7 +512,7 @@ Value 1 - FetchInventoryOnLogin + FetchInventoryOnLogin2 Comment Automatically fetch the inventory in the background after login (has issues) @@ -521,7 +521,7 @@ Type Boolean Value - 0 + 1 FloaterAnimationListRect diff --git a/linden/indra/newview/llstartup.cpp b/linden/indra/newview/llstartup.cpp index 922cfa3..3b8215b 100644 --- a/linden/indra/newview/llstartup.cpp +++ b/linden/indra/newview/llstartup.cpp @@ -2453,13 +2453,17 @@ bool idle_startup() // start background fetching for animations here in case the cache is empty. // We do this to improve AO support (that's Animatoni Overrider, not LL's // silly "AO" acronym -- MC - if (gInventory.getAnimationsFolderUUID() != LLUUID::null) + if (gSavedSettings.getBOOL("FetchInventoryOnLogin2")) { - gInventory.startBackgroundFetch(gInventory.getAnimationsFolderUUID()); - } - else - { - gInventory.startBackgroundFetch(); + // Start loading inventory + if (gInventory.getAnimationsFolderUUID() != LLUUID::null) + { + gInventory.startBackgroundFetch(gInventory.getAnimationsFolderUUID()); + } + else + { + gInventory.startBackgroundFetch(); + } } options.clear(); @@ -2948,12 +2952,6 @@ bool idle_startup() // Have the agent start watching the friends list so we can update proxies gAgent.observeFriends(); - if (gSavedSettings.getBOOL("FetchInventoryOnLogin")) - { - // Start loading inventory - gInventory.startBackgroundFetch(); - } - if (gSavedSettings.getBOOL("LoginAsGod")) { gAgent.requestEnterGodMode(); -- cgit v1.1 From 306cce10bd5fe99ab7b50fff9fc468e81fc7ecb2 Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Wed, 8 Jun 2011 23:23:35 -0700 Subject: Fixed inventory window not showing item count on login when the full cache is loaded --- linden/indra/newview/llinventoryview.cpp | 20 ++++++++++++++------ linden/indra/newview/llinventoryview.h | 1 - 2 files changed, 14 insertions(+), 7 deletions(-) (limited to 'linden/indra') diff --git a/linden/indra/newview/llinventoryview.cpp b/linden/indra/newview/llinventoryview.cpp index ec14cb3..f2fe921 100644 --- a/linden/indra/newview/llinventoryview.cpp +++ b/linden/indra/newview/llinventoryview.cpp @@ -491,7 +491,9 @@ LLInventoryView::LLInventoryView(const std::string& name, LLFloater(name, rect, std::string("Inventory"), RESIZE_YES, INV_MIN_WIDTH, INV_MIN_HEIGHT, DRAG_ON_TOP, MINIMIZE_NO, CLOSE_YES), - mActivePanel(NULL) + mActivePanel(NULL), + mOldFilterText(""), + mFilterText("") //LLHandle mFinderHandle takes care of its own initialization { init(inventory); @@ -683,10 +685,11 @@ void LLInventoryView::draw() { if (!LLInventoryModel::backgroundFetchActive()) { + static S32 old_item_count = 0; S32 item_count = gInventory.getItemCount(); //don't let llfloater work more than necessary - if (item_count != mOldItemCount || mOldFilterText != mFilterText) + if (item_count > old_item_count || mOldFilterText != mFilterText) { LLLocale locale(LLLocale::USER_LOCALE); std::ostringstream title; @@ -696,11 +699,10 @@ void LLInventoryView::draw() title << " (" << item_count_string << " items)"; title << mFilterText; setTitle(title.str()); - } - - mOldFilterText = mFilterText; - mOldItemCount = item_count; + mOldFilterText = mFilterText; + old_item_count = item_count; + } } if (mActivePanel && mSearchEditor) { @@ -889,6 +891,12 @@ void LLInventoryView::changed(U32 mask) } else { + // This is here because it gets called on login even when it shouldn't -- MC + LLLocale locale(LLLocale::USER_LOCALE); + std::string item_count_string; + LLResMgr::getInstance()->getIntegerString(item_count_string, gInventory.getItemCount()); + title << " (" << item_count_string << " items)"; + gSavedPerAccountSettings.setS32("InventoryPreviousCount", gInventory.getItemCount()); } title << mFilterText; diff --git a/linden/indra/newview/llinventoryview.h b/linden/indra/newview/llinventoryview.h index 3ec1e73..e499113 100644 --- a/linden/indra/newview/llinventoryview.h +++ b/linden/indra/newview/llinventoryview.h @@ -315,7 +315,6 @@ protected: std::string mOldFilterText; S32 mItemCount; - S32 mOldItemCount; // This container is used to hold all active inventory views. This // is here to support the inventory toggle show button. -- cgit v1.1 From 50155d40f967c9ff76dd1c67f847a06b9acf60b0 Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Tue, 10 May 2011 15:16:26 -0700 Subject: Added some log info when ao_template.ini can't be found --- linden/indra/newview/floaterao.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'linden/indra') diff --git a/linden/indra/newview/floaterao.cpp b/linden/indra/newview/floaterao.cpp index df88d6f..444e395 100644 --- a/linden/indra/newview/floaterao.cpp +++ b/linden/indra/newview/floaterao.cpp @@ -72,6 +72,11 @@ public: text->insertText(line); } file.close(); + + if (line.empty()) + { + llwarns << "Can't open ao_template.ini at << " << mFileName << llendl; + } nc->saveIfNeeded(); } -- cgit v1.1 From 372b1a5a432320ab4770a4eeb5cdc59a6332aab7 Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Tue, 10 May 2011 18:43:21 -0700 Subject: Fixed AO loading on startup and did some light cleanup for readability's sake. The AO now checks for the notecard every 10 seconds until it's loaded. This whole feature could really use a major refactor --- linden/indra/newview/floaterao.cpp | 841 ++++++++++++++++++++++------------ linden/indra/newview/floaterao.h | 73 +-- linden/indra/newview/llstartup.cpp | 12 +- linden/indra/newview/llviewermenu.cpp | 2 +- 4 files changed, 599 insertions(+), 329 deletions(-) (limited to 'linden/indra') diff --git a/linden/indra/newview/floaterao.cpp b/linden/indra/newview/floaterao.cpp index 444e395..843cb3a 100644 --- a/linden/indra/newview/floaterao.cpp +++ b/linden/indra/newview/floaterao.cpp @@ -34,6 +34,8 @@ #include "llboost.h" #include +static LLFrameTimer sInitTimer; + void cmdline_printchat(std::string message); AOInvTimer* gAOInvTimer = NULL; @@ -118,37 +120,71 @@ BOOL AOStandTimer::tick() // ------------------------------------------------------- +BOOL AOInvTimer::sInitialized = FALSE; + AOInvTimer::AOInvTimer() : LLEventTimer( (F32)1.0 ) { + // if we can't find the item we need, start the init timer + // background inventory fetching has already begun in llstartup -- MC + if (LLStartUp::getStartupState() == STATE_STARTED) + { + LLUUID ao_notecard = (LLUUID)gSavedPerAccountSettings.getString("AOConfigNotecardID"); + if (ao_notecard.notNull()) + { + const LLInventoryItem* item = gInventory.getItem(ao_notecard); + if (!item) + { + sInitTimer.start(); + sInitTimer.setTimerExpirySec(10.0f); + } + else + { + sInitialized = LLFloaterAO::init(); + if (!sInitialized) // should never happen, but just in case -- MC + { + sInitTimer.start(); + sInitTimer.setTimerExpirySec(10.0f); + } + } + } + } } + AOInvTimer::~AOInvTimer() { } -BOOL AOInvTimer::fullfetch = FALSE; - BOOL AOInvTimer::tick() { - if (!(gSavedSettings.getBOOL("AOEnabled"))) return TRUE; - if(LLStartUp::getStartupState() >= STATE_INVENTORY_SEND) + /*if (!(gSavedSettings.getBOOL("AOEnabled"))) + { + return TRUE; + }*/ + + if (gInventory.isEverythingFetched()) { - if(gInventory.isEverythingFetched()) + if (!sInitialized) { -// cmdline_printchat("Inventory fetched, loading AO."); LLFloaterAO::init(); - return TRUE; - }else + sInitialized = TRUE; // this can happen even if we can't initialize the AO -- MC + } + + if (sInitTimer.getStarted()) { - //static BOOL startedfetch = FALSE; - if(fullfetch == FALSE) - { - fullfetch = TRUE; - //no choice, can't move the AO till we find it, should only have to happen once - gInventory.startBackgroundFetch(); - } + sInitTimer.stop(); } } - return FALSE; + + if (!sInitialized && LLStartUp::getStartupState() == STATE_STARTED) + { + if (sInitTimer.hasExpired()) + { + sInitTimer.start(); + sInitTimer.setTimerExpirySec(10.0f); + sInitialized = LLFloaterAO::init(); + } + } + return sInitialized; } // NC DROP ------------------------------------------------------- @@ -215,40 +251,40 @@ BOOL AONoteCardDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, return handled; } -AONoteCardDropTarget * LLFloaterAO::mAOItemDropTarget; +AONoteCardDropTarget * LLFloaterAO::sAOItemDropTarget; // STUFF ------------------------------------------------------- -int LLFloaterAO::mAnimationState = 0; -int LLFloaterAO::stand_iterator = 0; +S32 LLFloaterAO::sAnimationState = 0; +S32 LLFloaterAO::stand_iterator = 0; LLUUID LLFloaterAO::invfolderid = LLUUID::null; -LLUUID LLFloaterAO::mCurrentStandId = LLUUID::null; - -LLComboBox* mcomboBox_stands; -LLComboBox* mcomboBox_walks; -LLComboBox* mcomboBox_runs; -LLComboBox* mcomboBox_jumps; -LLComboBox* mcomboBox_sits; -LLComboBox* mcomboBox_gsits; -LLComboBox* mcomboBox_crouchs; -LLComboBox* mcomboBox_cwalks; -LLComboBox* mcomboBox_falls; -LLComboBox* mcomboBox_hovers; -LLComboBox* mcomboBox_flys; -LLComboBox* mcomboBox_flyslows; -LLComboBox* mcomboBox_flyups; -LLComboBox* mcomboBox_flydowns; -LLComboBox* mcomboBox_lands; -LLComboBox* mcomboBox_standups; -LLComboBox* mcomboBox_prejumps; +LLUUID LLFloaterAO::sCurrentStandId = LLUUID::null; + +LLComboBox* mComboBox_stands; +LLComboBox* mComboBox_walks; +LLComboBox* mComboBox_runs; +LLComboBox* mComboBox_jumps; +LLComboBox* mComboBox_sits; +LLComboBox* mComboBox_gsits; +LLComboBox* mComboBox_crouchs; +LLComboBox* mComboBox_cwalks; +LLComboBox* mComboBox_falls; +LLComboBox* mComboBox_hovers; +LLComboBox* mComboBox_flys; +LLComboBox* mComboBox_flyslows; +LLComboBox* mComboBox_flyups; +LLComboBox* mComboBox_flydowns; +LLComboBox* mComboBox_lands; +LLComboBox* mComboBox_standups; +LLComboBox* mComboBox_prejumps; struct struct_overrides { LLUUID orig_id; LLUUID ao_id; - int state; + S32 state; }; std::vector mAOOverrides; @@ -262,14 +298,16 @@ std::vector mAOStands; struct struct_tokens { std::string token; - int state; + S32 state; }; std::vector mAOTokens; LLFloaterAO* LLFloaterAO::sInstance = NULL; LLFloaterAO::LLFloaterAO() -:LLFloater(std::string("floater_ao")) + : + LLFloater(std::string("floater_ao")), + mDirty(FALSE) { // init(); llassert_always(sInstance == NULL); @@ -280,80 +318,55 @@ LLFloaterAO::LLFloaterAO() LLFloaterAO::~LLFloaterAO() { sInstance=NULL; - mcomboBox_stands = 0; - mcomboBox_walks = 0; - mcomboBox_runs = 0; - mcomboBox_jumps = 0; - mcomboBox_sits = 0; - mcomboBox_gsits = 0; - mcomboBox_crouchs = 0; - mcomboBox_cwalks = 0; - mcomboBox_falls = 0; - mcomboBox_hovers = 0; - mcomboBox_flys = 0; - mcomboBox_flyslows = 0; - mcomboBox_flyups = 0; - mcomboBox_flydowns = 0; - mcomboBox_lands = 0; - mcomboBox_standups = 0; - mcomboBox_prejumps = 0; - delete mAOItemDropTarget; - mAOItemDropTarget = NULL; + mComboBox_stands = 0; + mComboBox_walks = 0; + mComboBox_runs = 0; + mComboBox_jumps = 0; + mComboBox_sits = 0; + mComboBox_gsits = 0; + mComboBox_crouchs = 0; + mComboBox_cwalks = 0; + mComboBox_falls = 0; + mComboBox_hovers = 0; + mComboBox_flys = 0; + mComboBox_flyslows = 0; + mComboBox_flyups = 0; + mComboBox_flydowns = 0; + mComboBox_lands = 0; + mComboBox_standups = 0; + mComboBox_prejumps = 0; + delete sAOItemDropTarget; + sAOItemDropTarget = NULL; // llinfos << "floater destroyed" << llendl; } -void LLFloaterAO::show(void*) -{ - if (!sInstance) - { - sInstance = new LLFloaterAO(); - updateLayout(sInstance); - init(); - - sInstance->open(); - } - else - { - sInstance->close(); - } - LLFirstUse::useAO(); -} - -bool LLFloaterAO::getInstance() -{ - if (sInstance) - return true; - else - return false; -} - BOOL LLFloaterAO::postBuild() { LLView *target_view = getChild("ao_notecard"); - if(target_view) + if (target_view) { - if (mAOItemDropTarget) + if (sAOItemDropTarget) { - delete mAOItemDropTarget; + delete sAOItemDropTarget; } - mAOItemDropTarget = new AONoteCardDropTarget("drop target", target_view->getRect(), AOItemDrop);//, mAvatarID); - addChild(mAOItemDropTarget); + sAOItemDropTarget = new AONoteCardDropTarget("drop target", target_view->getRect(), AOItemDrop);//, mAvatarID); + addChild(sAOItemDropTarget); } - if(LLStartUp::getStartupState() == STATE_STARTED) + if (LLStartUp::getStartupState() == STATE_STARTED) { LLUUID itemidimport = (LLUUID)gSavedPerAccountSettings.getString("AOConfigNotecardID"); LLViewerInventoryItem* itemimport = gInventory.getItem(itemidimport); - if(itemimport) + if (itemimport) { childSetValue("ao_nc_text","Currently set to: "+itemimport->getName()); } - else if(itemidimport.isNull()) + else if (itemidimport.isNull()) { childSetValue("ao_nc_text","Currently not set"); } else { - childSetValue("ao_nc_text","Currently set to a item not on this account"); + childSetValue("ao_nc_text","Currently not loaded"); } } else @@ -371,23 +384,23 @@ BOOL LLFloaterAO::postBuild() childSetCommitCallback("AOEnabled",onClickToggleAO); childSetCommitCallback("AOSitsEnabled",onClickToggleSits); childSetCommitCallback("standtime",onSpinnerCommit); - mcomboBox_stands = getChild("stands"); - mcomboBox_walks = getChild("walks"); - mcomboBox_runs = getChild("runs"); - mcomboBox_jumps = getChild("jumps"); - mcomboBox_sits = getChild("sits"); - mcomboBox_gsits = getChild("gsits"); - mcomboBox_crouchs = getChild("crouchs"); - mcomboBox_cwalks = getChild("cwalks"); - mcomboBox_falls = getChild("falls"); - mcomboBox_hovers = getChild("hovers"); - mcomboBox_flys = getChild("flys"); - mcomboBox_flyslows = getChild("flyslows"); - mcomboBox_flyups = getChild("flyups"); - mcomboBox_flydowns = getChild("flydowns"); - mcomboBox_lands = getChild("lands"); - mcomboBox_standups = getChild("standups"); - mcomboBox_prejumps = getChild("prejumps"); + mComboBox_stands = getChild("stands"); + mComboBox_walks = getChild("walks"); + mComboBox_runs = getChild("runs"); + mComboBox_jumps = getChild("jumps"); + mComboBox_sits = getChild("sits"); + mComboBox_gsits = getChild("gsits"); + mComboBox_crouchs = getChild("crouchs"); + mComboBox_cwalks = getChild("cwalks"); + mComboBox_falls = getChild("falls"); + mComboBox_hovers = getChild("hovers"); + mComboBox_flys = getChild("flys"); + mComboBox_flyslows = getChild("flyslows"); + mComboBox_flyups = getChild("flyups"); + mComboBox_flydowns = getChild("flydowns"); + mComboBox_lands = getChild("lands"); + mComboBox_standups = getChild("standups"); + mComboBox_prejumps = getChild("prejumps"); getChild("stands")->setCommitCallback(onComboBoxCommit); getChild("walks")->setCommitCallback(onComboBoxCommit); getChild("runs")->setCommitCallback(onComboBoxCommit); @@ -409,10 +422,49 @@ BOOL LLFloaterAO::postBuild() return TRUE; } +// static +void LLFloaterAO::show(void*) +{ + if (!sInstance) + { + sInstance = new LLFloaterAO(); + updateLayout(sInstance); + init(); + + sInstance->open(); + } + else + { + sInstance->close(); + } + LLFirstUse::useAO(); +} + +// static +LLFloaterAO* LLFloaterAO::getInstance() +{ + if (!sInstance) + { + sInstance = new LLFloaterAO(); + } + return sInstance; +} + +// static +bool LLFloaterAO::getVisible() +{ + if (sInstance) + { + return true; + } + return false; +} + +// static void LLFloaterAO::onSpinnerCommit(LLUICtrl* ctrl, void* userdata) { - LLSpinCtrl* spin = (LLSpinCtrl*) ctrl; - if(spin) + LLSpinCtrl* spin = (LLSpinCtrl*)ctrl; + if (spin) { if (spin->getName() == "standtime") { @@ -421,10 +473,11 @@ void LLFloaterAO::onSpinnerCommit(LLUICtrl* ctrl, void* userdata) } } +// static void LLFloaterAO::onComboBoxCommit(LLUICtrl* ctrl, void* userdata) { LLComboBox* box = (LLComboBox*)ctrl; - if(box) + if (box) { if (box->getName() == "stands") { @@ -434,7 +487,7 @@ void LLFloaterAO::onComboBoxCommit(LLUICtrl* ctrl, void* userdata) } else { - int state = STATE_AGENT_IDLE; + S32 state = STATE_AGENT_IDLE; std::string stranim = box->getValue().asString(); // llinfos << "state " << (gAgent.getAvatarObject()->mIsSitting) << " - " << getAnimationState() << llendl; if (box->getName() == "walks") @@ -561,6 +614,7 @@ void LLFloaterAO::onComboBoxCommit(LLUICtrl* ctrl, void* userdata) } } +// static void LLFloaterAO::updateLayout(LLFloaterAO* floater) { if (floater) @@ -618,8 +672,10 @@ void LLFloaterAO::updateLayout(LLFloaterAO* floater) } } -void LLFloaterAO::init() +// static +bool LLFloaterAO::init() { + //cmdline_printchat("init() called"); mAOStands.clear(); mAOTokens.clear(); mAOOverrides.clear(); @@ -678,82 +734,87 @@ void LLFloaterAO::init() overrideloader.orig_id = ANIM_AGENT_FLY; overrideloader.ao_id = LLUUID::null; overrideloader.state = STATE_AGENT_FLY; mAOOverrides.push_back(overrideloader); overrideloader.orig_id = ANIM_AGENT_FLYSLOW; overrideloader.ao_id = LLUUID::null; overrideloader.state = STATE_AGENT_FLYSLOW; mAOOverrides.push_back(overrideloader); - BOOL success = TRUE; + BOOL success = FALSE; - if(LLStartUp::getStartupState() >= STATE_INVENTORY_SEND) + if (LLStartUp::getStartupState() >= STATE_INVENTORY_SEND) { - if(gInventory.isEverythingFetched()) + LLUUID configncitem = (LLUUID)gSavedPerAccountSettings.getString("AOConfigNotecardID"); + if (configncitem.notNull()) { - LLUUID configncitem = (LLUUID)gSavedPerAccountSettings.getString("AOConfigNotecardID"); - if (configncitem.notNull()) + const LLInventoryItem* item = gInventory.getItem(configncitem); + if (item) { - success = FALSE; - const LLInventoryItem* item = gInventory.getItem(configncitem); - if(item) + if (gAgent.allowOperation(PERM_COPY, item->getPermissions(),GP_OBJECT_MANIPULATE) || gAgent.isGodlike()) { - if (gAgent.allowOperation(PERM_COPY, item->getPermissions(),GP_OBJECT_MANIPULATE) || gAgent.isGodlike()) + if (!item->getAssetUUID().isNull()) { - if(!item->getAssetUUID().isNull()) - { - LLUUID* new_uuid = new LLUUID(configncitem); - LLHost source_sim = LLHost::invalid; - invfolderid = item->getParentUUID(); - gAssetStorage->getInvItemAsset(source_sim, - gAgent.getID(), - gAgent.getSessionID(), - item->getPermissions().getOwner(), - LLUUID::null, - item->getUUID(), - item->getAssetUUID(), - item->getType(), - &onNotecardLoadComplete, - (void*)new_uuid, - TRUE); - success = TRUE; - } + LLUUID* new_uuid = new LLUUID(configncitem); + LLHost source_sim = LLHost::invalid; + invfolderid = item->getParentUUID(); + gAssetStorage->getInvItemAsset(source_sim, + gAgent.getID(), + gAgent.getSessionID(), + item->getPermissions().getOwner(), + LLUUID::null, + item->getUUID(), + item->getAssetUUID(), + item->getType(), + &onNotecardLoadComplete, + (void*)new_uuid, + TRUE); + success = TRUE; } } } + else // item + { + //cmdline_printchat("no item (notecard)"); + } } } - - if (!success) + else // notecard null { - cmdline_printchat("Could not read the specified Config Notecard"); + //cmdline_printchat("Config Notecard set to a null UUID!"); } -// mAnimationState = 0; -// mCurrentStandId = LLUUID::null; +// sAnimationState = 0; +// sCurrentStandId = LLUUID::null; // setAnimationState(STATE_AGENT_IDLE); + return success; } +// static void LLFloaterAO::onClickMore(void* data) { gSavedSettings.setBOOL( "AOAdvanced", TRUE ); updateLayout(sInstance); } + +// static void LLFloaterAO::onClickLess(void* data) { gSavedSettings.setBOOL( "AOAdvanced", FALSE ); updateLayout(sInstance); } +// static void LLFloaterAO::onClickToggleAO(LLUICtrl *, void*) { run(); } +// static void LLFloaterAO::onClickToggleSits(LLUICtrl *, void*) { run(); } - +// static void LLFloaterAO::run() { setAnimationState(STATE_AGENT_IDLE); // reset state - int state = getAnimationState(); // check if sitting or hovering + S32 state = getAnimationState(); // check if sitting or hovering if ((state == STATE_AGENT_IDLE) || (state == STATE_AGENT_STAND)) { if (gSavedSettings.getBOOL("AOEnabled")) @@ -776,98 +837,158 @@ void LLFloaterAO::run() } else { - if (state == STATE_AGENT_SIT) gAgent.sendAnimationRequest(GetAnimIDFromState(state), (gSavedSettings.getBOOL("AOEnabled") && gSavedSettings.getBOOL("AOSitsEnabled")) ? ANIM_REQUEST_START : ANIM_REQUEST_STOP); - else gAgent.sendAnimationRequest(GetAnimIDFromState(state), gSavedSettings.getBOOL("AOEnabled") ? ANIM_REQUEST_START : ANIM_REQUEST_STOP); + if (state == STATE_AGENT_SIT) + { + gAgent.sendAnimationRequest(GetAnimIDFromState(state), (gSavedSettings.getBOOL("AOEnabled") && gSavedSettings.getBOOL("AOSitsEnabled")) ? ANIM_REQUEST_START : ANIM_REQUEST_STOP); + } + else + { + gAgent.sendAnimationRequest(GetAnimIDFromState(state), gSavedSettings.getBOOL("AOEnabled") ? ANIM_REQUEST_START : ANIM_REQUEST_STOP); + } } } -int LLFloaterAO::getAnimationState() +// static +S32 LLFloaterAO::getAnimationState() { if (gAgent.getAvatarObject()) { - if (gAgent.getAvatarObject()->mIsSitting) setAnimationState(STATE_AGENT_SIT); - else if (gAgent.getFlying()) setAnimationState(STATE_AGENT_HOVER); + if (gAgent.getAvatarObject()->mIsSitting) + { + setAnimationState(STATE_AGENT_SIT); + } + else if (gAgent.getFlying()) + { + setAnimationState(STATE_AGENT_HOVER); + } } - return mAnimationState; + return sAnimationState; } -void LLFloaterAO::setAnimationState(const int state) +// static +void LLFloaterAO::setAnimationState(const S32 state) { - mAnimationState = state; + sAnimationState = state; } +// static LLUUID LLFloaterAO::getCurrentStandId() { - return mCurrentStandId; + return sCurrentStandId; } +// static void LLFloaterAO::setCurrentStandId(const LLUUID& id) { - mCurrentStandId = id; + sCurrentStandId = id; } +// static void LLFloaterAO::AOItemDrop(LLViewerInventoryItem* item) { gSavedPerAccountSettings.setString("AOConfigNotecardID", item->getUUID().asString()); sInstance->childSetValue("ao_nc_text","Currently set to: "+item->getName()); } +// static LLUUID LLFloaterAO::GetAnimID(const LLUUID& id) { for (std::vector::iterator iter = mAOOverrides.begin(); iter != mAOOverrides.end(); ++iter) { - if (iter->orig_id == id) return iter->ao_id; + if (iter->orig_id == id) + { + return iter->ao_id; + } } return LLUUID::null; } -int LLFloaterAO::GetStateFromAnimID(const LLUUID& id) +// static +S32 LLFloaterAO::GetStateFromAnimID(const LLUUID& id) { for (std::vector::iterator iter = mAOOverrides.begin(); iter != mAOOverrides.end(); ++iter) { - if (iter->orig_id == id) return iter->state; + if (iter->orig_id == id) + { + return iter->state; + } } return STATE_AGENT_IDLE; } -LLUUID LLFloaterAO::GetAnimIDFromState(const int state) +// static +LLUUID LLFloaterAO::GetAnimIDFromState(const S32 state) { for (std::vector::iterator iter = mAOOverrides.begin(); iter != mAOOverrides.end(); ++iter) { - if (iter->state == state) return iter->ao_id; + if (iter->state == state) + { + return iter->ao_id; + } } return LLUUID::null; } -int LLFloaterAO::GetStateFromToken(std::string strtoken) +// static +S32 LLFloaterAO::GetStateFromToken(std::string strtoken) { for (std::vector::iterator iter = mAOTokens.begin(); iter != mAOTokens.end(); ++iter) { - if (iter->token == strtoken) return iter->state; + if (iter->token == strtoken) + { + return iter->state; + } } return STATE_AGENT_IDLE; } +// static void LLFloaterAO::onClickPrevStand(void* user_data) { - if (!(mAOStands.size() > 0)) return; - stand_iterator=stand_iterator-1; - if (stand_iterator < 0) stand_iterator = int( mAOStands.size()-stand_iterator); - if (stand_iterator > int( mAOStands.size()-1)) stand_iterator = 0; + if (!(mAOStands.size() > 0)) + { + return; + } + + stand_iterator = stand_iterator-1; + + if (stand_iterator < 0) + { + stand_iterator = S32( mAOStands.size()-stand_iterator); + } + if (stand_iterator > S32( mAOStands.size()-1)) + { + stand_iterator = 0; + } + cmdline_printchat(llformat("Changing stand to %s.",mAOStands[stand_iterator].anim_name.c_str())); ChangeStand(); } +// static void LLFloaterAO::onClickNextStand(void* user_data) { - if (!(mAOStands.size() > 0)) return; - stand_iterator=stand_iterator+1; - if (stand_iterator < 0) stand_iterator = int( mAOStands.size()-stand_iterator); - if (stand_iterator > int( mAOStands.size()-1)) stand_iterator = 0; + if (!(mAOStands.size() > 0)) + { + return; + } + + stand_iterator = stand_iterator+1; + + if (stand_iterator < 0) + { + stand_iterator = S32( mAOStands.size()-stand_iterator); + } + if (stand_iterator > S32( mAOStands.size()-1)) + { + stand_iterator = 0; + } + cmdline_printchat(llformat("Changing stand to %s.",mAOStands[stand_iterator].anim_name.c_str())); ChangeStand(); } +// static BOOL LLFloaterAO::ChangeStand() { if (gSavedSettings.getBOOL("AOEnabled")) @@ -886,17 +1007,32 @@ BOOL LLFloaterAO::ChangeStand() } if ((getAnimationState() == STATE_AGENT_IDLE) || (getAnimationState() == STATE_AGENT_STAND))// stands have lowest priority { - if (!(mAOStands.size() > 0)) return TRUE; + if (!(mAOStands.size() > 0)) + { + return TRUE; + } + if (gSavedSettings.getBOOL("AOStandRandomize")) { stand_iterator = ll_rand(mAOStands.size()-1); } - if (stand_iterator < 0) stand_iterator = int( mAOStands.size()-stand_iterator); - if (stand_iterator > int( mAOStands.size()-1)) stand_iterator = 0; - int stand_iterator_previous = stand_iterator -1; + if (stand_iterator < 0) + { + stand_iterator = S32( mAOStands.size()-stand_iterator); + } + + if (stand_iterator > S32( mAOStands.size()-1)) + { + stand_iterator = 0; + } + + S32 stand_iterator_previous = stand_iterator -1; - if (stand_iterator_previous < 0) stand_iterator_previous = int( mAOStands.size()-1); + if (stand_iterator_previous < 0) + { + stand_iterator_previous = S32( mAOStands.size()-1); + } if (mAOStands[stand_iterator].ao_id.notNull()) { @@ -905,7 +1041,10 @@ BOOL LLFloaterAO::ChangeStand() setAnimationState(STATE_AGENT_STAND); setCurrentStandId(mAOStands[stand_iterator].ao_id); - if ((sInstance)&&(mcomboBox_stands)) mcomboBox_stands->selectNthItem(stand_iterator); + if (sInstance && mComboBox_stands) + { + mComboBox_stands->selectNthItem(stand_iterator); + } // llinfos << "changing stand to " << mAOStands[stand_iterator].anim_name << llendl; return FALSE; } @@ -931,7 +1070,10 @@ BOOL LLFloaterAO::startMotion(const LLUUID& id, F32 time_offset, BOOL stand) { sitting = gAgent.getAvatarObject()->mIsSitting; } - if (sitting) return FALSE; + if (sitting) + { + return FALSE; + } gAgent.sendAnimationRequest(id, ANIM_REQUEST_START); return TRUE; } @@ -944,7 +1086,10 @@ BOOL LLFloaterAO::startMotion(const LLUUID& id, F32 time_offset, BOOL stand) setAnimationState(GetStateFromAnimID(id)); // llinfos << " state " << getAnimationState() << " start anim " << id << " overriding with " << GetAnimID(id) << llendl; - if ((GetStateFromAnimID(id) == STATE_AGENT_SIT) && !(gSavedSettings.getBOOL("AOSitsEnabled"))) return TRUE; + if ((GetStateFromAnimID(id) == STATE_AGENT_SIT) && !(gSavedSettings.getBOOL("AOSitsEnabled"))) + { + return TRUE; + } gAgent.sendAnimationRequest(GetAnimID(id), ANIM_REQUEST_START); return TRUE; } @@ -977,35 +1122,36 @@ BOOL LLFloaterAO::stopMotion(const LLUUID& id, BOOL stop_immediate, BOOL stand) return FALSE; } +// static void LLFloaterAO::onClickReloadCard(void* user_data) { - if(gInventory.isEverythingFetched()) - { - LLFloaterAO::init(); - } + LLFloaterAO::init(); } +// static void LLFloaterAO::onClickOpenCard(void* user_data) { - if(gInventory.isEverythingFetched()) + LLUUID configncitem = (LLUUID)gSavedPerAccountSettings.getString("AOConfigNotecardID"); + if (configncitem.notNull()) { - LLUUID configncitem = (LLUUID)gSavedPerAccountSettings.getString("AOConfigNotecardID"); - if (configncitem.notNull()) + const LLInventoryItem* item = gInventory.getItem(configncitem); + if (item) { - const LLInventoryItem* item = gInventory.getItem(configncitem); - if(item) + if (gAgent.allowOperation(PERM_COPY, item->getPermissions(),GP_OBJECT_MANIPULATE) || gAgent.isGodlike()) { - if (gAgent.allowOperation(PERM_COPY, item->getPermissions(),GP_OBJECT_MANIPULATE) || gAgent.isGodlike()) - { - if(!item->getAssetUUID().isNull()) - open_notecard((LLViewerInventoryItem*)item, std::string("Note: ") + item->getName(), LLUUID::null, FALSE); - // open_notecard((LLViewerInventoryItem*)item, std::string("Note: ") + item->getName(), LLUUID::null, FALSE, LLUUID::null, FALSE); - } + if(!item->getAssetUUID().isNull()) + open_notecard((LLViewerInventoryItem*)item, std::string("Note: ") + item->getName(), LLUUID::null, FALSE); +// open_notecard((LLViewerInventoryItem*)item, std::string("Note: ") + item->getName(), LLUUID::null, FALSE, LLUUID::null, FALSE); } } + else + { + cmdline_printchat("Could not find notecard UUID " + configncitem.asString() + " in your inventory. Make sure your inventory is fully loaded and try again."); + } } } +// static void LLFloaterAO::onClickNewCard(void* user_data) { // load the template file from app_settings/ao_template.ini then @@ -1031,15 +1177,16 @@ struct AOAssetInfo std::string name; }; +// static void LLFloaterAO::onNotecardLoadComplete(LLVFS *vfs,const LLUUID& asset_uuid,LLAssetType::EType type,void* user_data, S32 status, LLExtStat ext_status) { - if(status == LL_ERR_NOERR) + if (status == LL_ERR_NOERR) { S32 size = vfs->getSize(asset_uuid, type); U8* buffer = new U8[size]; vfs->getData(asset_uuid, type, buffer, 0, size); - if(type == LLAssetType::AT_NOTECARD) + if (type == LLAssetType::AT_NOTECARD) { LLViewerTextEditor* edit = new LLViewerTextEditor("",LLRect(0,0,0,0),S32_MAX,""); if(edit->importBuffer((char*)buffer, (S32)size)) @@ -1048,27 +1195,43 @@ void LLFloaterAO::onNotecardLoadComplete(LLVFS *vfs,const LLUUID& asset_uuid,LLA std::string card = edit->getText(); edit->die(); - if (mcomboBox_stands) + if (sInstance && mComboBox_stands) { - mcomboBox_stands->clear(); - mcomboBox_stands->removeall(); + mComboBox_stands->clear(); + mComboBox_stands->removeall(); } - if (mcomboBox_walks) mcomboBox_walks->clear(); - if (mcomboBox_runs) mcomboBox_runs->clear(); - if (mcomboBox_jumps) mcomboBox_jumps->clear(); - if (mcomboBox_sits) mcomboBox_sits->clear(); - if (mcomboBox_gsits) mcomboBox_gsits->clear(); - if (mcomboBox_crouchs) mcomboBox_cwalks->clear(); - if (mcomboBox_cwalks) mcomboBox_cwalks->clear(); - if (mcomboBox_falls) mcomboBox_falls->clear(); - if (mcomboBox_hovers) mcomboBox_hovers->clear(); - if (mcomboBox_flys) mcomboBox_flys->clear(); - if (mcomboBox_flyslows) mcomboBox_flyslows->clear(); - if (mcomboBox_flyups) mcomboBox_flyups->clear(); - if (mcomboBox_flydowns) mcomboBox_flydowns->clear(); - if (mcomboBox_lands) mcomboBox_lands->clear(); - if (mcomboBox_standups) mcomboBox_standups->clear(); - if (mcomboBox_prejumps) mcomboBox_prejumps->clear(); + if (sInstance && mComboBox_walks) + mComboBox_walks->clear(); + if (sInstance && mComboBox_runs) + mComboBox_runs->clear(); + if (sInstance && mComboBox_jumps) + mComboBox_jumps->clear(); + if (sInstance && mComboBox_sits) + mComboBox_sits->clear(); + if (sInstance && mComboBox_gsits) + mComboBox_gsits->clear(); + if (sInstance && mComboBox_crouchs) + mComboBox_cwalks->clear(); + if (sInstance && mComboBox_cwalks) + mComboBox_cwalks->clear(); + if (sInstance && mComboBox_falls) + mComboBox_falls->clear(); + if (sInstance && mComboBox_hovers) + mComboBox_hovers->clear(); + if (sInstance && mComboBox_flys) + mComboBox_flys->clear(); + if (sInstance && mComboBox_flyslows) + mComboBox_flyslows->clear(); + if (sInstance && mComboBox_flyups) + mComboBox_flyups->clear(); + if (sInstance && mComboBox_flydowns) + mComboBox_flydowns->clear(); + if (sInstance && mComboBox_lands) + mComboBox_lands->clear(); + if (sInstance && mComboBox_standups) + mComboBox_standups->clear(); + if (sInstance && mComboBox_prejumps) + mComboBox_prejumps->clear(); struct_stands loader; @@ -1111,134 +1274,185 @@ void LLFloaterAO::onNotecardLoadComplete(LLVFS *vfs,const LLUUID& asset_uuid,LLA { case STATE_AGENT_STAND: loader.ao_id = animid; loader.anim_name = stranim.c_str(); mAOStands.push_back(loader); - if(mcomboBox_stands != NULL) mcomboBox_stands->add(stranim.c_str(), ADD_BOTTOM, TRUE); + if (sInstance && mComboBox_stands != NULL) + { + mComboBox_stands->add(stranim.c_str(), ADD_BOTTOM, TRUE); + } break; case STATE_AGENT_WALK: { - if (sInstance && (mcomboBox_walks != NULL)) + if (sInstance && mComboBox_walks != NULL) { //llinfos << "1 anim: " << stranim.c_str() << " assetid: " << animid << llendl; - if (!(mcomboBox_walks->selectByValue(stranim.c_str()))) mcomboBox_walks->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist + if (!(mComboBox_walks->selectByValue(stranim.c_str()))) + { + mComboBox_walks->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist + } } } break; case STATE_AGENT_RUN: { - if (sInstance && (mcomboBox_runs != NULL)) + if (sInstance && mComboBox_runs != NULL) { - if (!(mcomboBox_runs->selectByValue(stranim.c_str()))) mcomboBox_runs->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist + if (!(mComboBox_runs->selectByValue(stranim.c_str()))) + { + mComboBox_runs->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist + } } } break; case STATE_AGENT_JUMP: { - if (sInstance && (mcomboBox_jumps != NULL)) + if (sInstance && mComboBox_jumps != NULL) { - if (!(mcomboBox_jumps->selectByValue(stranim.c_str()))) mcomboBox_jumps->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist + if (!(mComboBox_jumps->selectByValue(stranim.c_str()))) + { + mComboBox_jumps->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist + } } } break; case STATE_AGENT_SIT: { - if (sInstance && (mcomboBox_sits != NULL)) + if (sInstance && mComboBox_sits != NULL) { - if (!(mcomboBox_sits->selectByValue(stranim.c_str()))) mcomboBox_sits->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist + if (!(mComboBox_sits->selectByValue(stranim.c_str()))) + { + mComboBox_sits->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist + } } } break; case STATE_AGENT_GROUNDSIT: { - if (sInstance && (mcomboBox_gsits != NULL)) + if (sInstance && mComboBox_gsits != NULL) { - if (!(mcomboBox_gsits->selectByValue(stranim.c_str()))) mcomboBox_gsits->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist + if (!(mComboBox_gsits->selectByValue(stranim.c_str()))) + { + mComboBox_gsits->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist + } } } break; case STATE_AGENT_CROUCH: { - if (sInstance && (mcomboBox_crouchs != NULL)) + if (sInstance && mComboBox_crouchs != NULL) { - if (!(mcomboBox_crouchs->selectByValue(stranim.c_str()))) mcomboBox_crouchs->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist + if (!(mComboBox_crouchs->selectByValue(stranim.c_str()))) + { + mComboBox_crouchs->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist + } } } break; case STATE_AGENT_CROUCHWALK: { - if (sInstance && (mcomboBox_cwalks != NULL)) + if (sInstance && mComboBox_cwalks != NULL) { - if (!(mcomboBox_cwalks->selectByValue(stranim.c_str()))) mcomboBox_cwalks->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist + if (!(mComboBox_cwalks->selectByValue(stranim.c_str()))) + { + mComboBox_cwalks->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist + } } } break; case STATE_AGENT_FALLDOWN: { - if (sInstance && (mcomboBox_falls != NULL)) + if (sInstance && mComboBox_falls != NULL) { - if (!(mcomboBox_falls->selectByValue(stranim.c_str()))) mcomboBox_falls->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist + if (!(mComboBox_falls->selectByValue(stranim.c_str()))) + { + mComboBox_falls->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist + } } } break; case STATE_AGENT_HOVER: { - if (sInstance && (mcomboBox_hovers != NULL)) + if (sInstance && mComboBox_hovers != NULL) { - if (!(mcomboBox_hovers->selectByValue(stranim.c_str()))) mcomboBox_hovers->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist + if (!(mComboBox_hovers->selectByValue(stranim.c_str()))) + { + mComboBox_hovers->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist + } } } break; case STATE_AGENT_FLY: { - if (sInstance && (mcomboBox_flys != NULL)) + if (sInstance && mComboBox_flys != NULL) { - if (!(mcomboBox_flys->selectByValue(stranim.c_str()))) mcomboBox_flys->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist + if (!(mComboBox_flys->selectByValue(stranim.c_str()))) + { + mComboBox_flys->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist + } } } break; case STATE_AGENT_FLYSLOW: { - if (sInstance && (mcomboBox_flyslows != NULL)) + if (sInstance && mComboBox_flyslows != NULL) { - if (!(mcomboBox_flyslows->selectByValue(stranim.c_str()))) mcomboBox_flyslows->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist + if (!(mComboBox_flyslows->selectByValue(stranim.c_str()))) + { + mComboBox_flyslows->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist + } } } break; case STATE_AGENT_HOVER_UP: { - if (sInstance && (mcomboBox_flyups != NULL)) + if (sInstance && mComboBox_flyups != NULL) { - if (!(mcomboBox_flyups->selectByValue(stranim.c_str()))) mcomboBox_flyups->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist + if (!(mComboBox_flyups->selectByValue(stranim.c_str()))) + { + mComboBox_flyups->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist + } } } break; case STATE_AGENT_HOVER_DOWN: { - if (sInstance && (mcomboBox_flydowns != NULL)) + if (sInstance && mComboBox_flydowns != NULL) { - if (!(mcomboBox_flydowns->selectByValue(stranim.c_str()))) mcomboBox_flydowns->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist + if (!(mComboBox_flydowns->selectByValue(stranim.c_str()))) + { + mComboBox_flydowns->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist + } } } break; case STATE_AGENT_LAND: { - if (sInstance && (mcomboBox_lands != NULL)) + if (sInstance && mComboBox_lands != NULL) { - if (!(mcomboBox_lands->selectByValue(stranim.c_str()))) mcomboBox_lands->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist + if (!(mComboBox_lands->selectByValue(stranim.c_str()))) + { + mComboBox_lands->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist + } } } break; case STATE_AGENT_STANDUP: { - if (sInstance && (mcomboBox_standups != NULL)) + if (sInstance && mComboBox_standups != NULL) { - if (!(mcomboBox_standups->selectByValue(stranim.c_str()))) mcomboBox_standups->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist + if (!(mComboBox_standups->selectByValue(stranim.c_str()))) + { + mComboBox_standups->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist + } } } break; case STATE_AGENT_PRE_JUMP: { - if (sInstance && (mcomboBox_prejumps != NULL)) + if (sInstance && mComboBox_prejumps != NULL) { - if (!(mcomboBox_prejumps->selectByValue(stranim.c_str()))) mcomboBox_prejumps->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist + if (!(mComboBox_prejumps->selectByValue(stranim.c_str()))) + { + mComboBox_prejumps->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist + } } } break; @@ -1264,113 +1478,161 @@ void LLFloaterAO::onNotecardLoadComplete(LLVFS *vfs,const LLUUID& asset_uuid,LLA case STATE_AGENT_WALK: { std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultWalk"); - SetDefault(mcomboBox_walks,iter->ao_id,defaultanim); - if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); + setDefault(mComboBox_walks, iter->ao_id,defaultanim); + if (getAssetIDByName(defaultanim) != LLUUID::null) + { + iter->ao_id = getAssetIDByName(defaultanim); + } } break; case STATE_AGENT_RUN: { std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultRun"); - SetDefault(mcomboBox_runs,iter->ao_id,defaultanim); - if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); + setDefault(mComboBox_runs, iter->ao_id,defaultanim); + if (getAssetIDByName(defaultanim) != LLUUID::null) + { + iter->ao_id = getAssetIDByName(defaultanim); + } } break; case STATE_AGENT_JUMP: { std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultJump"); - SetDefault(mcomboBox_jumps,iter->ao_id,defaultanim); - if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); + setDefault(mComboBox_jumps, iter->ao_id,defaultanim); + if (getAssetIDByName(defaultanim) != LLUUID::null) + { + iter->ao_id = getAssetIDByName(defaultanim); + } } break; case STATE_AGENT_SIT: { std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultSit"); - SetDefault(mcomboBox_sits,iter->ao_id,defaultanim); - if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); + setDefault(mComboBox_sits, iter->ao_id,defaultanim); + if (getAssetIDByName(defaultanim) != LLUUID::null) + { + iter->ao_id = getAssetIDByName(defaultanim); + } } break; case STATE_AGENT_CROUCH: { std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultCrouch"); - SetDefault(mcomboBox_crouchs,iter->ao_id,defaultanim); - if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); + setDefault(mComboBox_crouchs,iter->ao_id,defaultanim); + if (getAssetIDByName(defaultanim) != LLUUID::null) + { + iter->ao_id = getAssetIDByName(defaultanim); + } } break; case STATE_AGENT_GROUNDSIT: { std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultGroundSit"); - SetDefault(mcomboBox_gsits,iter->ao_id,defaultanim); - if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); + setDefault(mComboBox_gsits,iter->ao_id,defaultanim); + if (getAssetIDByName(defaultanim) != LLUUID::null) + { + iter->ao_id = getAssetIDByName(defaultanim); + } } break; case STATE_AGENT_CROUCHWALK: { std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultCrouchWalk"); - SetDefault(mcomboBox_cwalks,iter->ao_id,defaultanim); - if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); + setDefault(mComboBox_cwalks,iter->ao_id,defaultanim); + if (getAssetIDByName(defaultanim) != LLUUID::null) + { + iter->ao_id = getAssetIDByName(defaultanim); + } } break; case STATE_AGENT_FALLDOWN: { std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultFall"); - SetDefault(mcomboBox_falls,iter->ao_id,defaultanim); - if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); + setDefault(mComboBox_falls,iter->ao_id,defaultanim); + if (getAssetIDByName(defaultanim) != LLUUID::null) + { + iter->ao_id = getAssetIDByName(defaultanim); + } } break; case STATE_AGENT_HOVER: { std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultHover"); - SetDefault(mcomboBox_hovers,iter->ao_id,defaultanim); - if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); + setDefault(mComboBox_hovers,iter->ao_id,defaultanim); + if (getAssetIDByName(defaultanim) != LLUUID::null) + { + iter->ao_id = getAssetIDByName(defaultanim); + } } break; case STATE_AGENT_FLY: { std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultFly"); - SetDefault(mcomboBox_flys,iter->ao_id,defaultanim); - if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); + setDefault(mComboBox_flys,iter->ao_id,defaultanim); + if (getAssetIDByName(defaultanim) != LLUUID::null) + { + iter->ao_id = getAssetIDByName(defaultanim); + } } break; case STATE_AGENT_HOVER_UP: { std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultFlyUp"); - SetDefault(mcomboBox_flyups,iter->ao_id,defaultanim); - if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); + setDefault(mComboBox_flyups,iter->ao_id,defaultanim); + if (getAssetIDByName(defaultanim) != LLUUID::null) + { + iter->ao_id = getAssetIDByName(defaultanim); + } } break; case STATE_AGENT_FLYSLOW: { std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultFlySlow"); - SetDefault(mcomboBox_flyslows,iter->ao_id,defaultanim); - if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); + setDefault(mComboBox_flyslows,iter->ao_id,defaultanim); + if (getAssetIDByName(defaultanim) != LLUUID::null) + { + iter->ao_id = getAssetIDByName(defaultanim); + } } break; case STATE_AGENT_HOVER_DOWN: { std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultFlyDown"); - SetDefault(mcomboBox_flydowns,iter->ao_id,defaultanim); - if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); + setDefault(mComboBox_flydowns,iter->ao_id,defaultanim); + if (getAssetIDByName(defaultanim) != LLUUID::null) + { + iter->ao_id = getAssetIDByName(defaultanim); + } } break; case STATE_AGENT_LAND: { std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultLand"); - SetDefault(mcomboBox_lands,iter->ao_id,defaultanim); - if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); + setDefault(mComboBox_lands,iter->ao_id,defaultanim); + if (getAssetIDByName(defaultanim) != LLUUID::null) + { + iter->ao_id = getAssetIDByName(defaultanim); + } } break; case STATE_AGENT_STANDUP: { std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultStandUp"); - SetDefault(mcomboBox_standups,iter->ao_id,defaultanim); - if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); + setDefault(mComboBox_standups,iter->ao_id,defaultanim); + if (getAssetIDByName(defaultanim) != LLUUID::null) + { + iter->ao_id = getAssetIDByName(defaultanim); + } } break; case STATE_AGENT_PRE_JUMP: { std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultPreJump"); - SetDefault(mcomboBox_prejumps,iter->ao_id,defaultanim); - if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); + setDefault(mComboBox_prejumps,iter->ao_id,defaultanim); + if (getAssetIDByName(defaultanim) != LLUUID::null) + { + iter->ao_id = getAssetIDByName(defaultanim); + } } break; } @@ -1389,7 +1651,8 @@ void LLFloaterAO::onNotecardLoadComplete(LLVFS *vfs,const LLUUID& asset_uuid,LLA } } -BOOL LLFloaterAO::SetDefault(void* userdata, LLUUID ao_id, std::string defaultanim) +// static +bool LLFloaterAO::setDefault(void* userdata, LLUUID ao_id, std::string defaultanim) { if (sInstance && (userdata)) { @@ -1432,14 +1695,18 @@ private: std::string sName; }; +// static const LLUUID& LLFloaterAO::getAssetIDByName(const std::string& name) { - if (name.empty() || !(gInventory.isEverythingFetched())) return LLUUID::null; + if (name.empty()) + { + return LLUUID::null; + } LLViewerInventoryCategory::cat_array_t cats; LLViewerInventoryItem::item_array_t items; ObjectNameMatches objectnamematches(name); - gInventory.collectDescendentsIf(LLUUID::null,cats,items,FALSE,objectnamematches); + gInventory.collectDescendentsIf(LLUUID::null, cats, items, FALSE, objectnamematches); if (items.count()) { diff --git a/linden/indra/newview/floaterao.h b/linden/indra/newview/floaterao.h index 465f32e..45fd7af 100644 --- a/linden/indra/newview/floaterao.h +++ b/linden/indra/newview/floaterao.h @@ -9,35 +9,35 @@ class AONoteCardDropTarget; -const int STATE_AGENT_IDLE = 0; -const int STATE_AGENT_WALK = 1; -const int STATE_AGENT_RUN = 2; -const int STATE_AGENT_STAND = 3; +const S32 STATE_AGENT_IDLE = 0; +const S32 STATE_AGENT_WALK = 1; +const S32 STATE_AGENT_RUN = 2; +const S32 STATE_AGENT_STAND = 3; -const int STATE_AGENT_PRE_JUMP = 4; -const int STATE_AGENT_JUMP = 5; -const int STATE_AGENT_TURNLEFT = 6; -const int STATE_AGENT_TURNRIGHT = 7; +const S32 STATE_AGENT_PRE_JUMP = 4; +const S32 STATE_AGENT_JUMP = 5; +const S32 STATE_AGENT_TURNLEFT = 6; +const S32 STATE_AGENT_TURNRIGHT = 7; -const int STATE_AGENT_SIT = 8; -const int STATE_AGENT_GROUNDSIT = 9; +const S32 STATE_AGENT_SIT = 8; +const S32 STATE_AGENT_GROUNDSIT = 9; -const int STATE_AGENT_HOVER = 10; -const int STATE_AGENT_HOVER_DOWN = 11; -const int STATE_AGENT_HOVER_UP = 12; - -const int STATE_AGENT_CROUCH = 13; -const int STATE_AGENT_CROUCHWALK = 14; -const int STATE_AGENT_FALLDOWN = 15; -const int STATE_AGENT_STANDUP = 16; -const int STATE_AGENT_LAND = 17; - -const int STATE_AGENT_FLY = 18; -const int STATE_AGENT_FLYSLOW = 19; +const S32 STATE_AGENT_HOVER = 10; +const S32 STATE_AGENT_HOVER_DOWN = 11; +const S32 STATE_AGENT_HOVER_UP = 12; +const S32 STATE_AGENT_CROUCH = 13; +const S32 STATE_AGENT_CROUCHWALK = 14; +const S32 STATE_AGENT_FALLDOWN = 15; +const S32 STATE_AGENT_STANDUP = 16; +const S32 STATE_AGENT_LAND = 17; +const S32 STATE_AGENT_FLY = 18; +const S32 STATE_AGENT_FLYSLOW = 19; +class LLFrameTimer; +class LLComboBox; class AOStandTimer : public LLEventTimer { @@ -51,10 +51,12 @@ public: class AOInvTimer : public LLEventTimer { public: - static BOOL fullfetch; AOInvTimer(); ~AOInvTimer(); BOOL tick(); + +private: + static BOOL sInitialized; }; class LLFloaterAO : public LLFloater @@ -66,7 +68,7 @@ public: virtual ~LLFloaterAO(); static void show(void*); - static void init(); + static bool init(); static void onClickToggleAO(LLUICtrl *, void*); static void onClickToggleSits(LLUICtrl *, void*); @@ -75,13 +77,13 @@ public: static BOOL loadAnims(); - static int getAnimationState(); - static void setAnimationState(int state); + static S32 getAnimationState(); + static void setAnimationState(S32 state); static void setStates(const LLUUID& id, BOOL start); static LLUUID getCurrentStandId(); static void setCurrentStandId(const LLUUID& id); - static int stand_iterator; + static S32 stand_iterator; static BOOL ChangeStand(); static BOOL startMotion(const LLUUID& id, F32 time_offset = 0.f, BOOL stand = FALSE); @@ -89,9 +91,9 @@ public: static LLUUID GetAnimID(const LLUUID& id); - static int GetStateFromAnimID(const LLUUID& id); - static LLUUID GetAnimIDFromState(const int state); - static int GetStateFromToken(std::string strtoken); + static S32 GetStateFromAnimID(const LLUUID& id); + static LLUUID GetAnimIDFromState(const S32 state); + static S32 GetStateFromToken(std::string strtoken); static void onClickLess(void* data) ; static void onClickMore(void* data) ; @@ -105,19 +107,20 @@ public: static LLUUID invfolderid; static const LLUUID& getAssetIDByName(const std::string& name); - static bool getInstance(); + static LLFloaterAO* getInstance(); + static bool getVisible(); private: static LLFloaterAO* sInstance; - static int mAnimationState; - static LLUUID mCurrentStandId; + static S32 sAnimationState; + static LLUUID sCurrentStandId; - static AONoteCardDropTarget* mAOItemDropTarget; + static AONoteCardDropTarget* sAOItemDropTarget; static void AOItemDrop(LLViewerInventoryItem* item); static void onSpinnerCommit(LLUICtrl* ctrl, void* userdata); static void onComboBoxCommit(LLUICtrl* ctrl, void* userdata); - static BOOL SetDefault(void *userdata, LLUUID ao_id, std::string defaultanim); + static bool setDefault(void *userdata, LLUUID ao_id, std::string defaultanim); BOOL mDirty; diff --git a/linden/indra/newview/llstartup.cpp b/linden/indra/newview/llstartup.cpp index 3b8215b..08e12ce 100644 --- a/linden/indra/newview/llstartup.cpp +++ b/linden/indra/newview/llstartup.cpp @@ -2913,12 +2913,6 @@ bool idle_startup() gStatusBar->updateElements(); } - // Start the AO now that settings have loaded and login successful -- MC - if (!gAOInvTimer) - { - gAOInvTimer = new AOInvTimer(); - } - LLFirstUse::ClientTags(); // Add login location to teleport history 'teleported-into' @@ -2987,6 +2981,12 @@ bool idle_startup() //LLInventoryView::toggleVisibility(NULL); } + // Init the AO now that settings have loaded and login successful -- MC + if (!gAOInvTimer) + { + gAOInvTimer = new AOInvTimer(); + } + LLStartUp::setStartupState( STATE_STARTED ); LLStartUp::setStartedOnce(true); LLStartUp::setLoginFailed(false); diff --git a/linden/indra/newview/llviewermenu.cpp b/linden/indra/newview/llviewermenu.cpp index ac16dbc..8aed3e0 100644 --- a/linden/indra/newview/llviewermenu.cpp +++ b/linden/indra/newview/llviewermenu.cpp @@ -8329,7 +8329,7 @@ class LLViewCheckAO: public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - gMenuHolder->findControl(userdata["control"].asString())->setValue(LLFloaterAO::getInstance()); + gMenuHolder->findControl(userdata["control"].asString())->setValue(LLFloaterAO::getVisible()); return true; } }; -- cgit v1.1 From 7fac3f9deb8fadefb99372b29e83a00a96528b7f Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Sat, 14 May 2011 15:03:56 -0700 Subject: Added tacky-but-useful button for toggling the AO window in the toolbar --- .../newview/skins/default/xui/en-us/panel_ao_remote_expanded.xml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'linden/indra') diff --git a/linden/indra/newview/skins/default/xui/en-us/panel_ao_remote_expanded.xml b/linden/indra/newview/skins/default/xui/en-us/panel_ao_remote_expanded.xml index 29c34fb..d8b31f1 100644 --- a/linden/indra/newview/skins/default/xui/en-us/panel_ao_remote_expanded.xml +++ b/linden/indra/newview/skins/default/xui/en-us/panel_ao_remote_expanded.xml @@ -3,8 +3,11 @@ enabled="true" follows="right|bottom" height="45" left="0" mouse_opaque="true" name="ao_remote" use_bounding_rect="true" width="96"> -