Merge branch 'V2MultiWear' of git://github.com/Shyotl/SingularityViewer into V2MultiWear

This commit is contained in:
Lirusaito
2012-07-12 17:43:53 -04:00
5 changed files with 80 additions and 16 deletions

View File

@@ -718,20 +718,33 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
} }
else if (major_version > 1 || minor_version >= 30) else if (major_version > 1 || minor_version >= 30)
{ //switches are supported in GLSL 1.30 and later { //switches are supported in GLSL 1.30 and later
text[count++] = strdup("\tvec4 ret = vec4(1,0,1,1);\n"); if (gGLManager.mIsNVIDIA)
text[count++] = strdup("\tswitch (vary_texture_index.r)\n"); { //switches are unreliable on some NVIDIA drivers
text[count++] = strdup("\t{\n"); for (S32 i = 0; i < texture_index_channels; ++i)
{
//switch body std::string if_string = llformat("\t%sif (vary_texture_index.r == %d) { return texture2D(tex%d, texcoord); }\n", i > 0 ? "else " : "", i, i);
for (S32 i = 0; i < texture_index_channels; ++i) text[count++] = strdup(if_string.c_str());
{ }
std::string case_str = llformat("\t\tcase %d: ret = texture2D(tex%d, texcoord); break;\n", i, i); text[count++] = strdup("\treturn vec4(1,0,1,1);\n");
text[count++] = strdup(case_str.c_str()); text[count++] = strdup("}\n");
} }
else
{
text[count++] = strdup("\tvec4 ret = vec4(1,0,1,1);\n");
text[count++] = strdup("\tswitch (vary_texture_index.r)\n");
text[count++] = strdup("\t{\n");
//switch body
for (S32 i = 0; i < texture_index_channels; ++i)
{
std::string case_str = llformat("\t\tcase %d: ret = texture2D(tex%d, texcoord); break;\n", i, i);
text[count++] = strdup(case_str.c_str());
}
text[count++] = strdup("\t}\n"); text[count++] = strdup("\t}\n");
text[count++] = strdup("\treturn ret;\n"); text[count++] = strdup("\treturn ret;\n");
text[count++] = strdup("}\n"); text[count++] = strdup("}\n");
}
} }
else else
{ //should never get here. Indexed texture rendering requires GLSL 1.30 or later { //should never get here. Indexed texture rendering requires GLSL 1.30 or later

View File

@@ -858,12 +858,15 @@ void LLInventoryView::updateItemcountText()
{ {
std::ostringstream title; std::ostringstream title;
title << "Inventory"; title << "Inventory";
if (LLInventoryModelBackgroundFetch::instance().folderFetchActive()) if (LLInventoryModelBackgroundFetch::instance().folderFetchActive() || LLInventoryModelBackgroundFetch::instance().isEverythingFetched())
{ {
LLLocale locale(LLLocale::USER_LOCALE); LLLocale locale(LLLocale::USER_LOCALE);
std::string item_count_string; std::string item_count_string;
LLResMgr::getInstance()->getIntegerString(item_count_string, gInventory.getItemCount()); LLResMgr::getInstance()->getIntegerString(item_count_string, gInventory.getItemCount());
title << " (Fetched " << item_count_string << " items...)"; if(LLInventoryModelBackgroundFetch::instance().folderFetchActive())
title << " (Fetched " << item_count_string << " items...)";
else
title << " ("<< item_count_string << " items)";
} }
title << mFilterText; title << mFilterText;
setTitle(title.str()); setTitle(title.str());

View File

@@ -1035,7 +1035,14 @@ BOOL LLToolDragAndDrop::handleDropTextureProtections(LLViewerObject* hit_obj,
} }
} }
// Add the texture item to the target object's inventory. // Add the texture item to the target object's inventory.
hit_obj->updateInventory(new_item, TASK_INVENTORY_ITEM_KEY, true); if (LLAssetType::AT_TEXTURE == new_item->getType())
{
hit_obj->updateTextureInventory(new_item, TASK_INVENTORY_ITEM_KEY, true);
}
else
{
hit_obj->updateInventory(new_item, TASK_INVENTORY_ITEM_KEY, true);
}
// TODO: Check to see if adding the item was successful; if not, then // TODO: Check to see if adding the item was successful; if not, then
// we should return false here. // we should return false here.
} }
@@ -1050,7 +1057,14 @@ BOOL LLToolDragAndDrop::handleDropTextureProtections(LLViewerObject* hit_obj,
// *FIX: may want to make sure agent can paint hit_obj. // *FIX: may want to make sure agent can paint hit_obj.
// Add the texture item to the target object's inventory. // Add the texture item to the target object's inventory.
hit_obj->updateInventory(new_item, TASK_INVENTORY_ITEM_KEY, true); if (LLAssetType::AT_TEXTURE == new_item->getType())
{
hit_obj->updateTextureInventory(new_item, TASK_INVENTORY_ITEM_KEY, true);
}
else
{
hit_obj->updateInventory(new_item, TASK_INVENTORY_ITEM_KEY, true);
}
// Force the object to update its refetch its inventory so it has this texture. // Force the object to update its refetch its inventory so it has this texture.
hit_obj->fetchInventoryFromServer(); hit_obj->fetchInventoryFromServer();
// TODO: Check to see if adding the item was successful; if not, then // TODO: Check to see if adding the item was successful; if not, then

View File

@@ -2984,6 +2984,33 @@ void LLViewerObject::removeInventory(const LLUUID& item_id)
//gBuildView->refresh(); //gBuildView->refresh();
} }
bool LLViewerObject::isTextureInInventory(LLViewerInventoryItem* item)
{
bool result = false;
if (item && LLAssetType::AT_TEXTURE == item->getType())
{
std::list<LLUUID>::iterator begin = mPendingInventoryItemsIDs.begin();
std::list<LLUUID>::iterator end = mPendingInventoryItemsIDs.end();
bool is_fetching = std::find(begin, end, item->getAssetUUID()) != end;
bool is_fetched = getInventoryItemByAsset(item->getAssetUUID()) != NULL;
result = is_fetched || is_fetching;
}
return result;
}
void LLViewerObject::updateTextureInventory(LLViewerInventoryItem* item, U8 key, bool is_new)
{
if (item && !isTextureInInventory(item))
{
mPendingInventoryItemsIDs.push_back(item->getAssetUUID());
updateInventory(item, key, is_new);
}
}
void LLViewerObject::updateInventory( void LLViewerObject::updateInventory(
LLViewerInventoryItem* item, LLViewerInventoryItem* item,
U8 key, U8 key,

View File

@@ -444,12 +444,15 @@ public:
// manager until we have better iterators. // manager until we have better iterators.
void updateInventory(LLViewerInventoryItem* item, U8 key, bool is_new); void updateInventory(LLViewerInventoryItem* item, U8 key, bool is_new);
void updateInventoryLocal(LLInventoryItem* item, U8 key); // Update without messaging. void updateInventoryLocal(LLInventoryItem* item, U8 key); // Update without messaging.
void updateTextureInventory(LLViewerInventoryItem* item, U8 key, bool is_new);
LLInventoryObject* getInventoryObject(const LLUUID& item_id); LLInventoryObject* getInventoryObject(const LLUUID& item_id);
void getInventoryContents(LLInventoryObject::object_list_t& objects); void getInventoryContents(LLInventoryObject::object_list_t& objects);
LLInventoryObject* getInventoryRoot(); LLInventoryObject* getInventoryRoot();
LLViewerInventoryItem* getInventoryItemByAsset(const LLUUID& asset_id); LLViewerInventoryItem* getInventoryItemByAsset(const LLUUID& asset_id);
S16 getInventorySerial() const { return mInventorySerialNum; } S16 getInventorySerial() const { return mInventorySerialNum; }
bool isTextureInInventory(LLViewerInventoryItem* item);
// These functions does viewer-side only object inventory modifications // These functions does viewer-side only object inventory modifications
void updateViewerInventoryAsset( void updateViewerInventoryAsset(
const LLViewerInventoryItem* item, const LLViewerInventoryItem* item,
@@ -698,6 +701,10 @@ protected:
F32 mAppAngle; // Apparent visual arc in degrees F32 mAppAngle; // Apparent visual arc in degrees
F32 mPixelArea; // Apparent area in pixels F32 mPixelArea; // Apparent area in pixels
// IDs of of all items in the object's content which are added to the object's content,
// but not updated on the server yet. After item was updated, its ID will be removed from this list.
std::list<LLUUID> mPendingInventoryItemsIDs;
// This is the object's inventory from the viewer's perspective. // This is the object's inventory from the viewer's perspective.
LLInventoryObject::object_list_t* mInventory; LLInventoryObject::object_list_t* mInventory;
class LLInventoryCallbackInfo class LLInventoryCallbackInfo