start pushing in exporting crap
This commit is contained in:
@@ -156,6 +156,8 @@ set(viewer_SOURCE_FILES
|
||||
llfloatereditui.cpp
|
||||
llfloaterenvsettings.cpp
|
||||
llfloaterevent.cpp
|
||||
llfloaterexport.cpp
|
||||
llfloaterexportregion.cpp
|
||||
llfloaterexploreanimations.cpp
|
||||
llfloaterfriends.cpp
|
||||
llfloaterfonttest.cpp
|
||||
@@ -553,7 +555,6 @@ set(viewer_HEADER_FILES
|
||||
lleventinfo.h
|
||||
lleventnotifier.h
|
||||
lleventpoll.h
|
||||
llfloaterexploreanimations.h
|
||||
llface.h
|
||||
llfasttimerview.h
|
||||
llfeaturemanager.h
|
||||
@@ -587,6 +588,9 @@ set(viewer_HEADER_FILES
|
||||
llfloaterdirectory.h
|
||||
llfloatereditui.h
|
||||
llfloaterenvsettings.h
|
||||
llfloaterexport.h
|
||||
llfloaterexportregion.h
|
||||
llfloaterexploreanimations.h
|
||||
llfloaterevent.h
|
||||
llfloaterfonttest.h
|
||||
llfloaterfriends.h
|
||||
|
||||
774
indra/newview/llfloaterexport.cpp
Normal file
774
indra/newview/llfloaterexport.cpp
Normal file
@@ -0,0 +1,774 @@
|
||||
// <edit>
|
||||
|
||||
#include "llviewerprecompiledheaders.h"
|
||||
#include "llfloaterexport.h"
|
||||
#include "lluictrlfactory.h"
|
||||
#include "llsdutil.h"
|
||||
#include "llsdserialize.h"
|
||||
#include "llselectmgr.h"
|
||||
#include "llscrolllistctrl.h"
|
||||
#include "llchat.h"
|
||||
#include "llfloaterchat.h"
|
||||
#include "llfilepicker.h"
|
||||
#include "llagent.h"
|
||||
#include "llvoavatar.h"
|
||||
#include "llvoavatardefines.h"
|
||||
#include "llimportobject.h"
|
||||
#include "llviewerobjectlist.h"
|
||||
#include "llviewerregion.h"
|
||||
|
||||
std::vector<LLFloaterExport*> LLFloaterExport::instances;
|
||||
LLExportable::LLExportable(LLViewerObject* object, std::string name, std::map<U32,std::string>& primNameMap)
|
||||
: mObject(object),
|
||||
mType(EXPORTABLE_OBJECT),
|
||||
mPrimNameMap(&primNameMap)
|
||||
{
|
||||
}
|
||||
|
||||
LLExportable::LLExportable(LLVOAvatar* avatar, EWearableType type, std::map<U32,std::string>& primNameMap)
|
||||
: mAvatar(avatar),
|
||||
mType(EXPORTABLE_WEARABLE),
|
||||
mWearableType(type),
|
||||
mPrimNameMap(&primNameMap)
|
||||
{
|
||||
}
|
||||
|
||||
LLSD LLExportable::asLLSD()
|
||||
{
|
||||
if(mType == EXPORTABLE_OBJECT)
|
||||
{
|
||||
std::list<LLViewerObject*> prims;
|
||||
|
||||
prims.push_back(mObject);
|
||||
|
||||
LLViewerObject::child_list_t child_list = mObject->getChildren();
|
||||
for (LLViewerObject::child_list_t::iterator i = child_list.begin(); i != child_list.end(); ++i)
|
||||
{
|
||||
LLViewerObject* child = *i;
|
||||
if(child->getPCode() < LL_PCODE_APP)
|
||||
{
|
||||
prims.push_back(child);
|
||||
}
|
||||
}
|
||||
|
||||
LLSD llsd;
|
||||
|
||||
std::list<LLViewerObject*>::iterator prim_iter = prims.begin();
|
||||
std::list<LLViewerObject*>::iterator prims_end = prims.end();
|
||||
for( ; prim_iter != prims_end; ++prim_iter)
|
||||
{
|
||||
LLViewerObject* object = (*prim_iter);
|
||||
|
||||
LLSD prim_llsd;
|
||||
|
||||
prim_llsd["type"] = "prim";
|
||||
|
||||
if (!object->isRoot())
|
||||
{
|
||||
if(!object->getSubParent()->isAvatar())
|
||||
{
|
||||
// Parent id
|
||||
prim_llsd["parent"] = llformat("%d", object->getSubParent()->getLocalID());
|
||||
}
|
||||
}
|
||||
if(object->getSubParent())
|
||||
{
|
||||
if(object->getSubParent()->isAvatar())
|
||||
{
|
||||
// attachment-specific
|
||||
U8 state = object->getState();
|
||||
S32 attachpt = ((S32)((((U8)state & AGENT_ATTACH_MASK) >> 4) | (((U8)state & ~AGENT_ATTACH_MASK) << 4)));
|
||||
prim_llsd["attach"] = attachpt;
|
||||
}
|
||||
}
|
||||
|
||||
// Transforms
|
||||
prim_llsd["position"] = object->getPosition().getValue();
|
||||
prim_llsd["scale"] = object->getScale().getValue();
|
||||
prim_llsd["rotation"] = ll_sd_from_quaternion(object->getRotation());
|
||||
|
||||
// Flags
|
||||
prim_llsd["shadows"] = object->flagCastShadows();
|
||||
prim_llsd["phantom"] = object->flagPhantom();
|
||||
prim_llsd["physical"] = (BOOL)(object->mFlags & FLAGS_USE_PHYSICS);
|
||||
|
||||
// Volume params
|
||||
LLVolumeParams params = object->getVolume()->getParams();
|
||||
prim_llsd["volume"] = params.asLLSD();
|
||||
|
||||
// Extra params
|
||||
if (object->isFlexible())
|
||||
{
|
||||
// Flexible
|
||||
LLFlexibleObjectData* flex = (LLFlexibleObjectData*)object->getParameterEntry(LLNetworkData::PARAMS_FLEXIBLE);
|
||||
prim_llsd["flexible"] = flex->asLLSD();
|
||||
}
|
||||
if (object->getParameterEntryInUse(LLNetworkData::PARAMS_LIGHT))
|
||||
{
|
||||
// Light
|
||||
LLLightParams* light = (LLLightParams*)object->getParameterEntry(LLNetworkData::PARAMS_LIGHT);
|
||||
prim_llsd["light"] = light->asLLSD();
|
||||
}
|
||||
if (object->getParameterEntryInUse(LLNetworkData::PARAMS_SCULPT))
|
||||
{
|
||||
// Sculpt
|
||||
LLSculptParams* sculpt = (LLSculptParams*)object->getParameterEntry(LLNetworkData::PARAMS_SCULPT);
|
||||
prim_llsd["sculpt"] = sculpt->asLLSD();
|
||||
}
|
||||
|
||||
// Textures
|
||||
LLSD te_llsd;
|
||||
U8 te_count = object->getNumTEs();
|
||||
for (U8 i = 0; i < te_count; i++)
|
||||
{
|
||||
te_llsd.append(object->getTE(i)->asLLSD());
|
||||
}
|
||||
prim_llsd["textures"] = te_llsd;
|
||||
|
||||
std::map<U32,std::string>::iterator pos = (*mPrimNameMap).find(object->getLocalID());
|
||||
if(pos != (*mPrimNameMap).end())
|
||||
prim_llsd["name"] = (*mPrimNameMap)[object->getLocalID()];
|
||||
|
||||
llsd[llformat("%d", object->getLocalID())] = prim_llsd;
|
||||
}
|
||||
|
||||
return llsd;
|
||||
}
|
||||
else if(mType == EXPORTABLE_WEARABLE)
|
||||
{
|
||||
LLSD llsd; // pointless map with single key/value
|
||||
|
||||
LLSD item_sd; // map for wearable
|
||||
|
||||
item_sd["type"] = "wearable";
|
||||
|
||||
S32 type_s32 = (S32)mWearableType;
|
||||
std::string wearable_name = LLWearable::typeToTypeName( mWearableType );
|
||||
|
||||
item_sd["name"] = mAvatar->getFullname() + " " + wearable_name;
|
||||
item_sd["wearabletype"] = type_s32;
|
||||
|
||||
LLSD param_map;
|
||||
|
||||
for( LLVisualParam* param = mAvatar->getFirstVisualParam(); param; param = mAvatar->getNextVisualParam() )
|
||||
{
|
||||
LLViewerVisualParam* viewer_param = (LLViewerVisualParam*)param;
|
||||
if( (viewer_param->getWearableType() == type_s32) &&
|
||||
(viewer_param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE) )
|
||||
{
|
||||
param_map[llformat("%d", viewer_param->getID())] = viewer_param->getWeight();
|
||||
}
|
||||
}
|
||||
|
||||
item_sd["params"] = param_map;
|
||||
|
||||
LLSD textures_map;
|
||||
|
||||
for( S32 te = 0; te < LLVOAvatarDefines::TEX_NUM_INDICES; te++ )
|
||||
{
|
||||
if( LLVOAvatar::getTEWearableType( (LLVOAvatarDefines::ETextureIndex)te ) == mWearableType )
|
||||
{
|
||||
LLViewerImage* te_image = mAvatar->getTEImage( te );
|
||||
if( te_image )
|
||||
{
|
||||
textures_map[llformat("%d", te)] = te_image->getID();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
item_sd["textures"] = textures_map;
|
||||
|
||||
// Generate a unique ID for it...
|
||||
LLUUID myid;
|
||||
myid.generate();
|
||||
|
||||
llsd[myid.asString()] = item_sd;
|
||||
|
||||
return llsd;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
LLFloaterExport::LLFloaterExport()
|
||||
: LLFloater()
|
||||
{
|
||||
mSelection = LLSelectMgr::getInstance()->getSelection();
|
||||
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_export.xml");
|
||||
LLFloaterExport::instances.push_back(this);
|
||||
}
|
||||
|
||||
|
||||
LLFloaterExport::~LLFloaterExport()
|
||||
{
|
||||
std::vector<LLFloaterExport*>::iterator pos = std::find(LLFloaterExport::instances.begin(), LLFloaterExport::instances.end(), this);
|
||||
if(pos != LLFloaterExport::instances.end())
|
||||
{
|
||||
LLFloaterExport::instances.erase(pos);
|
||||
}
|
||||
}
|
||||
|
||||
BOOL LLFloaterExport::postBuild(void)
|
||||
{
|
||||
if(!mSelection) return TRUE;
|
||||
if(mSelection->getRootObjectCount() < 1) return TRUE;
|
||||
|
||||
// New stuff: Populate prim name map
|
||||
|
||||
for (LLObjectSelection::valid_iterator iter = mSelection->valid_begin();
|
||||
iter != mSelection->valid_end(); iter++)
|
||||
{
|
||||
LLSelectNode* nodep = *iter;
|
||||
LLViewerObject* objectp = nodep->getObject();
|
||||
U32 localid = objectp->getLocalID();
|
||||
std::string name = nodep->mName;
|
||||
mPrimNameMap[localid] = name;
|
||||
}
|
||||
|
||||
// Older stuff
|
||||
|
||||
LLScrollListCtrl* list = getChild<LLScrollListCtrl>("export_list");
|
||||
|
||||
std::map<LLViewerObject*, bool> avatars;
|
||||
|
||||
for (LLObjectSelection::valid_root_iterator iter = mSelection->valid_root_begin();
|
||||
iter != mSelection->valid_root_end(); iter++)
|
||||
{
|
||||
LLSelectNode* nodep = *iter;
|
||||
LLViewerObject* objectp = nodep->getObject();
|
||||
std::string objectp_id = llformat("%d", objectp->getLocalID());
|
||||
|
||||
if(list->getItemIndex(objectp->getID()) == -1)
|
||||
{
|
||||
bool is_attachment = false;
|
||||
bool is_root = true;
|
||||
LLViewerObject* parentp = objectp->getSubParent();
|
||||
if(parentp)
|
||||
{
|
||||
if(!parentp->isAvatar())
|
||||
{
|
||||
// parent is a prim I guess
|
||||
is_root = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// parent is an avatar
|
||||
is_attachment = true;
|
||||
if(!avatars[parentp]) avatars[parentp] = true;
|
||||
}
|
||||
}
|
||||
|
||||
bool is_prim = true;
|
||||
if(objectp->getPCode() >= LL_PCODE_APP)
|
||||
{
|
||||
is_prim = false;
|
||||
}
|
||||
|
||||
bool is_avatar = objectp->isAvatar();
|
||||
|
||||
|
||||
if(is_root && is_prim)
|
||||
{
|
||||
LLSD element;
|
||||
element["id"] = objectp->getID();
|
||||
|
||||
LLSD& check_column = element["columns"][LIST_CHECKED];
|
||||
check_column["column"] = "checked";
|
||||
check_column["type"] = "checkbox";
|
||||
check_column["value"] = true;
|
||||
|
||||
LLSD& type_column = element["columns"][LIST_TYPE];
|
||||
type_column["column"] = "type";
|
||||
type_column["type"] = "icon";
|
||||
type_column["value"] = "inv_item_object.tga";
|
||||
|
||||
LLSD& name_column = element["columns"][LIST_NAME];
|
||||
name_column["column"] = "name";
|
||||
if(is_attachment)
|
||||
name_column["value"] = nodep->mName + " (worn on " + utf8str_tolower(objectp->getAttachmentPointName()) + ")";
|
||||
else
|
||||
name_column["value"] = nodep->mName;
|
||||
|
||||
LLSD& avatarid_column = element["columns"][LIST_AVATARID];
|
||||
avatarid_column["column"] = "avatarid";
|
||||
if(is_attachment)
|
||||
avatarid_column["value"] = parentp->getID();
|
||||
else
|
||||
avatarid_column["value"] = LLUUID::null;
|
||||
|
||||
LLExportable* exportable = new LLExportable(objectp, nodep->mName, mPrimNameMap);
|
||||
mExportables[objectp->getID()] = exportable->asLLSD();
|
||||
|
||||
list->addElement(element, ADD_BOTTOM);
|
||||
|
||||
addToPrimList(objectp);
|
||||
}
|
||||
else if(is_avatar)
|
||||
{
|
||||
if(!avatars[objectp])
|
||||
{
|
||||
avatars[objectp] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
std::map<LLViewerObject*, bool>::iterator avatar_iter = avatars.begin();
|
||||
std::map<LLViewerObject*, bool>::iterator avatars_end = avatars.end();
|
||||
for( ; avatar_iter != avatars_end; avatar_iter++)
|
||||
{
|
||||
LLViewerObject* avatar = (*avatar_iter).first;
|
||||
addAvatarStuff((LLVOAvatar*)avatar);
|
||||
}
|
||||
|
||||
updateNamesProgress();
|
||||
|
||||
childSetAction("select_all_btn", onClickSelectAll, this);
|
||||
childSetAction("select_objects_btn", onClickSelectObjects, this);
|
||||
childSetAction("select_wearables_btn", onClickSelectWearables, this);
|
||||
|
||||
childSetAction("save_as_btn", onClickSaveAs, this);
|
||||
childSetAction("make_copy_btn", onClickMakeCopy, this);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void LLFloaterExport::addAvatarStuff(LLVOAvatar* avatarp)
|
||||
{
|
||||
LLScrollListCtrl* list = getChild<LLScrollListCtrl>("export_list");
|
||||
for( S32 type = WT_SHAPE; type < WT_COUNT; type++ )
|
||||
{
|
||||
// guess whether this wearable actually exists
|
||||
// by checking whether it has any textures that aren't default
|
||||
bool exists = false;
|
||||
if(type == WT_SHAPE)
|
||||
{
|
||||
exists = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
for( S32 te = 0; te < LLVOAvatarDefines::TEX_NUM_INDICES; te++ )
|
||||
{
|
||||
if( (S32)LLVOAvatar::getTEWearableType( (LLVOAvatarDefines::ETextureIndex)te ) == type )
|
||||
{
|
||||
LLViewerImage* te_image = avatarp->getTEImage( te );
|
||||
if( te_image->getID() != IMG_DEFAULT_AVATAR)
|
||||
{
|
||||
exists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(exists)
|
||||
{
|
||||
std::string wearable_name = LLWearable::typeToTypeName( (EWearableType)type );
|
||||
std::string name = avatarp->getFullname() + " " + wearable_name;
|
||||
LLUUID myid;
|
||||
myid.generate();
|
||||
|
||||
LLSD element;
|
||||
element["id"] = myid;
|
||||
|
||||
LLSD& check_column = element["columns"][LIST_CHECKED];
|
||||
check_column["column"] = "checked";
|
||||
check_column["type"] = "checkbox";
|
||||
check_column["value"] = false;
|
||||
|
||||
LLSD& type_column = element["columns"][LIST_TYPE];
|
||||
type_column["column"] = "type";
|
||||
type_column["type"] = "icon";
|
||||
type_column["value"] = "inv_item_" + wearable_name + ".tga";
|
||||
|
||||
LLSD& name_column = element["columns"][LIST_NAME];
|
||||
name_column["column"] = "name";
|
||||
name_column["value"] = name;
|
||||
|
||||
LLSD& avatarid_column = element["columns"][LIST_AVATARID];
|
||||
avatarid_column["column"] = "avatarid";
|
||||
avatarid_column["value"] = avatarp->getID();
|
||||
|
||||
LLExportable* exportable = new LLExportable(avatarp, (EWearableType)type, mPrimNameMap);
|
||||
mExportables[myid] = exportable->asLLSD();
|
||||
|
||||
list->addElement(element, ADD_BOTTOM);
|
||||
}
|
||||
}
|
||||
|
||||
// Add attachments
|
||||
LLViewerObject::child_list_t child_list = avatarp->getChildren();
|
||||
for (LLViewerObject::child_list_t::iterator i = child_list.begin(); i != child_list.end(); ++i)
|
||||
{
|
||||
LLViewerObject* childp = *i;
|
||||
if(list->getItemIndex(childp->getID()) == -1)
|
||||
{
|
||||
LLSD element;
|
||||
element["id"] = childp->getID();
|
||||
|
||||
LLSD& check_column = element["columns"][LIST_CHECKED];
|
||||
check_column["column"] = "checked";
|
||||
check_column["type"] = "checkbox";
|
||||
check_column["value"] = false;
|
||||
|
||||
LLSD& type_column = element["columns"][LIST_TYPE];
|
||||
type_column["column"] = "type";
|
||||
type_column["type"] = "icon";
|
||||
type_column["value"] = "inv_item_object.tga";
|
||||
|
||||
LLSD& name_column = element["columns"][LIST_NAME];
|
||||
name_column["column"] = "name";
|
||||
name_column["value"] = "Object (worn on " + utf8str_tolower(childp->getAttachmentPointName()) + ")";
|
||||
|
||||
LLSD& avatarid_column = element["columns"][LIST_AVATARID];
|
||||
avatarid_column["column"] = "avatarid";
|
||||
avatarid_column["value"] = avatarp->getID();
|
||||
|
||||
LLExportable* exportable = new LLExportable(childp, "Object", mPrimNameMap);
|
||||
mExportables[childp->getID()] = exportable->asLLSD();
|
||||
|
||||
list->addElement(element, ADD_BOTTOM);
|
||||
|
||||
addToPrimList(childp);
|
||||
//LLSelectMgr::getInstance()->selectObjectAndFamily(childp, false);
|
||||
//LLSelectMgr::getInstance()->deselectObjectAndFamily(childp, true, true);
|
||||
|
||||
LLViewerObject::child_list_t select_list = childp->getChildren();
|
||||
LLViewerObject::child_list_t::iterator select_iter;
|
||||
int block_counter;
|
||||
|
||||
gMessageSystem->newMessageFast(_PREHASH_ObjectSelect);
|
||||
gMessageSystem->nextBlockFast(_PREHASH_AgentData);
|
||||
gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
|
||||
gMessageSystem->addUUID(_PREHASH_SessionID, gAgent.getSessionID());
|
||||
gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
|
||||
gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, childp->getLocalID());
|
||||
block_counter = 0;
|
||||
for (select_iter = select_list.begin(); select_iter != select_list.end(); ++select_iter)
|
||||
{
|
||||
block_counter++;
|
||||
if(block_counter >= 254)
|
||||
{
|
||||
// start a new message
|
||||
gMessageSystem->sendReliable(childp->getRegion()->getHost());
|
||||
gMessageSystem->newMessageFast(_PREHASH_ObjectSelect);
|
||||
gMessageSystem->nextBlockFast(_PREHASH_AgentData);
|
||||
gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
|
||||
gMessageSystem->addUUID(_PREHASH_SessionID, gAgent.getSessionID());
|
||||
}
|
||||
gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
|
||||
gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, (*select_iter)->getLocalID());
|
||||
}
|
||||
gMessageSystem->sendReliable(childp->getRegion()->getHost());
|
||||
|
||||
gMessageSystem->newMessageFast(_PREHASH_ObjectDeselect);
|
||||
gMessageSystem->nextBlockFast(_PREHASH_AgentData);
|
||||
gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
|
||||
gMessageSystem->addUUID(_PREHASH_SessionID, gAgent.getSessionID());
|
||||
gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
|
||||
gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, childp->getLocalID());
|
||||
block_counter = 0;
|
||||
for (select_iter = select_list.begin(); select_iter != select_list.end(); ++select_iter)
|
||||
{
|
||||
block_counter++;
|
||||
if(block_counter >= 254)
|
||||
{
|
||||
// start a new message
|
||||
gMessageSystem->sendReliable(childp->getRegion()->getHost());
|
||||
gMessageSystem->newMessageFast(_PREHASH_ObjectDeselect);
|
||||
gMessageSystem->nextBlockFast(_PREHASH_AgentData);
|
||||
gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
|
||||
gMessageSystem->addUUID(_PREHASH_SessionID, gAgent.getSessionID());
|
||||
}
|
||||
gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
|
||||
gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, (*select_iter)->getLocalID());
|
||||
}
|
||||
gMessageSystem->sendReliable(childp->getRegion()->getHost());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//static
|
||||
void LLFloaterExport::onClickSelectAll(void* user_data)
|
||||
{
|
||||
LLFloaterExport* floater = (LLFloaterExport*)user_data;
|
||||
LLScrollListCtrl* list = floater->getChild<LLScrollListCtrl>("export_list");
|
||||
std::vector<LLScrollListItem*> items = list->getAllData();
|
||||
std::vector<LLScrollListItem*>::iterator item_iter = items.begin();
|
||||
std::vector<LLScrollListItem*>::iterator items_end = items.end();
|
||||
bool new_value = !((*item_iter)->getColumn(LIST_CHECKED)->getValue());
|
||||
for( ; item_iter != items_end; ++item_iter)
|
||||
{
|
||||
LLScrollListItem* item = (*item_iter);
|
||||
item->getColumn(LIST_CHECKED)->setValue(new_value);
|
||||
}
|
||||
}
|
||||
|
||||
//static
|
||||
void LLFloaterExport::onClickSelectObjects(void* user_data)
|
||||
{
|
||||
LLFloaterExport* floater = (LLFloaterExport*)user_data;
|
||||
LLScrollListCtrl* list = floater->getChild<LLScrollListCtrl>("export_list");
|
||||
std::vector<LLScrollListItem*> items = list->getAllData();
|
||||
std::vector<LLScrollListItem*>::iterator item_iter = items.begin();
|
||||
std::vector<LLScrollListItem*>::iterator items_end = items.end();
|
||||
bool new_value = false;
|
||||
for( ; item_iter != items_end; ++item_iter)
|
||||
{
|
||||
if(((*item_iter)->getColumn(LIST_TYPE)->getValue()).asString() == "inv_item_object.tga")
|
||||
{
|
||||
new_value = !((*item_iter)->getColumn(LIST_CHECKED)->getValue());
|
||||
break;
|
||||
}
|
||||
}
|
||||
for(item_iter = items.begin(); item_iter != items_end; ++item_iter)
|
||||
{
|
||||
if(((*item_iter)->getColumn(LIST_TYPE)->getValue()).asString() == "inv_item_object.tga")
|
||||
{
|
||||
LLScrollListItem* item = (*item_iter);
|
||||
item->getColumn(LIST_CHECKED)->setValue(new_value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//static
|
||||
void LLFloaterExport::onClickSelectWearables(void* user_data)
|
||||
{
|
||||
LLFloaterExport* floater = (LLFloaterExport*)user_data;
|
||||
LLScrollListCtrl* list = floater->getChild<LLScrollListCtrl>("export_list");
|
||||
std::vector<LLScrollListItem*> items = list->getAllData();
|
||||
std::vector<LLScrollListItem*>::iterator item_iter = items.begin();
|
||||
std::vector<LLScrollListItem*>::iterator items_end = items.end();
|
||||
bool new_value = false;
|
||||
for( ; item_iter != items_end; ++item_iter)
|
||||
{
|
||||
if(((*item_iter)->getColumn(LIST_TYPE)->getValue()).asString() != "inv_item_object.tga")
|
||||
{
|
||||
new_value = !((*item_iter)->getColumn(LIST_CHECKED)->getValue());
|
||||
break;
|
||||
}
|
||||
}
|
||||
for(item_iter = items.begin(); item_iter != items_end; ++item_iter)
|
||||
{
|
||||
if(((*item_iter)->getColumn(LIST_TYPE)->getValue()).asString() != "inv_item_object.tga")
|
||||
{
|
||||
LLScrollListItem* item = (*item_iter);
|
||||
item->getColumn(LIST_CHECKED)->setValue(new_value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LLSD LLFloaterExport::getLLSD()
|
||||
{
|
||||
LLScrollListCtrl* list = getChild<LLScrollListCtrl>("export_list");
|
||||
std::vector<LLScrollListItem*> items = list->getAllData();
|
||||
LLSD sd;
|
||||
std::vector<LLScrollListItem*>::iterator item_iter = items.begin();
|
||||
std::vector<LLScrollListItem*>::iterator items_end = items.end();
|
||||
for( ; item_iter != items_end; ++item_iter)
|
||||
{
|
||||
LLScrollListItem* item = (*item_iter);
|
||||
if(item->getColumn(LIST_CHECKED)->getValue())
|
||||
{
|
||||
LLSD item_sd = mExportables[item->getUUID()];
|
||||
LLSD::map_iterator map_iter = item_sd.beginMap();
|
||||
LLSD::map_iterator map_end = item_sd.endMap();
|
||||
for( ; map_iter != map_end; ++map_iter)
|
||||
{
|
||||
std::string key((*map_iter).first);
|
||||
LLSD data = (*map_iter).second;
|
||||
// copy it...
|
||||
sd[key] = data;
|
||||
}
|
||||
}
|
||||
}
|
||||
return sd;
|
||||
}
|
||||
|
||||
//static
|
||||
void LLFloaterExport::onClickSaveAs(void* user_data)
|
||||
{
|
||||
LLFloaterExport* floater = (LLFloaterExport*)user_data;
|
||||
LLSD sd = floater->getLLSD();
|
||||
|
||||
if(sd.size())
|
||||
{
|
||||
std::string default_filename = "untitled";
|
||||
|
||||
// set correct names within llsd
|
||||
LLSD::map_iterator map_iter = sd.beginMap();
|
||||
LLSD::map_iterator map_end = sd.endMap();
|
||||
for( ; map_iter != map_end; ++map_iter)
|
||||
{
|
||||
std::istringstream keystr((*map_iter).first);
|
||||
U32 key;
|
||||
keystr >> key;
|
||||
LLSD item = (*map_iter).second;
|
||||
if(item["type"].asString() == "prim")
|
||||
{
|
||||
std::string name = floater->mPrimNameMap[key];
|
||||
item["name"] = name;
|
||||
// I don't understand C++ :(
|
||||
sd[(*map_iter).first] = item;
|
||||
}
|
||||
}
|
||||
|
||||
// count the number of selected items
|
||||
LLScrollListCtrl* list = floater->getChild<LLScrollListCtrl>("export_list");
|
||||
std::vector<LLScrollListItem*> items = list->getAllData();
|
||||
int item_count = 0;
|
||||
LLUUID avatarid = (*(items.begin()))->getColumn(LIST_AVATARID)->getValue().asUUID();
|
||||
bool all_same_avatarid = true;
|
||||
std::vector<LLScrollListItem*>::iterator item_iter = items.begin();
|
||||
std::vector<LLScrollListItem*>::iterator items_end = items.end();
|
||||
for( ; item_iter != items_end; ++item_iter)
|
||||
{
|
||||
LLScrollListItem* item = (*item_iter);
|
||||
if(item->getColumn(LIST_CHECKED)->getValue())
|
||||
{
|
||||
item_count++;
|
||||
if(item->getColumn(LIST_AVATARID)->getValue().asUUID() != avatarid)
|
||||
{
|
||||
all_same_avatarid = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(item_count == 1)
|
||||
{
|
||||
// Exporting one item? Use its name for the filename.
|
||||
// But make sure it's a root!
|
||||
LLSD target = (*(sd.beginMap())).second;
|
||||
if(target.has("parent"))
|
||||
{
|
||||
std::string parentid = target["parent"].asString();
|
||||
target = sd[parentid];
|
||||
}
|
||||
if(target.has("name"))
|
||||
{
|
||||
if(target["name"].asString().length() > 0)
|
||||
{
|
||||
default_filename = target["name"].asString();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Multiple items?
|
||||
// If they're all part of the same avatar, use the avatar's name as filename.
|
||||
if(all_same_avatarid)
|
||||
{
|
||||
std::string fullname;
|
||||
if(gCacheName->getFullName(avatarid, fullname))
|
||||
{
|
||||
default_filename = fullname;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LLFilePicker& file_picker = LLFilePicker::instance();
|
||||
if(file_picker.getSaveFile( LLFilePicker::FFSAVE_XML, LLDir::getScrubbedFileName(default_filename + ".xml")))
|
||||
{
|
||||
std::string file_name = file_picker.getFirstFile();
|
||||
llofstream export_file(file_name);
|
||||
LLSDSerialize::toPrettyXML(sd, export_file);
|
||||
export_file.close();
|
||||
|
||||
std::string msg = "Saved ";
|
||||
msg.append(file_name);
|
||||
LLChat chat(msg);
|
||||
LLFloaterChat::addChat(chat);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string msg = "No exportable items selected";
|
||||
LLChat chat(msg);
|
||||
LLFloaterChat::addChat(chat);
|
||||
return;
|
||||
}
|
||||
|
||||
floater->close();
|
||||
}
|
||||
|
||||
//static
|
||||
void LLFloaterExport::onClickMakeCopy(void* user_data)
|
||||
{
|
||||
LLFloaterExport* floater = (LLFloaterExport*)user_data;
|
||||
LLSD sd = floater->getLLSD();
|
||||
|
||||
if(sd.size())
|
||||
{
|
||||
LLXmlImport::import(new LLXmlImportOptions(sd));
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string msg = "No copyable items selected";
|
||||
LLChat chat(msg);
|
||||
LLFloaterChat::addChat(chat);
|
||||
return;
|
||||
}
|
||||
|
||||
// I guess close the floater because only one import is allowed at once anyway
|
||||
floater->close();
|
||||
}
|
||||
|
||||
void LLFloaterExport::addToPrimList(LLViewerObject* object)
|
||||
{
|
||||
mPrimList.push_back(object->getLocalID());
|
||||
LLViewerObject::child_list_t child_list = object->getChildren();
|
||||
for (LLViewerObject::child_list_t::iterator i = child_list.begin(); i != child_list.end(); ++i)
|
||||
{
|
||||
LLViewerObject* child = *i;
|
||||
if(child->getPCode() < LL_PCODE_APP)
|
||||
{
|
||||
mPrimList.push_back(child->getLocalID());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LLFloaterExport::updateNamesProgress()
|
||||
{
|
||||
childSetText("names_progress_text", llformat("Names retrieved: %d of %d", mPrimNameMap.size(), mPrimList.size()));
|
||||
}
|
||||
|
||||
void LLFloaterExport::receivePrimName(LLViewerObject* object, std::string name)
|
||||
{
|
||||
LLUUID fullid = object->getID();
|
||||
U32 localid = object->getLocalID();
|
||||
if(std::find(mPrimList.begin(), mPrimList.end(), localid) != mPrimList.end())
|
||||
{
|
||||
mPrimNameMap[localid] = name;
|
||||
LLScrollListCtrl* list = getChild<LLScrollListCtrl>("export_list");
|
||||
S32 item_index = list->getItemIndex(fullid);
|
||||
if(item_index != -1)
|
||||
{
|
||||
std::vector<LLScrollListItem*> items = list->getAllData();
|
||||
std::vector<LLScrollListItem*>::iterator iter = items.begin();
|
||||
std::vector<LLScrollListItem*>::iterator end = items.end();
|
||||
for( ; iter != end; ++iter)
|
||||
{
|
||||
if((*iter)->getUUID() == fullid)
|
||||
{
|
||||
(*iter)->getColumn(LIST_NAME)->setValue(name + " (worn on " + utf8str_tolower(object->getAttachmentPointName()) + ")");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
updateNamesProgress();
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
void LLFloaterExport::receiveObjectProperties(LLUUID fullid, std::string name, std::string desc)
|
||||
{
|
||||
LLViewerObject* object = gObjectList.findObject(fullid);
|
||||
std::vector<LLFloaterExport*>::iterator iter = LLFloaterExport::instances.begin();
|
||||
std::vector<LLFloaterExport*>::iterator end = LLFloaterExport::instances.end();
|
||||
for( ; iter != end; ++iter)
|
||||
{
|
||||
(*iter)->receivePrimName(object, name);
|
||||
}
|
||||
}
|
||||
|
||||
// </edit>
|
||||
114
indra/newview/llfloaterexport.h
Normal file
114
indra/newview/llfloaterexport.h
Normal file
@@ -0,0 +1,114 @@
|
||||
// <edit>
|
||||
#ifndef LL_LLFLOATEREXPORT_H
|
||||
#define LL_LLFLOATEREXPORT_H
|
||||
|
||||
#include "llfloater.h"
|
||||
#include "llselectmgr.h"
|
||||
#include "llvoavatar.h"
|
||||
#include "llvoavatardefines.h"
|
||||
|
||||
//class LLExportObject
|
||||
//{
|
||||
//public:
|
||||
// LLExportObject(LLViewerObject* object);
|
||||
// //LLExportObject(LLViewerObject* object, std::string name);
|
||||
//
|
||||
// LLSD asLLSD();
|
||||
//
|
||||
// LLViewerObject* mObject;
|
||||
//};
|
||||
//
|
||||
//class LLExportWearable
|
||||
//{
|
||||
//public:
|
||||
// LLExportWearable(LLVOAvatar* avatar, EWearableType type);
|
||||
//
|
||||
// LLSD asLLSD();
|
||||
// std::string getIcon();
|
||||
//
|
||||
// LLVOAvatar* mAvatar;
|
||||
// EWearableType mType;
|
||||
// std::string mName;
|
||||
//};
|
||||
//
|
||||
//
|
||||
//class LLExportBakedWearable // not used
|
||||
//{
|
||||
//public:
|
||||
// LLExportBakedWearable(LLVOAvatar* avatar, EWearableType type);
|
||||
//
|
||||
// LLSD asLLSD();
|
||||
// std::string getIcon();
|
||||
//
|
||||
// LLVOAvatar* mAvatar;
|
||||
// EWearableType mType;
|
||||
// std::string mName;
|
||||
//};
|
||||
|
||||
|
||||
|
||||
class LLExportable
|
||||
{
|
||||
enum EXPORTABLE_TYPE
|
||||
{
|
||||
EXPORTABLE_OBJECT,
|
||||
EXPORTABLE_WEARABLE
|
||||
};
|
||||
|
||||
public:
|
||||
LLExportable(LLViewerObject* object, std::string name, std::map<U32,std::string>& primNameMap);
|
||||
LLExportable(LLVOAvatar* avatar, EWearableType type, std::map<U32,std::string>& primNameMap);
|
||||
|
||||
LLSD asLLSD();
|
||||
|
||||
EXPORTABLE_TYPE mType;
|
||||
EWearableType mWearableType;
|
||||
LLViewerObject* mObject;
|
||||
LLVOAvatar* mAvatar;
|
||||
std::map<U32,std::string>* mPrimNameMap;
|
||||
};
|
||||
|
||||
|
||||
class LLFloaterExport
|
||||
: public LLFloater
|
||||
{
|
||||
public:
|
||||
LLFloaterExport();
|
||||
BOOL postBuild(void);
|
||||
void addAvatarStuff(LLVOAvatar* avatarp);
|
||||
void updateNamesProgress();
|
||||
void receivePrimName(LLViewerObject* object, std::string name);
|
||||
|
||||
LLSD getLLSD();
|
||||
|
||||
std::vector<U32> mPrimList;
|
||||
std::map<U32, std::string> mPrimNameMap;
|
||||
|
||||
static std::vector<LLFloaterExport*> instances; // for callback-type use
|
||||
|
||||
static void receiveObjectProperties(LLUUID fullid, std::string name, std::string desc);
|
||||
|
||||
static void onClickSelectAll(void* user_data);
|
||||
static void onClickSelectObjects(void* user_data);
|
||||
static void onClickSelectWearables(void* user_data);
|
||||
static void onClickSaveAs(void* user_data);
|
||||
static void onClickMakeCopy(void* user_data);
|
||||
|
||||
private:
|
||||
virtual ~LLFloaterExport();
|
||||
void addToPrimList(LLViewerObject* object);
|
||||
|
||||
enum LIST_COLUMN_ORDER
|
||||
{
|
||||
LIST_CHECKED,
|
||||
LIST_TYPE,
|
||||
LIST_NAME,
|
||||
LIST_AVATARID
|
||||
};
|
||||
|
||||
LLObjectSelectionHandle mSelection;
|
||||
std::map<LLUUID, LLSD> mExportables;
|
||||
};
|
||||
|
||||
#endif
|
||||
// </edit>
|
||||
256
indra/newview/llfloaterexportregion.cpp
Normal file
256
indra/newview/llfloaterexportregion.cpp
Normal file
@@ -0,0 +1,256 @@
|
||||
// <edit>
|
||||
|
||||
#include "llviewerprecompiledheaders.h"
|
||||
#include "llfloaterexportregion.h"
|
||||
#include "llfloaterexport.h"
|
||||
#include "lluictrlfactory.h"
|
||||
#include "llsdutil.h"
|
||||
#include "llsdserialize.h"
|
||||
#include "llselectmgr.h"
|
||||
#include "llscrolllistctrl.h"
|
||||
#include "llchat.h"
|
||||
#include "llfloaterchat.h"
|
||||
#include "llfilepicker.h"
|
||||
#include "llagent.h"
|
||||
#include "llvoavatar.h"
|
||||
#include "llimportobject.h"
|
||||
#include "llviewerobjectlist.h"
|
||||
#include "llviewerregion.h"
|
||||
|
||||
LLFloaterExportRegion* LLFloaterExportRegion::sInstance = NULL;
|
||||
|
||||
LLFloaterExportRegion::LLFloaterExportRegion()
|
||||
: LLFloater()
|
||||
{
|
||||
sInstance = this;
|
||||
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_export.xml");
|
||||
}
|
||||
|
||||
|
||||
LLFloaterExportRegion::~LLFloaterExportRegion()
|
||||
{
|
||||
sInstance = NULL;
|
||||
}
|
||||
|
||||
BOOL LLFloaterExportRegion::postBuild(void)
|
||||
{
|
||||
updateNamesProgress();
|
||||
|
||||
childSetAction("select_all_btn", onClickSelectAll, this);
|
||||
childSetEnabled("select_objects_btn", FALSE);
|
||||
childSetEnabled("select_wearables_btn", FALSE);
|
||||
|
||||
childSetAction("save_as_btn", onClickSaveAs, this);
|
||||
childSetEnabled("make_copy_btn", FALSE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//static
|
||||
void LLFloaterExportRegion::onClickSelectAll(void* user_data)
|
||||
{
|
||||
LLFloaterExport* floater = (LLFloaterExport*)user_data;
|
||||
LLScrollListCtrl* list = floater->getChild<LLScrollListCtrl>("export_list");
|
||||
std::vector<LLScrollListItem*> items = list->getAllData();
|
||||
std::vector<LLScrollListItem*>::iterator item_iter = items.begin();
|
||||
std::vector<LLScrollListItem*>::iterator items_end = items.end();
|
||||
bool new_value = !((*item_iter)->getColumn(LIST_CHECKED)->getValue());
|
||||
for( ; item_iter != items_end; ++item_iter)
|
||||
{
|
||||
LLScrollListItem* item = (*item_iter);
|
||||
item->getColumn(LIST_CHECKED)->setValue(new_value);
|
||||
}
|
||||
}
|
||||
|
||||
LLSD LLFloaterExportRegion::getLLSD()
|
||||
{
|
||||
LLScrollListCtrl* list = getChild<LLScrollListCtrl>("export_list");
|
||||
std::vector<LLScrollListItem*> items = list->getAllData();
|
||||
LLSD sd;
|
||||
std::vector<LLScrollListItem*>::iterator item_iter = items.begin();
|
||||
std::vector<LLScrollListItem*>::iterator items_end = items.end();
|
||||
for( ; item_iter != items_end; ++item_iter)
|
||||
{
|
||||
LLScrollListItem* item = (*item_iter);
|
||||
if(item->getColumn(LIST_CHECKED)->getValue())
|
||||
{
|
||||
LLSD item_sd = mExportables[item->getUUID()];
|
||||
LLSD::map_iterator map_iter = item_sd.beginMap();
|
||||
LLSD::map_iterator map_end = item_sd.endMap();
|
||||
for( ; map_iter != map_end; ++map_iter)
|
||||
{
|
||||
std::string key((*map_iter).first);
|
||||
LLSD data = (*map_iter).second;
|
||||
// copy it...
|
||||
sd[key] = data;
|
||||
}
|
||||
}
|
||||
}
|
||||
return sd;
|
||||
}
|
||||
|
||||
//static
|
||||
void LLFloaterExportRegion::onClickSaveAs(void* user_data)
|
||||
{
|
||||
LLFloaterExport* floater = (LLFloaterExport*)user_data;
|
||||
LLSD sd = floater->getLLSD();
|
||||
|
||||
if(sd.size())
|
||||
{
|
||||
std::string default_filename = "untitled";
|
||||
|
||||
// set correct names within llsd
|
||||
LLSD::map_iterator map_iter = sd.beginMap();
|
||||
LLSD::map_iterator map_end = sd.endMap();
|
||||
for( ; map_iter != map_end; ++map_iter)
|
||||
{
|
||||
std::istringstream keystr((*map_iter).first);
|
||||
U32 key;
|
||||
keystr >> key;
|
||||
LLSD item = (*map_iter).second;
|
||||
if(item["type"].asString() == "prim")
|
||||
{
|
||||
std::string name = floater->mPrimNameMap[key];
|
||||
item["name"] = name;
|
||||
// I don't understand C++ :(
|
||||
sd[(*map_iter).first] = item;
|
||||
}
|
||||
}
|
||||
|
||||
// count the number of selected items
|
||||
LLScrollListCtrl* list = floater->getChild<LLScrollListCtrl>("export_list");
|
||||
std::vector<LLScrollListItem*> items = list->getAllData();
|
||||
int item_count = 0;
|
||||
LLUUID avatarid = (*(items.begin()))->getColumn(LIST_AVATARID)->getValue().asUUID();
|
||||
bool all_same_avatarid = true;
|
||||
std::vector<LLScrollListItem*>::iterator item_iter = items.begin();
|
||||
std::vector<LLScrollListItem*>::iterator items_end = items.end();
|
||||
for( ; item_iter != items_end; ++item_iter)
|
||||
{
|
||||
LLScrollListItem* item = (*item_iter);
|
||||
if(item->getColumn(LIST_CHECKED)->getValue())
|
||||
{
|
||||
item_count++;
|
||||
if(item->getColumn(LIST_AVATARID)->getValue().asUUID() != avatarid)
|
||||
{
|
||||
all_same_avatarid = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(item_count == 1)
|
||||
{
|
||||
// Exporting one item? Use its name for the filename.
|
||||
// But make sure it's a root!
|
||||
LLSD target = (*(sd.beginMap())).second;
|
||||
if(target.has("parent"))
|
||||
{
|
||||
std::string parentid = target["parent"].asString();
|
||||
target = sd[parentid];
|
||||
}
|
||||
if(target.has("name"))
|
||||
{
|
||||
if(target["name"].asString().length() > 0)
|
||||
{
|
||||
default_filename = target["name"].asString();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Multiple items?
|
||||
// If they're all part of the same avatar, use the avatar's name as filename.
|
||||
if(all_same_avatarid)
|
||||
{
|
||||
std::string fullname;
|
||||
if(gCacheName->getFullName(avatarid, fullname))
|
||||
{
|
||||
default_filename = fullname;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LLFilePicker& file_picker = LLFilePicker::instance();
|
||||
if(file_picker.getSaveFile( LLFilePicker::FFSAVE_XML, LLDir::getScrubbedFileName(default_filename + ".xml")))
|
||||
{
|
||||
std::string file_name = file_picker.getFirstFile();
|
||||
llofstream export_file(file_name);
|
||||
LLSDSerialize::toPrettyXML(sd, export_file);
|
||||
export_file.close();
|
||||
|
||||
std::string msg = "Saved ";
|
||||
msg.append(file_name);
|
||||
LLChat chat(msg);
|
||||
LLFloaterChat::addChat(chat);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string msg = "No exportable items selected";
|
||||
LLChat chat(msg);
|
||||
LLFloaterChat::addChat(chat);
|
||||
return;
|
||||
}
|
||||
|
||||
floater->close();
|
||||
}
|
||||
|
||||
void LLFloaterExportRegion::addToPrimList(LLViewerObject* object)
|
||||
{
|
||||
mPrimList.push_back(object->getLocalID());
|
||||
LLViewerObject::child_list_t child_list = object->getChildren();
|
||||
for (LLViewerObject::child_list_t::iterator i = child_list.begin(); i != child_list.end(); ++i)
|
||||
{
|
||||
LLViewerObject* child = *i;
|
||||
if(child->getPCode() < LL_PCODE_APP)
|
||||
{
|
||||
mPrimList.push_back(child->getLocalID());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LLFloaterExportRegion::updateNamesProgress()
|
||||
{
|
||||
childSetText("names_progress_text", llformat("Names retrieved: %d of %d", mPrimNameMap.size(), mPrimList.size()));
|
||||
}
|
||||
|
||||
void LLFloaterExportRegion::receivePrimName(LLViewerObject* object, std::string name)
|
||||
{
|
||||
LLUUID fullid = object->getID();
|
||||
U32 localid = object->getLocalID();
|
||||
if(std::find(mPrimList.begin(), mPrimList.end(), localid) != mPrimList.end())
|
||||
{
|
||||
mPrimNameMap[localid] = name;
|
||||
LLScrollListCtrl* list = getChild<LLScrollListCtrl>("export_list");
|
||||
S32 item_index = list->getItemIndex(fullid);
|
||||
if(item_index != -1)
|
||||
{
|
||||
std::vector<LLScrollListItem*> items = list->getAllData();
|
||||
std::vector<LLScrollListItem*>::iterator iter = items.begin();
|
||||
std::vector<LLScrollListItem*>::iterator end = items.end();
|
||||
for( ; iter != end; ++iter)
|
||||
{
|
||||
if((*iter)->getUUID() == fullid)
|
||||
{
|
||||
(*iter)->getColumn(LIST_NAME)->setValue(name + " (worn on " + utf8str_tolower(object->getAttachmentPointName()) + ")");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
updateNamesProgress();
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
void LLFloaterExportRegion::receiveObjectProperties(LLUUID fullid, std::string name, std::string desc)
|
||||
{
|
||||
LLViewerObject* object = gObjectList.findObject(fullid);
|
||||
std::vector<LLFloaterExport*>::iterator iter = LLFloaterExport::instances.begin();
|
||||
std::vector<LLFloaterExport*>::iterator end = LLFloaterExport::instances.end();
|
||||
for( ; iter != end; ++iter)
|
||||
{
|
||||
(*iter)->receivePrimName(object, name);
|
||||
}
|
||||
}
|
||||
|
||||
// </edit>
|
||||
46
indra/newview/llfloaterexportregion.h
Normal file
46
indra/newview/llfloaterexportregion.h
Normal file
@@ -0,0 +1,46 @@
|
||||
// <edit>
|
||||
#ifndef LL_LLFLOATEREXPORTREGION_H
|
||||
#define LL_LLFLOATEREXPORTREGION_H
|
||||
|
||||
#include "llfloater.h"
|
||||
#include "llselectmgr.h"
|
||||
#include "llvoavatar.h"
|
||||
|
||||
class LLFloaterExportRegion
|
||||
: public LLFloater
|
||||
{
|
||||
public:
|
||||
LLFloaterExportRegion();
|
||||
BOOL postBuild(void);
|
||||
void updateNamesProgress();
|
||||
void receivePrimName(LLViewerObject* object, std::string name);
|
||||
|
||||
LLSD getLLSD();
|
||||
|
||||
std::vector<U32> mPrimList;
|
||||
std::map<U32, std::string> mPrimNameMap;
|
||||
|
||||
static LLFloaterExportRegion* sInstance;
|
||||
|
||||
static void receiveObjectProperties(LLUUID fullid, std::string name, std::string desc);
|
||||
|
||||
static void onClickSelectAll(void* user_data);
|
||||
static void onClickSaveAs(void* user_data);
|
||||
|
||||
private:
|
||||
virtual ~LLFloaterExportRegion();
|
||||
void addToPrimList(LLViewerObject* object);
|
||||
|
||||
enum LIST_COLUMN_ORDER
|
||||
{
|
||||
LIST_CHECKED,
|
||||
LIST_TYPE,
|
||||
LIST_NAME,
|
||||
LIST_AVATARID
|
||||
};
|
||||
|
||||
std::map<LLUUID, LLSD> mExportables;
|
||||
};
|
||||
|
||||
#endif
|
||||
// </edit>
|
||||
@@ -85,6 +85,9 @@
|
||||
#include "llvoavatar.h"
|
||||
#include "llvovolume.h"
|
||||
#include "pipeline.h"
|
||||
// <edit>
|
||||
#include "llfloaterexport.h"
|
||||
// </edit>
|
||||
|
||||
#include "llglheaders.h"
|
||||
|
||||
@@ -1387,6 +1390,9 @@ void LLSelectMgr::selectionSetImage(const LLUUID& imageid)
|
||||
{
|
||||
// First for (no copy) textures and multiple object selection
|
||||
LLViewerInventoryItem* item = gInventory.getItem(imageid);
|
||||
// <edit> fffff
|
||||
/*
|
||||
// </edit>
|
||||
if(item
|
||||
&& !item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID())
|
||||
&& (mSelectedObjects->getNumNodes() > 1) )
|
||||
@@ -1395,6 +1401,9 @@ void LLSelectMgr::selectionSetImage(const LLUUID& imageid)
|
||||
<< llendl;
|
||||
return;
|
||||
}
|
||||
// <edit>
|
||||
*/
|
||||
// </edit>
|
||||
|
||||
struct f : public LLSelectedTEFunctor
|
||||
{
|
||||
@@ -1443,11 +1452,19 @@ void LLSelectMgr::selectionSetImage(const LLUUID& imageid)
|
||||
{
|
||||
object->sendTEUpdate();
|
||||
// 1 particle effect per object
|
||||
// 1 particle effect per object
|
||||
// <edit>
|
||||
if(!gSavedSettings.getBOOL("DisablePointAtAndBeam"))
|
||||
{
|
||||
// </edit>
|
||||
LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE);
|
||||
effectp->setSourceObject(gAgent.getAvatarObject());
|
||||
effectp->setTargetObject(object);
|
||||
effectp->setDuration(LL_HUD_DUR_SHORT);
|
||||
effectp->setColor(LLColor4U(gAgent.getEffectColor()));
|
||||
// <edit>
|
||||
}
|
||||
// </edit>
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -69,10 +69,9 @@
|
||||
#include "llui.h"
|
||||
#include "llweb.h"
|
||||
|
||||
#if OPENSIM_RULES==1
|
||||
#include "llpreview.h"
|
||||
#include "llpreviewtexture.h"
|
||||
#endif /* OPENSIM_RULES==1 */
|
||||
// <edit>
|
||||
#include "lllocalinventory.h"
|
||||
// </edit>
|
||||
|
||||
extern void handle_buy(void*);
|
||||
|
||||
@@ -163,46 +162,25 @@ BOOL LLToolPie::pickAndShowMenu(BOOL always_show)
|
||||
LLViewerObject *object = mPick.getObject();
|
||||
LLViewerObject *parent = NULL;
|
||||
|
||||
#if OPENSIM_RULES==1
|
||||
if(mPick.mKeyMask == MASK_SHIFT)
|
||||
{
|
||||
if(object)
|
||||
{
|
||||
U8 face = mPick.mObjectFace & 0xff;
|
||||
if(face < object->getNumTEs())
|
||||
{
|
||||
LLViewerImage* img = object->getTEImage(face);
|
||||
if(img)
|
||||
{
|
||||
LLUUID image_id = img->getID();
|
||||
|
||||
// See if we can bring an exiting preview to the front
|
||||
if( !LLPreview::show( image_id, true ) )
|
||||
{
|
||||
// There isn't one, so make a new preview
|
||||
S32 left, top;
|
||||
gFloaterView->getNewFloaterPosition(&left, &top);
|
||||
LLRect rect = gSavedSettings.getRect("PreviewTextureRect");
|
||||
rect.translate( left - rect.mLeft, top - rect.mTop );
|
||||
|
||||
LLPreviewTexture* preview;
|
||||
preview = new LLPreviewTexture("preview texture",
|
||||
rect,
|
||||
image_id.getString(),
|
||||
image_id,
|
||||
image_id,
|
||||
true);
|
||||
preview->setSourceID(image_id);
|
||||
preview->setFocus(TRUE);
|
||||
|
||||
gFloaterView->adjustToFitScreen(preview, FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
#endif /* OPENSIM_RULES==1 */
|
||||
// <edit>
|
||||
if(mPick.mKeyMask == MASK_SHIFT)
|
||||
{
|
||||
if(object)
|
||||
{
|
||||
U8 face = mPick.mObjectFace & 0xff;
|
||||
if(face < object->getNumTEs())
|
||||
{
|
||||
LLViewerImage* img = object->getTEImage(face);
|
||||
if(img)
|
||||
{
|
||||
LLUUID image_id = img->getID();
|
||||
LLLocalInventory::addItem(image_id.asString(), (int)LLAssetType::AT_TEXTURE, image_id, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
// </edit>
|
||||
|
||||
if (mPick.mPickType != LLPickInfo::PICK_LAND)
|
||||
{
|
||||
@@ -240,6 +218,9 @@ BOOL LLToolPie::pickAndShowMenu(BOOL always_show)
|
||||
case CLICK_ACTION_SIT:
|
||||
if ((gAgent.getAvatarObject() != NULL) && (!gAgent.getAvatarObject()->mIsSitting)) // agent not already sitting
|
||||
{
|
||||
// <edit>
|
||||
if(!gSavedSettings.getBOOL("DisableClickSit"))
|
||||
// </edit>
|
||||
handle_sit_or_stand();
|
||||
// put focus in world when sitting on an object
|
||||
gFocusMgr.setKeyboardFocus(NULL);
|
||||
@@ -374,11 +355,18 @@ BOOL LLToolPie::pickAndShowMenu(BOOL always_show)
|
||||
gMenuHolder->setParcelSelection(selection);
|
||||
gPieLand->show(x, y, mPieMouseButtonDown);
|
||||
|
||||
// <edit>
|
||||
if(!gSavedSettings.getBOOL("DisablePointAtAndBeam"))
|
||||
{
|
||||
// </edit>
|
||||
// VEFFECT: ShowPie
|
||||
LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_SPHERE, TRUE);
|
||||
effectp->setPositionGlobal(mPick.mPosGlobal);
|
||||
effectp->setColor(LLColor4U(gAgent.getEffectColor()));
|
||||
effectp->setDuration(0.25f);
|
||||
// <edit>
|
||||
}
|
||||
// </edit>
|
||||
}
|
||||
else if (mPick.mObjectID == gAgent.getID() )
|
||||
{
|
||||
@@ -446,6 +434,10 @@ BOOL LLToolPie::pickAndShowMenu(BOOL always_show)
|
||||
|
||||
gPieObject->show(x, y, mPieMouseButtonDown);
|
||||
|
||||
// <edit>
|
||||
if(!gSavedSettings.getBOOL("DisablePointAtAndBeam"))
|
||||
{
|
||||
// </edit>
|
||||
// VEFFECT: ShowPie object
|
||||
// Don't show when you click on someone else, it freaks them
|
||||
// out.
|
||||
@@ -453,6 +445,9 @@ BOOL LLToolPie::pickAndShowMenu(BOOL always_show)
|
||||
effectp->setPositionGlobal(mPick.mPosGlobal);
|
||||
effectp->setColor(LLColor4U(gAgent.getEffectColor()));
|
||||
effectp->setDuration(0.25f);
|
||||
// <edit>
|
||||
}
|
||||
// </edit>
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -487,7 +487,7 @@ BOOL LLUserAuth::getOptions(const std::string& key, options_t& options) const
|
||||
all_options_t::const_iterator it = mOptions.find(key);
|
||||
if(it != mOptions.end())
|
||||
{
|
||||
// found the option set, copyt them onto the container.
|
||||
// found the option set, copy them onto the container.
|
||||
std::back_insert_iterator<options_t> ii(options);
|
||||
std::copy((*it).second.begin(), (*it).second.end(), ii);
|
||||
return TRUE;
|
||||
|
||||
@@ -59,6 +59,12 @@
|
||||
#include "message.h"
|
||||
#include "raytrace.h"
|
||||
#include "llsdserialize.h"
|
||||
// <edit>
|
||||
#include "lllocalinventory.h"
|
||||
#include "llimportobject.h"
|
||||
#include "llfloaterexport.h"
|
||||
#include "llfloaterexploreanimations.h"
|
||||
// </edit>
|
||||
#include "lltimer.h"
|
||||
#include "llvfile.h"
|
||||
#include "llvolumemgr.h"
|
||||
@@ -222,6 +228,10 @@
|
||||
|
||||
#include "lltexlayer.h"
|
||||
|
||||
// <edit>
|
||||
#include "dofloaterhex.h"
|
||||
// </edit>
|
||||
|
||||
using namespace LLVOAvatarDefines;
|
||||
void init_client_menu(LLMenuGL* menu);
|
||||
void init_server_menu(LLMenuGL* menu);
|
||||
@@ -381,6 +391,11 @@ void handle_god_mode(void*);
|
||||
// God menu
|
||||
void handle_leave_god_mode(void*);
|
||||
|
||||
// <edit>
|
||||
void handle_close_all_notifications(void*);
|
||||
void handle_reopen_with_hex_editor(void*);
|
||||
// </edit>
|
||||
|
||||
BOOL is_inventory_visible( void* user_data );
|
||||
void handle_reset_view();
|
||||
|
||||
@@ -842,7 +857,9 @@ void init_client_menu(LLMenuGL* menu)
|
||||
|
||||
|
||||
#ifdef TOGGLE_HACKED_GODLIKE_VIEWER
|
||||
if (!LLViewerLogin::getInstance()->isInProductionGrid())
|
||||
// <edit>
|
||||
//if (!LLViewerLogin::getInstance()->isInProductionGrid())
|
||||
// </edit>
|
||||
{
|
||||
menu->append(new LLMenuItemCheckGL("Hacked Godmode",
|
||||
&handle_toggle_hacked_godmode,
|
||||
@@ -1012,6 +1029,16 @@ void init_client_menu(LLMenuGL* menu)
|
||||
menu->append(new LLMenuItemCallGL("Leave Admin Status",
|
||||
&handle_leave_god_mode, NULL, NULL, 'G', MASK_ALT | MASK_SHIFT | MASK_CONTROL));
|
||||
|
||||
// <edit>
|
||||
menu->appendSeparator();
|
||||
menu->append(new LLMenuItemCallGL( "Close All Dialogs",
|
||||
&handle_close_all_notifications, NULL, NULL, 'D', MASK_CONTROL | MASK_ALT | MASK_SHIFT));
|
||||
|
||||
menu->append(new LLMenuItemCallGL( "Reopen with Hex Editor",
|
||||
&handle_reopen_with_hex_editor, NULL));
|
||||
|
||||
// </edit>
|
||||
|
||||
menu->createJumpKeys();
|
||||
}
|
||||
|
||||
@@ -1114,7 +1141,10 @@ void init_debug_xui_menu(LLMenuGL* menu)
|
||||
menu->append(new LLMenuItemCallGL("Export Menus to XML...", handle_export_menus_to_xml));
|
||||
menu->append(new LLMenuItemCallGL("Edit UI...", LLFloaterEditUI::show));
|
||||
menu->append(new LLMenuItemCallGL("Load from XML...", handle_load_from_xml));
|
||||
menu->append(new LLMenuItemCallGL("Save to XML...", handle_save_to_xml));
|
||||
// <edit>
|
||||
//menu->append(new LLMenuItemCallGL("Save to XML...", handle_save_to_xml));
|
||||
menu->append(new LLMenuItemCallGL("Save to XML...", handle_save_to_xml, NULL, NULL, 'X', MASK_CONTROL | MASK_ALT | MASK_SHIFT));
|
||||
// </edit>
|
||||
menu->append(new LLMenuItemCheckGL("Show XUI Names", toggle_show_xui_names, NULL, check_show_xui_names, NULL));
|
||||
|
||||
//menu->append(new LLMenuItemCallGL("Buy Currency...", handle_buy_currency));
|
||||
@@ -1425,10 +1455,14 @@ void init_debug_avatar_menu(LLMenuGL* menu)
|
||||
menu->append(new LLMenuItemToggleGL( "Debug Rotation", &LLVOAvatar::sDebugAvatarRotation));
|
||||
menu->append(new LLMenuItemCallGL("Dump Attachments", handle_dump_attachments));
|
||||
menu->append(new LLMenuItemCallGL("Rebake Textures", handle_rebake_textures, NULL, NULL, 'R', MASK_ALT | MASK_CONTROL ));
|
||||
#ifndef LL_RELEASE_FOR_DOWNLOAD
|
||||
// <edit>
|
||||
//#ifndef LL_RELEASE_FOR_DOWNLOAD
|
||||
// </edit>
|
||||
menu->append(new LLMenuItemCallGL("Debug Avatar Textures", handle_debug_avatar_textures, NULL, NULL, 'A', MASK_SHIFT|MASK_CONTROL|MASK_ALT));
|
||||
menu->append(new LLMenuItemCallGL("Dump Local Textures", handle_dump_avatar_local_textures, NULL, NULL, 'M', MASK_SHIFT|MASK_ALT ));
|
||||
#endif
|
||||
// <edit>
|
||||
//#endif
|
||||
// </edit>
|
||||
menu->createJumpKeys();
|
||||
}
|
||||
|
||||
@@ -2153,6 +2187,125 @@ class LLObjectMute : public view_listener_t
|
||||
}
|
||||
};
|
||||
|
||||
// <edit>
|
||||
class LLObjectEnableCopyUUID : public view_listener_t
|
||||
{
|
||||
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
||||
{
|
||||
LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
|
||||
bool new_value = (object != NULL);
|
||||
gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
class LLObjectCopyUUID : public view_listener_t
|
||||
{
|
||||
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
||||
{
|
||||
LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
|
||||
if(object)
|
||||
{
|
||||
gViewerWindow->mWindow->copyTextToClipboard(utf8str_to_wstring(object->getID().asString()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
class LLObjectEnableSaveAs : public view_listener_t
|
||||
{
|
||||
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
||||
{
|
||||
LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
|
||||
bool new_value = (object != NULL);
|
||||
gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
class LLObjectSaveAs : public view_listener_t
|
||||
{
|
||||
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
||||
{
|
||||
LLFloaterExport* floater = new LLFloaterExport();
|
||||
floater->center();
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
class LLObjectEnableImport : public view_listener_t
|
||||
{
|
||||
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
||||
{
|
||||
LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
|
||||
bool new_value = (object != NULL);
|
||||
if(object)
|
||||
{
|
||||
if(!object->permCopy())
|
||||
new_value = false;
|
||||
else if(!object->permModify())
|
||||
new_value = false;
|
||||
else if(!object->permMove())
|
||||
new_value = false;
|
||||
else if(object->numChildren() != 0)
|
||||
new_value = false;
|
||||
else if(object->getParent())
|
||||
new_value = false;
|
||||
}
|
||||
gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
class LLObjectImport : public view_listener_t
|
||||
{
|
||||
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
||||
{
|
||||
LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
|
||||
bool new_value = (object != NULL);
|
||||
if(object)
|
||||
{
|
||||
if(!object->permCopy())
|
||||
new_value = false;
|
||||
else if(!object->permModify())
|
||||
new_value = false;
|
||||
else if(!object->permMove())
|
||||
new_value = false;
|
||||
else if(object->numChildren() != 0)
|
||||
new_value = false;
|
||||
else if(object->getParent())
|
||||
new_value = false;
|
||||
}
|
||||
if(new_value == false) return true;
|
||||
|
||||
LLFilePicker& picker = LLFilePicker::instance();
|
||||
if (!picker.getOpenFile(LLFilePicker::FFLOAD_XML))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
std::string file_name = picker.getFirstFile();
|
||||
LLXmlImportOptions* options = new LLXmlImportOptions(file_name);
|
||||
options->mSupplier = object;
|
||||
new LLFloaterXmlImportOptions(options);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
class LLAvatarAnims : public view_listener_t
|
||||
{
|
||||
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
||||
{
|
||||
LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() );
|
||||
if(avatar)
|
||||
{
|
||||
new LLFloaterExploreAnimations(avatar->getID()); //temporary
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
// </edit>
|
||||
|
||||
bool handle_go_to()
|
||||
{
|
||||
LLVector3d pos = LLToolPie::getInstance()->getPick().mPosGlobal;
|
||||
@@ -2985,7 +3138,10 @@ bool handle_sit_or_stand()
|
||||
{
|
||||
LLPickInfo pick = LLToolPie::getInstance()->getPick();
|
||||
LLViewerObject *object = pick.getObject();;
|
||||
if (!object || pick.mPickType == LLPickInfo::PICK_FLORA)
|
||||
// <edit>
|
||||
//if (!object || pick.mPickType == LLPickInfo::PICK_FLORA)
|
||||
if (!object)
|
||||
// </edit>
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -3590,9 +3746,12 @@ void derez_objects(EDeRezDestination dest, const LLUUID& dest_id)
|
||||
break;
|
||||
|
||||
default:
|
||||
if((node->mPermissions->allowTransferTo(gAgent.getID())
|
||||
&& object->permCopy())
|
||||
|| gAgent.isGodlike())
|
||||
// <edit>
|
||||
//if((node->mPermissions->allowTransferTo(gAgent.getID())
|
||||
// && object->permCopy())
|
||||
// || gAgent.isGodlike())
|
||||
if(1)
|
||||
// </edit>
|
||||
{
|
||||
can_derez_current = TRUE;
|
||||
}
|
||||
@@ -3649,10 +3808,17 @@ void derez_objects(EDeRezDestination dest, const LLUUID& dest_id)
|
||||
LLViewerObject* object = derez_objects.get(object_index++);
|
||||
msg->nextBlockFast(_PREHASH_ObjectData);
|
||||
msg->addU32Fast(_PREHASH_ObjectLocalID, object->getLocalID());
|
||||
// <edit>
|
||||
if(!gSavedSettings.getBOOL("DisablePointAtAndBeam"))
|
||||
{
|
||||
// </edit>
|
||||
// VEFFECT: DerezObject
|
||||
LLHUDEffectSpiral* effectp = (LLHUDEffectSpiral*)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE);
|
||||
effectp->setPositionGlobal(object->getPositionGlobal());
|
||||
effectp->setColor(LLColor4U(gAgent.getEffectColor()));
|
||||
// <edit>
|
||||
}
|
||||
// </edit>
|
||||
}
|
||||
msg->sendReliable(first_region->getHost());
|
||||
}
|
||||
@@ -4140,6 +4306,20 @@ BOOL sitting_on_selection()
|
||||
return (avatar->mIsSitting && avatar->getRoot() == root_object);
|
||||
}
|
||||
|
||||
class LLToolsSaveToInventory : public view_listener_t
|
||||
{
|
||||
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
||||
{
|
||||
// <edit>
|
||||
//if(enable_save_into_inventory(NULL))
|
||||
if(1)
|
||||
// </edit>
|
||||
{
|
||||
derez_objects(DRD_SAVE_INTO_AGENT_INVENTORY, LLUUID::null);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
class LLToolsSaveToObjectInventory : public view_listener_t
|
||||
{
|
||||
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
||||
@@ -6135,6 +6315,10 @@ class LLObjectEnableWear : public view_listener_t
|
||||
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
||||
{
|
||||
bool is_wearable = object_selected_and_point_valid(NULL);
|
||||
// <edit> Don't allow attaching objects while importing attachments
|
||||
if(LLXmlImport::sImportInProgress && LLXmlImport::sImportHasAttachments)
|
||||
is_wearable = false;
|
||||
// </edit>
|
||||
gMenuHolder->findControl(userdata["control"].asString())->setValue(is_wearable);
|
||||
return TRUE;
|
||||
}
|
||||
@@ -6305,6 +6489,10 @@ class LLToolsSelectedScriptAction : public view_listener_t
|
||||
|
||||
void handle_selected_texture_info(void*)
|
||||
{
|
||||
// <edit>
|
||||
std::map<LLUUID, bool> unique_textures;
|
||||
S32 total_memory = 0;
|
||||
// </edit>
|
||||
for (LLObjectSelection::valid_iterator iter = LLSelectMgr::getInstance()->getSelection()->valid_begin();
|
||||
iter != LLSelectMgr::getInstance()->getSelection()->valid_end(); iter++)
|
||||
{
|
||||
@@ -6327,18 +6515,33 @@ void handle_selected_texture_info(void*)
|
||||
LLViewerImage* img = node->getObject()->getTEImage(i);
|
||||
LLUUID image_id = img->getID();
|
||||
faces_per_texture[image_id].push_back(i);
|
||||
// <edit>
|
||||
if(!unique_textures[image_id])
|
||||
{
|
||||
unique_textures[image_id] = true;
|
||||
total_memory += (img->getWidth() * img->getHeight() * img->getComponents());
|
||||
}
|
||||
// </edit>
|
||||
}
|
||||
// Per-texture, dump which faces are using it.
|
||||
map_t::iterator it;
|
||||
for (it = faces_per_texture.begin(); it != faces_per_texture.end(); ++it)
|
||||
{
|
||||
LLUUID image_id = it->first;
|
||||
// <edit>
|
||||
std::string uuid_str;
|
||||
image_id.toString(uuid_str);
|
||||
// </edit>
|
||||
U8 te = it->second[0];
|
||||
LLViewerImage* img = node->getObject()->getTEImage(te);
|
||||
S32 height = img->getHeight();
|
||||
S32 width = img->getWidth();
|
||||
S32 components = img->getComponents();
|
||||
msg = llformat("%dx%d %s on face ",
|
||||
// <edit>
|
||||
//msg = llformat("%dx%d %s on face ",
|
||||
msg = llformat("%s, %dx%d %s on face ",
|
||||
uuid_str.c_str(),
|
||||
// </edit>
|
||||
width,
|
||||
height,
|
||||
(components == 4 ? "alpha" : "opaque"));
|
||||
@@ -6349,7 +6552,41 @@ void handle_selected_texture_info(void*)
|
||||
LLChat chat(msg);
|
||||
LLFloaterChat::addChat(chat);
|
||||
}
|
||||
}
|
||||
// <edit>
|
||||
if(node->getObject()->isSculpted())
|
||||
{
|
||||
LLSculptParams *sculpt_params = (LLSculptParams *)(node->getObject()->getParameterEntry(LLNetworkData::PARAMS_SCULPT));
|
||||
LLUUID sculpt_id = sculpt_params->getSculptTexture();
|
||||
std::string uuid_str;
|
||||
sculpt_id.toString(uuid_str);
|
||||
msg.assign("Sculpt texture: ");
|
||||
msg.append(uuid_str.c_str());
|
||||
LLChat chat(msg);
|
||||
LLFloaterChat::addChat(chat);
|
||||
|
||||
unique_textures[sculpt_id] = true;
|
||||
}
|
||||
if(node->getObject()->isParticleSource())
|
||||
{
|
||||
//LLUUID particle_id = node->getObject()->mPartSourcep->getImage()->getID();
|
||||
}
|
||||
// </edit>
|
||||
}
|
||||
// <edit>
|
||||
typedef std::map<LLUUID, bool>::iterator map_iter;
|
||||
for(map_iter i = unique_textures.begin(); i != unique_textures.end(); ++i)
|
||||
{
|
||||
LLUUID asset_id = (*i).first;
|
||||
LLLocalInventory::addItem(asset_id.asString(), (int)LLAssetType::AT_TEXTURE, asset_id, true);
|
||||
}
|
||||
|
||||
// Show total widthxheight
|
||||
F32 memoriez = (F32)total_memory;
|
||||
memoriez = memoriez / 1000000;
|
||||
std::string msg = llformat("Total uncompressed: %f MB", memoriez);
|
||||
LLChat chat(msg);
|
||||
LLFloaterChat::addChat(chat);
|
||||
// </edit>
|
||||
}
|
||||
|
||||
void handle_dump_image_list(void*)
|
||||
@@ -6582,6 +6819,25 @@ class LLToolsEnableTakeCopy : public view_listener_t
|
||||
}
|
||||
};
|
||||
|
||||
// <edit>
|
||||
class LLToolsEnableAdminDelete : public view_listener_t
|
||||
{
|
||||
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
||||
{
|
||||
LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
|
||||
return (object != NULL);
|
||||
}
|
||||
};
|
||||
class LLToolsAdminDelete : public view_listener_t
|
||||
{
|
||||
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
||||
{
|
||||
LLSelectMgr::getInstance()->selectForceDelete();
|
||||
return true;
|
||||
}
|
||||
};
|
||||
// </edit>
|
||||
|
||||
BOOL enable_selection_you_own_all(void*)
|
||||
{
|
||||
if (LLSelectMgr::getInstance())
|
||||
@@ -7807,6 +8063,11 @@ void initialize_menus()
|
||||
addMenu(new LLToolsLookAtSelection(), "Tools.LookAtSelection");
|
||||
addMenu(new LLToolsBuyOrTake(), "Tools.BuyOrTake");
|
||||
addMenu(new LLToolsTakeCopy(), "Tools.TakeCopy");
|
||||
addMenu(new LLToolsTakeCopy(), "Tools.TakeCopy");
|
||||
// <edit>
|
||||
addMenu(new LLToolsEnableAdminDelete(), "Tools.EnableAdminDelete");
|
||||
addMenu(new LLToolsAdminDelete(), "Tools.AdminDelete");
|
||||
// </edit>
|
||||
addMenu(new LLToolsSaveToObjectInventory(), "Tools.SaveToObjectInventory");
|
||||
addMenu(new LLToolsSelectedScriptAction(), "Tools.SelectedScriptAction");
|
||||
|
||||
@@ -7857,6 +8118,11 @@ void initialize_menus()
|
||||
addMenu(new LLObjectAttachToAvatar(), "Object.AttachToAvatar");
|
||||
addMenu(new LLObjectReturn(), "Object.Return");
|
||||
addMenu(new LLObjectReportAbuse(), "Object.ReportAbuse");
|
||||
addMenu(new LLObjectReportAbuse(), "Object.ReportAbuse");
|
||||
// <edit>
|
||||
addMenu(new LLObjectSaveAs(), "Object.SaveAs");
|
||||
addMenu(new LLObjectImport(), "Object.Import");
|
||||
// </edit>
|
||||
addMenu(new LLObjectMute(), "Object.Mute");
|
||||
addMenu(new LLObjectBuy(), "Object.Buy");
|
||||
addMenu(new LLObjectEdit(), "Object.Edit");
|
||||
@@ -7869,6 +8135,10 @@ void initialize_menus()
|
||||
addMenu(new LLObjectEnableWear(), "Object.EnableWear");
|
||||
addMenu(new LLObjectEnableReturn(), "Object.EnableReturn");
|
||||
addMenu(new LLObjectEnableReportAbuse(), "Object.EnableReportAbuse");
|
||||
// <edit>
|
||||
addMenu(new LLObjectEnableSaveAs(), "Object.EnableSaveAs");
|
||||
addMenu(new LLObjectEnableImport(), "Object.EnableImport");
|
||||
// </edit>
|
||||
addMenu(new LLObjectEnableMute(), "Object.EnableMute");
|
||||
addMenu(new LLObjectEnableBuy(), "Object.EnableBuy");
|
||||
|
||||
|
||||
@@ -139,6 +139,9 @@
|
||||
#include "llviewerdisplay.h"
|
||||
#include "llkeythrottle.h"
|
||||
#include "lltranslate.h"
|
||||
// <edit>
|
||||
#include "llviewernetwork.h"
|
||||
// </edit>
|
||||
|
||||
#include <boost/tokenizer.hpp>
|
||||
|
||||
@@ -261,7 +264,10 @@ static LLNotificationFunctorRegistration friendship_offer_callback_reg_nm("Offer
|
||||
void give_money(const LLUUID& uuid, LLViewerRegion* region, S32 amount, BOOL is_group,
|
||||
S32 trx_type, const std::string& desc)
|
||||
{
|
||||
if(0 == amount || !region) return;
|
||||
// <edit>
|
||||
//if(0 == amount || !region) return;
|
||||
if(!region) return;
|
||||
// </edit>
|
||||
amount = abs(amount);
|
||||
LL_INFOS("Messaging") << "give_money(" << uuid << "," << amount << ")"<< LL_ENDL;
|
||||
if(can_afford_transaction(amount))
|
||||
@@ -1198,7 +1204,10 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD&
|
||||
|
||||
log_message = "You decline " + mDesc + " from " + mFromName + ".";
|
||||
chat.mText = log_message;
|
||||
if( LLMuteList::getInstance()->isMuted(mFromID ) && ! LLMuteList::getInstance()->isLinden(mFromName) ) // muting for SL-42269
|
||||
// <edit>
|
||||
//if( LLMuteList::getInstance()->isMuted(mFromID ) && ! LLMuteList::getInstance()->isLinden(mFromName) ) // muting for SL-42269
|
||||
if( LLMuteList::getInstance()->isMuted(mFromID) ) // muting for SL-42269
|
||||
// </edit>
|
||||
{
|
||||
chat.mMuted = TRUE;
|
||||
}
|
||||
@@ -1457,14 +1466,21 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
|
||||
msg->getVector3Fast(_PREHASH_MessageBlock, _PREHASH_Position, position);
|
||||
msg->getBinaryDataFast( _PREHASH_MessageBlock, _PREHASH_BinaryBucket, binary_bucket, 0, 0, MTUBYTES);
|
||||
binary_bucket_size = msg->getSizeFast(_PREHASH_MessageBlock, _PREHASH_BinaryBucket);
|
||||
EInstantMessage dialog = (EInstantMessage)d;
|
||||
EInstantMessage dialog = (EInstantMessage)d;
|
||||
|
||||
// <edit>
|
||||
llinfos << "RegionID: " << region_id.asString() << llendl;
|
||||
// </edit>
|
||||
|
||||
BOOL is_busy = gAgent.getBusy();
|
||||
BOOL is_muted = LLMuteList::getInstance()->isMuted(from_id, name, LLMute::flagTextChat);
|
||||
BOOL is_linden = LLMuteList::getInstance()->isLinden(name);
|
||||
BOOL is_owned_by_me = FALSE;
|
||||
|
||||
chat.mMuted = is_muted && !is_linden;
|
||||
// <edit>
|
||||
//chat.mMuted = is_muted && !is_linden;
|
||||
chat.mMuted = is_muted;
|
||||
// </edit>
|
||||
chat.mFromID = from_id;
|
||||
chat.mFromName = name;
|
||||
chat.mSourceType = (from_id.isNull() || (name == std::string(SYSTEM_FROM))) ? CHAT_SOURCE_SYSTEM : CHAT_SOURCE_AGENT;
|
||||
@@ -2331,6 +2347,19 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data)
|
||||
msg->getUUID("ChatData", "SourceID", from_id);
|
||||
chat.mFromID = from_id;
|
||||
|
||||
// <edit>
|
||||
// this chatter assignment is moved from below
|
||||
chatter = gObjectList.findObject(from_id);
|
||||
/*
|
||||
if(chatter)
|
||||
{
|
||||
if(chatter->isAvatar())
|
||||
{
|
||||
((LLVOAvatar*)chatter)->resetIdleTime();
|
||||
}
|
||||
}
|
||||
*/
|
||||
// </edit>
|
||||
// Object owner for objects
|
||||
msg->getUUID("ChatData", "OwnerID", owner_id);
|
||||
|
||||
@@ -2358,7 +2387,10 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data)
|
||||
LLMuteList::getInstance()->isLinden(from_name);
|
||||
|
||||
BOOL is_audible = (CHAT_AUDIBLE_FULLY == chat.mAudible);
|
||||
chatter = gObjectList.findObject(from_id);
|
||||
// <edit>
|
||||
// because I moved it to above
|
||||
//chatter = gObjectList.findObject(from_id);
|
||||
// </edit>
|
||||
if (chatter)
|
||||
{
|
||||
chat.mPosAgent = chatter->getPositionAgent();
|
||||
@@ -2528,11 +2560,17 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data)
|
||||
// F T T T * No No
|
||||
// T * * * F Yes Yes
|
||||
|
||||
chat.mMuted = is_muted && !is_linden;
|
||||
// <edit>
|
||||
//chat.mMuted = is_muted && !is_linden;
|
||||
chat.mMuted = is_muted;
|
||||
// </edit>
|
||||
|
||||
|
||||
if (!visible_in_chat_bubble
|
||||
&& (is_linden || !is_busy || is_owned_by_me))
|
||||
// <edit>
|
||||
// && (is_linden || !is_busy || is_owned_by_me))
|
||||
&& (!is_busy || is_owned_by_me))
|
||||
// </edit>
|
||||
{
|
||||
// show on screen and add to history
|
||||
check_translate_chat(mesg, chat, FALSE);
|
||||
@@ -3158,7 +3196,15 @@ void send_agent_update(BOOL force_send, BOOL send_reliable)
|
||||
// If a modifier key is held down, turn off
|
||||
// LBUTTON and ML_LBUTTON so that using the camera (alt-key) doesn't
|
||||
// trigger a control event.
|
||||
U32 control_flags = gAgent.getControlFlags();
|
||||
U32 control_flags = gAgent.getControlFlags();
|
||||
|
||||
// <edit>
|
||||
if(gSavedSettings.getBOOL("Nimble"))
|
||||
{
|
||||
control_flags |= AGENT_CONTROL_FINISH_ANIM;
|
||||
}
|
||||
// </edit>
|
||||
|
||||
MASK key_mask = gKeyboard->currentMask(TRUE);
|
||||
if (key_mask & MASK_ALT || key_mask & MASK_CONTROL)
|
||||
{
|
||||
@@ -3530,7 +3576,10 @@ void process_sound_trigger(LLMessageSystem *msg, void **)
|
||||
return;
|
||||
}
|
||||
|
||||
gAudiop->triggerSound(sound_id, owner_id, gain, LLAudioEngine::AUDIO_TYPE_SFX, pos_global);
|
||||
// <edit>
|
||||
gAudiop->triggerSound(sound_id, owner_id, gain, LLAudioEngine::AUDIO_TYPE_SFX, pos_global);
|
||||
//gAudiop->triggerSound(sound_id, owner_id, gain, LLAudioEngine::AUDIO_TYPE_SFX, pos_global, object_id);
|
||||
// </edit>
|
||||
}
|
||||
|
||||
void process_preload_sound(LLMessageSystem *msg, void **user_data)
|
||||
|
||||
Reference in New Issue
Block a user