void AgentStateResponder::result(const LLSD &pContent)
{
	llassert(pContent.has(AGENT_STATE_CAN_REBAKE_REGION_FIELD));
	llassert(pContent.get(AGENT_STATE_CAN_REBAKE_REGION_FIELD).isBoolean());
	BOOL canRebakeRegion = pContent.get(AGENT_STATE_CAN_REBAKE_REGION_FIELD).asBoolean();
	LLPathfindingManager::getInstance()->handleAgentState(canRebakeRegion);
}
void LLPathfindingObject::parseObjectData(const LLSD &pObjectData)
{
	llassert(pObjectData.has(PATHFINDING_OBJECT_NAME_FIELD));
	llassert(pObjectData.get(PATHFINDING_OBJECT_NAME_FIELD).isString());
	mName = pObjectData.get(PATHFINDING_OBJECT_NAME_FIELD).asString();
	
	llassert(pObjectData.has(PATHFINDING_OBJECT_DESCRIPTION_FIELD));
	llassert(pObjectData.get(PATHFINDING_OBJECT_DESCRIPTION_FIELD).isString());
	mDescription = pObjectData.get(PATHFINDING_OBJECT_DESCRIPTION_FIELD).asString();

	llassert(pObjectData.has(PATHFINDING_OBJECT_OWNER_FIELD));
	llassert(pObjectData.get(PATHFINDING_OBJECT_OWNER_FIELD).isUUID());
	mOwnerUUID = pObjectData.get(PATHFINDING_OBJECT_OWNER_FIELD).asUUID();
	fetchOwnerName();

	if (pObjectData.has(PATHFINDING_OBJECT_IS_GROUP_OWNED_FIELD))
	{
		llassert(pObjectData.get(PATHFINDING_OBJECT_IS_GROUP_OWNED_FIELD).isBoolean());
		mIsGroupOwned = pObjectData.get(PATHFINDING_OBJECT_IS_GROUP_OWNED_FIELD).asBoolean();
	}

	llassert(pObjectData.has(PATHFINDING_OBJECT_POSITION_FIELD));
	llassert(pObjectData.get(PATHFINDING_OBJECT_POSITION_FIELD).isArray());
	mLocation.setValue(pObjectData.get(PATHFINDING_OBJECT_POSITION_FIELD));
}
void LLNavMeshSimStateChangeNode::post(ResponsePtr pResponse, const LLSD &pContext, const LLSD &pInput) const
{
	llassert(pInput.has(SIM_MESSAGE_BODY_FIELD));
	llassert(pInput.get(SIM_MESSAGE_BODY_FIELD).isMap());
	LLPathfindingNavMeshStatus navMeshStatus(pInput.get(SIM_MESSAGE_BODY_FIELD));
	LLPathfindingManager::getInstance()->handleNavMeshStatusUpdate(navMeshStatus);
}
	void SDTestObject::test<10>()
		// map operations
	{
		SDCleanupCheck check;
		
		LLSD v;
		ensure("undefined has no members", !v.has("amy"));
		ensure("undefined get() is undefined", v.get("bob").isUndefined());
		
		v = LLSD::emptyMap();
		ensure("empty map is a map", v.isMap());
		ensure("empty map has no members", !v.has("cam"));
		ensure("empty map get() is undefined", v.get("don").isUndefined());
		
		v.clear();
		v.insert("eli", 43);
		ensure("insert converts to map", v.isMap());
		ensure("inserted key is present", v.has("eli"));
		ensureTypeAndValue("inserted value", v.get("eli"), 43);
		
		v.insert("fra", false);
		ensure("first key still present", v.has("eli"));
		ensure("second key is present", v.has("fra"));
		ensureTypeAndValue("first value", v.get("eli"), 43);
		ensureTypeAndValue("second value", v.get("fra"), false);
		
		v.erase("eli");
		ensure("first key now gone", !v.has("eli"));
		ensure("second key still present", v.has("fra"));
		ensure("first value gone", v.get("eli").isUndefined());
		ensureTypeAndValue("second value sill there", v.get("fra"), false);
		
		v.erase("fra");
		ensure("second key now gone", !v.has("fra"));
		ensure("second value gone", v.get("fra").isUndefined());
		
		v["gil"] = (std::string)"good morning";
		ensure("third key present", v.has("gil"));
		ensureTypeAndValue("third key value", v.get("gil"), "good morning");
		
		const LLSD& cv = v;	// FIX ME IF POSSIBLE
		ensure("missing key", cv["ham"].isUndefined());
		ensure("key not present", !v.has("ham"));
	
		LLSD w = 43;
		const LLSD& cw = w;	// FIX ME IF POSSIBLE
		int i = cw["ian"];
		ensureTypeAndValue("other missing value", i, 0);
		ensure("other missing key", !w.has("ian"));
		ensure("no conversion", w.isInteger());
		
		LLSD x;
		x = v;
		ensure("copy map type", x.isMap());
		ensureTypeAndValue("copy map value gil", x.get("gil"), "good morning");
	}
