// static
void LLFloaterExploreSounds::handle_look_at(void* user_data)
{
	LLFloaterExploreSounds* floater = (LLFloaterExploreSounds*)user_data;
	LLScrollListCtrl* list = floater->getChild<LLScrollListCtrl>("sound_list");
	LLUUID selection = list->getSelectedValue().asUUID();
	LLSoundHistoryItem item = floater->getItem(selection); // Single item only
	if(item.mID.isNull()) return;

	LLVector3d pos_global = item.mPosition;

	// Try to find object position
	if(item.mSourceID.notNull())
	{
		LLViewerObject* object = gObjectList.findObject(item.mSourceID);
		if(object)
		{
			pos_global = object->getPositionGlobal();
		}
	}

	// Move the camera
	// Find direction to self (reverse)
	LLVector3d cam = gAgent.getPositionGlobal() - pos_global;
	cam.normalize();
	// Go 4 meters back and 3 meters up
	cam *= 4.0f;
	cam += pos_global;
	cam += LLVector3d(0.f, 0.f, 3.0f);

	gAgent.setFocusOnAvatar(FALSE, FALSE);
	gAgent.setCameraPosAndFocusGlobal(cam, pos_global, item.mSourceID);
	gAgent.setCameraAnimating(FALSE);
}
void LLFloaterExploreAnimations::update()
{
	LLScrollListCtrl* list = getChild<LLScrollListCtrl>("anim_list");
	LLUUID selection = list->getSelectedValue().asUUID();
	list->clearRows(); // do this differently probably

	std::list<LLAnimHistoryItem*> history = animHistory[mAvatarID];
	std::list<LLAnimHistoryItem*>::iterator iter = history.begin();
	std::list<LLAnimHistoryItem*>::iterator end = history.end();
	for( ; iter != end; ++iter)
	{
		LLAnimHistoryItem* item = (*iter);

		LLSD element;
		element["id"] = item->mAssetID;

		LLSD& name_column = element["columns"][0];
		name_column["column"] = "name";
		name_column["value"] = item->mAssetID.asString();

		LLSD& info_column = element["columns"][1];
		info_column["column"] = "info";
		if(item->mPlaying)
			info_column["value"] = "Playing";
		else
			info_column["value"] = llformat("%.1f min ago", (LLTimer::getElapsedSeconds() - item->mTimeStopped) / 60.f);

		list->addElement(element, ADD_BOTTOM);
	}

	list->selectByID(selection);
}
// static
void LLFloaterExploreSounds::handle_copy_uuid(void* user_data)
{
	LLFloaterExploreSounds* floater = (LLFloaterExploreSounds*)user_data;
	LLScrollListCtrl* list = floater->getChild<LLScrollListCtrl>("sound_list");
	LLUUID selection = list->getSelectedValue().asUUID(); // Single item only
	LLSoundHistoryItem item = floater->getItem(selection);
	if(item.mID.isNull()) return;

	gViewerWindow->mWindow->copyTextToClipboard(utf8str_to_wstring(item.mAssetID.asString()));
}
// static
void LLFloaterExploreAnimations::onSelectAnimation(LLUICtrl* ctrl, void* user_data)
{
	LLFloaterExploreAnimations* floater = (LLFloaterExploreAnimations*)user_data;
	LLPreviewAnimation* preview = (LLPreviewAnimation*)floater->mAnimPreview;
	LLScrollListCtrl* list = floater->getChild<LLScrollListCtrl>("anim_list");
	LLUUID selection = list->getSelectedValue().asUUID();
	
	preview->getDummyAvatar()->deactivateAllMotions();
	preview->getDummyAvatar()->startMotion(selection, 0.f);
	preview->setZoom(2.0f);
}
void LLFloaterExploreAnimations::update()
{
	LLScrollListCtrl* list = getChild<LLScrollListCtrl>("anim_list");
	LLUUID selection = list->getSelectedValue().asUUID();
	list->clearRows(); // do this differently probably

    std::string fullname;
    if (gCacheName->getFullName(mAvatarID, fullname))
    {
        setTitle(mTitle + ": " + fullname);
    }
    else
    {
        setTitle(mTitle + ": INVALID AVATAR (" + mAvatarID.asString() + ")");
	}


	std::list<LLAnimHistoryItem*> history = animHistory[mAvatarID];
	std::list<LLAnimHistoryItem*>::iterator iter = history.begin();
	std::list<LLAnimHistoryItem*>::iterator end = history.end();
	for( ; iter != end; ++iter)
	{
		LLAnimHistoryItem* item = (*iter);

		if (gSavedSettings.getBOOL("PhoenixFilterDefaultAnims") && isLindenDefaultAnim(item->mAssetID.asString().c_str()))
		{
			continue;
		}

		LLSD element;
		element["id"] = item->mAssetID;

		LLSD& name_column = element["columns"][0];
		name_column["column"] = "name";
		name_column["value"] = item->mAssetID.asString();

		LLSD& info_column = element["columns"][1];
		info_column["column"] = "info";
		if(item->mPlaying)
			info_column["value"] = "Playing";
		else
			info_column["value"] = llformat("%.1f min ago", (LLTimer::getElapsedSeconds() - item->mTimeStopped) / 60.f);

		list->addElement(element, ADD_BOTTOM);
	}

	list->selectByID(selection);
}
// static
void LLFloaterExploreSounds::handle_copy_uuid(void* user_data)
{
	LLFloaterExploreSounds* floater = (LLFloaterExploreSounds*)user_data;
	LLScrollListCtrl* list = floater->getChild<LLScrollListCtrl>("sound_list");
	LLUUID selection = list->getSelectedValue().asUUID(); // Single item only
	LLSoundHistoryItem item = floater->getItem(selection);
	if(item.mID.isNull()) return;

	if (item.mOwnerID == gAgent.getID())
	{
		gViewerWindow->mWindow->copyTextToClipboard(utf8str_to_wstring(item.mAssetID.asString()));
	}
	else
	{
		LLChat chat;
		chat.mSourceType = CHAT_SOURCE_SYSTEM;
		chat.mText = llformat("Can't copy UUIDs you don't own.");
		LLFloaterChat::addChat(chat);
	}
}
示例#7
0
void LLFloaterWorldMap::updateSims(bool found_null_sim)
{
	if (mCompletingRegionName == "")
	{
		return;
	}

	LLScrollListCtrl *list = getChild<LLScrollListCtrl>("search_results");
	list->operateOnAll(LLCtrlListInterface::OP_DELETE);

	LLSD selected_value = list->getSelectedValue();

	S32 name_length = mCompletingRegionName.length();

	BOOL match_found = FALSE;
	S32 num_results = 0;
	std::map<U64, LLSimInfo*>::const_iterator it;
	for (it = LLWorldMap::getInstance()->mSimInfoMap.begin(); it != LLWorldMap::getInstance()->mSimInfoMap.end(); ++it)
	{
		LLSimInfo* info = (*it).second;
		std::string sim_name = info->mName;
		std::string sim_name_lower = sim_name;
		LLStringUtil::toLower(sim_name_lower);

		if (sim_name_lower.substr(0, name_length) == mCompletingRegionName)
		{
			if (LLWorldMap::getInstance()->mIsTrackingCommit)
			{
				if (sim_name_lower == mCompletingRegionName)
				{
					selected_value = sim_name;
					match_found = TRUE;
				}
			}

			LLSD value;
			value["id"] = sim_name;
			value["columns"][0]["column"] = "sim_name";
			value["columns"][0]["value"] = sim_name;
			list->addElement(value);
			num_results++;
		}
	}
	
	list->selectByValue(selected_value);

	if (found_null_sim)
	{
		mCompletingRegionName = "";
	}

	if (match_found)
	{
		mExactMatch = TRUE;
		childSetFocus("search_results");
		onCommitSearchResult(NULL, this);
	}
	else if (!mExactMatch && num_results > 0)
	{
		list->selectFirstItem(); // select first item by default
		childSetFocus("search_results");
		onCommitSearchResult(NULL, this);
	}
	else
	{
		list->addCommentText(std::string("None found."));
		list->operateOnAll(LLCtrlListInterface::OP_DESELECT);
	}
}