예제 #1
0
//virtual 
void LLUpdateTaskInventoryResponder::uploadComplete(const LLSD& content)
{
	llinfos << "LLUpdateTaskInventoryResponder::result from capabilities" << llendl;
	LLUUID item_id = mPostData["item_id"];
	LLUUID task_id = mPostData["task_id"];

	dialog_refresh_all();
	
	switch(mAssetType)
	{
		case LLAssetType::AT_NOTECARD:
			{
				// Update the UI with the new asset.
				LLPreviewNotecard* nc;
				nc = (LLPreviewNotecard*)LLPreview::find(item_id);
				if(nc)
				{
					// *HACK: we have to delete the asset in the VFS so
					// that the viewer will redownload it. This is only
					// really necessary if the asset had to be modified by
					// the uploader, so this can be optimized away in some
					// cases. A better design is to have a new uuid if the
					// script actually changed the asset.
					if(nc->hasEmbeddedInventory())
					{
						gVFS->removeFile(
							content["new_asset"].asUUID(),
							LLAssetType::AT_NOTECARD);
					}

					nc->setAssetId(content["new_asset"].asUUID());
					nc->refreshFromInventory();
				}
			}
			break;
		case LLAssetType::AT_LSL_TEXT:
			{
				if(mQueueId.notNull())
				{
					LLFloaterCompileQueue* queue = 
						(LLFloaterCompileQueue*) LLFloaterScriptQueue::findInstance(mQueueId);
					if(NULL != queue)
					{
						queue->removeItemByItemID(item_id);
					}
				}
				else
				{
					LLLiveLSLEditor* preview = LLLiveLSLEditor::find(item_id, task_id);
					if (preview)
					{
						// Bytecode save completed
						if (content["compiled"])
						{
							preview->callbackLSLCompileSucceeded(
								task_id,
								item_id,
								mPostData["is_script_running"]);
						}
						else
						{
							preview->callbackLSLCompileFailed(content["errors"]);
						}
					}
				}
			}
			break;
	default:
		break;
	}
}
예제 #2
0
//virtual 
void LLUpdateAgentInventoryResponder::uploadComplete(const LLSD& content)
{
	llinfos << "LLUpdateAgentInventoryResponder::result from capabilities" << llendl;
	LLUUID item_id = mPostData["item_id"];

	LLViewerInventoryItem* item = (LLViewerInventoryItem*)gInventory.getItem(item_id);
	if(!item)
	{
		llwarns << "Inventory item for " << mVFileID
			<< " is no longer in agent inventory." << llendl;
		return;
	}

	// Update viewer inventory item
	LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
	new_item->setAssetUUID(content["new_asset"].asUUID());
	gInventory.updateItem(new_item);
	gInventory.notifyObservers();

	llinfos << "Inventory item " << item->getName() << " saved into "
		<< content["new_asset"].asString() << llendl;

	LLInventoryType::EType inventory_type = new_item->getInventoryType();
	switch(inventory_type)
	{
		case LLInventoryType::IT_NOTECARD:
			{

				// Update the UI with the new asset.
				LLPreviewNotecard* nc;
				nc = (LLPreviewNotecard*)LLPreview::find(new_item->getUUID());
				if(nc)
				{
					// *HACK: we have to delete the asset in the VFS so
					// that the viewer will redownload it. This is only
					// really necessary if the asset had to be modified by
					// the uploader, so this can be optimized away in some
					// cases. A better design is to have a new uuid if the
					// script actually changed the asset.
					if(nc->hasEmbeddedInventory())
					{
						gVFS->removeFile(
							content["new_asset"].asUUID(),
							LLAssetType::AT_NOTECARD);
					}
					nc->refreshFromInventory();
				}
			}
			break;
		case LLInventoryType::IT_LSL:
			{
				// Find our window and close it if requested.
				LLPreviewLSL* preview = (LLPreviewLSL*)LLPreview::find(item_id);
				if (preview)
				{
					// Bytecode save completed
					if (content["compiled"])
					{
						preview->callbackLSLCompileSucceeded();
					}
					else
					{
						preview->callbackLSLCompileFailed(content["errors"]);
					}
				}
			}
			break;

		case LLInventoryType::IT_GESTURE:
			{
				// If this gesture is active, then we need to update the in-memory
				// active map with the new pointer.				
				if (gGestureManager.isGestureActive(item_id))
				{
					LLUUID asset_id = new_item->getAssetUUID();
					gGestureManager.replaceGesture(item_id, asset_id);
					gInventory.notifyObservers();
				}				

				//gesture will have a new asset_id
				LLPreviewGesture* previewp = (LLPreviewGesture*)LLPreview::find(item_id);
				if(previewp)
				{
					previewp->onUpdateSucceeded();	
				}			
				
			}
			break;
		case LLInventoryType::IT_WEARABLE:
		default:
			break;
	}
}