void LLAgentStateChangeNode::post(ResponsePtr pResponse, const LLSD &pContext, const LLSD &pInput) const
{
	llassert(pInput.has(SIM_MESSAGE_BODY_FIELD));
	llassert(pInput.get(SIM_MESSAGE_BODY_FIELD).isMap());
	llassert(pInput.get(SIM_MESSAGE_BODY_FIELD).has(AGENT_STATE_CAN_REBAKE_REGION_FIELD));
	llassert(pInput.get(SIM_MESSAGE_BODY_FIELD).get(AGENT_STATE_CAN_REBAKE_REGION_FIELD).isBoolean());
	BOOL canRebakeRegion = pInput.get(SIM_MESSAGE_BODY_FIELD).get(AGENT_STATE_CAN_REBAKE_REGION_FIELD).asBoolean();
	
	LLPathfindingManager::getInstance()->handleAgentState(canRebakeRegion);
}
Esempio n. 6
0
// Update controls based on current settings
void LLPrefsAscentVan::refresh()
{
    //General --------------------------------------------------------------------------------

    //Tags\Colors ----------------------------------------------------------------------------
    //Colors ---------------------------------------------------------------------------------
	LLComboBox* combo = getChild<LLComboBox>("tag_spoofing_combobox");
	if(LLVOAvatar::sClientResolutionList.has("isComplete"))
	{
		//combo->setColor(LLColor4::black);
		combo->clear();
		for(LLSD::map_iterator itr = LLVOAvatar::sClientResolutionList.beginMap(); itr != LLVOAvatar::sClientResolutionList.endMap(); itr++)
		{
			LLSD value = (*itr).second;
			if(value.has("name"))
			{
				std::string name = value.get("name");
				std::string uuid = (*itr).first;
				LLColor4 color = LLColor4(value.get("color"));
				if(value["multiple"].asReal() != 0)
				{
					color *= 1.0/(value["multiple"].asReal()+1.0f);
				}
				LLScrollListItem* item = combo->add(name,uuid);
				//bad practice
				item->getColumn(0)->setColor(color);
			}
		}
		//add Viewer 2.0
		LLScrollListItem* item = combo->add("Viewer 2.0",IMG_DEFAULT_AVATAR);
		//bad practice
		item->getColumn(0)->setColor(LLColor4::black);
	}
	combo->setCurrentByIndex(mSelectedClient);

    childSetEnabled("friends_color_textbox",     mUseStatusColors);
    childSetEnabled("friend_color_swatch",       mUseStatusColors);
    childSetEnabled("estate_owner_color_swatch", mUseStatusColors);
    childSetEnabled("linden_color_swatch",       mUseStatusColors);
    childSetEnabled("muted_color_swatch",        mUseStatusColors);

    childSetEnabled("custom_tag_label_text",   mCustomTagOn);
    childSetEnabled("custom_tag_label_box",    mCustomTagOn);
    childSetValue("custom_tag_label_box", gSavedSettings.getString("AscentCustomTagLabel"));
    childSetEnabled("custom_tag_color_text",   mCustomTagOn);
    childSetEnabled("custom_tag_color_swatch", mCustomTagOn);

    //Body Dynamics --------------------------------------------------------------------------
    childSetEnabled("EmeraldBoobMass",     mBreastPhysicsToggle);
    childSetEnabled("EmeraldBoobHardness", mBreastPhysicsToggle);
    childSetEnabled("EmeraldBoobVelMax",   mBreastPhysicsToggle);
    childSetEnabled("EmeraldBoobFriction", mBreastPhysicsToggle);
    childSetEnabled("EmeraldBoobVelMin",   mBreastPhysicsToggle);
}
void LLPathfindingNavMesh::handleNavMeshResult(const LLSD &pContent, U32 pNavMeshVersion)
{
	llassert(pContent.has(NAVMESH_VERSION_FIELD));
	if (pContent.has(NAVMESH_VERSION_FIELD))
	{
		llassert(pContent.get(NAVMESH_VERSION_FIELD).isInteger());
		llassert(pContent.get(NAVMESH_VERSION_FIELD).asInteger() >= 0);
		U32 embeddedNavMeshVersion = static_cast<U32>(pContent.get(NAVMESH_VERSION_FIELD).asInteger());
		llassert(embeddedNavMeshVersion == pNavMeshVersion); // stinson 03/13/2012 : does this ever occur?
		if (embeddedNavMeshVersion != pNavMeshVersion)
		{
			LL_WARNS() << "Mismatch between expected and embedded navmesh versions occurred" << LL_ENDL;
			pNavMeshVersion = embeddedNavMeshVersion;
		}
	}

	if (mNavMeshStatus.getVersion() == pNavMeshVersion)
	{
		ENavMeshRequestStatus status;
		if ( pContent.has(NAVMESH_DATA_FIELD) )
		{
			const LLSD::Binary &value = pContent.get(NAVMESH_DATA_FIELD).asBinary();
			unsigned int binSize = value.size();
			std::string newStr(reinterpret_cast<const char *>(&value[0]), binSize);
			std::istringstream streamdecomp( newStr );
			unsigned int decompBinSize = 0;
			bool valid = false;
			U8* pUncompressedNavMeshContainer = unzip_llsdNavMesh( valid, decompBinSize, streamdecomp, binSize ) ;
			if ( !valid )
			{
				LL_WARNS() << "Unable to decompress the navmesh llsd." << LL_ENDL;
				status = kNavMeshRequestError;
			}
			else
			{
				llassert(pUncompressedNavMeshContainer);
				mNavMeshData.resize( decompBinSize );
				memcpy( &mNavMeshData[0], &pUncompressedNavMeshContainer[0], decompBinSize );
				status = kNavMeshRequestCompleted;
			}
			if ( pUncompressedNavMeshContainer )
			{
				free( pUncompressedNavMeshContainer );
			}
		}
		else
		{
			LL_WARNS() << "No mesh data received" << LL_ENDL;
			status = kNavMeshRequestError;
		}
		setRequestStatus(status);
	}
}
Esempio n. 8
0
// static
bool LLURLDispatcherImpl::dispatchApp(const std::string& url, 
									  bool right_mouse,
									  LLMediaCtrl* web,
									  bool trusted_browser)
{
	// ensure the URL is in the secondlife:///app/ format
	if (!LLSLURL::isSLURLCommand(url))
	{
		return false;
	}

	LLURI uri(url);
	LLSD pathArray = uri.pathArray();
	pathArray.erase(0); // erase "app"
	std::string cmd = pathArray.get(0);
	pathArray.erase(0); // erase "cmd"
	bool handled = LLCommandDispatcher::dispatch(
			cmd, pathArray, uri.queryMap(), web, trusted_browser);

	// alert if we didn't handle this secondlife:///app/ SLURL
	// (but still return true because it is a valid app SLURL)
	if (! handled)
	{
		LLNotificationsUtil::add("UnsupportedCommandSLURL");
	}
	return true;
}
Esempio n. 9
0
LLSavedLoginEntry::LLSavedLoginEntry(const LLSD& entry_data)
{
	if (entry_data.isUndefined() || !entry_data.isMap())
	{
		throw std::invalid_argument("Cannot create a null login entry.");
	}
	if (!entry_data.has("firstname"))
	{
		throw std::invalid_argument("Missing firstname key.");
	}
	if (!entry_data.has("lastname"))
	{
		throw std::invalid_argument("Missing lastname key.");
	}
	if (!entry_data.has("grid"))
	{
		throw std::invalid_argument("Missing grid key.");
	}
	if (!entry_data.has("password"))
	{
		throw std::invalid_argument("Missing password key.");
	}
	if (!entry_data.get("grid").isInteger())
	{
		throw std::invalid_argument("grid key is not integer.");
	}
	if (!entry_data.get("firstname").isString())
	{
		throw std::invalid_argument("firstname key is not string.");
	}
	if (!entry_data.get("lastname").isString())
	{
		throw std::invalid_argument("lastname key is not string.");
	}
	if (!(entry_data.get("password").isUndefined() || entry_data.get("password").isBinary()))
	{
		throw std::invalid_argument("password key is neither blank nor binary.");
	}
	mEntry = entry_data;
}
Esempio n. 10
0
bool LLProgressView::handleUpdate(const LLSD& event_data)
{
	LLSD message = event_data.get("message");
	LLSD desc = event_data.get("desc");
	LLSD percent = event_data.get("percent");

	if(message.isDefined())
	{
		setMessage(message.asString());
	}

	if(desc.isDefined())
	{
		setText(desc.asString());
	}
	
	if(percent.isDefined())
	{
		setPercent(percent.asReal());
	}
	return false;
}
void LLLoginInstance::handleIndeterminate(const LLSD& event)
{
	// The indeterminate response means that the server
	// gave the viewer a new url and params to try.
	// The login module handles the retry, but it gives us the
	// server response so that we may show
	// the user some status.
	LLSD message = event.get("data").get("message");
	if(message.isDefined())
	{
		LLSD progress_update;
		progress_update["desc"] = message;
		LLEventPumps::getInstance()->obtain("LLProgressView").post(progress_update);
	}
}
bool LLFacebookFriendsPanel::onConnectedToFacebook(const LLSD& data)
{
	LLSD::Integer connection_state = data.get("enum").asInteger();

	if (connection_state == LLFacebookConnect::FB_CONNECTED)
	{
		LLFacebookConnect::instance().loadFacebookFriends();
	}
	else if (connection_state == LLFacebookConnect::FB_NOT_CONNECTED)
	{
		updateSuggestedFriendList();
	}

	return false;
}
bool LLFloaterAutoReplaceSettings::selectedListIsFirst()
{
	bool isFirst = false;
	
	if (!mSelectedListName.empty())
	{
		LLSD lists = mSettings.getListNames(); // an Array of Strings
		LLSD first = lists.get(0);
		if ( first.isString() && first.asString() == mSelectedListName )
		{
			isFirst = true;
		}
	}
	return isFirst;
}
bool LLFacebookCheckinPanel::onFacebookConnectStateChange(const LLSD& data)
{
	switch (data.get("enum").asInteger())
	{
		case LLFacebookConnect::FB_CONNECTED:
			sendCheckin();
			break;

		case LLFacebookConnect::FB_POSTED:
			LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLFacebookCheckinPanel");
			clearAndClose();
			break;
	}

	return false;
}
bool LLFacebookStatusPanel::onFacebookConnectAccountStateChange(const LLSD& data)
{
	if(LLFacebookConnect::instance().isConnected())
	{
		//In process of disconnecting so leave the layout as is
		if(data.get("enum").asInteger() != LLFacebookConnect::FB_DISCONNECTING)
		{
			showConnectedLayout();
		}
	}
	else
	{
		showDisconnectedLayout();
	}

	return false;
}
// static
bool LLURLDispatcherImpl::dispatchApp(const std::string& url, 
									  bool right_mouse,
									  LLWebBrowserCtrl* web,
									  bool trusted_browser)
{
	if (!isSLURL(url))
	{
		return false;
	}

	LLURI uri(url);
	LLSD pathArray = uri.pathArray();
	pathArray.erase(0); // erase "app"
	std::string cmd = pathArray.get(0);
	pathArray.erase(0); // erase "cmd"
	bool handled = LLCommandDispatcher::dispatch(
			cmd, pathArray, uri.queryMap(), web, trusted_browser);
	return handled;
}
LLPreview::LLPreview(const LLSD& key)
:	LLFloater(key),
	mItemUUID(key.has("itemid") ? key.get("itemid").asUUID() : key.asUUID()),
	mObjectUUID(),			// set later by setObjectID()
	mCopyToInvBtn( NULL ),
	mForceClose(FALSE),
	mUserResized(FALSE),
	mCloseAfterSave(FALSE),
	mAssetStatus(PREVIEW_ASSET_UNLOADED),
	mDirty(TRUE)
{
	mAuxItem = new LLInventoryItem;
	// don't necessarily steal focus on creation -- sometimes these guys pop up without user action
	setAutoFocus(FALSE);

	gInventory.addObserver(this);
	
	refreshFromItem();
}
Esempio n. 18
0
// static
bool LLURLDispatcherImpl::dispatchApp(const std::string& url, 
									  bool right_mouse,
									  LLMediaCtrl* web,
									  bool trusted_browser)
{
	// we support legacy secondlife:///app links as well as inworldz:/// *only* in the text editor -- MC
	if (isIZURL(url) || isSLURL(url))
	{
		LLURI uri(url);
		LLSD pathArray = uri.pathArray();
		pathArray.erase(0); // erase "app"
		std::string cmd = pathArray.get(0);
		pathArray.erase(0); // erase "cmd"
		bool handled = LLCommandDispatcher::dispatch(
				cmd, pathArray, uri.queryMap(), web, trusted_browser);
		return handled;
	}
	return false;
}
void LLPathfindingLinkset::parseLinksetData(const LLSD &pLinksetData)
{
	llassert(pLinksetData.has(LINKSET_LAND_IMPACT_FIELD));
	llassert(pLinksetData.get(LINKSET_LAND_IMPACT_FIELD).isInteger());
	llassert(pLinksetData.get(LINKSET_LAND_IMPACT_FIELD).asInteger() >= 0);
	mLandImpact = pLinksetData.get(LINKSET_LAND_IMPACT_FIELD).asInteger();
	
	llassert(pLinksetData.has(LINKSET_MODIFIABLE_FIELD));
	llassert(pLinksetData.get(LINKSET_MODIFIABLE_FIELD).isBoolean());
	mIsModifiable = pLinksetData.get(LINKSET_MODIFIABLE_FIELD).asBoolean();

	mHasIsScripted = pLinksetData.has(LINKSET_IS_SCRIPTED_FIELD);
	if (mHasIsScripted)
	{
		llassert(pLinksetData.get(LINKSET_IS_SCRIPTED_FIELD).isBoolean());
		mIsScripted = pLinksetData.get(LINKSET_IS_SCRIPTED_FIELD).asBoolean();
	}
}
LLPreviewTexture::LLPreviewTexture(const LLSD& key)
	: LLPreview((key.has("uuid") ? key.get("uuid") : key)), // Changed for texture preview mode
	  mLoadingFullImage( FALSE ),
	  mShowKeepDiscard(FALSE),
	  mCopyToInv(FALSE),
	  mIsCopyable(FALSE),
	  mIsFullPerm(FALSE),
	  mUpdateDimensions(TRUE),
	  mLastHeight(0),
	  mLastWidth(0),
	  mAspectRatio(0.f),
	  mPreviewToSave(FALSE),
	  mImage(NULL),
	  mImageOldBoostLevel(LLGLTexture::BOOST_NONE),
	  mShowingButtons(false),
	  mDisplayNameCallback(false),
	  mAvatarNameCallbackConnection(),
	  // <FS:Ansariel> Performance improvement
	  mCurrentImageWidth(0),
	  mCurrentImageHeight(0)
	  // </FS:Ansariel>
{
	updateImageID();
	if (key.has("save_as"))
	{
		mPreviewToSave = TRUE;
	}
	// Texture preview mode
	if (key.has("preview_only"))
	{
		mShowKeepDiscard = FALSE;
		mCopyToInv = FALSE;
		mIsCopyable = FALSE;
		mPreviewToSave = FALSE;
		mIsFullPerm = FALSE;
	}
}
Esempio n. 21
0
void LLInventoryView::init(LLInventoryModel* inventory)
{
	// Callbacks
	init_inventory_actions(this);

	// Controls
	U32 sort_order = gSavedSettings.getU32("InventorySortOrder");
	BOOL sort_by_name = ! ( sort_order & LLInventoryFilter::SO_DATE );
	BOOL sort_folders_by_name = ( sort_order & LLInventoryFilter::SO_FOLDERS_BY_NAME );
	BOOL sort_system_folders_to_top = ( sort_order & LLInventoryFilter::SO_SYSTEM_FOLDERS_TO_TOP );

	addBoolControl("Inventory.ShowFilters", FALSE);
	addBoolControl("Inventory.SortByName", sort_by_name );
	addBoolControl("Inventory.SortByDate", ! sort_by_name );
	addBoolControl("Inventory.FoldersAlwaysByName", sort_folders_by_name );
	addBoolControl("Inventory.SystemFoldersToTop", sort_system_folders_to_top );

	mSavedFolderState = new LLSaveFolderState();
	mSavedFolderState->setApply(FALSE);

	LLUICtrlFactory::getInstance()->buildFloater(this, "floater_inventory.xml", NULL);

	mFilterTabs = (LLTabContainer*)getChild<LLTabContainer>("inventory filter tabs");

	// Set up the default inv. panel/filter settings.
	mActivePanel = getChild<LLInventoryPanel>("All Items");
	if (mActivePanel)
	{
		// "All Items" is the previous only view, so it gets the InventorySortOrder
		mActivePanel->setSortOrder(gSavedSettings.getU32("InventorySortOrder"));
		mActivePanel->getFilter()->markDefault();
		mActivePanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState);
		mActivePanel->setSelectCallback(onSelectionChange, mActivePanel);
	}
	LLInventoryPanel* recent_items_panel = getChild<LLInventoryPanel>("Recent Items");
	if (recent_items_panel)
	{
		recent_items_panel->setSinceLogoff(TRUE);
		recent_items_panel->setSortOrder(LLInventoryFilter::SO_DATE);
		recent_items_panel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
		recent_items_panel->getFilter()->markDefault();
		recent_items_panel->setSelectCallback(onSelectionChange, recent_items_panel);
	}

	// Now load the stored settings from disk, if available.
	std::ostringstream filterSaveName;
	filterSaveName << gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "filters.xml");
	llinfos << "LLInventoryView::init: reading from " << filterSaveName << llendl;
    llifstream file(filterSaveName.str());
	LLSD savedFilterState;
    if (file.is_open())
    {
        LLSDSerialize::fromXML(savedFilterState, file);
		file.close();

		// Load the persistent "Recent Items" settings.
		// Note that the "All Items" settings do not persist.
		if(recent_items_panel)
		{
			if(savedFilterState.has(recent_items_panel->getFilter()->getName()))
			{
				LLSD recent_items = savedFilterState.get(
					recent_items_panel->getFilter()->getName());
				recent_items_panel->getFilter()->fromLLSD(recent_items);
			}
		}

    }


	mSearchEditor = getChild<LLSearchEditor>("inventory search editor");
	if (mSearchEditor)
	{
		mSearchEditor->setSearchCallback(onSearchEdit, this);
	}

	sActiveViews.put(this);

	gInventory.addObserver(this);
}
	void SDTestObject::test<11>()
		// array operations
	{
		SDCleanupCheck check;
		
		LLSD v;
		ensure_equals("undefined has no size", v.size(), 0);
		ensure("undefined get() is undefined", v.get(0).isUndefined());
		
		v = LLSD::emptyArray();
		ensure("empty array is an array", v.isArray());
		ensure_equals("empty array has no size", v.size(), 0);
		ensure("empty map get() is undefined", v.get(0).isUndefined());
		
		v.clear();
		v.append(88);
		v.append("noodle");
		v.append(true);
		ensure_equals("appened array size", v.size(), 3);
		ensure("append array is an array", v.isArray());
		ensureTypeAndValue("append 0", v[0], 88);
		ensureTypeAndValue("append 1", v[1], "noodle");
		ensureTypeAndValue("append 2", v[2], true);
		
		v.insert(0, 77);
		v.insert(2, "soba");
		v.insert(4, false);
		ensure_equals("inserted array size", v.size(), 6);
		ensureTypeAndValue("post insert 0", v[0], 77);
		ensureTypeAndValue("post insert 1", v[1], 88);
		ensureTypeAndValue("post insert 2", v[2], "soba");
		ensureTypeAndValue("post insert 3", v[3], "noodle");
		ensureTypeAndValue("post insert 4", v[4], false);
		ensureTypeAndValue("post insert 5", v[5], true);
		
		ensureTypeAndValue("get 1", v.get(1), 88);
		v.set(1, "hot");
		ensureTypeAndValue("set 1", v.get(1), "hot");
		
		v.erase(3);
		ensure_equals("post erase array size", v.size(), 5);
		ensureTypeAndValue("post erase 0", v[0], 77);
		ensureTypeAndValue("post erase 1", v[1], "hot");
		ensureTypeAndValue("post erase 2", v[2], "soba");
		ensureTypeAndValue("post erase 3", v[3], false);
		ensureTypeAndValue("post erase 4", v[4], true);
		
		v.append(34);
		ensure_equals("size after append", v.size(), 6);
		ensureTypeAndValue("post append 5", v[5], 34);

		LLSD w;
		w = v;
		ensure("copy array type", w.isArray());
		ensure_equals("copy array size", w.size(), 6);
		ensureTypeAndValue("copy array 0", w[0], 77);
		ensureTypeAndValue("copy array 1", w[1], "hot");
		ensureTypeAndValue("copy array 2", w[2], "soba");
		ensureTypeAndValue("copy array 3", w[3], false);
		ensureTypeAndValue("copy array 4", w[4], true);
		ensureTypeAndValue("copy array 5", w[5], 34);
	}
