// TODO: Sort the legacy and non-legacy together? void LLPreviewGesture::addAnimations() { LLComboBox* combo = mAnimationCombo; combo->removeall(); std::string none_text = getString("none_text"); combo->add(none_text, LLUUID::null); // Add all the default (legacy) animations S32 i; for (i = 0; i < gUserAnimStatesCount; ++i) { // Use the user-readable name std::string label = LLAnimStateLabels::getStateLabel( gUserAnimStates[i].mName ); const LLUUID& id = gUserAnimStates[i].mID; combo->add(label, id); } // Get all inventory items that are animations LLViewerInventoryCategory::cat_array_t cats; LLViewerInventoryItem::item_array_t items; LLIsTypeWithPermissions is_copyable_animation(LLAssetType::AT_ANIMATION, PERM_ITEM_UNRESTRICTED, gAgent.getID(), gAgent.getGroupID()); gInventory.collectDescendentsIf(gInventory.getRootFolderID(), cats, items, LLInventoryModel::EXCLUDE_TRASH, is_copyable_animation); // Copy into something we can sort std::vector<LLInventoryItem*> animations; S32 count = items.count(); for(i = 0; i < count; ++i) { animations.push_back( items.get(i) ); } // Do the sort std::sort(animations.begin(), animations.end(), SortItemPtrsByName()); // And load up the combobox std::vector<LLInventoryItem*>::iterator it; for (it = animations.begin(); it != animations.end(); ++it) { LLInventoryItem* item = *it; combo->add(item->getName(), item->getAssetUUID(), ADD_BOTTOM); } }
void LLFloaterAO::addAnimations() { mAnimListCombo->removeall(); std::string none_text = getString("none_text"); mAnimListCombo->add(none_text, LLUUID::null); // Add all the default (legacy) animations S32 i; // Get all inventory items that are animations LLViewerInventoryCategory::cat_array_t cats; LLViewerInventoryItem::item_array_t items; LLIsTypeWithPermissions is_copyable_animation(LLAssetType::AT_ANIMATION, PERM_NONE, gAgent.getID(), gAgent.getGroupID()); gInventory.collectDescendentsIf(gAgent.getInventoryRootID(), cats, items, LLInventoryModel::EXCLUDE_TRASH, is_copyable_animation); // Copy into something we can sort std::vector<LLInventoryItem*> animations; S32 count = items.count(); for(i = 0; i < count; ++i) { animations.push_back( items.get(i) ); } // Do the sort std::sort(animations.begin(), animations.end(), SortItemPtrsByName()); // And load up the combobox std::vector<LLInventoryItem*>::iterator it; for (it = animations.begin(); it != animations.end(); ++it) { LLInventoryItem* item = *it; mAnimListCombo->add(item->getName(), item->getAssetUUID(), ADD_BOTTOM); } }