parent
c45eff54cb
commit
41f5801aae
|
|
@ -50,6 +50,7 @@
|
|||
#include "llinventoryfunctions.h"
|
||||
#include "llinventorymodel.h"
|
||||
#include "llmanipscale.h"
|
||||
#include "llmenubutton.h"
|
||||
#include "llpreviewscript.h"
|
||||
#include "llresmgr.h"
|
||||
#include "llselectmgr.h"
|
||||
|
|
@ -158,13 +159,13 @@ BOOL LLPanelObject::postBuild()
|
|||
mBtnCopyPos->setCommitCallback( boost::bind(&LLPanelObject::onCopyPos, this, _2 ));
|
||||
mBtnPastePos = getChild<LLButton>("paste_pos_btn");
|
||||
mBtnPastePos->setCommitCallback( boost::bind(&LLPanelObject::onPastePos, this, _2 ));
|
||||
|
||||
|
||||
// Copy/paste size
|
||||
mBtnCopySize = getChild<LLButton>("copy_size_btn");
|
||||
mBtnCopySize->setCommitCallback( boost::bind(&LLPanelObject::onCopySize, this, _2 ));
|
||||
mBtnPasteSize = getChild<LLButton>("paste_size_btn");
|
||||
mBtnPasteSize->setCommitCallback( boost::bind(&LLPanelObject::onPasteSize, this, _2 ));
|
||||
|
||||
|
||||
// Copy/paste rot
|
||||
mBtnCopyRot = getChild<LLButton>("copy_rot_btn");
|
||||
mBtnCopyRot->setCommitCallback( boost::bind(&LLPanelObject::onCopyRot, this, _2 ));
|
||||
|
|
@ -176,6 +177,7 @@ BOOL LLPanelObject::postBuild()
|
|||
mBtnCopyParams->setCommitCallback( boost::bind(&LLPanelObject::onCopyParams, this, _2 ));
|
||||
mBtnPasteParams = getChild<LLButton>("paste_params_btn");
|
||||
mBtnPasteParams->setCommitCallback( boost::bind(&LLPanelObject::onPasteParams, this, _2 ));
|
||||
mBtnPasteMenu = getChild<LLMenuButton>("patse_gear_btn");
|
||||
|
||||
//--------------------------------------------------------
|
||||
|
||||
|
|
@ -316,8 +318,14 @@ LLPanelObject::LLPanelObject()
|
|||
mSizeChanged(FALSE),
|
||||
mHasPosClipboard(FALSE),
|
||||
mHasSizeClipboard(FALSE),
|
||||
mHasRotClipboard(FALSE)
|
||||
mHasRotClipboard(FALSE),
|
||||
mPasteParametric(TRUE),
|
||||
mPastePhysics(TRUE),
|
||||
mPasteLight(TRUE)
|
||||
{
|
||||
mEnableCallbackRegistrar.add("BuildObject.PasteCheckItem", boost::bind(&LLPanelObject::pasteCheckMenuItem, this, _2));
|
||||
mCommitCallbackRegistrar.add("BuildObject.PasteDoToSelected", boost::bind(&LLPanelObject::pasteDoMenuItem, this, _2));
|
||||
mEnableCallbackRegistrar.add("BuildObject.PasteEnable", boost::bind(&LLPanelObject::pasteEnabletMenuItem, this, _2));
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -474,6 +482,7 @@ void LLPanelObject::getState( )
|
|||
|
||||
mBtnCopyParams->setEnabled( single_volume && enable_modify );
|
||||
mBtnPasteParams->setEnabled( single_volume && enable_modify );
|
||||
mBtnPasteMenu->setEnabled( single_volume && enable_modify );
|
||||
|
||||
LLUUID owner_id;
|
||||
std::string owner_name;
|
||||
|
|
@ -2136,9 +2145,13 @@ void LLPanelObject::onCopyParams(const LLSD& data)
|
|||
return;
|
||||
}
|
||||
|
||||
mParamsClipboard.clear();
|
||||
|
||||
mParamsClipboard["is_phantom"] = objectp->flagPhantom();
|
||||
mParamsClipboard["is_physical"] = objectp->flagUsePhysics();
|
||||
|
||||
// Parametrics
|
||||
getVolumeParams(mClipboardVolumeParams);
|
||||
mHasParamsClipboard = TRUE;
|
||||
|
||||
LLVOVolume *volobjp = NULL;
|
||||
if (objectp && (objectp->getPCode() == LL_PCODE_VOLUME))
|
||||
|
|
@ -2152,122 +2165,72 @@ void LLPanelObject::onCopyParams(const LLSD& data)
|
|||
LLFlexibleObjectData *attributes = (LLFlexibleObjectData *)objectp->getParameterEntry(LLNetworkData::PARAMS_FLEXIBLE);
|
||||
if (attributes)
|
||||
{
|
||||
mParamsClipboard["lod"] = attributes->getSimulateLOD();
|
||||
mParamsClipboard["gav"] = attributes->getGravity();
|
||||
mParamsClipboard["ten"] = attributes->getTension();
|
||||
mParamsClipboard["fri"] = attributes->getAirFriction();
|
||||
mParamsClipboard["sen"] = attributes->getWindSensitivity();
|
||||
mParamsClipboard["flex"]["lod"] = attributes->getSimulateLOD();
|
||||
mParamsClipboard["flex"]["gav"] = attributes->getGravity();
|
||||
mParamsClipboard["flex"]["ten"] = attributes->getTension();
|
||||
mParamsClipboard["flex"]["fri"] = attributes->getAirFriction();
|
||||
mParamsClipboard["flex"]["sen"] = attributes->getWindSensitivity();
|
||||
LLVector3 force = attributes->getUserForce();
|
||||
mParamsClipboard["forx"] = force.mV[0];
|
||||
mParamsClipboard["fory"] = force.mV[1];
|
||||
mParamsClipboard["forz"] = force.mV[2];
|
||||
mHasFlexiParam = TRUE;
|
||||
mParamsClipboard["flex"]["forx"] = force.mV[0];
|
||||
mParamsClipboard["flex"]["fory"] = force.mV[1];
|
||||
mParamsClipboard["flex"]["forz"] = force.mV[2];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mHasFlexiParam = FALSE;
|
||||
}
|
||||
|
||||
// Sculpted Prim
|
||||
// User is allowed to copy if they could otherwise recreate it manually
|
||||
// ie. User has full perm copy of the sculpted texture in their inventory,
|
||||
// or is a default texture or library asset.
|
||||
if (objectp->getParameterEntryInUse(LLNetworkData::PARAMS_SCULPT))
|
||||
{
|
||||
LLSculptParams *sculpt_params = (LLSculptParams *)objectp->getParameterEntry(LLNetworkData::PARAMS_SCULPT);
|
||||
|
||||
LLUUID image_id = sculpt_params->getSculptTexture();
|
||||
BOOL allow_texture = FALSE;
|
||||
if (gInventory.isObjectDescendentOf(image_id, gInventory.getLibraryRootFolderID())
|
||||
|| image_id == LLUUID(gSavedSettings.getString( "DefaultObjectTexture" ))
|
||||
|| image_id == LLUUID(gSavedSettings.getString( "UIImgWhiteUUID" ))
|
||||
|| image_id == LLUUID(gSavedSettings.getString( "UIImgInvisibleUUID" ))
|
||||
|| image_id == LLUUID(SCULPT_DEFAULT_TEXTURE))
|
||||
LLUUID texture_id = sculpt_params->getSculptTexture();
|
||||
if (canCopyTexture(texture_id))
|
||||
{
|
||||
allow_texture = TRUE;
|
||||
LL_INFOS() << "copu texture " << LL_ENDL;
|
||||
mParamsClipboard["sculpt"]["id"] = texture_id;
|
||||
}
|
||||
else
|
||||
{
|
||||
LLUUID inventory_item_id;
|
||||
LLViewerInventoryCategory::cat_array_t cats;
|
||||
LLViewerInventoryItem::item_array_t items;
|
||||
LLAssetIDMatches asset_id_matches(image_id);
|
||||
gInventory.collectDescendentsIf(LLUUID::null,
|
||||
cats,
|
||||
items,
|
||||
LLInventoryModel::INCLUDE_TRASH,
|
||||
asset_id_matches);
|
||||
|
||||
if (items.size())
|
||||
{
|
||||
// search for copyable version first
|
||||
for (S32 i = 0; i < items.size(); i++)
|
||||
{
|
||||
LLInventoryItem* itemp = items[i];
|
||||
LLPermissions item_permissions = itemp->getPermissions();
|
||||
if (item_permissions.allowCopyBy(gAgent.getID(), gAgent.getGroupID()))
|
||||
{
|
||||
inventory_item_id = itemp->getUUID();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (inventory_item_id.notNull())
|
||||
{
|
||||
LLInventoryItem* itemp = gInventory.getItem(inventory_item_id);
|
||||
if (itemp)
|
||||
{
|
||||
LLPermissions perm = itemp->getPermissions();
|
||||
if ((perm.getMaskBase() & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED)
|
||||
{
|
||||
allow_texture = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (allow_texture)
|
||||
{
|
||||
mParamsClipboard["sculptid"] = image_id;
|
||||
}
|
||||
else
|
||||
{
|
||||
mParamsClipboard["sculptid"] = LLUUID(SCULPT_DEFAULT_TEXTURE);
|
||||
mParamsClipboard["sculpt"]["id"] = LLUUID(SCULPT_DEFAULT_TEXTURE);
|
||||
}
|
||||
|
||||
mParamsClipboard["sculpt_type"] = sculpt_params->getSculptType();
|
||||
mHasSculptParam = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
mHasSculptParam = FALSE;
|
||||
mParamsClipboard["sculpt"]["type"] = sculpt_params->getSculptType();
|
||||
}
|
||||
|
||||
// Light Source
|
||||
// only captures basic settings
|
||||
if (volobjp && volobjp->getIsLight())
|
||||
{
|
||||
mParamsClipboard["Light Intensity"] = volobjp->getLightIntensity();
|
||||
mParamsClipboard["Light Radius"] = volobjp->getLightRadius();
|
||||
mParamsClipboard["Light Falloff"] = volobjp->getLightFalloff();
|
||||
mParamsClipboard["light"]["intensity"] = volobjp->getLightIntensity();
|
||||
mParamsClipboard["light"]["radius"] = volobjp->getLightRadius();
|
||||
mParamsClipboard["light"]["falloff"] = volobjp->getLightFalloff();
|
||||
LLColor3 color = volobjp->getLightColor();
|
||||
mParamsClipboard["r"] = color.mV[0];
|
||||
mParamsClipboard["g"] = color.mV[1];
|
||||
mParamsClipboard["b"] = color.mV[2];
|
||||
mHasLightParam = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
mHasLightParam = FALSE;
|
||||
mParamsClipboard["light"]["r"] = color.mV[0];
|
||||
mParamsClipboard["light"]["g"] = color.mV[1];
|
||||
mParamsClipboard["light"]["b"] = color.mV[2];
|
||||
|
||||
// Spotlight
|
||||
if (volobjp->isLightSpotlight())
|
||||
{
|
||||
LLUUID id = volobjp->getLightTextureID();
|
||||
if (id.notNull() && canCopyTexture(id))
|
||||
{
|
||||
mParamsClipboard["spot"]["id"] = id;
|
||||
LLVector3 spot_params = volobjp->getSpotLightParams();
|
||||
mParamsClipboard["spot"]["fov"] = spot_params.mV[0];
|
||||
mParamsClipboard["spot"]["focus"] = spot_params.mV[1];
|
||||
mParamsClipboard["spot"]["ambiance"] = spot_params.mV[2];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Physics
|
||||
{
|
||||
mParamsClipboard["physics_shape"] = objectp->getPhysicsShapeType();
|
||||
mParamsClipboard["physics_gravity"] = objectp->getPhysicsGravity();
|
||||
mParamsClipboard["physics_friction"] = objectp->getPhysicsFriction();
|
||||
mParamsClipboard["physics_density"] = objectp->getPhysicsDensity();
|
||||
mParamsClipboard["physics_restitution"] = objectp->getPhysicsRestitution();
|
||||
mParamsClipboard["physics"]["shape"] = objectp->getPhysicsShapeType();
|
||||
mParamsClipboard["physics"]["gravity"] = objectp->getPhysicsGravity();
|
||||
mParamsClipboard["physics"]["friction"] = objectp->getPhysicsFriction();
|
||||
mParamsClipboard["physics"]["density"] = objectp->getPhysicsDensity();
|
||||
mParamsClipboard["physics"]["restitution"] = objectp->getPhysicsRestitution();
|
||||
|
||||
U8 material_code = 0;
|
||||
struct f : public LLSelectedTEGetFunctor<U8>
|
||||
|
|
@ -2281,125 +2244,251 @@ void LLPanelObject::onCopyParams(const LLSD& data)
|
|||
// This should always be true since material should be per object.
|
||||
if (material_same)
|
||||
{
|
||||
mParamsClipboard["physics_material"] = material_code;
|
||||
mParamsClipboard["physics"]["material"] = material_code;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
mHasParamsClipboard = TRUE;
|
||||
}
|
||||
|
||||
void LLPanelObject::onPasteParams(const LLSD& data)
|
||||
{
|
||||
LLViewerObject* objectp = mObject;
|
||||
if (!objectp)
|
||||
if (!objectp || !mHasParamsClipboard)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Flexi Prim
|
||||
if (mHasFlexiParam && (objectp->getPCode() == LL_PCODE_VOLUME))
|
||||
LLVOVolume *volobjp = NULL;
|
||||
if (objectp && (objectp->getPCode() == LL_PCODE_VOLUME))
|
||||
{
|
||||
LLFlexibleObjectData *attributes = (LLFlexibleObjectData *)objectp->getParameterEntry(LLNetworkData::PARAMS_FLEXIBLE);
|
||||
if (attributes)
|
||||
{
|
||||
LLFlexibleObjectData new_attributes;
|
||||
new_attributes = *attributes;
|
||||
|
||||
new_attributes.setSimulateLOD(mParamsClipboard["lod"].asInteger());
|
||||
new_attributes.setGravity(mParamsClipboard["gav"].asReal());
|
||||
new_attributes.setTension(mParamsClipboard["ten"].asReal());
|
||||
new_attributes.setAirFriction(mParamsClipboard["fri"].asReal());
|
||||
new_attributes.setWindSensitivity(mParamsClipboard["sen"].asReal());
|
||||
F32 fx = (F32)mParamsClipboard["forx"].asReal();
|
||||
F32 fy = (F32)mParamsClipboard["fory"].asReal();
|
||||
F32 fz = (F32)mParamsClipboard["forz"].asReal();
|
||||
LLVector3 force(fx,fy,fz);
|
||||
new_attributes.setUserForce(force);
|
||||
objectp->setParameterEntry(LLNetworkData::PARAMS_FLEXIBLE, new_attributes, true);
|
||||
}
|
||||
}
|
||||
|
||||
// Sculpted Prim
|
||||
if (mHasSculptParam)
|
||||
{
|
||||
LLSculptParams sculpt_params;
|
||||
|
||||
if (mParamsClipboard.has("sculptid"))
|
||||
{
|
||||
sculpt_params.setSculptTexture(mParamsClipboard["sculptid"].asUUID(), (U8)mParamsClipboard["sculpt_type"].asInteger());
|
||||
}
|
||||
|
||||
objectp->setParameterEntry(LLNetworkData::PARAMS_SCULPT, sculpt_params, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
LLSculptParams *sculpt_params = (LLSculptParams *)objectp->getParameterEntry(LLNetworkData::PARAMS_SCULPT);
|
||||
if (sculpt_params)
|
||||
{
|
||||
objectp->setParameterEntryInUse(LLNetworkData::PARAMS_SCULPT, FALSE, TRUE);
|
||||
}
|
||||
volobjp = (LLVOVolume *)objectp;
|
||||
}
|
||||
|
||||
// Light Source
|
||||
if (objectp && (objectp->getPCode() == LL_PCODE_VOLUME))
|
||||
if (mPasteLight && volobjp)
|
||||
{
|
||||
LLVOVolume *volobjp = (LLVOVolume *)objectp;
|
||||
|
||||
if (volobjp && mHasLightParam)
|
||||
if (mParamsClipboard.has("light"))
|
||||
{
|
||||
volobjp->setIsLight(TRUE);
|
||||
volobjp->setLightIntensity((F32)mParamsClipboard["Light Intensity"].asReal());
|
||||
volobjp->setLightRadius((F32)mParamsClipboard["Light Radius"].asReal());
|
||||
volobjp->setLightFalloff((F32)mParamsClipboard["Light Falloff"].asReal());
|
||||
F32 r = (F32)mParamsClipboard["r"].asReal();
|
||||
F32 g = (F32)mParamsClipboard["g"].asReal();
|
||||
F32 b = (F32)mParamsClipboard["b"].asReal();
|
||||
volobjp->setLightIntensity((F32)mParamsClipboard["light"]["intensity"].asReal());
|
||||
volobjp->setLightRadius((F32)mParamsClipboard["light"]["radius"].asReal());
|
||||
volobjp->setLightFalloff((F32)mParamsClipboard["light"]["falloff"].asReal());
|
||||
F32 r = (F32)mParamsClipboard["light"]["r"].asReal();
|
||||
F32 g = (F32)mParamsClipboard["light"]["g"].asReal();
|
||||
F32 b = (F32)mParamsClipboard["light"]["b"].asReal();
|
||||
volobjp->setLightColor(LLColor3(r,g,b));
|
||||
}
|
||||
|
||||
if (mParamsClipboard.has("spot"))
|
||||
{
|
||||
volobjp->setLightTextureID(mParamsClipboard["spot"]["id"]);
|
||||
LLVector3 spot_params;
|
||||
spot_params.mV[0] = (F32)mParamsClipboard["spot"]["fov"].asReal();
|
||||
spot_params.mV[1] = (F32)mParamsClipboard["spot"]["focus"].asReal();
|
||||
spot_params.mV[2] = (F32)mParamsClipboard["spot"]["ambiance"].asReal();
|
||||
volobjp->setSpotLightParams(spot_params);
|
||||
}
|
||||
}
|
||||
|
||||
// Physics
|
||||
if (mPastePhysics)
|
||||
{
|
||||
if (mParamsClipboard.has("physics_shape"))
|
||||
{
|
||||
objectp->setPhysicsShapeType((U8)mParamsClipboard["physics_shape"].asInteger());
|
||||
}
|
||||
if (mParamsClipboard.has("physics_material"))
|
||||
bool is_root = objectp->isRoot();
|
||||
|
||||
// Not sure if phantom should go under physics, but doesn't fit elsewhere
|
||||
BOOL is_phantom = mParamsClipboard["is_phantom"].asBoolean() && is_root;
|
||||
LLSelectMgr::getInstance()->selectionUpdatePhantom(is_phantom);
|
||||
|
||||
BOOL is_physical = mParamsClipboard["is_physical"].asBoolean() && is_root;
|
||||
LLSelectMgr::getInstance()->selectionUpdatePhysics(is_physical);
|
||||
|
||||
if (mParamsClipboard.has("physics"))
|
||||
{
|
||||
objectp->setPhysicsShapeType((U8)mParamsClipboard["physics"]["shape"].asInteger());
|
||||
U8 cur_material = objectp->getMaterial();
|
||||
U8 material = (U8)mParamsClipboard["physics_material"].asInteger() | (cur_material & ~LL_MCODE_MASK);
|
||||
|
||||
objectp->setMaterial(material);
|
||||
objectp->sendMaterialUpdate();
|
||||
}
|
||||
bool phys_update_flags = false;
|
||||
if (mParamsClipboard.has("physics_gravity"))
|
||||
{
|
||||
objectp->setPhysicsGravity(mParamsClipboard["physics_gravity"].asReal());
|
||||
phys_update_flags = true;
|
||||
}
|
||||
if (mParamsClipboard.has("physics_friction"))
|
||||
{
|
||||
objectp->setPhysicsFriction(mParamsClipboard["physics_friction"].asReal());
|
||||
phys_update_flags = true;
|
||||
}
|
||||
if (mParamsClipboard.has("physics_density"))
|
||||
{
|
||||
objectp->setPhysicsDensity(mParamsClipboard["physics_density"].asReal());
|
||||
phys_update_flags = true;
|
||||
}
|
||||
if (mParamsClipboard.has("physics_restitution"))
|
||||
{
|
||||
objectp->setPhysicsRestitution(mParamsClipboard["physics_restitution"].asReal());
|
||||
phys_update_flags = true;
|
||||
}
|
||||
if (phys_update_flags)
|
||||
{
|
||||
objectp->setPhysicsGravity(mParamsClipboard["physics"]["gravity"].asReal());
|
||||
objectp->setPhysicsFriction(mParamsClipboard["physics"]["friction"].asReal());
|
||||
objectp->setPhysicsDensity(mParamsClipboard["physics"]["density"].asReal());
|
||||
objectp->setPhysicsRestitution(mParamsClipboard["physics"]["restitution"].asReal());
|
||||
objectp->updateFlags(TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
// Parametrics
|
||||
if(mHasParamsClipboard)
|
||||
if(mPasteParametric)
|
||||
{
|
||||
// Sculpted Prim
|
||||
if (mParamsClipboard.has("sculpt"))
|
||||
{
|
||||
LLSculptParams sculpt_params;
|
||||
LLUUID sculpt_id = mParamsClipboard["sculpt"]["id"].asUUID();
|
||||
U8 sculpt_type = (U8)mParamsClipboard["sculpt"]["type"].asInteger();
|
||||
sculpt_params.setSculptTexture(sculpt_id, sculpt_type);
|
||||
objectp->setParameterEntry(LLNetworkData::PARAMS_SCULPT, sculpt_params, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
LLSculptParams *sculpt_params = (LLSculptParams *)objectp->getParameterEntry(LLNetworkData::PARAMS_SCULPT);
|
||||
if (sculpt_params)
|
||||
{
|
||||
objectp->setParameterEntryInUse(LLNetworkData::PARAMS_SCULPT, FALSE, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
// Flexi Params
|
||||
if (mParamsClipboard.has("flex"))
|
||||
{
|
||||
if (objectp->getClickAction() == CLICK_ACTION_SIT)
|
||||
{
|
||||
objectp->setClickAction(CLICK_ACTION_NONE);
|
||||
}
|
||||
|
||||
LLFlexibleObjectData *attributes = (LLFlexibleObjectData *)objectp->getParameterEntry(LLNetworkData::PARAMS_FLEXIBLE);
|
||||
if (attributes)
|
||||
{
|
||||
LLFlexibleObjectData new_attributes;
|
||||
new_attributes = *attributes;
|
||||
new_attributes.setSimulateLOD(mParamsClipboard["flex"]["lod"].asInteger());
|
||||
new_attributes.setGravity(mParamsClipboard["flex"]["gav"].asReal());
|
||||
new_attributes.setTension(mParamsClipboard["flex"]["ten"].asReal());
|
||||
new_attributes.setAirFriction(mParamsClipboard["flex"]["fri"].asReal());
|
||||
new_attributes.setWindSensitivity(mParamsClipboard["flex"]["sen"].asReal());
|
||||
F32 fx = (F32)mParamsClipboard["flex"]["forx"].asReal();
|
||||
F32 fy = (F32)mParamsClipboard["flex"]["fory"].asReal();
|
||||
F32 fz = (F32)mParamsClipboard["flex"]["forz"].asReal();
|
||||
LLVector3 force(fx,fy,fz);
|
||||
new_attributes.setUserForce(force);
|
||||
objectp->setParameterEntry(LLNetworkData::PARAMS_FLEXIBLE, new_attributes, true);
|
||||
}
|
||||
}
|
||||
|
||||
objectp->updateVolume(mClipboardVolumeParams);
|
||||
}
|
||||
}
|
||||
|
||||
bool LLPanelObject::pasteCheckMenuItem(const LLSD& userdata)
|
||||
{
|
||||
std::string command = userdata.asString();
|
||||
|
||||
if ("Parametric" == command)
|
||||
{
|
||||
return mPasteParametric;
|
||||
}
|
||||
if ("Physics" == command)
|
||||
{
|
||||
return mPastePhysics;
|
||||
}
|
||||
if ("Light" == command)
|
||||
{
|
||||
return mPasteLight;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void LLPanelObject::pasteDoMenuItem(const LLSD& userdata)
|
||||
{
|
||||
std::string command = userdata.asString();
|
||||
|
||||
if ("Parametric" == command)
|
||||
{
|
||||
mPasteParametric = !mPasteParametric;
|
||||
}
|
||||
if ("Physics" == command)
|
||||
{
|
||||
mPastePhysics = !mPastePhysics;
|
||||
}
|
||||
if ("Light" == command)
|
||||
{
|
||||
mPasteLight = !mPasteLight;
|
||||
}
|
||||
}
|
||||
|
||||
bool LLPanelObject::pasteEnabletMenuItem(const LLSD& userdata)
|
||||
{
|
||||
std::string command = userdata.asString();
|
||||
|
||||
// Keep at least one option enabled
|
||||
if (mPasteParametric + mPastePhysics + mPasteLight == 1)
|
||||
{
|
||||
if ("Parametric" == command && mPasteParametric)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if ("Physics" == command && mPastePhysics)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if ("Light" == command && mPasteLight)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// User is allowed to copy if they could otherwise recreate it manually
|
||||
// ie. User has full perm copy of the sculpted texture in their inventory,
|
||||
// or is a default texture or library asset.
|
||||
bool LLPanelObject::canCopyTexture(LLUUID image_id)
|
||||
{
|
||||
// Library asset or default texture
|
||||
if (gInventory.isObjectDescendentOf(image_id, gInventory.getLibraryRootFolderID())
|
||||
|| image_id == LLUUID(gSavedSettings.getString( "DefaultObjectTexture" ))
|
||||
|| image_id == LLUUID(gSavedSettings.getString( "UIImgWhiteUUID" ))
|
||||
|| image_id == LLUUID(gSavedSettings.getString( "UIImgInvisibleUUID" ))
|
||||
|| image_id == LLUUID(SCULPT_DEFAULT_TEXTURE))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// LLUUID inventory_item_id;
|
||||
LLViewerInventoryCategory::cat_array_t cats;
|
||||
LLViewerInventoryItem::item_array_t items;
|
||||
LLAssetIDMatches asset_id_matches(image_id);
|
||||
gInventory.collectDescendentsIf(LLUUID::null,
|
||||
cats,
|
||||
items,
|
||||
LLInventoryModel::INCLUDE_TRASH,
|
||||
asset_id_matches);
|
||||
|
||||
if (items.size())
|
||||
{
|
||||
// search for copyable version first
|
||||
for (S32 i = 0; i < items.size(); i++)
|
||||
{
|
||||
LLInventoryItem* itemp = items[i];
|
||||
LLPermissions item_permissions = itemp->getPermissions();
|
||||
// if (item_permissions.allowCopyBy(gAgent.getID(), gAgent.getGroupID()))
|
||||
if (item_permissions.allowCopyBy(gAgent.getID()))
|
||||
{
|
||||
// inventory_item_id = itemp->getUUID();
|
||||
// break;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if (inventory_item_id.notNull())
|
||||
// {
|
||||
// LLInventoryItem* itemp = gInventory.getItem(inventory_item_id);
|
||||
// if (itemp)
|
||||
// {
|
||||
// if (itemp && !itemp->getPermissions().allowCopyBy(gAgent.getID()))
|
||||
// // LLPermissions perm = itemp->getPermissions();
|
||||
// // if ((perm.getMaskBase() & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED)
|
||||
// {
|
||||
// // User has full perm copy of texture
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ class LLCheckBoxCtrl;
|
|||
class LLTextBox;
|
||||
class LLUICtrl;
|
||||
class LLButton;
|
||||
class LLMenuButton;
|
||||
class LLViewerObject;
|
||||
class LLComboBox;
|
||||
class LLColorSwatchCtrl;
|
||||
|
|
@ -84,6 +85,10 @@ public:
|
|||
BOOL onDropSculpt(LLInventoryItem* item);
|
||||
static void onCommitSculptType( LLUICtrl *ctrl, void* userdata);
|
||||
|
||||
bool pasteCheckMenuItem(const LLSD& userdata);
|
||||
void pasteDoMenuItem(const LLSD& userdata);
|
||||
bool pasteEnabletMenuItem(const LLSD& userdata);
|
||||
|
||||
protected:
|
||||
void getState();
|
||||
|
||||
|
|
@ -97,6 +102,8 @@ protected:
|
|||
void sendSculpt();
|
||||
|
||||
void getVolumeParams(LLVolumeParams& volume_params);
|
||||
|
||||
bool canCopyTexture(LLUUID image_id);
|
||||
|
||||
protected:
|
||||
// Per-object options
|
||||
|
|
@ -164,6 +171,7 @@ protected:
|
|||
LLButton *mBtnPasteRot;
|
||||
LLButton *mBtnCopyParams;
|
||||
LLButton *mBtnPasteParams;
|
||||
LLMenuButton *mBtnPasteMenu;
|
||||
|
||||
LLCheckBoxCtrl *mCheckLock;
|
||||
LLCheckBoxCtrl *mCheckPhysics;
|
||||
|
|
@ -196,9 +204,10 @@ protected:
|
|||
LLSD mParamsClipboard;
|
||||
LLVolumeParams mClipboardVolumeParams;
|
||||
BOOL mHasParamsClipboard;
|
||||
BOOL mHasFlexiParam;
|
||||
BOOL mHasSculptParam;
|
||||
BOOL mHasLightParam;
|
||||
|
||||
BOOL mPasteParametric;
|
||||
BOOL mPastePhysics;
|
||||
BOOL mPasteLight;
|
||||
|
||||
LLPointer<LLViewerObject> mObject;
|
||||
LLPointer<LLViewerObject> mRootObject;
|
||||
|
|
|
|||
|
|
@ -1696,25 +1696,38 @@ even though the user gets a free copy.
|
|||
</text>-->
|
||||
<button
|
||||
follows="top|right"
|
||||
height="16"
|
||||
height="23"
|
||||
label="Copy"
|
||||
layout="topleft"
|
||||
left="135"
|
||||
name="copy_params_btn"
|
||||
tool_tip="Copy Parameters to Clipboard"
|
||||
top="6"
|
||||
width="65">
|
||||
width="53">
|
||||
</button>
|
||||
<button
|
||||
follows="top|right"
|
||||
height="16"
|
||||
height="23"
|
||||
label="Paste"
|
||||
layout="topleft"
|
||||
left_pad="10"
|
||||
left_pad="5"
|
||||
name="paste_params_btn"
|
||||
tool_tip="Paste Parameters from Clipboard"
|
||||
width="65">
|
||||
width="53">
|
||||
</button>
|
||||
<menu_button
|
||||
menu_filename="menu_build_paste.xml"
|
||||
follows="top|left"
|
||||
height="23"
|
||||
image_hover_unselected="Toolbar_Middle_Over"
|
||||
image_overlay="OptionsMenu_Off"
|
||||
image_selected="Toolbar_Middle_Selected"
|
||||
image_unselected="Toolbar_Middle_Off"
|
||||
layout="topleft"
|
||||
left_pad="5"
|
||||
name="patse_gear_btn"
|
||||
tool_tip="Paste options"
|
||||
width="31"/>
|
||||
<combo_box
|
||||
height="19"
|
||||
layout="topleft"
|
||||
|
|
|
|||
Loading…
Reference in New Issue