Example #1
0
					virtual bool apply(LLViewerObject* object)
					{
						object->boostTexturePriority(TRUE);
						LLViewerObject::child_list_t children = object->getChildren();
						children.push_front(object); //push root onto list
						LLSD prim_llsd = LLObjectBackup::getInstance()->primsToLLSD(children);				
						LLSD stuff;
						stuff["root_position"] = object->getPosition().getValue();
						stuff["root_rotation"] = ll_sd_from_quaternion(object->getRotation());
						stuff["group_body"] = prim_llsd;
						LLObjectBackup::getInstance()->mLLSD["data"].append(stuff);
						return true;
					}
				virtual bool apply(LLViewerObject* object)
				{
					bool is_attachment = object->isAttachment();
					object->boostTexturePriority(true);
					LLViewerObject::child_list_t children = object->getChildren();
					children.push_front(object); //push root onto list
					LLObjectBackup* self = findInstance();
					LLSD prim_llsd = self->primsToLLSD(children,
													   is_attachment);
					LLSD stuff;
					if (is_attachment)
					{
						stuff["root_position"] = object->getPositionEdit().getValue();
						stuff["root_rotation"] = ll_sd_from_quaternion(object->getRotationEdit());
					}
					else
					{
						stuff["root_position"] = object->getPosition().getValue();
						stuff["root_rotation"] = ll_sd_from_quaternion(object->getRotation());
					}
					stuff["group_body"] = prim_llsd;
					self->mLLSD["data"].append(stuff);
					return true;
				}
void LLFloaterTools::refresh()
{
	const S32 INFO_WIDTH = getRect().getWidth();
	const S32 INFO_HEIGHT = 384;
	LLRect object_info_rect(0, 0, INFO_WIDTH, -INFO_HEIGHT);
	BOOL all_volume = LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME );

	S32 idx_features = mTab->getPanelIndexByTitle(PANEL_NAMES[PANEL_FEATURES]);
	S32 idx_face = mTab->getPanelIndexByTitle(PANEL_NAMES[PANEL_FACE]);
	S32 idx_contents = mTab->getPanelIndexByTitle(PANEL_NAMES[PANEL_CONTENTS]);

	S32 selected_index = mTab->getCurrentPanelIndex();

	if (!all_volume && (selected_index == idx_features || selected_index == idx_face ||
		selected_index == idx_contents))
	{
		mTab->selectFirstTab();
	}

	mTab->enableTabButton(idx_features, all_volume);
	mTab->enableTabButton(idx_face, all_volume);
	mTab->enableTabButton(idx_contents, all_volume);

	// Refresh object and prim count labels
	LLLocale locale(LLLocale::USER_LOCALE);
	// Added in Link Num value -HgB
	S32 object_count = LLSelectMgr::getInstance()->getSelection()->getRootObjectCount();
	S32 prim_count = LLSelectMgr::getInstance()->getEditSelection()->getObjectCount();
	std::string value_string;
	std::string desc_string;
	if ((gSavedSettings.getBOOL("EditLinkedParts"))&&(prim_count == 1)) //Selecting a single prim in "Edit Linked" mode, show link number
	{
		desc_string = "Link number:";

		LLViewerObject* selected = LLSelectMgr::getInstance()->getSelection()->getFirstObject();
		if (selected && selected->getRootEdit())
		{
			LLViewerObject::child_list_t children = selected->getRootEdit()->getChildren();
			if (children.empty())
			{
				value_string = "0"; // An unlinked prim is "link 0".
			}
			else 
			{
				children.push_front(selected->getRootEdit()); // need root in the list too
				S32 index = 0;
				for (LLViewerObject::child_list_t::iterator iter = children.begin(); iter != children.end(); ++iter)
				{
					index++;
					if ((*iter)->isSelected())
					{
						LLResMgr::getInstance()->getIntegerString(value_string, index);
						break;
					}
				}
			}
		}
	}
	else
	{
		desc_string = "Selected objects:";
		LLResMgr::getInstance()->getIntegerString(value_string, object_count);
	}
	childSetTextArg("link_num_obj_count",  "[DESC]", desc_string);	
	childSetTextArg("link_num_obj_count",  "[NUM]", value_string);
	
	LLStringUtil::format_map_t selection_args;
	selection_args["COUNT"] = llformat("%.1d", (S32)prim_count);
	if(gMeshRepo.meshRezEnabled())
	{
		F32 link_cost  = LLSelectMgr::getInstance()->getSelection()->getSelectedObjectCost();
		LLStringUtil::format_map_t prim_equiv_args;
		prim_equiv_args["SEL_WEIGHT"] = llformat("%.1d", (S32)link_cost);
		selection_args["PE_STRING"] = getString("status_selectprimequiv", prim_equiv_args);
	}
	else
	{
		selection_args["PE_STRING"] = "";
	}
	std::string prim_count_string = getString("status_selectcount",selection_args);
	childSetText("prim_count", prim_count_string);

	// Refresh child tabs
	mPanelPermissions->refresh();
	mPanelObject->refresh();
	mPanelVolume->refresh();
	mPanelFace->refresh();
	mPanelContents->refresh();
	mPanelLandInfo->refresh();
}