BOOL LLInventoryView::postBuild()
{
	gInventory.addObserver(this);
	
	mFilterTabs = (LLTabContainer*)getChild<LLTabContainer>("inventory filter tabs");

	// Set up the default inv. panel/filter settings.
	mActivePanel = getChild<LLInventoryPanel>("All Items");
	if (mActivePanel)
	{
		// "All Items" is the previous only view, so it gets the InventorySortOrder
		mActivePanel->setSortOrder(gSavedSettings.getU32(LLInventoryPanel::DEFAULT_SORT_ORDER));
		mActivePanel->getFilter()->markDefault();
		mActivePanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState);
		mActivePanel->setSelectCallback(boost::bind(&LLInventoryView::onSelectionChange, this, mActivePanel, _1, _2));
		mResortActivePanel = true;
	}
	LLInventoryPanel* recent_items_panel = getChild<LLInventoryPanel>("Recent Items");
	if (recent_items_panel)
	{
		recent_items_panel->setSinceLogoff(TRUE);
		recent_items_panel->setSortOrder(gSavedSettings.getU32(LLInventoryPanel::RECENTITEMS_SORT_ORDER));
		recent_items_panel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
		recent_items_panel->getFilter()->markDefault();
		recent_items_panel->setSelectCallback(boost::bind(&LLInventoryView::onSelectionChange, this, recent_items_panel, _1, _2));
	}
	LLInventoryPanel* worn_items_panel = getChild<LLInventoryPanel>("Worn Items");
	if (worn_items_panel)
	{
		worn_items_panel->setSortOrder(gSavedSettings.getU32(LLInventoryPanel::WORNITEMS_SORT_ORDER));
		worn_items_panel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
		worn_items_panel->getFilter()->markDefault();
		worn_items_panel->setFilterWorn(true);
		worn_items_panel->setFilterLinks(LLInventoryFilter::FILTERLINK_EXCLUDE_LINKS);
		worn_items_panel->setSelectCallback(boost::bind(&LLInventoryView::onSelectionChange, this, worn_items_panel, _1, _2));
	}

	// Now load the stored settings from disk, if available.
	std::ostringstream filterSaveName;
	filterSaveName << gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, FILTERS_FILENAME);
	llinfos << "LLInventoryView::init: reading from " << filterSaveName.str() << llendl;
	llifstream file(filterSaveName.str());
	LLSD savedFilterState;
	if (file.is_open())
	{
		LLSDSerialize::fromXML(savedFilterState, file);
		file.close();

		// Load the persistent "Recent Items" settings.
		// Note that the "All Items" and "Worn Items" settings do not persist per-account.
		if(recent_items_panel)
		{
			if(savedFilterState.has(recent_items_panel->getFilter()->getName()))
			{
				LLSD recent_items = savedFilterState.get(
					recent_items_panel->getFilter()->getName());
				recent_items_panel->getFilter()->fromLLSD(recent_items);
			}
		}
	}


	mFilterEditor = getChild<LLFilterEditor>("inventory search editor");
	if (mFilterEditor)
	{
		mFilterEditor->setCommitCallback(boost::bind(&LLInventoryView::onFilterEdit, this, _2));
	}

	mQuickFilterCombo = getChild<LLComboBox>("Quick Filter");

	if (mQuickFilterCombo)
	{
		mQuickFilterCombo->setCommitCallback(boost::bind(LLInventoryView::onQuickFilterCommit, _1, this));
	}


	sActiveViews.put(this);

	getChild<LLTabContainer>("inventory filter tabs")->setCommitCallback(boost::bind(&LLInventoryView::onFilterSelected,this));

	childSetAction("Inventory.ResetAll",onResetAll,this);
	childSetAction("Inventory.ExpandAll",onExpandAll,this);
	childSetAction("collapse_btn", onCollapseAll, this);
	return TRUE;
}
BOOL LLEventNotification::load(const LLSD& response)
{
	BOOL event_ok = TRUE;
	LLSD option = response.get("event_id");
	if (option.isDefined())
	{
		mEventID = option.asInteger();
	}
	else
	{
		event_ok = FALSE;
	}

	option = response.get("event_name");
	if (option.isDefined())
	{
		llinfos << "Event: " << option.asString() << llendl;
		mEventName = option.asString();
	}
	else
	{
		event_ok = FALSE;
	}

	option = response.get("event_date");
	if (option.isDefined())
	{
		llinfos << "EventDate: " << option.asString() << llendl;
		mEventDateStr = option.asString();
	}
	else
	{
		event_ok = FALSE;
	}

	option = response.get("event_date_ut");
	if (option.isDefined())
	{
		llinfos << "EventDate: " << option.asString() << llendl;
		mEventDate = strtoul(option.asString().c_str(), NULL, 10);
	}
	else
	{
		event_ok = FALSE;
	}

	S32 grid_x = 0;
	S32 grid_y = 0;
	S32 x_region = 0;
	S32 y_region = 0;

	option = response.get("grid_x");
	if (option.isDefined())
	{
		llinfos << "GridX: " << option.asInteger() << llendl;
		grid_x= option.asInteger();
	}
	else
	{
		event_ok = FALSE;
	}

	option = response.get("grid_y");
	if (option.isDefined())
	{
		llinfos << "GridY: " << option.asInteger() << llendl;
		grid_y = option.asInteger();
	}
	else
	{
		event_ok = FALSE;
	}

	option = response.get("x_region");
	if (option.isDefined())
	{
		llinfos << "RegionX: " << option.asInteger() << llendl;
		x_region = option.asInteger();
	}
	else
	{
		event_ok = FALSE;
	}

	option = response.get("y_region");
	if (option.isDefined())
	{
		llinfos << "RegionY: " << option.asInteger() << llendl;
		y_region = option.asInteger();
	}
	else
	{
		event_ok = FALSE;
	}

	mEventPosGlobal.mdV[VX] = grid_x * 256 + x_region;
	mEventPosGlobal.mdV[VY] = grid_y * 256 + y_region;
	mEventPosGlobal.mdV[VZ] = 0.f;

	return event_ok;
}
BOOL LLPanelMainInventory::postBuild()
{
	gInventory.addObserver(this);
	
	mFilterTabs = getChild<LLTabContainer>("inventory filter tabs");
	mFilterTabs->setCommitCallback(boost::bind(&LLPanelMainInventory::onFilterSelected, this));
	
	//panel->getFilter()->markDefault();

	// Set up the default inv. panel/filter settings.
	mActivePanel = getChild<LLInventoryPanel>("All Items");
	if (mActivePanel)
	{
		// "All Items" is the previous only view, so it gets the InventorySortOrder
		mActivePanel->setSortOrder(gSavedSettings.getU32(LLInventoryPanel::DEFAULT_SORT_ORDER));
		mActivePanel->getFilter()->markDefault();
		mActivePanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState);
		mActivePanel->setSelectCallback(boost::bind(&LLPanelMainInventory::onSelectionChange, this, mActivePanel, _1, _2));
	}
	LLInventoryPanel* recent_items_panel = getChild<LLInventoryPanel>("Recent Items");
	if (recent_items_panel)
	{
		recent_items_panel->setSinceLogoff(TRUE);
		recent_items_panel->setSortOrder(LLInventoryFilter::SO_DATE);
		recent_items_panel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
		recent_items_panel->getFilter()->markDefault();
		recent_items_panel->setSelectCallback(boost::bind(&LLPanelMainInventory::onSelectionChange, this, recent_items_panel, _1, _2));
	}

	// Now load the stored settings from disk, if available.
	std::ostringstream filterSaveName;
	filterSaveName << gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, FILTERS_FILENAME);
	llinfos << "LLPanelMainInventory::init: reading from " << filterSaveName.str() << llendl;
	llifstream file(filterSaveName.str());
	LLSD savedFilterState;
	if (file.is_open())
	{
		LLSDSerialize::fromXML(savedFilterState, file);
		file.close();

		// Load the persistent "Recent Items" settings.
		// Note that the "All Items" settings do not persist.
		if(recent_items_panel)
		{
			if(savedFilterState.has(recent_items_panel->getFilter()->getName()))
			{
				LLSD recent_items = savedFilterState.get(
					recent_items_panel->getFilter()->getName());
				recent_items_panel->getFilter()->fromLLSD(recent_items);
			}
		}

	}

	mFilterEditor = getChild<LLFilterEditor>("inventory search editor");
	if (mFilterEditor)
	{
		mFilterEditor->setCommitCallback(boost::bind(&LLPanelMainInventory::onFilterEdit, this, _2));
	}

	initListCommandsHandlers();

	// *TODO:Get the cost info from the server
	const std::string upload_cost("10");
	mMenuAdd->getChild<LLMenuItemGL>("Upload Image")->setLabelArg("[COST]", upload_cost);
	mMenuAdd->getChild<LLMenuItemGL>("Upload Sound")->setLabelArg("[COST]", upload_cost);
	mMenuAdd->getChild<LLMenuItemGL>("Upload Animation")->setLabelArg("[COST]", upload_cost);
	mMenuAdd->getChild<LLMenuItemGL>("Bulk Upload")->setLabelArg("[COST]", upload_cost);

	return TRUE;
}
void LLPathfindingLinkset::parsePathfindingData(const LLSD &pLinksetData)
{
	bool isPhantom = false;
	if (pLinksetData.has(LINKSET_PHANTOM_FIELD))
	{
		llassert(pLinksetData.get(LINKSET_PHANTOM_FIELD).isBoolean());
		isPhantom = pLinksetData.get(LINKSET_PHANTOM_FIELD).asBoolean();
	}
	
	llassert(pLinksetData.has(LINKSET_CATEGORY_FIELD));
	mLinksetUse = getLinksetUse(isPhantom, convertCategoryFromLLSD(pLinksetData.get(LINKSET_CATEGORY_FIELD)));

	if (pLinksetData.has(LINKSET_CAN_BE_VOLUME))
	{
		llassert(pLinksetData.get(LINKSET_CAN_BE_VOLUME).isBoolean());
		mCanBeVolume = pLinksetData.get(LINKSET_CAN_BE_VOLUME).asBoolean();
	}

	llassert(pLinksetData.has(LINKSET_WALKABILITY_A_FIELD));
	llassert(pLinksetData.get(LINKSET_WALKABILITY_A_FIELD).isInteger());
	mWalkabilityCoefficientA = pLinksetData.get(LINKSET_WALKABILITY_A_FIELD).asInteger();
	llassert(mWalkabilityCoefficientA >= MIN_WALKABILITY_VALUE);
	llassert(mWalkabilityCoefficientA <= MAX_WALKABILITY_VALUE);
	
	llassert(pLinksetData.has(LINKSET_WALKABILITY_B_FIELD));
	llassert(pLinksetData.get(LINKSET_WALKABILITY_B_FIELD).isInteger());
	mWalkabilityCoefficientB = pLinksetData.get(LINKSET_WALKABILITY_B_FIELD).asInteger();
	llassert(mWalkabilityCoefficientB >= MIN_WALKABILITY_VALUE);
	llassert(mWalkabilityCoefficientB <= MAX_WALKABILITY_VALUE);
	
	llassert(pLinksetData.has(LINKSET_WALKABILITY_C_FIELD));
	llassert(pLinksetData.get(LINKSET_WALKABILITY_C_FIELD).isInteger());
	mWalkabilityCoefficientC = pLinksetData.get(LINKSET_WALKABILITY_C_FIELD).asInteger();
	llassert(mWalkabilityCoefficientC >= MIN_WALKABILITY_VALUE);
	llassert(mWalkabilityCoefficientC <= MAX_WALKABILITY_VALUE);
	
	llassert(pLinksetData.has(LINKSET_WALKABILITY_D_FIELD));
	llassert(pLinksetData.get(LINKSET_WALKABILITY_D_FIELD).isInteger());
	mWalkabilityCoefficientD = pLinksetData.get(LINKSET_WALKABILITY_D_FIELD).asInteger();
	llassert(mWalkabilityCoefficientD >= MIN_WALKABILITY_VALUE);
	llassert(mWalkabilityCoefficientD <= MAX_WALKABILITY_VALUE);
}