From 3ee20531c96c05452a4b832634df000cf5d0dc08 Mon Sep 17 00:00:00 2001 From: Kadah_Coba Date: Mon, 8 Apr 2019 03:05:03 -0700 Subject: Added Copy/Paste to object properties in Build Tools --- indra/newview/llpanelobject.cpp | 116 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 115 insertions(+), 1 deletion(-) (limited to 'indra/newview/llpanelobject.cpp') diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp index 3665910c63..56a19d7551 100644 --- a/indra/newview/llpanelobject.cpp +++ b/indra/newview/llpanelobject.cpp @@ -150,6 +150,24 @@ BOOL LLPanelObject::postBuild() mCtrlRotZ = getChild("Rot Z"); childSetCommitCallback("Rot Z",onCommitRotation,this); + // Copy/paste pos + mBtnCopyPos = getChild("copy_pos_btn"); + mBtnCopyPos->setCommitCallback( boost::bind(&LLPanelObject::onCopyPos, this, _2 )); + mBtnPastePos = getChild("paste_pos_btn"); + mBtnPastePos->setCommitCallback( boost::bind(&LLPanelObject::onPastePos, this, _2 )); + + // Copy/paste size + mBtnCopySize = getChild("copy_size_btn"); + mBtnCopySize->setCommitCallback( boost::bind(&LLPanelObject::onCopySize, this, _2 )); + mBtnPasteSize = getChild("paste_size_btn"); + mBtnPasteSize->setCommitCallback( boost::bind(&LLPanelObject::onPasteSize, this, _2 )); + + // Copy/paste rot + mBtnCopyRot = getChild("copy_rot_btn"); + mBtnCopyRot->setCommitCallback( boost::bind(&LLPanelObject::onCopyRot, this, _2 )); + mBtnPasteRot = getChild("paste_rot_btn"); + mBtnPasteRot->setCommitCallback( boost::bind(&LLPanelObject::onPasteRot, this, _2 ));; + //-------------------------------------------------------- // Base Type @@ -286,7 +304,10 @@ LLPanelObject::LLPanelObject() mSelectedType(MI_BOX), mSculptTextureRevert(LLUUID::null), mSculptTypeRevert(0), - mSizeChanged(FALSE) + mSizeChanged(FALSE), + mHasPosClipboard(FALSE), + mHasSizeClipboard(FALSE), + mHasRotClipboard(FALSE) { } @@ -379,6 +400,8 @@ void LLPanelObject::getState( ) mCtrlPosX->setEnabled(enable_move); mCtrlPosY->setEnabled(enable_move); mCtrlPosZ->setEnabled(enable_move); + mBtnCopyPos->setEnabled(enable_move); + mBtnPastePos->setEnabled(enable_move && mHasPosClipboard); if (enable_scale) { @@ -404,6 +427,8 @@ void LLPanelObject::getState( ) mCtrlScaleX->setEnabled( enable_scale ); mCtrlScaleY->setEnabled( enable_scale ); mCtrlScaleZ->setEnabled( enable_scale ); + mBtnCopySize->setEnabled( enable_scale ); + mBtnPasteSize->setEnabled( enable_scale && mHasSizeClipboard ); LLQuaternion object_rot = objectp->getRotationEdit(); object_rot.getEulerAngles(&(mCurEulerDegrees.mV[VX]), &(mCurEulerDegrees.mV[VY]), &(mCurEulerDegrees.mV[VZ])); @@ -435,6 +460,8 @@ void LLPanelObject::getState( ) mCtrlRotX->setEnabled( enable_rotate ); mCtrlRotY->setEnabled( enable_rotate ); mCtrlRotZ->setEnabled( enable_rotate ); + mBtnCopyRot->setEnabled( enable_rotate ); + mBtnPasteRot->setEnabled( enable_rotate && mHasRotClipboard ); LLUUID owner_id; std::string owner_name; @@ -2001,3 +2028,90 @@ void LLPanelObject::onCommitSculptType(LLUICtrl *ctrl, void* userdata) self->sendSculpt(); } + +void copy_vector_to_clipboard(const LLVector3& vec) +{ + std::string stringVec = llformat("<%g, %g, %g>", vec.mV[VX], vec.mV[VY], vec.mV[VZ]); + LLView::getWindow()->copyTextToClipboard(utf8str_to_wstring(stringVec)); +} + +void LLPanelObject::onCopyPos(const LLSD& data) +{ + mClipboardPos = LLVector3(mCtrlPosX->get(), mCtrlPosY->get(), mCtrlPosZ->get()); + + copy_vector_to_clipboard(mClipboardPos); + + mBtnPastePos->setToolTip(llformat("Paste Position\n<%g, %g, %g>", mClipboardPos.mV[VX], mClipboardPos.mV[VY], mClipboardPos.mV[VZ])); + mBtnPastePos->setEnabled(TRUE); + + mHasPosClipboard = TRUE; +} + +void LLPanelObject::onCopySize(const LLSD& data) +{ + mClipboardSize = LLVector3(mCtrlScaleX->get(), mCtrlScaleY->get(), mCtrlScaleZ->get()); + + copy_vector_to_clipboard(mClipboardSize); + + mBtnPasteSize->setToolTip(llformat("Paste Size\n<%g, %g, %g>", mClipboardSize.mV[VX], mClipboardSize.mV[VY], mClipboardSize.mV[VZ])); + mBtnPasteSize->setEnabled(TRUE); + + mHasSizeClipboard = TRUE; +} + +void LLPanelObject::onCopyRot(const LLSD& data) +{ + mClipboardRot = LLVector3(mCtrlRotX->get(), mCtrlRotY->get(), mCtrlRotZ->get()); + + copy_vector_to_clipboard(mClipboardRot); + + mBtnPasteRot->setToolTip(llformat("Paste Rotation\n<%g, %g, %g>", mClipboardRot.mV[VX], mClipboardRot.mV[VY], mClipboardRot.mV[VZ])); + mBtnPasteSize->setEnabled(TRUE); + + mHasRotClipboard = TRUE; +} + +void LLPanelObject::onPastePos(const LLSD& data) +{ + if(!mHasPosClipboard) return; + + // Clamp pos on non-attachments, just keep the prims within the region + if (!mObject->isAttachment()) + { + mClipboardPos.mV[VX] = llclamp( mClipboardPos.mV[VX], 0.f, 256.f); + mClipboardPos.mV[VY] = llclamp( mClipboardPos.mV[VY], 0.f, 256.f); + //height will get properly clammed by sendPosition + } + + mCtrlPosX->set( mClipboardPos.mV[VX] ); + mCtrlPosY->set( mClipboardPos.mV[VY] ); + mCtrlPosZ->set( mClipboardPos.mV[VZ] ); + + sendPosition(FALSE); +} + +void LLPanelObject::onPasteSize(const LLSD& data) +{ + if(!mHasSizeClipboard) return; + + mClipboardSize.mV[VX] = llclamp(mClipboardSize.mV[VX], MIN_PRIM_SCALE, DEFAULT_MAX_PRIM_SCALE); + mClipboardSize.mV[VY] = llclamp(mClipboardSize.mV[VY], MIN_PRIM_SCALE, DEFAULT_MAX_PRIM_SCALE); + mClipboardSize.mV[VZ] = llclamp(mClipboardSize.mV[VZ], MIN_PRIM_SCALE, DEFAULT_MAX_PRIM_SCALE); + + mCtrlScaleX->set( mClipboardSize.mV[VX] ); + mCtrlScaleY->set( mClipboardSize.mV[VY] ); + mCtrlScaleZ->set( mClipboardSize.mV[VZ] ); + + sendScale(FALSE); +} + +void LLPanelObject::onPasteRot(const LLSD& data) +{ + if(!mHasRotClipboard) return; + + mCtrlRotX->set( mClipboardRot.mV[VX] ); + mCtrlRotY->set( mClipboardRot.mV[VY] ); + mCtrlRotZ->set( mClipboardRot.mV[VZ] ); + + sendRotation(FALSE); +} -- cgit v1.3 From 3a27acca73ec340987a1379c92eba5a45cc236a6 Mon Sep 17 00:00:00 2001 From: Kadah_Coba Date: Tue, 9 Apr 2019 00:12:04 -0700 Subject: Added Copy/Paste object parameters in Build Tools --- indra/newview/llpanelobject.cpp | 233 ++++++++++++++++++++- indra/newview/llpanelobject.h | 33 ++- .../newview/skins/default/xui/en/floater_tools.xml | 23 +- 3 files changed, 276 insertions(+), 13 deletions(-) (limited to 'indra/newview/llpanelobject.cpp') diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp index 56a19d7551..c8a12f1d38 100644 --- a/indra/newview/llpanelobject.cpp +++ b/indra/newview/llpanelobject.cpp @@ -46,6 +46,8 @@ #include "llcolorswatch.h" #include "llcombobox.h" #include "llfocusmgr.h" +#include "llinventoryfunctions.h" +#include "llinventorymodel.h" #include "llmanipscale.h" #include "llpreviewscript.h" #include "llresmgr.h" @@ -168,6 +170,12 @@ BOOL LLPanelObject::postBuild() mBtnPasteRot = getChild("paste_rot_btn"); mBtnPasteRot->setCommitCallback( boost::bind(&LLPanelObject::onPasteRot, this, _2 ));; + // Copy/paste obj prams + mBtnCopyParams = getChild("copy_params_btn"); + mBtnCopyParams->setCommitCallback( boost::bind(&LLPanelObject::onCopyParams, this, _2 )); + mBtnPasteParams = getChild("paste_params_btn"); + mBtnPasteParams->setCommitCallback( boost::bind(&LLPanelObject::onPasteParams, this, _2 )); + //-------------------------------------------------------- // Base Type @@ -463,6 +471,9 @@ void LLPanelObject::getState( ) mBtnCopyRot->setEnabled( enable_rotate ); mBtnPasteRot->setEnabled( enable_rotate && mHasRotClipboard ); + mBtnCopyParams->setEnabled( single_volume && enable_modify ); + mBtnPasteParams->setEnabled( single_volume && enable_modify ); + LLUUID owner_id; std::string owner_name; LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name); @@ -2066,7 +2077,7 @@ void LLPanelObject::onCopyRot(const LLSD& data) copy_vector_to_clipboard(mClipboardRot); mBtnPasteRot->setToolTip(llformat("Paste Rotation\n<%g, %g, %g>", mClipboardRot.mV[VX], mClipboardRot.mV[VY], mClipboardRot.mV[VZ])); - mBtnPasteSize->setEnabled(TRUE); + mBtnPasteRot->setEnabled(TRUE); mHasRotClipboard = TRUE; } @@ -2115,3 +2126,223 @@ void LLPanelObject::onPasteRot(const LLSD& data) sendRotation(FALSE); } + +void LLPanelObject::onCopyParams(const LLSD& data) +{ + LLViewerObject* objectp = mObject; + if (!objectp) + { + return; + } + + // Parametrics + getVolumeParams(mClipboardVolumeParams); + mHasParamsClipboard = TRUE; + + LLVOVolume *volobjp = NULL; + if (objectp && (objectp->getPCode() == LL_PCODE_VOLUME)) + { + volobjp = (LLVOVolume *)objectp; + } + + // Flexi Prim + if (volobjp && volobjp->isFlexible()) + { + 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(); + LLVector3 force = attributes->getUserForce(); + mParamsClipboard["forx"] = force.mV[0]; + mParamsClipboard["fory"] = force.mV[1]; + mParamsClipboard["forz"] = force.mV[2]; + mHasFlexiParam = TRUE; + } + } + 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)) + { + allow_texture = TRUE; + } + 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_type"] = sculpt_params->getSculptType(); + mHasSculptParam = TRUE; + } + else + { + mHasSculptParam = FALSE; + } + + // 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(); + LLColor3 color = volobjp->getLightColor(); + mParamsClipboard["r"] = color.mV[0]; + mParamsClipboard["g"] = color.mV[1]; + mParamsClipboard["b"] = color.mV[2]; + mHasLightParam = TRUE; + } + else + { + mHasLightParam = FALSE; + } + + // Physics + mParamsClipboard["physics_shape"] = objectp->getPhysicsShapeType(); +} + +void LLPanelObject::onPasteParams(const LLSD& data) +{ + LLViewerObject* objectp = mObject; + if (!objectp) + { + return; + } + + // Flexi Prim + if (mHasFlexiParam && (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); + } + } + + // Light Source + if (objectp && (objectp->getPCode() == LL_PCODE_VOLUME)) + { + LLVOVolume *volobjp = (LLVOVolume *)objectp; + + if (volobjp && mHasLightParam) + { + 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->setLightColor(LLColor3(r,g,b)); + } + } + + // Physics + if (mParamsClipboard.has("physics_shape")) + { + objectp->setPhysicsShapeType((U8)mParamsClipboard["physics_shape"].asInteger()); + } + + // Parametrics + if(mHasParamsClipboard) + { + objectp->updateVolume(mClipboardVolumeParams); + } +} diff --git a/indra/newview/llpanelobject.h b/indra/newview/llpanelobject.h index c1e0367b53..46725a80e4 100644 --- a/indra/newview/llpanelobject.h +++ b/indra/newview/llpanelobject.h @@ -72,6 +72,8 @@ public: void onPasteSize(const LLSD& data); void onCopyRot(const LLSD& data); void onPasteRot(const LLSD& data); + void onCopyParams(const LLSD& data); + void onPasteParams(const LLSD& data); static void onCommitParametric(LLUICtrl* ctrl, void* userdata); @@ -154,6 +156,15 @@ protected: LLSpinCtrl* mCtrlRotY; LLSpinCtrl* mCtrlRotZ; + LLButton *mBtnCopyPos; + LLButton *mBtnPastePos; + LLButton *mBtnCopySize; + LLButton *mBtnPasteSize; + LLButton *mBtnCopyRot; + LLButton *mBtnPasteRot; + LLButton *mBtnCopyParams; + LLButton *mBtnPasteParams; + LLCheckBoxCtrl *mCheckLock; LLCheckBoxCtrl *mCheckPhysics; LLCheckBoxCtrl *mCheckTemporary; @@ -165,17 +176,6 @@ protected: LLCheckBoxCtrl *mCtrlSculptMirror; LLCheckBoxCtrl *mCtrlSculptInvert; - LLButton *mBtnCopyPos; - LLButton *mBtnPastePos; - LLButton *mBtnCopySize; - LLButton *mBtnPasteSize; - LLButton *mBtnCopyRot; - LLButton *mBtnPasteRot; - - LLVector3 mClipboardPos; - LLVector3 mClipboardSize; - LLVector3 mClipboardRot; - LLVector3 mCurEulerDegrees; // to avoid sending rotation when not changed BOOL mIsPhysical; // to avoid sending "physical" when not changed BOOL mIsTemporary; // to avoid sending "temporary" when not changed @@ -185,10 +185,21 @@ protected: LLUUID mSculptTextureRevert; // so we can revert the sculpt texture on cancel U8 mSculptTypeRevert; // so we can revert the sculpt type on cancel + LLVector3 mClipboardPos; + LLVector3 mClipboardSize; + LLVector3 mClipboardRot; + BOOL mHasPosClipboard; BOOL mHasSizeClipboard; BOOL mHasRotClipboard; + LLSD mParamsClipboard; + LLVolumeParams mClipboardVolumeParams; + BOOL mHasParamsClipboard; + BOOL mHasFlexiParam; + BOOL mHasSculptParam; + BOOL mHasLightParam; + LLPointer mObject; LLPointer mRootObject; }; diff --git a/indra/newview/skins/default/xui/en/floater_tools.xml b/indra/newview/skins/default/xui/en/floater_tools.xml index 81a207c023..1e2846d943 100644 --- a/indra/newview/skins/default/xui/en/floater_tools.xml +++ b/indra/newview/skins/default/xui/en/floater_tools.xml @@ -1694,11 +1694,32 @@ even though the user gets a free copy. width="150"> Prim Type --> + + Date: Thu, 11 Apr 2019 01:49:46 -0700 Subject: Added remaining physical properies to copy/paste --- indra/newview/llpanelobject.cpp | 63 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 60 insertions(+), 3 deletions(-) (limited to 'indra/newview/llpanelobject.cpp') diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp index c8a12f1d38..1e462876ee 100644 --- a/indra/newview/llpanelobject.cpp +++ b/indra/newview/llpanelobject.cpp @@ -33,6 +33,7 @@ #include "lleconomy.h" #include "llerror.h" #include "llfontgl.h" +#include "material_codes.h" // LL_MCODE_MASK #include "llpermissionsflags.h" #include "llstring.h" #include "llvolume.h" @@ -2261,7 +2262,29 @@ void LLPanelObject::onCopyParams(const LLSD& data) } // Physics - mParamsClipboard["physics_shape"] = objectp->getPhysicsShapeType(); + { + 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 get(LLViewerObject* object, S32 te) + { + return object->getMaterial(); + } + } func; + bool material_same = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, material_code ); + // This should always be true since material should be per object. + if (material_same) + { + mParamsClipboard["physics_material"] = material_code; + } + } + } void LLPanelObject::onPasteParams(const LLSD& data) @@ -2335,9 +2358,43 @@ void LLPanelObject::onPasteParams(const LLSD& data) } // Physics - if (mParamsClipboard.has("physics_shape")) { - objectp->setPhysicsShapeType((U8)mParamsClipboard["physics_shape"].asInteger()); + if (mParamsClipboard.has("physics_shape")) + { + objectp->setPhysicsShapeType((U8)mParamsClipboard["physics_shape"].asInteger()); + } + if (mParamsClipboard.has("physics_material")) + { + 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->updateFlags(TRUE); + } } // Parametrics -- cgit v1.3 From 41f5801aae25931b8e1a2db1b2eb9623efbc1f3e Mon Sep 17 00:00:00 2001 From: Kadah_Coba Date: Tue, 16 Apr 2019 03:51:05 -0700 Subject: Added spotlight and phantom support to copy/paste Added paste options menu --- indra/newview/llpanelobject.cpp | 431 +++++++++++++-------- indra/newview/llpanelobject.h | 15 +- .../newview/skins/default/xui/en/floater_tools.xml | 23 +- 3 files changed, 290 insertions(+), 179 deletions(-) (limited to 'indra/newview/llpanelobject.cpp') diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp index 1e462876ee..1809392ad0 100644 --- a/indra/newview/llpanelobject.cpp +++ b/indra/newview/llpanelobject.cpp @@ -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("paste_pos_btn"); mBtnPastePos->setCommitCallback( boost::bind(&LLPanelObject::onPastePos, this, _2 )); - + // Copy/paste size mBtnCopySize = getChild("copy_size_btn"); mBtnCopySize->setCommitCallback( boost::bind(&LLPanelObject::onCopySize, this, _2 )); mBtnPasteSize = getChild("paste_size_btn"); mBtnPasteSize->setCommitCallback( boost::bind(&LLPanelObject::onPasteSize, this, _2 )); - + // Copy/paste rot mBtnCopyRot = getChild("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("paste_params_btn"); mBtnPasteParams->setCommitCallback( boost::bind(&LLPanelObject::onPasteParams, this, _2 )); + mBtnPasteMenu = getChild("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 @@ -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); - } + volobjp = (LLVOVolume *)objectp; } - // Sculpted Prim - if (mHasSculptParam) + // Light Source + if (mPasteLight && volobjp) { - LLSculptParams sculpt_params; - - if (mParamsClipboard.has("sculptid")) + if (mParamsClipboard.has("light")) { - sculpt_params.setSculptTexture(mParamsClipboard["sculptid"].asUUID(), (U8)mParamsClipboard["sculpt_type"].asInteger()); + 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["light"]["r"].asReal(); + F32 g = (F32)mParamsClipboard["light"]["g"].asReal(); + F32 b = (F32)mParamsClipboard["light"]["b"].asReal(); + volobjp->setLightColor(LLColor3(r,g,b)); } - objectp->setParameterEntry(LLNetworkData::PARAMS_SCULPT, sculpt_params, TRUE); - } - else - { - LLSculptParams *sculpt_params = (LLSculptParams *)objectp->getParameterEntry(LLNetworkData::PARAMS_SCULPT); - if (sculpt_params) + if (mParamsClipboard.has("spot")) { - objectp->setParameterEntryInUse(LLNetworkData::PARAMS_SCULPT, FALSE, TRUE); + 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); } } - // Light Source - if (objectp && (objectp->getPCode() == LL_PCODE_VOLUME)) + // Physics + if (mPastePhysics) { - LLVOVolume *volobjp = (LLVOVolume *)objectp; + bool is_root = objectp->isRoot(); - if (volobjp && mHasLightParam) - { - 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->setLightColor(LLColor3(r,g,b)); - } - } + // 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); - // Physics - { - if (mParamsClipboard.has("physics_shape")) - { - objectp->setPhysicsShapeType((U8)mParamsClipboard["physics_shape"].asInteger()); - } - if (mParamsClipboard.has("physics_material")) + 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(); + 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); } - bool phys_update_flags = false; - if (mParamsClipboard.has("physics_gravity")) + } + + // Parametrics + if(mPasteParametric) + { + // Sculpted Prim + if (mParamsClipboard.has("sculpt")) { - objectp->setPhysicsGravity(mParamsClipboard["physics_gravity"].asReal()); - phys_update_flags = true; + 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); } - if (mParamsClipboard.has("physics_friction")) + else { - objectp->setPhysicsFriction(mParamsClipboard["physics_friction"].asReal()); - phys_update_flags = true; + LLSculptParams *sculpt_params = (LLSculptParams *)objectp->getParameterEntry(LLNetworkData::PARAMS_SCULPT); + if (sculpt_params) + { + objectp->setParameterEntryInUse(LLNetworkData::PARAMS_SCULPT, FALSE, TRUE); + } } - if (mParamsClipboard.has("physics_density")) + + // 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) { - objectp->setPhysicsDensity(mParamsClipboard["physics_density"].asReal()); - phys_update_flags = true; + return false; } - if (mParamsClipboard.has("physics_restitution")) + if ("Physics" == command && mPastePhysics) { - objectp->setPhysicsRestitution(mParamsClipboard["physics_restitution"].asReal()); - phys_update_flags = true; + return false; } - if (phys_update_flags) + if ("Light" == command && mPasteLight) { - objectp->updateFlags(TRUE); + return false; } } - // Parametrics - if(mHasParamsClipboard) + 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)) { - objectp->updateVolume(mClipboardVolumeParams); + 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; } diff --git a/indra/newview/llpanelobject.h b/indra/newview/llpanelobject.h index 46725a80e4..7fa728ea57 100644 --- a/indra/newview/llpanelobject.h +++ b/indra/newview/llpanelobject.h @@ -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 mObject; LLPointer mRootObject; diff --git a/indra/newview/skins/default/xui/en/floater_tools.xml b/indra/newview/skins/default/xui/en/floater_tools.xml index 1e2846d943..8a7272d9e4 100644 --- a/indra/newview/skins/default/xui/en/floater_tools.xml +++ b/indra/newview/skins/default/xui/en/floater_tools.xml @@ -1696,25 +1696,38 @@ even though the user gets a free copy. --> + Date: Wed, 17 Apr 2019 02:41:33 -0700 Subject: Added translation support for build tools paste buttons tooltips --- indra/newview/llpanelobject.cpp | 65 +++++++++------------- .../newview/skins/default/xui/en/floater_tools.xml | 12 ++++ 2 files changed, 37 insertions(+), 40 deletions(-) (limited to 'indra/newview/llpanelobject.cpp') diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp index 1809392ad0..8a51007af7 100644 --- a/indra/newview/llpanelobject.cpp +++ b/indra/newview/llpanelobject.cpp @@ -2050,19 +2050,17 @@ void LLPanelObject::onCommitSculptType(LLUICtrl *ctrl, void* userdata) self->sendSculpt(); } -void copy_vector_to_clipboard(const LLVector3& vec) -{ - std::string stringVec = llformat("<%g, %g, %g>", vec.mV[VX], vec.mV[VY], vec.mV[VZ]); - LLView::getWindow()->copyTextToClipboard(utf8str_to_wstring(stringVec)); -} - void LLPanelObject::onCopyPos(const LLSD& data) { - mClipboardPos = LLVector3(mCtrlPosX->get(), mCtrlPosY->get(), mCtrlPosZ->get()); + mClipboardPos = LLVector3(mCtrlPosX->get(), mCtrlPosY->get(), mCtrlPosZ->get()); - copy_vector_to_clipboard(mClipboardPos); + std::string stringVec = llformat("<%g, %g, %g>", mClipboardPos.mV[VX], mClipboardPos.mV[VY], mClipboardPos.mV[VZ]); + LLView::getWindow()->copyTextToClipboard(utf8str_to_wstring(stringVec)); + + LLStringUtil::format_map_t args; + args["VALUE"] = stringVec; + mBtnPastePos->setToolTip(getString("paste_position", args)); - mBtnPastePos->setToolTip(llformat("Paste Position\n<%g, %g, %g>", mClipboardPos.mV[VX], mClipboardPos.mV[VY], mClipboardPos.mV[VZ])); mBtnPastePos->setEnabled(TRUE); mHasPosClipboard = TRUE; @@ -2070,11 +2068,15 @@ void LLPanelObject::onCopyPos(const LLSD& data) void LLPanelObject::onCopySize(const LLSD& data) { - mClipboardSize = LLVector3(mCtrlScaleX->get(), mCtrlScaleY->get(), mCtrlScaleZ->get()); + mClipboardSize = LLVector3(mCtrlScaleX->get(), mCtrlScaleY->get(), mCtrlScaleZ->get()); + + std::string stringVec = llformat("<%g, %g, %g>", mClipboardSize.mV[VX], mClipboardSize.mV[VY], mClipboardSize.mV[VZ]); + LLView::getWindow()->copyTextToClipboard(utf8str_to_wstring(stringVec)); - copy_vector_to_clipboard(mClipboardSize); + LLStringUtil::format_map_t args; + args["VALUE"] = stringVec; + mBtnPasteSize->setToolTip(getString("paste_size", args)); - mBtnPasteSize->setToolTip(llformat("Paste Size\n<%g, %g, %g>", mClipboardSize.mV[VX], mClipboardSize.mV[VY], mClipboardSize.mV[VZ])); mBtnPasteSize->setEnabled(TRUE); mHasSizeClipboard = TRUE; @@ -2082,11 +2084,15 @@ void LLPanelObject::onCopySize(const LLSD& data) void LLPanelObject::onCopyRot(const LLSD& data) { - mClipboardRot = LLVector3(mCtrlRotX->get(), mCtrlRotY->get(), mCtrlRotZ->get()); + mClipboardRot = LLVector3(mCtrlRotX->get(), mCtrlRotY->get(), mCtrlRotZ->get()); + + std::string stringVec = llformat("<%g, %g, %g>", mClipboardRot.mV[VX], mClipboardRot.mV[VY], mClipboardRot.mV[VZ]); + LLView::getWindow()->copyTextToClipboard(utf8str_to_wstring(stringVec)); - copy_vector_to_clipboard(mClipboardRot); + LLStringUtil::format_map_t args; + args["VALUE"] = stringVec; + mBtnPasteRot->setToolTip(getString("paste_rotation", args)); - mBtnPasteRot->setToolTip(llformat("Paste Rotation\n<%g, %g, %g>", mClipboardRot.mV[VX], mClipboardRot.mV[VY], mClipboardRot.mV[VZ])); mBtnPasteRot->setEnabled(TRUE); mHasRotClipboard = TRUE; @@ -2221,8 +2227,6 @@ void LLPanelObject::onCopyParams(const LLSD& data) } } } - - // Physics { @@ -2373,7 +2377,7 @@ void LLPanelObject::onPasteParams(const LLSD& data) bool LLPanelObject::pasteCheckMenuItem(const LLSD& userdata) { - std::string command = userdata.asString(); + std::string command = userdata.asString(); if ("Parametric" == command) { @@ -2388,12 +2392,12 @@ bool LLPanelObject::pasteCheckMenuItem(const LLSD& userdata) return mPasteLight; } - return false; + return false; } void LLPanelObject::pasteDoMenuItem(const LLSD& userdata) { - std::string command = userdata.asString(); + std::string command = userdata.asString(); if ("Parametric" == command) { @@ -2411,7 +2415,7 @@ void LLPanelObject::pasteDoMenuItem(const LLSD& userdata) bool LLPanelObject::pasteEnabletMenuItem(const LLSD& userdata) { - std::string command = userdata.asString(); + std::string command = userdata.asString(); // Keep at least one option enabled if (mPasteParametric + mPastePhysics + mPasteLight == 1) @@ -2457,7 +2461,6 @@ bool LLPanelObject::canCopyTexture(LLUUID image_id) items, LLInventoryModel::INCLUDE_TRASH, asset_id_matches); - if (items.size()) { // search for copyable version first @@ -2465,30 +2468,12 @@ bool LLPanelObject::canCopyTexture(LLUUID image_id) { 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; } diff --git a/indra/newview/skins/default/xui/en/floater_tools.xml b/indra/newview/skins/default/xui/en/floater_tools.xml index 8a7272d9e4..150d3d9804 100644 --- a/indra/newview/skins/default/xui/en/floater_tools.xml +++ b/indra/newview/skins/default/xui/en/floater_tools.xml @@ -1387,6 +1387,18 @@ even though the user gets a free copy. name="Object" top="16" width="295"> + +Paste Position +[VALUE] + + +Paste Size +[VALUE] + + +Paste Rotation +[VALUE] + Date: Fri, 6 Sep 2019 20:46:23 -0700 Subject: Cleanup object copy/paste functions --- indra/newview/llpanelobject.cpp | 37 +++++++++++----------- indra/newview/llpanelobject.h | 19 ++++++----- .../newview/skins/default/xui/en/floater_tools.xml | 4 +-- 3 files changed, 30 insertions(+), 30 deletions(-) (limited to 'indra/newview/llpanelobject.cpp') diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp index 8a51007af7..1a0c2c86eb 100644 --- a/indra/newview/llpanelobject.cpp +++ b/indra/newview/llpanelobject.cpp @@ -156,28 +156,28 @@ BOOL LLPanelObject::postBuild() // Copy/paste pos mBtnCopyPos = getChild("copy_pos_btn"); - mBtnCopyPos->setCommitCallback( boost::bind(&LLPanelObject::onCopyPos, this, _2 )); + mBtnCopyPos->setCommitCallback(boost::bind(&LLPanelObject::onCopyPos, this)); mBtnPastePos = getChild("paste_pos_btn"); - mBtnPastePos->setCommitCallback( boost::bind(&LLPanelObject::onPastePos, this, _2 )); + mBtnPastePos->setCommitCallback(boost::bind(&LLPanelObject::onPastePos, this)); // Copy/paste size mBtnCopySize = getChild("copy_size_btn"); - mBtnCopySize->setCommitCallback( boost::bind(&LLPanelObject::onCopySize, this, _2 )); + mBtnCopySize->setCommitCallback(boost::bind(&LLPanelObject::onCopySize, this)); mBtnPasteSize = getChild("paste_size_btn"); - mBtnPasteSize->setCommitCallback( boost::bind(&LLPanelObject::onPasteSize, this, _2 )); + mBtnPasteSize->setCommitCallback(boost::bind(&LLPanelObject::onPasteSize, this)); // Copy/paste rot mBtnCopyRot = getChild("copy_rot_btn"); - mBtnCopyRot->setCommitCallback( boost::bind(&LLPanelObject::onCopyRot, this, _2 )); + mBtnCopyRot->setCommitCallback(boost::bind(&LLPanelObject::onCopyRot, this)); mBtnPasteRot = getChild("paste_rot_btn"); - mBtnPasteRot->setCommitCallback( boost::bind(&LLPanelObject::onPasteRot, this, _2 ));; + mBtnPasteRot->setCommitCallback(boost::bind(&LLPanelObject::onPasteRot, this));; // Copy/paste obj prams mBtnCopyParams = getChild("copy_params_btn"); - mBtnCopyParams->setCommitCallback( boost::bind(&LLPanelObject::onCopyParams, this, _2 )); + mBtnCopyParams->setCommitCallback(boost::bind(&LLPanelObject::onCopyParams, this)); mBtnPasteParams = getChild("paste_params_btn"); - mBtnPasteParams->setCommitCallback( boost::bind(&LLPanelObject::onPasteParams, this, _2 )); - mBtnPasteMenu = getChild("patse_gear_btn"); + mBtnPasteParams->setCommitCallback(boost::bind(&LLPanelObject::onPasteParams, this)); + mBtnPasteMenu = getChild("paste_gear_btn"); //-------------------------------------------------------- @@ -2050,7 +2050,7 @@ void LLPanelObject::onCommitSculptType(LLUICtrl *ctrl, void* userdata) self->sendSculpt(); } -void LLPanelObject::onCopyPos(const LLSD& data) +void LLPanelObject::onCopyPos() { mClipboardPos = LLVector3(mCtrlPosX->get(), mCtrlPosY->get(), mCtrlPosZ->get()); @@ -2066,7 +2066,7 @@ void LLPanelObject::onCopyPos(const LLSD& data) mHasPosClipboard = TRUE; } -void LLPanelObject::onCopySize(const LLSD& data) +void LLPanelObject::onCopySize() { mClipboardSize = LLVector3(mCtrlScaleX->get(), mCtrlScaleY->get(), mCtrlScaleZ->get()); @@ -2082,7 +2082,7 @@ void LLPanelObject::onCopySize(const LLSD& data) mHasSizeClipboard = TRUE; } -void LLPanelObject::onCopyRot(const LLSD& data) +void LLPanelObject::onCopyRot() { mClipboardRot = LLVector3(mCtrlRotX->get(), mCtrlRotY->get(), mCtrlRotZ->get()); @@ -2098,7 +2098,7 @@ void LLPanelObject::onCopyRot(const LLSD& data) mHasRotClipboard = TRUE; } -void LLPanelObject::onPastePos(const LLSD& data) +void LLPanelObject::onPastePos() { if(!mHasPosClipboard) return; @@ -2117,7 +2117,7 @@ void LLPanelObject::onPastePos(const LLSD& data) sendPosition(FALSE); } -void LLPanelObject::onPasteSize(const LLSD& data) +void LLPanelObject::onPasteSize() { if(!mHasSizeClipboard) return; @@ -2132,7 +2132,7 @@ void LLPanelObject::onPasteSize(const LLSD& data) sendScale(FALSE); } -void LLPanelObject::onPasteRot(const LLSD& data) +void LLPanelObject::onPasteRot() { if(!mHasRotClipboard) return; @@ -2143,7 +2143,7 @@ void LLPanelObject::onPasteRot(const LLSD& data) sendRotation(FALSE); } -void LLPanelObject::onCopyParams(const LLSD& data) +void LLPanelObject::onCopyParams() { LLViewerObject* objectp = mObject; if (!objectp) @@ -2255,7 +2255,7 @@ void LLPanelObject::onCopyParams(const LLSD& data) mHasParamsClipboard = TRUE; } -void LLPanelObject::onPasteParams(const LLSD& data) +void LLPanelObject::onPasteParams() { LLViewerObject* objectp = mObject; if (!objectp || !mHasParamsClipboard) @@ -2286,7 +2286,7 @@ void LLPanelObject::onPasteParams(const LLSD& data) if (mParamsClipboard.has("spot")) { - volobjp->setLightTextureID(mParamsClipboard["spot"]["id"]); + volobjp->setLightTextureID(mParamsClipboard["spot"]["id"].asUUID()); LLVector3 spot_params; spot_params.mV[0] = (F32)mParamsClipboard["spot"]["fov"].asReal(); spot_params.mV[1] = (F32)mParamsClipboard["spot"]["focus"].asReal(); @@ -2440,6 +2440,7 @@ bool LLPanelObject::pasteEnabletMenuItem(const LLSD& userdata) // 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. +// Static bool LLPanelObject::canCopyTexture(LLUUID image_id) { // Library asset or default texture diff --git a/indra/newview/llpanelobject.h b/indra/newview/llpanelobject.h index 7fa728ea57..7161f51c73 100644 --- a/indra/newview/llpanelobject.h +++ b/indra/newview/llpanelobject.h @@ -67,14 +67,14 @@ public: static void onCommitPhantom( LLUICtrl* ctrl, void* userdata); static void onCommitPhysics( LLUICtrl* ctrl, void* userdata); - void onCopyPos(const LLSD& data); - void onPastePos(const LLSD& data); - void onCopySize(const LLSD& data); - void onPasteSize(const LLSD& data); - void onCopyRot(const LLSD& data); - void onPasteRot(const LLSD& data); - void onCopyParams(const LLSD& data); - void onPasteParams(const LLSD& data); + void onCopyPos(); + void onPastePos(); + void onCopySize(); + void onPasteSize(); + void onCopyRot(); + void onPasteRot(); + void onCopyParams(); + void onPasteParams(); static void onCommitParametric(LLUICtrl* ctrl, void* userdata); @@ -88,6 +88,7 @@ public: bool pasteCheckMenuItem(const LLSD& userdata); void pasteDoMenuItem(const LLSD& userdata); bool pasteEnabletMenuItem(const LLSD& userdata); + static bool canCopyTexture(LLUUID image_id); protected: void getState(); @@ -102,8 +103,6 @@ protected: void sendSculpt(); void getVolumeParams(LLVolumeParams& volume_params); - - bool canCopyTexture(LLUUID image_id); protected: // Per-object options diff --git a/indra/newview/skins/default/xui/en/floater_tools.xml b/indra/newview/skins/default/xui/en/floater_tools.xml index 150d3d9804..3032ad50b3 100644 --- a/indra/newview/skins/default/xui/en/floater_tools.xml +++ b/indra/newview/skins/default/xui/en/floater_tools.xml @@ -1737,7 +1737,7 @@ Paste Rotation image_unselected="Toolbar_Middle_Off" layout="topleft" left_pad="5" - name="patse_gear_btn" + name="paste_gear_btn" tool_tip="Paste options" width="31"/> - Date: Tue, 1 Oct 2019 15:44:05 +0300 Subject: SL-11944 FIXED [Project Copy/Paste] The prim's shape can be changed by pasting empty parameters --- indra/newview/llpanelobject.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'indra/newview/llpanelobject.cpp') diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp index 1e462876ee..3c41a4bce4 100644 --- a/indra/newview/llpanelobject.cpp +++ b/indra/newview/llpanelobject.cpp @@ -314,6 +314,7 @@ LLPanelObject::LLPanelObject() mSculptTextureRevert(LLUUID::null), mSculptTypeRevert(0), mSizeChanged(FALSE), + mHasParamsClipboard(FALSE), mHasPosClipboard(FALSE), mHasSizeClipboard(FALSE), mHasRotClipboard(FALSE) @@ -473,7 +474,7 @@ void LLPanelObject::getState( ) mBtnPasteRot->setEnabled( enable_rotate && mHasRotClipboard ); mBtnCopyParams->setEnabled( single_volume && enable_modify ); - mBtnPasteParams->setEnabled( single_volume && enable_modify ); + mBtnPasteParams->setEnabled( single_volume && enable_modify && mHasParamsClipboard ); LLUUID owner_id; std::string owner_name; @@ -2284,13 +2285,13 @@ void LLPanelObject::onCopyParams(const LLSD& data) mParamsClipboard["physics_material"] = material_code; } } - + mBtnPasteParams->setEnabled(TRUE); } void LLPanelObject::onPasteParams(const LLSD& data) { LLViewerObject* objectp = mObject; - if (!objectp) + if (!objectp || !mHasParamsClipboard) { return; } -- cgit v1.3 From ce48cb4303c10dbc9d3044271035153569226040 Mon Sep 17 00:00:00 2001 From: Kadah_Coba Date: Sun, 6 Oct 2019 16:09:56 -0700 Subject: [Project Copy/Paste] Simplified texture copy check --- indra/newview/llpanelobject.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'indra/newview/llpanelobject.cpp') diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp index 1a0c2c86eb..e53f03785f 100644 --- a/indra/newview/llpanelobject.cpp +++ b/indra/newview/llpanelobject.cpp @@ -2437,12 +2437,13 @@ bool LLPanelObject::pasteEnabletMenuItem(const LLSD& userdata) 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. // Static bool LLPanelObject::canCopyTexture(LLUUID image_id) { + // User is allowed to copy a texture if: + // library asset or default texture, + // or full perm asset exists in user's inventory + // Library asset or default texture if (gInventory.isObjectDescendentOf(image_id, gInventory.getLibraryRootFolderID()) || image_id == LLUUID(gSavedSettings.getString( "DefaultObjectTexture" )) @@ -2452,8 +2453,8 @@ bool LLPanelObject::canCopyTexture(LLUUID image_id) { return true; } - - // LLUUID inventory_item_id; + + // Search for a full perm asset LLViewerInventoryCategory::cat_array_t cats; LLViewerInventoryItem::item_array_t items; LLAssetIDMatches asset_id_matches(image_id); @@ -2464,12 +2465,10 @@ bool LLPanelObject::canCopyTexture(LLUUID image_id) 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())) + LLViewerInventoryItem* itemp = items[i]; + if (itemp->getIsFullPerm()) { return true; } -- cgit v1.3 From d3178573bb57a7c5cc997bde90a62e8d6a1affa4 Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Fri, 18 Oct 2019 17:23:28 +0300 Subject: SL-12156 FIXED [Project Copy/Paste] The prim's shape can be changed by pasting mesh parameters --- indra/newview/llpanelobject.cpp | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) (limited to 'indra/newview/llpanelobject.cpp') diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp index a382813de6..56aea7db5e 100644 --- a/indra/newview/llpanelobject.cpp +++ b/indra/newview/llpanelobject.cpp @@ -2158,7 +2158,10 @@ void LLPanelObject::onCopyParams() mParamsClipboard["is_physical"] = objectp->flagUsePhysics(); // Parametrics - getVolumeParams(mClipboardVolumeParams); + if (!objectp->isMesh()) + { + getVolumeParams(mClipboardVolumeParams); + } LLVOVolume *volobjp = NULL; if (objectp && (objectp->getPCode() == LL_PCODE_VOLUME)) @@ -2188,19 +2191,22 @@ void LLPanelObject::onCopyParams() if (objectp->getParameterEntryInUse(LLNetworkData::PARAMS_SCULPT)) { LLSculptParams *sculpt_params = (LLSculptParams *)objectp->getParameterEntry(LLNetworkData::PARAMS_SCULPT); - - LLUUID texture_id = sculpt_params->getSculptTexture(); - if (canCopyTexture(texture_id)) - { - LL_INFOS() << "copu texture " << LL_ENDL; - mParamsClipboard["sculpt"]["id"] = texture_id; - } - else + + if (!objectp->isMesh()) { - mParamsClipboard["sculpt"]["id"] = LLUUID(SCULPT_DEFAULT_TEXTURE); - } + LLUUID texture_id = sculpt_params->getSculptTexture(); + if (canCopyTexture(texture_id)) + { + LL_INFOS() << "copy texture " << LL_ENDL; + mParamsClipboard["sculpt"]["id"] = texture_id; + } + else + { + mParamsClipboard["sculpt"]["id"] = LLUUID(SCULPT_DEFAULT_TEXTURE); + } - mParamsClipboard["sculpt"]["type"] = sculpt_params->getSculptType(); + mParamsClipboard["sculpt"]["type"] = sculpt_params->getSculptType(); + } } // Light Source -- cgit v1.3 From baf86263e6dc1fe7f964e5885d6bed753554dad7 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Mon, 4 Nov 2019 18:24:36 +0200 Subject: SL-12213 Unable to paste no-modify/no-transfer texture --- indra/newview/llpanelobject.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'indra/newview/llpanelobject.cpp') diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp index 56aea7db5e..01fa9cc074 100644 --- a/indra/newview/llpanelobject.cpp +++ b/indra/newview/llpanelobject.cpp @@ -2449,7 +2449,7 @@ bool LLPanelObject::canCopyTexture(LLUUID image_id) { // User is allowed to copy a texture if: // library asset or default texture, - // or full perm asset exists in user's inventory + // or copy perm asset exists in user's inventory // Library asset or default texture if (gInventory.isObjectDescendentOf(image_id, gInventory.getLibraryRootFolderID()) @@ -2461,7 +2461,7 @@ bool LLPanelObject::canCopyTexture(LLUUID image_id) return true; } - // Search for a full perm asset + // Search for a copy perm asset LLViewerInventoryCategory::cat_array_t cats; LLViewerInventoryItem::item_array_t items; LLAssetIDMatches asset_id_matches(image_id); @@ -2475,9 +2475,15 @@ bool LLPanelObject::canCopyTexture(LLUUID image_id) for (S32 i = 0; i < items.size(); i++) { LLViewerInventoryItem* itemp = items[i]; - if (itemp->getIsFullPerm()) + if (itemp) { - return true; + LLPermissions item_permissions = itemp->getPermissions(); + if (item_permissions.allowOperationBy(PERM_COPY, + gAgent.getID(), + gAgent.getGroupID())) + { + return true; + } } } } -- cgit v1.3 From 3992875627514db275e9e394a538c0b8d597920c Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Tue, 5 Nov 2019 12:25:23 +0200 Subject: SL-12227 FIXED Copied physics data always applies physics material as Stone. --- indra/newview/llpanelobject.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llpanelobject.cpp') diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp index 01fa9cc074..8a5034db85 100644 --- a/indra/newview/llpanelobject.cpp +++ b/indra/newview/llpanelobject.cpp @@ -2318,7 +2318,7 @@ void LLPanelObject::onPasteParams() { objectp->setPhysicsShapeType((U8)mParamsClipboard["physics"]["shape"].asInteger()); U8 cur_material = objectp->getMaterial(); - U8 material = (U8)mParamsClipboard["physics_material"].asInteger() | (cur_material & ~LL_MCODE_MASK); + U8 material = (U8)mParamsClipboard["physics"]["material"].asInteger() | (cur_material & ~LL_MCODE_MASK); objectp->setMaterial(material); objectp->sendMaterialUpdate(); -- cgit v1.3 From aec6caf5eb89d8cc5ce37a8d59d2a57a3e745320 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Fri, 8 Nov 2019 21:11:48 +0200 Subject: SL-12241 Separated 'flexible' paramenters --- indra/newview/llpanelobject.cpp | 97 +++++++++++++++++----- indra/newview/llpanelobject.h | 1 + .../skins/default/xui/en/menu_build_paste.xml | 8 ++ 3 files changed, 85 insertions(+), 21 deletions(-) (limited to 'indra/newview/llpanelobject.cpp') diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp index 8a5034db85..872b71268d 100644 --- a/indra/newview/llpanelobject.cpp +++ b/indra/newview/llpanelobject.cpp @@ -321,6 +321,7 @@ LLPanelObject::LLPanelObject() mHasSizeClipboard(FALSE), mHasRotClipboard(FALSE), mPasteParametric(TRUE), + mPasteFlexible(TRUE), mPastePhysics(TRUE), mPasteLight(TRUE) { @@ -2330,30 +2331,19 @@ void LLPanelObject::onPasteParams() } } - // Parametrics - if(mPasteParametric) + if (mPasteFlexible) { - // 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 + bool is_flexible = mParamsClipboard.has("flex"); + if (is_flexible) { - LLSculptParams *sculpt_params = (LLSculptParams *)objectp->getParameterEntry(LLNetworkData::PARAMS_SCULPT); - if (sculpt_params) + LLVOVolume *volobjp = (LLVOVolume *)objectp; + BOOL update_shape = FALSE; + if (!mPasteParametric) { - objectp->setParameterEntryInUse(LLNetworkData::PARAMS_SCULPT, FALSE, TRUE); + // do before setParameterEntry or it will think that it is already flexi + update_shape = volobjp->setIsFlexible(is_flexible); } - } - // Flexi Params - if (mParamsClipboard.has("flex")) - { if (objectp->getClickAction() == CLICK_ACTION_SIT) { objectp->setClickAction(CLICK_ACTION_NONE); @@ -2372,10 +2362,63 @@ void LLPanelObject::onPasteParams() 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); + LLVector3 force(fx, fy, fz); new_attributes.setUserForce(force); objectp->setParameterEntry(LLNetworkData::PARAMS_FLEXIBLE, new_attributes, true); } + + if (!mPasteParametric && update_shape) + { + mObject->sendShapeUpdate(); + LLSelectMgr::getInstance()->selectionUpdatePhantom(volobjp->flagPhantom()); + } + } + else if (!mPasteParametric) + { + LLVOVolume *volobjp = (LLVOVolume *)objectp; + if (volobjp->setIsFlexible(is_flexible)) + { + mObject->sendShapeUpdate(); + LLSelectMgr::getInstance()->selectionUpdatePhantom(volobjp->flagPhantom()); + } + } + } + // Parametric does updateVolume(), make sure we won't affect flexible + else if (mPasteParametric) + { + LLVOVolume *volobjp = (LLVOVolume *)objectp; + if (volobjp->isFlexible()) + { + if (mClipboardVolumeParams.getPathParams().getCurveType() == LL_PCODE_PATH_LINE) + { + mClipboardVolumeParams.getPathParams().setCurveType(LL_PCODE_PATH_FLEXIBLE); + } + } + else if (mClipboardVolumeParams.getPathParams().getCurveType() == LL_PCODE_PATH_FLEXIBLE) + { + mClipboardVolumeParams.getPathParams().setCurveType(LL_PCODE_PATH_LINE); + } + } + + // Parametrics + 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); + } } objectp->updateVolume(mClipboardVolumeParams); @@ -2390,6 +2433,10 @@ bool LLPanelObject::pasteCheckMenuItem(const LLSD& userdata) { return mPasteParametric; } + if ("Flexible" == command) + { + return mPasteFlexible; + } if ("Physics" == command) { return mPastePhysics; @@ -2410,6 +2457,10 @@ void LLPanelObject::pasteDoMenuItem(const LLSD& userdata) { mPasteParametric = !mPasteParametric; } + if ("Flexible" == command) + { + mPasteFlexible = !mPasteFlexible; + } if ("Physics" == command) { mPastePhysics = !mPastePhysics; @@ -2425,12 +2476,16 @@ bool LLPanelObject::pasteEnabletMenuItem(const LLSD& userdata) std::string command = userdata.asString(); // Keep at least one option enabled - if (mPasteParametric + mPastePhysics + mPasteLight == 1) + if (mPasteParametric + mPasteFlexible + mPastePhysics + mPasteLight == 1) { if ("Parametric" == command && mPasteParametric) { return false; } + if ("Flexible" == command && mPasteFlexible) + { + return false; + } if ("Physics" == command && mPastePhysics) { return false; diff --git a/indra/newview/llpanelobject.h b/indra/newview/llpanelobject.h index 7161f51c73..0c37e837ad 100644 --- a/indra/newview/llpanelobject.h +++ b/indra/newview/llpanelobject.h @@ -205,6 +205,7 @@ protected: BOOL mHasParamsClipboard; BOOL mPasteParametric; + BOOL mPasteFlexible; BOOL mPastePhysics; BOOL mPasteLight; diff --git a/indra/newview/skins/default/xui/en/menu_build_paste.xml b/indra/newview/skins/default/xui/en/menu_build_paste.xml index f63362dabf..acbef528b8 100644 --- a/indra/newview/skins/default/xui/en/menu_build_paste.xml +++ b/indra/newview/skins/default/xui/en/menu_build_paste.xml @@ -10,6 +10,14 @@ + + + + + Date: Mon, 18 Nov 2019 15:28:49 +0200 Subject: SL-12290 FIXED [Project Copy/Paste] Checked 'Light' parameter has not become unchecked after Copy/Paste object properties --- indra/newview/llpanelobject.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/newview/llpanelobject.cpp') diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp index 872b71268d..b99c77fb79 100644 --- a/indra/newview/llpanelobject.cpp +++ b/indra/newview/llpanelobject.cpp @@ -2291,6 +2291,10 @@ void LLPanelObject::onPasteParams() F32 b = (F32)mParamsClipboard["light"]["b"].asReal(); volobjp->setLightColor(LLColor3(r,g,b)); } + else + { + volobjp->setIsLight(FALSE); + } if (mParamsClipboard.has("spot")) { -- cgit v1.3 From eaa4e977d687abbfb28687c66cb0b92e66deb484 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Wed, 11 Dec 2019 22:48:46 +0200 Subject: SL-12334 [Copypaste] Texture is not copied to clipboard from a full-perms object --- indra/newview/llpanelface.cpp | 69 +++++++++++++++++++++++++---------------- indra/newview/llpanelobject.cpp | 42 +++++++++++++++---------- indra/newview/llpanelobject.h | 6 ++++ 3 files changed, 73 insertions(+), 44 deletions(-) (limited to 'indra/newview/llpanelobject.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 3a48db0a1a..914863ccc0 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -2922,15 +2922,24 @@ void LLPanelFace::onCopyFaces() if (te_data["te"].has("imageid")) { + LLUUID item_id; LLUUID id = te_data["te"]["imageid"].asUUID(); - // Doesn't support local images! - if (id.isNull() || !LLPanelObject::canCopyTexture(id)) + bool full_perm = LLPanelObject::isLibraryTexture(id) || (objectp->permCopy() && objectp->permTransfer() && objectp->permModify()); + + // todo: fix this, we are often searching same tuxture multiple times (equal to number of faces) + if (id.notNull() && !full_perm) { - if (LLLocalBitmapMgr::getInstance()->isLocalBitmap(id)) - { - te_data["te"]["imageid"] = id; - } - else + // What this does is simply searches inventory for item with same asset id, + // as result it is Hightly unreliable, leaves little control to user, borderline hack + // but there are little options to preserve permissions - multiple inventory + // items might reference same asset and inventory search is expensive. + item_id = LLPanelObject::getCopyPermInventoryTextureId(id); + } + + if (id.isNull() + || (!full_perm && item_id.isNull())) + { + if (!LLLocalBitmapMgr::getInstance()->isLocalBitmap(id)) { te_data["te"].erase("imageid"); te_data["te"]["imageid"] = LLUUID(gSavedSettings.getString("DefaultObjectTexture")); @@ -2939,23 +2948,30 @@ void LLPanelFace::onCopyFaces() } else { - te_data["te"]["itemfullperm"] = false; // if item is not in inventory, we won't get here - LLTextureCtrl* texture_ctrl = getChild("texture control"); - LLUUID item_id = texture_ctrl->getImageItemID(); - if (item_id.notNull()) + te_data["te"]["itemfullperm"] = full_perm; + // If full permission object, texture is free to copy, + // but otherwise we need to check inventory and extract permissions + // + // Normally we care only about restrictions for current user and objects + // don't inherit any 'next owner' permissions from texture, so there is + // no need to record item id if full_perm==true + if (!full_perm && item_id.notNull()) { - // Texture control should have the id (otherwise canCopyTexture == false), - // use it for consistency. - te_data["te"]["imageitemid"] = item_id; - LLViewerInventoryItem* itemp = gInventory.getItem(item_id); if (itemp) { - te_data["te"]["itemfullperm"] = itemp->getIsFullPerm(); - if (!itemp->isFinished()) + LLPermissions item_permissions = itemp->getPermissions(); + if (item_permissions.allowOperationBy(PERM_COPY, + gAgent.getID(), + gAgent.getGroupID())) { - // needed for dropTextureAllFaces - LLInventoryModelBackgroundFetch::instance().start(item_id, false); + te_data["te"]["imageitemid"] = item_id; + te_data["te"]["itemfullperm"] = itemp->getIsFullPerm(); + if (!itemp->isFinished()) + { + // needed for dropTextureAllFaces + LLInventoryModelBackgroundFetch::instance().start(item_id, false); + } } } } @@ -3041,6 +3057,7 @@ void LLPanelFace::pasteFace(LLViewerObject* objectp, S32 te) if (te_data.has("te")) { // Texture + bool full_perm = te_data["te"].has("itemfullperm") && te_data["te"]["itemfullperm"].asBoolean(); if (mPasteDiffuse && te_data["te"].has("imageid")) { const LLUUID& imageid = te_data["te"]["imageid"].asUUID(); //texture or asset id @@ -3061,8 +3078,9 @@ void LLPanelFace::pasteFace(LLViewerObject* objectp, S32 te) } // for case when item got removed from inventory after we pressed 'copy' - if (!itemp_res) + if (!itemp_res && !full_perm) { + // todo: fix this, we are often searching same tuxter multiple times (equal to number of faces) LLViewerInventoryCategory::cat_array_t cats; LLViewerInventoryItem::item_array_t items; LLAssetIDMatches asset_id_matches(imageid); @@ -3111,14 +3129,11 @@ void LLPanelFace::pasteFace(LLViewerObject* objectp, S32 te) } } // not an inventory item or no complete items - else if (te_data["te"].has("itemfullperm")) + else if (full_perm) { - if (te_data["te"]["itemfullperm"].asBoolean()) - { - // when user clicked copy, item existed in inventory as fullperm (also can be used for local images) - LLViewerTexture* image = LLViewerTextureManager::getFetchedTexture(imageid, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); - objectp->setTEImage(U8(te), image); - } + // Either library, local or existed as fullperm when user made a copy + LLViewerTexture* image = LLViewerTextureManager::getFetchedTexture(imageid, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + objectp->setTEImage(U8(te), image); } } diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp index b99c77fb79..b179b1be53 100644 --- a/indra/newview/llpanelobject.cpp +++ b/indra/newview/llpanelobject.cpp @@ -2503,32 +2503,31 @@ bool LLPanelObject::pasteEnabletMenuItem(const LLSD& userdata) return true; } -// Static -bool LLPanelObject::canCopyTexture(LLUUID image_id) +//static +bool LLPanelObject::isLibraryTexture(LLUUID image_id) { - // User is allowed to copy a texture if: - // library asset or default texture, - // or copy perm asset exists in user's inventory - - // 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(gSavedSettings.getString("DefaultObjectTexture")) + || image_id == LLUUID(gSavedSettings.getString("UIImgWhiteUUID")) + || image_id == LLUUID(gSavedSettings.getString("UIImgInvisibleUUID")) || image_id == LLUUID(SCULPT_DEFAULT_TEXTURE)) { return true; } + return false; +} - // Search for a copy perm asset +//static +LLUUID LLPanelObject::getCopyPermInventoryTextureId(LLUUID image_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); + cats, + items, + LLInventoryModel::INCLUDE_TRASH, + asset_id_matches); if (items.size()) { for (S32 i = 0; i < items.size(); i++) @@ -2541,11 +2540,20 @@ bool LLPanelObject::canCopyTexture(LLUUID image_id) gAgent.getID(), gAgent.getGroupID())) { - return true; + return itemp->getUUID(); } } } } + return LLUUID::null; +} - return false; +// Static +bool LLPanelObject::canCopyTexture(LLUUID image_id) +{ + // User is allowed to copy a texture if: + // library asset or default texture, + // or copy perm asset exists in user's inventory + + return isLibraryTexture(image_id) || getCopyPermInventoryTextureId(image_id).notNull(); } diff --git a/indra/newview/llpanelobject.h b/indra/newview/llpanelobject.h index 0c37e837ad..65f46a8ed3 100644 --- a/indra/newview/llpanelobject.h +++ b/indra/newview/llpanelobject.h @@ -88,6 +88,12 @@ public: bool pasteCheckMenuItem(const LLSD& userdata); void pasteDoMenuItem(const LLSD& userdata); bool pasteEnabletMenuItem(const LLSD& userdata); + static bool isLibraryTexture(LLUUID image_id); + + // Finds copy-enabled texture with specified asset from inventory + // This can be performance unfriendly and doesn't warranty that + // the texture is original source of asset + static LLUUID getCopyPermInventoryTextureId(LLUUID image_id); static bool canCopyTexture(LLUUID image_id); protected: -- cgit v1.3 From f4c7c8aff55d0cd8f044d5b7c8cddb2be750dde5 Mon Sep 17 00:00:00 2001 From: Andrey Lihatskiy Date: Sun, 26 Apr 2020 21:15:54 +0300 Subject: Post-merge build fixes --- indra/newview/lllocalbitmaps.h | 4 +--- indra/newview/llpanelface.cpp | 2 +- indra/newview/llpanelobject.cpp | 4 ++-- 3 files changed, 4 insertions(+), 6 deletions(-) (limited to 'indra/newview/llpanelobject.cpp') diff --git a/indra/newview/lllocalbitmaps.h b/indra/newview/lllocalbitmaps.h index 8dba73f001..def5a6bd6e 100644 --- a/indra/newview/lllocalbitmaps.h +++ b/indra/newview/lllocalbitmaps.h @@ -122,9 +122,7 @@ public: LLUUID getWorldID(LLUUID tracking_id); bool isLocal(LLUUID world_id); std::string getFilename(LLUUID tracking_id); - - bool isLocalBitmap(LLUUID texture_id); - + void feedScrollList(LLScrollListCtrl* ctrl); void doUpdates(); void setNeedsRebake(); diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 810c18de40..13d0e377d7 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -2953,7 +2953,7 @@ void LLPanelFace::onCopyFaces() if (id.isNull() || (!full_perm && item_id.isNull())) { - if (!LLLocalBitmapMgr::getInstance()->isLocalBitmap(id)) + if (!LLLocalBitmapMgr::getInstance()->isLocal(id)) { te_data["te"].erase("imageid"); te_data["te"]["imageid"] = LLUUID(gSavedSettings.getString("DefaultObjectTexture")); diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp index 8c5afb914a..ac0122237f 100644 --- a/indra/newview/llpanelobject.cpp +++ b/indra/newview/llpanelobject.cpp @@ -2215,7 +2215,7 @@ void LLPanelObject::onCopyParams() mParamsClipboard["light"]["intensity"] = volobjp->getLightIntensity(); mParamsClipboard["light"]["radius"] = volobjp->getLightRadius(); mParamsClipboard["light"]["falloff"] = volobjp->getLightFalloff(); - LLColor3 color = volobjp->getLightColor(); + LLColor3 color = volobjp->getLightSRGBColor(); mParamsClipboard["light"]["r"] = color.mV[0]; mParamsClipboard["light"]["g"] = color.mV[1]; mParamsClipboard["light"]["b"] = color.mV[2]; @@ -2288,7 +2288,7 @@ void LLPanelObject::onPasteParams() 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)); + volobjp->setLightSRGBColor(LLColor3(r, g, b)); } else { -- cgit v1.3 From 090bb3e6de6d5cb70ed372748a76e391f61cb32e Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 2 Jun 2020 15:27:34 +0300 Subject: SL-13359 #1 Revert floater_tools and object panel changes --- indra/newview/llpanelface.cpp | 63 ++- indra/newview/llpanelface.h | 7 + indra/newview/llpanelobject.cpp | 479 +-------------------- indra/newview/llpanelobject.h | 34 -- .../newview/skins/default/textures/icons/Paste.png | Bin 530 -> 0 bytes indra/newview/skins/default/textures/textures.xml | 1 - .../newview/skins/default/xui/en/floater_tools.xml | 176 +------- .../skins/default/xui/en/menu_build_paste.xml | 38 -- 8 files changed, 87 insertions(+), 711 deletions(-) delete mode 100644 indra/newview/skins/default/textures/icons/Paste.png delete mode 100644 indra/newview/skins/default/xui/en/menu_build_paste.xml (limited to 'indra/newview/llpanelobject.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 13d0e377d7..369861fa25 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -2929,7 +2929,7 @@ void LLPanelFace::onCopyFaces() { LLUUID item_id; LLUUID id = te_data["te"]["imageid"].asUUID(); - bool full_perm = LLPanelObject::isLibraryTexture(id) || (objectp->permCopy() && objectp->permTransfer() && objectp->permModify()); + bool full_perm = LLPanelFace::isLibraryTexture(id) || (objectp->permCopy() && objectp->permTransfer() && objectp->permModify()); if (id.notNull() && !full_perm) { @@ -2944,7 +2944,7 @@ void LLPanelFace::onCopyFaces() // as result it is Hightly unreliable, leaves little control to user, borderline hack // but there are little options to preserve permissions - multiple inventory // items might reference same asset and inventory search is expensive. - item_id = LLPanelObject::getCopyPermInventoryTextureId(id); + item_id = LLPanelFace::getCopyPermInventoryTextureId(id); // record value to avoid repeating inventory search when possible asset_item_map[id] = item_id; } @@ -3022,7 +3022,7 @@ void LLPanelFace::onCopyFaces() if (mat_data.has("NormMap")) { LLUUID id = mat_data["NormMap"].asUUID(); - if (id.notNull() && !LLPanelObject::canCopyTexture(id)) + if (id.notNull() && !LLPanelFace::canCopyTexture(id)) { mat_data["NormMap"] = LLUUID(gSavedSettings.getString( "DefaultObjectTexture" )); mat_data["NormMapNoCopy"] = true; @@ -3032,7 +3032,7 @@ void LLPanelFace::onCopyFaces() if (mat_data.has("SpecMap")) { LLUUID id = mat_data["SpecMap"].asUUID(); - if (id.notNull() && !LLPanelObject::canCopyTexture(id)) + if (id.notNull() && !LLPanelFace::canCopyTexture(id)) { mat_data["SpecMap"] = LLUUID(gSavedSettings.getString( "DefaultObjectTexture" )); mat_data["SpecMapNoCopy"] = true; @@ -3504,3 +3504,58 @@ bool LLPanelFace::pasteEnabletMenuItem(const LLSD& userdata) return true; } + +//static +bool LLPanelFace::isLibraryTexture(LLUUID image_id) +{ + 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; + } + return false; +} + +//static +LLUUID LLPanelFace::getCopyPermInventoryTextureId(LLUUID image_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()) + { + for (S32 i = 0; i < items.size(); i++) + { + LLViewerInventoryItem* itemp = items[i]; + if (itemp) + { + LLPermissions item_permissions = itemp->getPermissions(); + if (item_permissions.allowOperationBy(PERM_COPY, + gAgent.getID(), + gAgent.getGroupID())) + { + return itemp->getUUID(); + } + } + } + } + return LLUUID::null; +} + +// Static +bool LLPanelFace::canCopyTexture(LLUUID image_id) +{ + // User is allowed to copy a texture if: + // library asset or default texture, + // or copy perm asset exists in user's inventory + + return isLibraryTexture(image_id) || getCopyPermInventoryTextureId(image_id).notNull(); +} diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h index 770f10e2ee..dbf3531332 100644 --- a/indra/newview/llpanelface.h +++ b/indra/newview/llpanelface.h @@ -115,6 +115,13 @@ public: LLRender::eTexIndex getTextureChannelToEdit(); void pasteFace(LLViewerObject* object, S32 te); + static bool isLibraryTexture(LLUUID image_id); + + // Finds copy-enabled texture with specified asset from inventory + // This can be performance unfriendly and doesn't warranty that + // the texture is original source of asset + static LLUUID getCopyPermInventoryTextureId(LLUUID image_id); + static bool canCopyTexture(LLUUID image_id); protected: void getState(); diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp index ac0122237f..5fd9655201 100644 --- a/indra/newview/llpanelobject.cpp +++ b/indra/newview/llpanelobject.cpp @@ -32,7 +32,6 @@ // linden library includes #include "llerror.h" #include "llfontgl.h" -#include "material_codes.h" // LL_MCODE_MASK #include "llpermissionsflags.h" #include "llstring.h" #include "llvolume.h" @@ -46,8 +45,6 @@ #include "llcolorswatch.h" #include "llcombobox.h" #include "llfocusmgr.h" -#include "llinventoryfunctions.h" -#include "llinventorymodel.h" #include "llmanipscale.h" #include "llmenubutton.h" #include "llpreviewscript.h" @@ -153,31 +150,6 @@ BOOL LLPanelObject::postBuild() mCtrlRotZ = getChild("Rot Z"); childSetCommitCallback("Rot Z",onCommitRotation,this); - // Copy/paste pos - mBtnCopyPos = getChild("copy_pos_btn"); - mBtnCopyPos->setCommitCallback(boost::bind(&LLPanelObject::onCopyPos, this)); - mBtnPastePos = getChild("paste_pos_btn"); - mBtnPastePos->setCommitCallback(boost::bind(&LLPanelObject::onPastePos, this)); - - // Copy/paste size - mBtnCopySize = getChild("copy_size_btn"); - mBtnCopySize->setCommitCallback(boost::bind(&LLPanelObject::onCopySize, this)); - mBtnPasteSize = getChild("paste_size_btn"); - mBtnPasteSize->setCommitCallback(boost::bind(&LLPanelObject::onPasteSize, this)); - - // Copy/paste rot - mBtnCopyRot = getChild("copy_rot_btn"); - mBtnCopyRot->setCommitCallback(boost::bind(&LLPanelObject::onCopyRot, this)); - mBtnPasteRot = getChild("paste_rot_btn"); - mBtnPasteRot->setCommitCallback(boost::bind(&LLPanelObject::onPasteRot, this));; - - // Copy/paste obj prams - mBtnCopyParams = getChild("copy_params_btn"); - mBtnCopyParams->setCommitCallback(boost::bind(&LLPanelObject::onCopyParams, this)); - mBtnPasteParams = getChild("paste_params_btn"); - mBtnPasteParams->setCommitCallback(boost::bind(&LLPanelObject::onPasteParams, this)); - mBtnPasteMenu = getChild("paste_gear_btn"); - //-------------------------------------------------------- // Base Type @@ -314,19 +286,11 @@ LLPanelObject::LLPanelObject() mSelectedType(MI_BOX), mSculptTextureRevert(LLUUID::null), mSculptTypeRevert(0), - mSizeChanged(FALSE), - mHasParamsClipboard(FALSE), mHasPosClipboard(FALSE), mHasSizeClipboard(FALSE), mHasRotClipboard(FALSE), - mPasteParametric(TRUE), - mPasteFlexible(TRUE), - mPastePhysics(TRUE), - mPasteLight(TRUE) + mSizeChanged(FALSE) { - 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)); } @@ -418,8 +382,6 @@ void LLPanelObject::getState( ) mCtrlPosX->setEnabled(enable_move); mCtrlPosY->setEnabled(enable_move); mCtrlPosZ->setEnabled(enable_move); - mBtnCopyPos->setEnabled(enable_move); - mBtnPastePos->setEnabled(enable_move && mHasPosClipboard); if (enable_scale) { @@ -445,8 +407,6 @@ void LLPanelObject::getState( ) mCtrlScaleX->setEnabled( enable_scale ); mCtrlScaleY->setEnabled( enable_scale ); mCtrlScaleZ->setEnabled( enable_scale ); - mBtnCopySize->setEnabled( enable_scale ); - mBtnPasteSize->setEnabled( enable_scale && mHasSizeClipboard ); LLQuaternion object_rot = objectp->getRotationEdit(); object_rot.getEulerAngles(&(mCurEulerDegrees.mV[VX]), &(mCurEulerDegrees.mV[VY]), &(mCurEulerDegrees.mV[VZ])); @@ -478,12 +438,6 @@ void LLPanelObject::getState( ) mCtrlRotX->setEnabled( enable_rotate ); mCtrlRotY->setEnabled( enable_rotate ); mCtrlRotZ->setEnabled( enable_rotate ); - mBtnCopyRot->setEnabled( enable_rotate ); - mBtnPasteRot->setEnabled( enable_rotate && mHasRotClipboard ); - - mBtnCopyParams->setEnabled( single_volume && enable_modify ); - mBtnPasteParams->setEnabled( single_volume && enable_modify && mHasParamsClipboard ); - mBtnPasteMenu->setEnabled( single_volume && enable_modify ); LLUUID owner_id; std::string owner_name; @@ -2058,12 +2012,6 @@ void LLPanelObject::onCopyPos() std::string stringVec = llformat("<%g, %g, %g>", mClipboardPos.mV[VX], mClipboardPos.mV[VY], mClipboardPos.mV[VZ]); LLView::getWindow()->copyTextToClipboard(utf8str_to_wstring(stringVec)); - LLStringUtil::format_map_t args; - args["VALUE"] = stringVec; - mBtnPastePos->setToolTip(getString("paste_position", args)); - - mBtnPastePos->setEnabled(TRUE); - mHasPosClipboard = TRUE; } @@ -2074,12 +2022,6 @@ void LLPanelObject::onCopySize() std::string stringVec = llformat("<%g, %g, %g>", mClipboardSize.mV[VX], mClipboardSize.mV[VY], mClipboardSize.mV[VZ]); LLView::getWindow()->copyTextToClipboard(utf8str_to_wstring(stringVec)); - LLStringUtil::format_map_t args; - args["VALUE"] = stringVec; - mBtnPasteSize->setToolTip(getString("paste_size", args)); - - mBtnPasteSize->setEnabled(TRUE); - mHasSizeClipboard = TRUE; } @@ -2090,12 +2032,6 @@ void LLPanelObject::onCopyRot() std::string stringVec = llformat("<%g, %g, %g>", mClipboardRot.mV[VX], mClipboardRot.mV[VY], mClipboardRot.mV[VZ]); LLView::getWindow()->copyTextToClipboard(utf8str_to_wstring(stringVec)); - LLStringUtil::format_map_t args; - args["VALUE"] = stringVec; - mBtnPasteRot->setToolTip(getString("paste_rotation", args)); - - mBtnPasteRot->setEnabled(TRUE); - mHasRotClipboard = TRUE; } @@ -2143,416 +2079,3 @@ void LLPanelObject::onPasteRot() sendRotation(FALSE); } - -void LLPanelObject::onCopyParams() -{ - LLViewerObject* objectp = mObject; - if (!objectp) - { - return; - } - - mParamsClipboard.clear(); - - mParamsClipboard["is_phantom"] = objectp->flagPhantom(); - mParamsClipboard["is_physical"] = objectp->flagUsePhysics(); - - // Parametrics - if (!objectp->isMesh()) - { - getVolumeParams(mClipboardVolumeParams); - } - - LLVOVolume *volobjp = NULL; - if (objectp && (objectp->getPCode() == LL_PCODE_VOLUME)) - { - volobjp = (LLVOVolume *)objectp; - } - - // Flexi Prim - if (volobjp && volobjp->isFlexible()) - { - LLFlexibleObjectData *attributes = (LLFlexibleObjectData *)objectp->getParameterEntry(LLNetworkData::PARAMS_FLEXIBLE); - if (attributes) - { - 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["flex"]["forx"] = force.mV[0]; - mParamsClipboard["flex"]["fory"] = force.mV[1]; - mParamsClipboard["flex"]["forz"] = force.mV[2]; - } - } - - // Sculpted Prim - if (objectp->getParameterEntryInUse(LLNetworkData::PARAMS_SCULPT)) - { - LLSculptParams *sculpt_params = (LLSculptParams *)objectp->getParameterEntry(LLNetworkData::PARAMS_SCULPT); - - if (!objectp->isMesh()) - { - LLUUID texture_id = sculpt_params->getSculptTexture(); - if (canCopyTexture(texture_id)) - { - LL_INFOS() << "copy texture " << LL_ENDL; - mParamsClipboard["sculpt"]["id"] = texture_id; - } - else - { - mParamsClipboard["sculpt"]["id"] = LLUUID(SCULPT_DEFAULT_TEXTURE); - } - - mParamsClipboard["sculpt"]["type"] = sculpt_params->getSculptType(); - } - } - - // Light Source - if (volobjp && volobjp->getIsLight()) - { - mParamsClipboard["light"]["intensity"] = volobjp->getLightIntensity(); - mParamsClipboard["light"]["radius"] = volobjp->getLightRadius(); - mParamsClipboard["light"]["falloff"] = volobjp->getLightFalloff(); - LLColor3 color = volobjp->getLightSRGBColor(); - 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(); - - U8 material_code = 0; - struct f : public LLSelectedTEGetFunctor - { - U8 get(LLViewerObject* object, S32 te) - { - return object->getMaterial(); - } - } func; - bool material_same = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, material_code ); - // This should always be true since material should be per object. - if (material_same) - { - mParamsClipboard["physics"]["material"] = material_code; - } - } - - mHasParamsClipboard = TRUE; -} - -void LLPanelObject::onPasteParams() -{ - LLViewerObject* objectp = mObject; - if (!objectp || !mHasParamsClipboard) - { - return; - } - - LLVOVolume *volobjp = NULL; - if (objectp && (objectp->getPCode() == LL_PCODE_VOLUME)) - { - volobjp = (LLVOVolume *)objectp; - } - - // Light Source - if (mPasteLight && volobjp) - { - 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["light"]["r"].asReal(); - F32 g = (F32)mParamsClipboard["light"]["g"].asReal(); - F32 b = (F32)mParamsClipboard["light"]["b"].asReal(); - volobjp->setLightSRGBColor(LLColor3(r, g, b)); - } - else - { - volobjp->setIsLight(FALSE); - } - - if (mParamsClipboard.has("spot")) - { - volobjp->setLightTextureID(mParamsClipboard["spot"]["id"].asUUID()); - 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) - { - 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(); - 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); - } - } - - if (mPasteFlexible) - { - bool is_flexible = mParamsClipboard.has("flex"); - if (is_flexible) - { - LLVOVolume *volobjp = (LLVOVolume *)objectp; - BOOL update_shape = FALSE; - if (!mPasteParametric) - { - // do before setParameterEntry or it will think that it is already flexi - update_shape = volobjp->setIsFlexible(is_flexible); - } - - 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); - } - - if (!mPasteParametric && update_shape) - { - mObject->sendShapeUpdate(); - LLSelectMgr::getInstance()->selectionUpdatePhantom(volobjp->flagPhantom()); - } - } - else if (!mPasteParametric) - { - LLVOVolume *volobjp = (LLVOVolume *)objectp; - if (volobjp->setIsFlexible(is_flexible)) - { - mObject->sendShapeUpdate(); - LLSelectMgr::getInstance()->selectionUpdatePhantom(volobjp->flagPhantom()); - } - } - } - // Parametric does updateVolume(), make sure we won't affect flexible - else if (mPasteParametric) - { - LLVOVolume *volobjp = (LLVOVolume *)objectp; - if (volobjp->isFlexible()) - { - if (mClipboardVolumeParams.getPathParams().getCurveType() == LL_PCODE_PATH_LINE) - { - mClipboardVolumeParams.getPathParams().setCurveType(LL_PCODE_PATH_FLEXIBLE); - } - } - else if (mClipboardVolumeParams.getPathParams().getCurveType() == LL_PCODE_PATH_FLEXIBLE) - { - mClipboardVolumeParams.getPathParams().setCurveType(LL_PCODE_PATH_LINE); - } - } - - // Parametrics - 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); - } - } - - objectp->updateVolume(mClipboardVolumeParams); - } -} - -bool LLPanelObject::pasteCheckMenuItem(const LLSD& userdata) -{ - std::string command = userdata.asString(); - - if ("Parametric" == command) - { - return mPasteParametric; - } - if ("Flexible" == command) - { - return mPasteFlexible; - } - 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 ("Flexible" == command) - { - mPasteFlexible = !mPasteFlexible; - } - 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 + mPasteFlexible + mPastePhysics + mPasteLight == 1) - { - if ("Parametric" == command && mPasteParametric) - { - return false; - } - if ("Flexible" == command && mPasteFlexible) - { - return false; - } - if ("Physics" == command && mPastePhysics) - { - return false; - } - if ("Light" == command && mPasteLight) - { - return false; - } - } - - return true; -} - -//static -bool LLPanelObject::isLibraryTexture(LLUUID image_id) -{ - 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; - } - return false; -} - -//static -LLUUID LLPanelObject::getCopyPermInventoryTextureId(LLUUID image_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()) - { - for (S32 i = 0; i < items.size(); i++) - { - LLViewerInventoryItem* itemp = items[i]; - if (itemp) - { - LLPermissions item_permissions = itemp->getPermissions(); - if (item_permissions.allowOperationBy(PERM_COPY, - gAgent.getID(), - gAgent.getGroupID())) - { - return itemp->getUUID(); - } - } - } - } - return LLUUID::null; -} - -// Static -bool LLPanelObject::canCopyTexture(LLUUID image_id) -{ - // User is allowed to copy a texture if: - // library asset or default texture, - // or copy perm asset exists in user's inventory - - return isLibraryTexture(image_id) || getCopyPermInventoryTextureId(image_id).notNull(); -} diff --git a/indra/newview/llpanelobject.h b/indra/newview/llpanelobject.h index 65f46a8ed3..e9b9254a78 100644 --- a/indra/newview/llpanelobject.h +++ b/indra/newview/llpanelobject.h @@ -37,7 +37,6 @@ class LLCheckBoxCtrl; class LLTextBox; class LLUICtrl; class LLButton; -class LLMenuButton; class LLViewerObject; class LLComboBox; class LLColorSwatchCtrl; @@ -73,9 +72,6 @@ public: void onPasteSize(); void onCopyRot(); void onPasteRot(); - void onCopyParams(); - void onPasteParams(); - static void onCommitParametric(LLUICtrl* ctrl, void* userdata); @@ -85,17 +81,6 @@ 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); - static bool isLibraryTexture(LLUUID image_id); - - // Finds copy-enabled texture with specified asset from inventory - // This can be performance unfriendly and doesn't warranty that - // the texture is original source of asset - static LLUUID getCopyPermInventoryTextureId(LLUUID image_id); - static bool canCopyTexture(LLUUID image_id); - protected: void getState(); @@ -168,16 +153,6 @@ protected: LLSpinCtrl* mCtrlRotY; LLSpinCtrl* mCtrlRotZ; - LLButton *mBtnCopyPos; - LLButton *mBtnPastePos; - LLButton *mBtnCopySize; - LLButton *mBtnPasteSize; - LLButton *mBtnCopyRot; - LLButton *mBtnPasteRot; - LLButton *mBtnCopyParams; - LLButton *mBtnPasteParams; - LLMenuButton *mBtnPasteMenu; - LLCheckBoxCtrl *mCheckLock; LLCheckBoxCtrl *mCheckPhysics; LLCheckBoxCtrl *mCheckTemporary; @@ -206,15 +181,6 @@ protected: BOOL mHasSizeClipboard; BOOL mHasRotClipboard; - LLSD mParamsClipboard; - LLVolumeParams mClipboardVolumeParams; - BOOL mHasParamsClipboard; - - BOOL mPasteParametric; - BOOL mPasteFlexible; - BOOL mPastePhysics; - BOOL mPasteLight; - LLPointer mObject; LLPointer mRootObject; }; diff --git a/indra/newview/skins/default/textures/icons/Paste.png b/indra/newview/skins/default/textures/icons/Paste.png deleted file mode 100644 index 10211df427..0000000000 Binary files a/indra/newview/skins/default/textures/icons/Paste.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index dd70354dd9..b041e6197c 100644 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -186,7 +186,6 @@ with the same filename but different name - diff --git a/indra/newview/skins/default/xui/en/floater_tools.xml b/indra/newview/skins/default/xui/en/floater_tools.xml index 425af16261..0abee2ff80 100644 --- a/indra/newview/skins/default/xui/en/floater_tools.xml +++ b/indra/newview/skins/default/xui/en/floater_tools.xml @@ -1397,18 +1397,6 @@ even though the user gets a free copy. name="Object" top="16" width="295"> - -Paste Position -[VALUE] - - -Paste Size -[VALUE] - - -Paste Rotation -[VALUE] - - - - @@ -1858,7 +1722,7 @@ Paste Rotation increment="5" initial_value="0" layout="topleft" - left="135" + left="125" max_val="95" name="Scale 1" top_pad="4" @@ -1882,7 +1746,7 @@ Paste Rotation follows="left|top" height="15" layout="topleft" - left="135" + left="125" name="Hollow Shape" top_pad="4" width="150"> @@ -1960,7 +1824,7 @@ Paste Rotation follows="left|top" height="10" layout="topleft" - left="135" + left="125" name="scale_taper" top_pad="3" width="150"> @@ -2013,7 +1877,7 @@ Paste Rotation follows="left|top" height="10" layout="topleft" - left="135" + left="125" name="text topshear" top_pad="3" width="141"> @@ -2056,7 +1920,7 @@ Paste Rotation follows="left|top" height="10" layout="topleft" - left="135" + left="125" name="advanced_cut" top_pad="3" width="150"> @@ -2120,7 +1984,7 @@ Paste Rotation follows="left|top" height="10" layout="topleft" - left="135" + left="125" name="text taper2" top_pad="3" width="150"> @@ -2163,7 +2027,7 @@ Paste Rotation follows="left|top" height="10" layout="topleft" - left="135" + left="125" name="text radius delta" top_pad="2" width="78"> @@ -2188,7 +2052,7 @@ Paste Rotation increment="0.05" initial_value="0" layout="topleft" - left="135" + left="125" min_val="-1" name="Radius Offset" top_pad="4" @@ -2213,7 +2077,7 @@ Paste Rotation height="141" label="Sculpt Texture" layout="topleft" - left="135" + left="125" name="sculpt texture control" tool_tip="Click to choose a picture" top="70" @@ -2671,7 +2535,7 @@ Paste Rotation top_pad="8" width="132" /> - - - - - - - - - - - - - - - - - - - - - - - - -- cgit v1.3 From f363646eb71d58007fc4936a67ad9c7bde9b93ac Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 2 Jun 2020 21:53:28 +0300 Subject: SL-13359 #2 UI changes for panel object todo: new icons, separator and some repositioning --- indra/newview/llpanelobject.cpp | 82 +++++++++++++++++++--- indra/newview/llpanelobject.h | 7 ++ .../newview/skins/default/xui/en/floater_tools.xml | 64 ++++++++++++++--- .../skins/default/xui/en/menu_copy_paste_pos.xml | 21 ++++++ .../skins/default/xui/en/menu_copy_paste_rot.xml | 21 ++++++ .../skins/default/xui/en/menu_copy_paste_size.xml | 21 ++++++ 6 files changed, 197 insertions(+), 19 deletions(-) create mode 100644 indra/newview/skins/default/xui/en/menu_copy_paste_pos.xml create mode 100644 indra/newview/skins/default/xui/en/menu_copy_paste_rot.xml create mode 100644 indra/newview/skins/default/xui/en/menu_copy_paste_size.xml (limited to 'indra/newview/llpanelobject.cpp') diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp index 5fd9655201..e6bbac8247 100644 --- a/indra/newview/llpanelobject.cpp +++ b/indra/newview/llpanelobject.cpp @@ -118,8 +118,9 @@ BOOL LLPanelObject::postBuild() // Phantom checkbox mCheckPhantom = getChild("Phantom Checkbox Ctrl"); childSetCommitCallback("Phantom Checkbox Ctrl",onCommitPhantom,this); - + // Position + mMenuPastePos = getChild("paste_pos_btn"); mLabelPosition = getChild("label position"); mCtrlPosX = getChild("Pos X"); childSetCommitCallback("Pos X",onCommitPosition,this); @@ -129,6 +130,7 @@ BOOL LLPanelObject::postBuild() childSetCommitCallback("Pos Z",onCommitPosition,this); // Scale + mMenuPasteSize = getChild("paste_size_btn"); mLabelSize = getChild("label size"); mCtrlScaleX = getChild("Scale X"); childSetCommitCallback("Scale X",onCommitScale,this); @@ -142,6 +144,7 @@ BOOL LLPanelObject::postBuild() childSetCommitCallback("Scale Z",onCommitScale,this); // Rotation + mMenuPasteRot = getChild("paste_rot_btn"); mLabelRotation = getChild("label rotation"); mCtrlRotX = getChild("Rot X"); childSetCommitCallback("Rot X",onCommitRotation,this); @@ -291,6 +294,8 @@ LLPanelObject::LLPanelObject() mHasRotClipboard(FALSE), mSizeChanged(FALSE) { + mCommitCallbackRegistrar.add("PanelObject.menuDoToSelected", boost::bind(&LLPanelObject::menuDoToSelected, this, _2)); + mEnableCallbackRegistrar.add("PanelObject.menuEnable", boost::bind(&LLPanelObject::menuEnableItem, this, _2)); } @@ -377,7 +382,7 @@ void LLPanelObject::getState( ) calcp->clearVar(LLCalc::Z_POS); } - + mMenuPastePos->setEnabled(enable_move); mLabelPosition->setEnabled( enable_move ); mCtrlPosX->setEnabled(enable_move); mCtrlPosY->setEnabled(enable_move); @@ -403,6 +408,7 @@ void LLPanelObject::getState( ) calcp->setVar(LLCalc::Z_SCALE, 0.f); } + mMenuPasteSize->setEnabled(enable_scale); mLabelSize->setEnabled( enable_scale ); mCtrlScaleX->setEnabled( enable_scale ); mCtrlScaleY->setEnabled( enable_scale ); @@ -434,6 +440,7 @@ void LLPanelObject::getState( ) calcp->clearVar(LLCalc::Z_ROT); } + mMenuPasteRot->setEnabled(enable_rotate); mLabelRotation->setEnabled( enable_rotate ); mCtrlRotX->setEnabled( enable_rotate ); mCtrlRotY->setEnabled( enable_rotate ); @@ -1648,6 +1655,8 @@ void LLPanelObject::sendPosition(BOOL btn_down) LLVector3 newpos(mCtrlPosX->get(), mCtrlPosY->get(), mCtrlPosZ->get()); LLViewerRegion* regionp = mObject->getRegion(); + if (!regionp) return; + // Clamp the Z height const F32 height = newpos.mV[VZ]; const F32 min_height = LLWorld::getInstance()->getMinAllowedZ(mObject, mObject->getPositionGlobal()); @@ -2005,6 +2014,57 @@ void LLPanelObject::onCommitSculptType(LLUICtrl *ctrl, void* userdata) self->sendSculpt(); } +void LLPanelObject::menuDoToSelected(const LLSD& userdata) +{ + std::string command = userdata.asString(); + + // paste + if (command == "pos_paste") + { + onPastePos(); + } + else if (command == "size_paste") + { + onPasteSize(); + } + else if (command == "rot_paste") + { + onPasteRot(); + } + // copy + else if (command == "pos_copy") + { + onCopyPos(); + } + else if (command == "size_copy") + { + onCopySize(); + } + else if (command == "rot_copy") + { + onCopyRot(); + } +} + +bool LLPanelObject::menuEnableItem(const LLSD& userdata) +{ + std::string command = userdata.asString(); + + if (command == "pos_paste") + { + return mHasPosClipboard; + } + else if (command == "size_paste") + { + return mHasSizeClipboard; + } + else if (command == "rot_paste") + { + return mHasRotClipboard; + } + return false; +} + void LLPanelObject::onCopyPos() { mClipboardPos = LLVector3(mCtrlPosX->get(), mCtrlPosY->get(), mCtrlPosZ->get()); @@ -2037,14 +2097,20 @@ void LLPanelObject::onCopyRot() void LLPanelObject::onPastePos() { - if(!mHasPosClipboard) return; + if (!mHasPosClipboard) return; + if (mObject.isNull()) return; + + LLViewerRegion* regionp = mObject->getRegion(); + if (!regionp) return; + // Clamp pos on non-attachments, just keep the prims within the region if (!mObject->isAttachment()) { - mClipboardPos.mV[VX] = llclamp( mClipboardPos.mV[VX], 0.f, 256.f); - mClipboardPos.mV[VY] = llclamp( mClipboardPos.mV[VY], 0.f, 256.f); - //height will get properly clammed by sendPosition + F32 max_width = regionp->getWidth(); // meters + mClipboardPos.mV[VX] = llclamp(mClipboardPos.mV[VX], 0.f, max_width); + mClipboardPos.mV[VY] = llclamp(mClipboardPos.mV[VY], 0.f, max_width); + //height will get properly clamped by sendPosition } mCtrlPosX->set( mClipboardPos.mV[VX] ); @@ -2056,7 +2122,7 @@ void LLPanelObject::onPastePos() void LLPanelObject::onPasteSize() { - if(!mHasSizeClipboard) return; + if (!mHasSizeClipboard) return; mClipboardSize.mV[VX] = llclamp(mClipboardSize.mV[VX], MIN_PRIM_SCALE, DEFAULT_MAX_PRIM_SCALE); mClipboardSize.mV[VY] = llclamp(mClipboardSize.mV[VY], MIN_PRIM_SCALE, DEFAULT_MAX_PRIM_SCALE); @@ -2071,7 +2137,7 @@ void LLPanelObject::onPasteSize() void LLPanelObject::onPasteRot() { - if(!mHasRotClipboard) return; + if (!mHasRotClipboard) return; mCtrlRotX->set( mClipboardRot.mV[VX] ); mCtrlRotY->set( mClipboardRot.mV[VY] ); diff --git a/indra/newview/llpanelobject.h b/indra/newview/llpanelobject.h index e9b9254a78..e8f8d0eb9a 100644 --- a/indra/newview/llpanelobject.h +++ b/indra/newview/llpanelobject.h @@ -37,6 +37,7 @@ class LLCheckBoxCtrl; class LLTextBox; class LLUICtrl; class LLButton; +class LLMenuButton; class LLViewerObject; class LLComboBox; class LLColorSwatchCtrl; @@ -81,6 +82,9 @@ public: BOOL onDropSculpt(LLInventoryItem* item); static void onCommitSculptType( LLUICtrl *ctrl, void* userdata); + void menuDoToSelected(const LLSD& userdata); + bool menuEnableItem(const LLSD& userdata); + protected: void getState(); @@ -137,17 +141,20 @@ protected: LLTextBox* mLabelRevolutions; LLSpinCtrl* mSpinRevolutions; + LLMenuButton* mMenuPastePos; LLTextBox* mLabelPosition; LLSpinCtrl* mCtrlPosX; LLSpinCtrl* mCtrlPosY; LLSpinCtrl* mCtrlPosZ; + LLMenuButton* mMenuPasteSize; LLTextBox* mLabelSize; LLSpinCtrl* mCtrlScaleX; LLSpinCtrl* mCtrlScaleY; LLSpinCtrl* mCtrlScaleZ; BOOL mSizeChanged; + LLMenuButton* mMenuPasteRot; LLTextBox* mLabelRotation; LLSpinCtrl* mCtrlRotX; LLSpinCtrl* mCtrlRotY; diff --git a/indra/newview/skins/default/xui/en/floater_tools.xml b/indra/newview/skins/default/xui/en/floater_tools.xml index 0abee2ff80..2397be6b61 100644 --- a/indra/newview/skins/default/xui/en/floater_tools.xml +++ b/indra/newview/skins/default/xui/en/floater_tools.xml @@ -1430,6 +1430,18 @@ even though the user gets a free copy. tool_tip="Causes object to not collide with other objects or avatars" top_pad="0" width="123" /> + - Position (meters) + Position + - Size (meters) + Size + - Rotation (degrees) + Rotation + + + + + + + + + + diff --git a/indra/newview/skins/default/xui/en/menu_copy_paste_rot.xml b/indra/newview/skins/default/xui/en/menu_copy_paste_rot.xml new file mode 100644 index 0000000000..dcfb3faeca --- /dev/null +++ b/indra/newview/skins/default/xui/en/menu_copy_paste_rot.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + diff --git a/indra/newview/skins/default/xui/en/menu_copy_paste_size.xml b/indra/newview/skins/default/xui/en/menu_copy_paste_size.xml new file mode 100644 index 0000000000..58d71b12d5 --- /dev/null +++ b/indra/newview/skins/default/xui/en/menu_copy_paste_size.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + -- cgit v1.3 From 30f1038351734b946be9a6f910e4e0eca82be1d4 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 3 Jun 2020 16:12:11 +0300 Subject: SL-13359 #3 UI changes for panel object --- indra/newview/llpanelobject.cpp | 12 +++--- indra/newview/llpanelobject.h | 6 +-- .../textures/icons/ClipboardSmallMenu_Disabled.png | Bin 0 -> 218 bytes .../textures/icons/ClipboardSmallMenu_Off.png | Bin 0 -> 217 bytes .../textures/icons/ClipboardSmallMenu_Press.png | Bin 0 -> 215 bytes indra/newview/skins/default/textures/textures.xml | 4 ++ .../newview/skins/default/xui/en/floater_tools.xml | 48 +++++++++++++-------- 7 files changed, 42 insertions(+), 28 deletions(-) create mode 100644 indra/newview/skins/default/textures/icons/ClipboardSmallMenu_Disabled.png create mode 100644 indra/newview/skins/default/textures/icons/ClipboardSmallMenu_Off.png create mode 100644 indra/newview/skins/default/textures/icons/ClipboardSmallMenu_Press.png (limited to 'indra/newview/llpanelobject.cpp') diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp index e6bbac8247..6fa2da7bac 100644 --- a/indra/newview/llpanelobject.cpp +++ b/indra/newview/llpanelobject.cpp @@ -120,7 +120,7 @@ BOOL LLPanelObject::postBuild() childSetCommitCallback("Phantom Checkbox Ctrl",onCommitPhantom,this); // Position - mMenuPastePos = getChild("paste_pos_btn"); + mMenuClipboardPos = getChild("clipboard_pos_btn"); mLabelPosition = getChild("label position"); mCtrlPosX = getChild("Pos X"); childSetCommitCallback("Pos X",onCommitPosition,this); @@ -130,7 +130,7 @@ BOOL LLPanelObject::postBuild() childSetCommitCallback("Pos Z",onCommitPosition,this); // Scale - mMenuPasteSize = getChild("paste_size_btn"); + mMenuClipboardSize = getChild("clipboard_size_btn"); mLabelSize = getChild("label size"); mCtrlScaleX = getChild("Scale X"); childSetCommitCallback("Scale X",onCommitScale,this); @@ -144,7 +144,7 @@ BOOL LLPanelObject::postBuild() childSetCommitCallback("Scale Z",onCommitScale,this); // Rotation - mMenuPasteRot = getChild("paste_rot_btn"); + mMenuClipboardRot = getChild("clipboard_rot_btn"); mLabelRotation = getChild("label rotation"); mCtrlRotX = getChild("Rot X"); childSetCommitCallback("Rot X",onCommitRotation,this); @@ -382,7 +382,7 @@ void LLPanelObject::getState( ) calcp->clearVar(LLCalc::Z_POS); } - mMenuPastePos->setEnabled(enable_move); + mMenuClipboardPos->setEnabled(enable_move); mLabelPosition->setEnabled( enable_move ); mCtrlPosX->setEnabled(enable_move); mCtrlPosY->setEnabled(enable_move); @@ -408,7 +408,7 @@ void LLPanelObject::getState( ) calcp->setVar(LLCalc::Z_SCALE, 0.f); } - mMenuPasteSize->setEnabled(enable_scale); + mMenuClipboardSize->setEnabled(enable_scale); mLabelSize->setEnabled( enable_scale ); mCtrlScaleX->setEnabled( enable_scale ); mCtrlScaleY->setEnabled( enable_scale ); @@ -440,7 +440,7 @@ void LLPanelObject::getState( ) calcp->clearVar(LLCalc::Z_ROT); } - mMenuPasteRot->setEnabled(enable_rotate); + mMenuClipboardRot->setEnabled(enable_rotate); mLabelRotation->setEnabled( enable_rotate ); mCtrlRotX->setEnabled( enable_rotate ); mCtrlRotY->setEnabled( enable_rotate ); diff --git a/indra/newview/llpanelobject.h b/indra/newview/llpanelobject.h index e8f8d0eb9a..764c0d8af4 100644 --- a/indra/newview/llpanelobject.h +++ b/indra/newview/llpanelobject.h @@ -141,20 +141,20 @@ protected: LLTextBox* mLabelRevolutions; LLSpinCtrl* mSpinRevolutions; - LLMenuButton* mMenuPastePos; + LLMenuButton* mMenuClipboardPos; LLTextBox* mLabelPosition; LLSpinCtrl* mCtrlPosX; LLSpinCtrl* mCtrlPosY; LLSpinCtrl* mCtrlPosZ; - LLMenuButton* mMenuPasteSize; + LLMenuButton* mMenuClipboardSize; LLTextBox* mLabelSize; LLSpinCtrl* mCtrlScaleX; LLSpinCtrl* mCtrlScaleY; LLSpinCtrl* mCtrlScaleZ; BOOL mSizeChanged; - LLMenuButton* mMenuPasteRot; + LLMenuButton* mMenuClipboardRot; LLTextBox* mLabelRotation; LLSpinCtrl* mCtrlRotX; LLSpinCtrl* mCtrlRotY; diff --git a/indra/newview/skins/default/textures/icons/ClipboardSmallMenu_Disabled.png b/indra/newview/skins/default/textures/icons/ClipboardSmallMenu_Disabled.png new file mode 100644 index 0000000000..63b4bd2127 Binary files /dev/null and b/indra/newview/skins/default/textures/icons/ClipboardSmallMenu_Disabled.png differ diff --git a/indra/newview/skins/default/textures/icons/ClipboardSmallMenu_Off.png b/indra/newview/skins/default/textures/icons/ClipboardSmallMenu_Off.png new file mode 100644 index 0000000000..4200182b0c Binary files /dev/null and b/indra/newview/skins/default/textures/icons/ClipboardSmallMenu_Off.png differ diff --git a/indra/newview/skins/default/textures/icons/ClipboardSmallMenu_Press.png b/indra/newview/skins/default/textures/icons/ClipboardSmallMenu_Press.png new file mode 100644 index 0000000000..e12887f489 Binary files /dev/null and b/indra/newview/skins/default/textures/icons/ClipboardSmallMenu_Press.png differ diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index 7325d836d2..b7fa1e72f8 100644 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -438,6 +438,10 @@ with the same filename but different name + + + + diff --git a/indra/newview/skins/default/xui/en/floater_tools.xml b/indra/newview/skins/default/xui/en/floater_tools.xml index 2397be6b61..7768f894b8 100644 --- a/indra/newview/skins/default/xui/en/floater_tools.xml +++ b/indra/newview/skins/default/xui/en/floater_tools.xml @@ -1430,19 +1430,29 @@ even though the user gets a free copy. tool_tip="Causes object to not collide with other objects or avatars" top_pad="0" width="123" /> + - Date: Wed, 17 Jun 2020 23:38:55 +0300 Subject: SL-13359 #5 Implemented revised changes --- indra/newview/llfloatermodelpreview.cpp | 1 + indra/newview/llpanelface.cpp | 64 +----- indra/newview/llpanelface.h | 7 - indra/newview/llpanelobject.cpp | 219 ++++++++++++++++++--- indra/newview/llpanelobject.h | 11 +- indra/newview/lltexturectrl.cpp | 55 ++++++ indra/newview/lltexturectrl.h | 10 + .../textures/icons/ClipboardMenu_Disabled.png | Bin 0 -> 231 bytes .../default/textures/icons/ClipboardMenu_Off.png | Bin 0 -> 231 bytes .../default/textures/icons/ClipboardMenu_Press.png | Bin 0 -> 224 bytes indra/newview/skins/default/textures/textures.xml | 3 + .../newview/skins/default/xui/en/floater_tools.xml | 31 ++- .../default/xui/en/menu_copy_paste_generic.xml | 21 ++ .../skins/default/xui/en/menu_copy_paste_pos.xml | 26 ++- .../skins/default/xui/en/menu_copy_paste_rot.xml | 26 ++- .../skins/default/xui/en/menu_copy_paste_size.xml | 26 ++- 16 files changed, 382 insertions(+), 118 deletions(-) create mode 100644 indra/newview/skins/default/textures/icons/ClipboardMenu_Disabled.png create mode 100644 indra/newview/skins/default/textures/icons/ClipboardMenu_Off.png create mode 100644 indra/newview/skins/default/textures/icons/ClipboardMenu_Press.png create mode 100644 indra/newview/skins/default/xui/en/menu_copy_paste_generic.xml (limited to 'indra/newview/llpanelobject.cpp') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index bc44e37c5a..f44dd92ddb 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -4379,6 +4379,7 @@ void LLModelPreview::textureLoadedCallback( if(final && preview->mModelLoader) { + // for areTexturesReady() if(preview->mModelLoader->mNumOfFetchingTextures > 0) { preview->mModelLoader->mNumOfFetchingTextures-- ; diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 369861fa25..6e99a10b98 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -54,7 +54,6 @@ #include "llmediaentry.h" #include "llmenubutton.h" #include "llnotificationsutil.h" -#include "llpanelobject.h" // LLPanelObject::canCopyTexture #include "llradiogroup.h" #include "llresmgr.h" #include "llselectmgr.h" @@ -2929,7 +2928,7 @@ void LLPanelFace::onCopyFaces() { LLUUID item_id; LLUUID id = te_data["te"]["imageid"].asUUID(); - bool full_perm = LLPanelFace::isLibraryTexture(id) || (objectp->permCopy() && objectp->permTransfer() && objectp->permModify()); + bool full_perm = get_is_library_texture(id) || (objectp->permCopy() && objectp->permTransfer() && objectp->permModify()); if (id.notNull() && !full_perm) { @@ -2944,7 +2943,7 @@ void LLPanelFace::onCopyFaces() // as result it is Hightly unreliable, leaves little control to user, borderline hack // but there are little options to preserve permissions - multiple inventory // items might reference same asset and inventory search is expensive. - item_id = LLPanelFace::getCopyPermInventoryTextureId(id); + item_id = get_copy_free_item_by_asset_id(id); // record value to avoid repeating inventory search when possible asset_item_map[id] = item_id; } @@ -3022,7 +3021,7 @@ void LLPanelFace::onCopyFaces() if (mat_data.has("NormMap")) { LLUUID id = mat_data["NormMap"].asUUID(); - if (id.notNull() && !LLPanelFace::canCopyTexture(id)) + if (id.notNull() && !get_can_copy_texture(id)) { mat_data["NormMap"] = LLUUID(gSavedSettings.getString( "DefaultObjectTexture" )); mat_data["NormMapNoCopy"] = true; @@ -3032,7 +3031,7 @@ void LLPanelFace::onCopyFaces() if (mat_data.has("SpecMap")) { LLUUID id = mat_data["SpecMap"].asUUID(); - if (id.notNull() && !LLPanelFace::canCopyTexture(id)) + if (id.notNull() && !get_can_copy_texture(id)) { mat_data["SpecMap"] = LLUUID(gSavedSettings.getString( "DefaultObjectTexture" )); mat_data["SpecMapNoCopy"] = true; @@ -3504,58 +3503,3 @@ bool LLPanelFace::pasteEnabletMenuItem(const LLSD& userdata) return true; } - -//static -bool LLPanelFace::isLibraryTexture(LLUUID image_id) -{ - 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; - } - return false; -} - -//static -LLUUID LLPanelFace::getCopyPermInventoryTextureId(LLUUID image_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()) - { - for (S32 i = 0; i < items.size(); i++) - { - LLViewerInventoryItem* itemp = items[i]; - if (itemp) - { - LLPermissions item_permissions = itemp->getPermissions(); - if (item_permissions.allowOperationBy(PERM_COPY, - gAgent.getID(), - gAgent.getGroupID())) - { - return itemp->getUUID(); - } - } - } - } - return LLUUID::null; -} - -// Static -bool LLPanelFace::canCopyTexture(LLUUID image_id) -{ - // User is allowed to copy a texture if: - // library asset or default texture, - // or copy perm asset exists in user's inventory - - return isLibraryTexture(image_id) || getCopyPermInventoryTextureId(image_id).notNull(); -} diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h index dbf3531332..770f10e2ee 100644 --- a/indra/newview/llpanelface.h +++ b/indra/newview/llpanelface.h @@ -115,13 +115,6 @@ public: LLRender::eTexIndex getTextureChannelToEdit(); void pasteFace(LLViewerObject* object, S32 te); - static bool isLibraryTexture(LLUUID image_id); - - // Finds copy-enabled texture with specified asset from inventory - // This can be performance unfriendly and doesn't warranty that - // the texture is original source of asset - static LLUUID getCopyPermInventoryTextureId(LLUUID image_id); - static bool canCopyTexture(LLUUID image_id); protected: void getState(); diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp index 6fa2da7bac..f1426ddf33 100644 --- a/indra/newview/llpanelobject.cpp +++ b/indra/newview/llpanelobject.cpp @@ -159,6 +159,8 @@ BOOL LLPanelObject::postBuild() mComboBaseType = getChild("comboBaseType"); childSetCommitCallback("comboBaseType",onCommitParametric,this); + mMenuClipboardParams = getChild("clipboard_params_btn"); + // Cut mLabelCut = getChild("text cut"); mSpinCutBegin = getChild("cut begin"); @@ -289,9 +291,10 @@ LLPanelObject::LLPanelObject() mSelectedType(MI_BOX), mSculptTextureRevert(LLUUID::null), mSculptTypeRevert(0), - mHasPosClipboard(FALSE), - mHasSizeClipboard(FALSE), - mHasRotClipboard(FALSE), + mHasClipboardPos(false), + mHasClipboardSize(false), + mHasClipboardRot(false), + mHasClipboardParams(false), mSizeChanged(FALSE) { mCommitCallbackRegistrar.add("PanelObject.menuDoToSelected", boost::bind(&LLPanelObject::menuDoToSelected, this, _2)); @@ -618,7 +621,7 @@ void LLPanelObject::getState( ) } else { - LL_INFOS() << "Unknown path " << (S32) path << " profile " << (S32) profile << " in getState" << LL_ENDL; + LL_INFOS("FloaterTools") << "Unknown path " << (S32) path << " profile " << (S32) profile << " in getState" << LL_ENDL; selected_item = MI_BOX; } @@ -944,6 +947,7 @@ void LLPanelObject::getState( ) // Update field enablement mComboBaseType ->setEnabled( enabled ); + mMenuClipboardParams->setEnabled(enabled); mLabelCut ->setEnabled( enabled ); mSpinCutBegin ->setEnabled( enabled ); @@ -1104,7 +1108,8 @@ void LLPanelObject::getState( ) } mComboBaseType->setEnabled(!isMesh); - + mMenuClipboardParams->setEnabled(!isMesh); + if (mCtrlSculptType) { if (sculpt_stitching == LL_SCULPT_TYPE_NONE) @@ -1168,11 +1173,11 @@ void LLPanelObject::sendIsPhysical() LLSelectMgr::getInstance()->selectionUpdatePhysics(value); mIsPhysical = value; - LL_INFOS() << "update physics sent" << LL_ENDL; + LL_INFOS("FloaterTools") << "update physics sent" << LL_ENDL; } else { - LL_INFOS() << "update physics not changed" << LL_ENDL; + LL_INFOS("FloaterTools") << "update physics not changed" << LL_ENDL; } } @@ -1184,11 +1189,11 @@ void LLPanelObject::sendIsTemporary() LLSelectMgr::getInstance()->selectionUpdateTemporary(value); mIsTemporary = value; - LL_INFOS() << "update temporary sent" << LL_ENDL; + LL_INFOS("FloaterTools") << "update temporary sent" << LL_ENDL; } else { - LL_INFOS() << "update temporary not changed" << LL_ENDL; + LL_INFOS("FloaterTools") << "update temporary not changed" << LL_ENDL; } } @@ -1201,11 +1206,11 @@ void LLPanelObject::sendIsPhantom() LLSelectMgr::getInstance()->selectionUpdatePhantom(value); mIsPhantom = value; - LL_INFOS() << "update phantom sent" << LL_ENDL; + LL_INFOS("FloaterTools") << "update phantom sent" << LL_ENDL; } else { - LL_INFOS() << "update phantom not changed" << LL_ENDL; + LL_INFOS("FloaterTools") << "update phantom not changed" << LL_ENDL; } } @@ -1315,7 +1320,7 @@ void LLPanelObject::getVolumeParams(LLVolumeParams& volume_params) break; default: - LL_WARNS() << "Unknown base type " << selected_type + LL_WARNS("FloaterTools") << "Unknown base type " << selected_type << " in getVolumeParams()" << LL_ENDL; // assume a box selected_type = MI_BOX; @@ -2019,7 +2024,13 @@ void LLPanelObject::menuDoToSelected(const LLSD& userdata) std::string command = userdata.asString(); // paste - if (command == "pos_paste") + if (command == "psr_paste") + { + onPastePos(); + onPasteSize(); + onPasteRot(); + } + else if (command == "pos_paste") { onPastePos(); } @@ -2031,7 +2042,17 @@ void LLPanelObject::menuDoToSelected(const LLSD& userdata) { onPasteRot(); } + else if (command == "params_paste") + { + onPasteParams(); + } // copy + else if (command == "psr_copy") + { + onCopyPos(); + onCopySize(); + onCopyRot(); + } else if (command == "pos_copy") { onCopyPos(); @@ -2044,23 +2065,71 @@ void LLPanelObject::menuDoToSelected(const LLSD& userdata) { onCopyRot(); } + else if (command == "params_copy") + { + onCopyParams(); + } } bool LLPanelObject::menuEnableItem(const LLSD& userdata) { std::string command = userdata.asString(); - if (command == "pos_paste") + // paste options + if (command == "psr_paste") + { + S32 selected_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount(); + BOOL single_volume = (LLSelectMgr::getInstance()->selectionAllPCode(LL_PCODE_VOLUME)) + && (selected_count == 1); + + if (!single_volume) + { + return false; + } + + bool enable_move; + bool enable_modify; + + LLSelectMgr::getInstance()->selectGetEditMoveLinksetPermissions(enable_move, enable_modify); + + return enable_move && enable_modify && mHasClipboardPos && mHasClipboardSize && mHasClipboardRot; + } + else if (command == "pos_paste") { - return mHasPosClipboard; + // assumes that menu won't be active if there is no move permission + return mHasClipboardPos; } else if (command == "size_paste") { - return mHasSizeClipboard; + return mHasClipboardSize; } else if (command == "rot_paste") { - return mHasRotClipboard; + return mHasClipboardRot; + } + else if (command == "params_paste") + { + return mHasClipboardParams; + } + // copy options + else if (command == "psr_copy") + { + S32 selected_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount(); + BOOL single_volume = (LLSelectMgr::getInstance()->selectionAllPCode(LL_PCODE_VOLUME)) + && (selected_count == 1); + + if (!single_volume) + { + return false; + } + + bool enable_move; + bool enable_modify; + + LLSelectMgr::getInstance()->selectGetEditMoveLinksetPermissions(enable_move, enable_modify); + + // since we forbid seeing values we also should forbid copying them + return enable_move && enable_modify; } return false; } @@ -2072,7 +2141,7 @@ void LLPanelObject::onCopyPos() std::string stringVec = llformat("<%g, %g, %g>", mClipboardPos.mV[VX], mClipboardPos.mV[VY], mClipboardPos.mV[VZ]); LLView::getWindow()->copyTextToClipboard(utf8str_to_wstring(stringVec)); - mHasPosClipboard = TRUE; + mHasClipboardPos = true; } void LLPanelObject::onCopySize() @@ -2082,7 +2151,7 @@ void LLPanelObject::onCopySize() std::string stringVec = llformat("<%g, %g, %g>", mClipboardSize.mV[VX], mClipboardSize.mV[VY], mClipboardSize.mV[VZ]); LLView::getWindow()->copyTextToClipboard(utf8str_to_wstring(stringVec)); - mHasSizeClipboard = TRUE; + mHasClipboardSize = true; } void LLPanelObject::onCopyRot() @@ -2092,12 +2161,12 @@ void LLPanelObject::onCopyRot() std::string stringVec = llformat("<%g, %g, %g>", mClipboardRot.mV[VX], mClipboardRot.mV[VY], mClipboardRot.mV[VZ]); LLView::getWindow()->copyTextToClipboard(utf8str_to_wstring(stringVec)); - mHasRotClipboard = TRUE; + mHasClipboardRot = true; } void LLPanelObject::onPastePos() { - if (!mHasPosClipboard) return; + if (!mHasClipboardPos) return; if (mObject.isNull()) return; LLViewerRegion* regionp = mObject->getRegion(); @@ -2122,26 +2191,118 @@ void LLPanelObject::onPastePos() void LLPanelObject::onPasteSize() { - if (!mHasSizeClipboard) return; + if (!mHasClipboardSize) return; mClipboardSize.mV[VX] = llclamp(mClipboardSize.mV[VX], MIN_PRIM_SCALE, DEFAULT_MAX_PRIM_SCALE); mClipboardSize.mV[VY] = llclamp(mClipboardSize.mV[VY], MIN_PRIM_SCALE, DEFAULT_MAX_PRIM_SCALE); mClipboardSize.mV[VZ] = llclamp(mClipboardSize.mV[VZ], MIN_PRIM_SCALE, DEFAULT_MAX_PRIM_SCALE); - mCtrlScaleX->set( mClipboardSize.mV[VX] ); - mCtrlScaleY->set( mClipboardSize.mV[VY] ); - mCtrlScaleZ->set( mClipboardSize.mV[VZ] ); + mCtrlScaleX->set(mClipboardSize.mV[VX]); + mCtrlScaleY->set(mClipboardSize.mV[VY]); + mCtrlScaleZ->set(mClipboardSize.mV[VZ]); sendScale(FALSE); } void LLPanelObject::onPasteRot() { - if (!mHasRotClipboard) return; + if (!mHasClipboardRot) return; - mCtrlRotX->set( mClipboardRot.mV[VX] ); - mCtrlRotY->set( mClipboardRot.mV[VY] ); - mCtrlRotZ->set( mClipboardRot.mV[VZ] ); + mCtrlRotX->set(mClipboardRot.mV[VX]); + mCtrlRotY->set(mClipboardRot.mV[VY]); + mCtrlRotZ->set(mClipboardRot.mV[VZ]); sendRotation(FALSE); } + +void LLPanelObject::onCopyParams() +{ + LLViewerObject* objectp = mObject; + if (!objectp) + { + return; + } + + mClipboardParams.clear(); + + // Parametrics + if (!objectp->isMesh()) + { + LLVolumeParams params; + getVolumeParams(params); + mClipboardParams["volume_params"] = params.asLLSD(); + } + + // Sculpted Prim + if (objectp->getParameterEntryInUse(LLNetworkData::PARAMS_SCULPT)) + { + LLSculptParams *sculpt_params = (LLSculptParams *)objectp->getParameterEntry(LLNetworkData::PARAMS_SCULPT); + + if (!objectp->isMesh()) + { + LLUUID texture_id = sculpt_params->getSculptTexture(); + if (get_can_copy_texture(texture_id)) + { + LL_DEBUGS("FloaterTools") << "Recording texture" << LL_ENDL; + mClipboardParams["sculpt"]["id"] = texture_id; + } + else + { + mClipboardParams["sculpt"]["id"] = LLUUID(SCULPT_DEFAULT_TEXTURE); + } + + mClipboardParams["sculpt"]["type"] = sculpt_params->getSculptType(); + } + } + + mHasClipboardParams = TRUE; +} + +void LLPanelObject::onPasteParams() +{ + LLViewerObject* objectp = mObject; + if (!objectp || !mHasClipboardParams) + { + return; + } + + // Sculpted Prim + if (mClipboardParams.has("sculpt")) + { + LLSculptParams sculpt_params; + LLUUID sculpt_id = mClipboardParams["sculpt"]["id"].asUUID(); + U8 sculpt_type = (U8)mClipboardParams["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); + } + } + + // volume params + // make sure updateVolume() won't affect flexible + if (mClipboardParams.has("volume_params")) + { + LLVolumeParams params; + params.fromLLSD(mClipboardParams["volume_params"]); + LLVOVolume *volobjp = (LLVOVolume *)objectp; + if (volobjp->isFlexible()) + { + if (params.getPathParams().getCurveType() == LL_PCODE_PATH_LINE) + { + params.getPathParams().setCurveType(LL_PCODE_PATH_FLEXIBLE); + } + } + else if (params.getPathParams().getCurveType() == LL_PCODE_PATH_FLEXIBLE) + { + params.getPathParams().setCurveType(LL_PCODE_PATH_LINE); + } + + objectp->updateVolume(params); + } +} diff --git a/indra/newview/llpanelobject.h b/indra/newview/llpanelobject.h index 764c0d8af4..5ea3d07699 100644 --- a/indra/newview/llpanelobject.h +++ b/indra/newview/llpanelobject.h @@ -73,6 +73,8 @@ public: void onPasteSize(); void onCopyRot(); void onPasteRot(); + void onCopyParams(); + void onPasteParams(); static void onCommitParametric(LLUICtrl* ctrl, void* userdata); @@ -102,6 +104,7 @@ protected: protected: // Per-object options LLComboBox* mComboBaseType; + LLMenuButton* mMenuClipboardParams; LLTextBox* mLabelCut; LLSpinCtrl* mSpinCutBegin; @@ -183,10 +186,12 @@ protected: LLVector3 mClipboardPos; LLVector3 mClipboardSize; LLVector3 mClipboardRot; + LLSD mClipboardParams; - BOOL mHasPosClipboard; - BOOL mHasSizeClipboard; - BOOL mHasRotClipboard; + bool mHasClipboardPos; + bool mHasClipboardSize; + bool mHasClipboardRot; + bool mHasClipboardParams; LLPointer mObject; LLPointer mRootObject; diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index 6a0464c657..2f5be2b32e 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -79,6 +79,61 @@ static const S32 LOCAL_TRACKING_ID_COLUMN = 1; //static const char WHITE_IMAGE_NAME[] = "Blank Texture"; //static const char NO_IMAGE_NAME[] = "None"; + + +//static +bool get_is_library_texture(LLUUID image_id) +{ + 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; + } + return false; +} + +LLUUID get_copy_free_item_by_asset_id(LLUUID image_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()) + { + for (S32 i = 0; i < items.size(); i++) + { + LLViewerInventoryItem* itemp = items[i]; + if (itemp) + { + LLPermissions item_permissions = itemp->getPermissions(); + if (item_permissions.allowOperationBy(PERM_COPY, + gAgent.getID(), + gAgent.getGroupID())) + { + return itemp->getUUID(); + } + } + } + } + return LLUUID::null; +} + +bool get_can_copy_texture(LLUUID image_id) +{ + // User is allowed to copy a texture if: + // library asset or default texture, + // or copy perm asset exists in user's inventory + + return get_is_library_texture(image_id) || get_copy_free_item_by_asset_id(image_id).notNull(); +} + LLFloaterTexturePicker::LLFloaterTexturePicker( LLView* owner, LLUUID image_asset_id, diff --git a/indra/newview/lltexturectrl.h b/indra/newview/lltexturectrl.h index b2a34a37c4..2b2c5fa237 100644 --- a/indra/newview/lltexturectrl.h +++ b/indra/newview/lltexturectrl.h @@ -53,6 +53,16 @@ class LLViewerFetchedTexture; typedef boost::function drag_n_drop_callback; typedef boost::function texture_selected_callback; +// Helper functions for UI that work with picker +bool get_is_library_texture(LLUUID image_id); + +// texture picker works by asset ids since objects normaly do +// not retain inventory ids as result these functions are looking +// for textures in inventory by asset ids +// This search can be performance unfriendly and doesn't warranty +// that the texture is original source of asset +LLUUID get_copy_free_item_by_asset_id(LLUUID image_id); +bool get_can_copy_texture(LLUUID image_id); ////////////////////////////////////////////////////////////////////////////////////////// // LLTextureCtrl diff --git a/indra/newview/skins/default/textures/icons/ClipboardMenu_Disabled.png b/indra/newview/skins/default/textures/icons/ClipboardMenu_Disabled.png new file mode 100644 index 0000000000..9a81c5f94b Binary files /dev/null and b/indra/newview/skins/default/textures/icons/ClipboardMenu_Disabled.png differ diff --git a/indra/newview/skins/default/textures/icons/ClipboardMenu_Off.png b/indra/newview/skins/default/textures/icons/ClipboardMenu_Off.png new file mode 100644 index 0000000000..88012cf8d1 Binary files /dev/null and b/indra/newview/skins/default/textures/icons/ClipboardMenu_Off.png differ diff --git a/indra/newview/skins/default/textures/icons/ClipboardMenu_Press.png b/indra/newview/skins/default/textures/icons/ClipboardMenu_Press.png new file mode 100644 index 0000000000..ab02e7d42d Binary files /dev/null and b/indra/newview/skins/default/textures/icons/ClipboardMenu_Press.png differ diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index b7fa1e72f8..473b074213 100644 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -441,6 +441,9 @@ with the same filename but different name + + + diff --git a/indra/newview/skins/default/xui/en/floater_tools.xml b/indra/newview/skins/default/xui/en/floater_tools.xml index afc6155585..0b2b1abeb9 100644 --- a/indra/newview/skins/default/xui/en/floater_tools.xml +++ b/indra/newview/skins/default/xui/en/floater_tools.xml @@ -1436,7 +1436,7 @@ even though the user gets a free copy. height="0" layout="topleft" left_delta="0" - name="lod_tab_border" + name="object_horizontal" top_pad="10" width="95" /> Prim Type --> + + + width="125"> + Path Cut (begin/end) diff --git a/indra/newview/skins/default/xui/en/menu_copy_paste_generic.xml b/indra/newview/skins/default/xui/en/menu_copy_paste_generic.xml new file mode 100644 index 0000000000..8e016e4a1c --- /dev/null +++ b/indra/newview/skins/default/xui/en/menu_copy_paste_generic.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + diff --git a/indra/newview/skins/default/xui/en/menu_copy_paste_pos.xml b/indra/newview/skins/default/xui/en/menu_copy_paste_pos.xml index c2763af603..3ea95b281f 100644 --- a/indra/newview/skins/default/xui/en/menu_copy_paste_pos.xml +++ b/indra/newview/skins/default/xui/en/menu_copy_paste_pos.xml @@ -3,19 +3,35 @@ layout="topleft" name="Copy Paste Position Menu"> + + + + - + + + + + - - + + diff --git a/indra/newview/skins/default/xui/en/menu_copy_paste_rot.xml b/indra/newview/skins/default/xui/en/menu_copy_paste_rot.xml index dcfb3faeca..06ce80f897 100644 --- a/indra/newview/skins/default/xui/en/menu_copy_paste_rot.xml +++ b/indra/newview/skins/default/xui/en/menu_copy_paste_rot.xml @@ -3,19 +3,35 @@ layout="topleft" name="Copy Paste Rotation Menu"> + + + + - + + + + + - - + + diff --git a/indra/newview/skins/default/xui/en/menu_copy_paste_size.xml b/indra/newview/skins/default/xui/en/menu_copy_paste_size.xml index 58d71b12d5..7082a0e65b 100644 --- a/indra/newview/skins/default/xui/en/menu_copy_paste_size.xml +++ b/indra/newview/skins/default/xui/en/menu_copy_paste_size.xml @@ -3,19 +3,35 @@ layout="topleft" name="Copy Paste Size Menu"> + + + + - + + + + + - - + + -- cgit v1.3 From d95f86c5931db5b025e0923071c9b3a08bb25301 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 18 Jun 2020 22:38:58 +0300 Subject: SL-13359 #7 Features tab --- indra/newview/llpanelobject.cpp | 43 ++- indra/newview/llpanelobject.h | 1 - indra/newview/llpanelvolume.cpp | 297 ++++++++++++++++++++- indra/newview/llpanelvolume.h | 13 + .../newview/skins/default/xui/en/floater_tools.xml | 43 ++- .../default/xui/en/menu_copy_paste_features.xml | 21 ++ .../default/xui/en/menu_copy_paste_generic.xml | 21 -- .../skins/default/xui/en/menu_copy_paste_light.xml | 21 ++ .../default/xui/en/menu_copy_paste_object.xml | 21 ++ 9 files changed, 428 insertions(+), 53 deletions(-) create mode 100644 indra/newview/skins/default/xui/en/menu_copy_paste_features.xml delete mode 100644 indra/newview/skins/default/xui/en/menu_copy_paste_generic.xml create mode 100644 indra/newview/skins/default/xui/en/menu_copy_paste_light.xml create mode 100644 indra/newview/skins/default/xui/en/menu_copy_paste_object.xml (limited to 'indra/newview/llpanelobject.cpp') diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp index f1426ddf33..9bdc68b86a 100644 --- a/indra/newview/llpanelobject.cpp +++ b/indra/newview/llpanelobject.cpp @@ -159,7 +159,7 @@ BOOL LLPanelObject::postBuild() mComboBaseType = getChild("comboBaseType"); childSetCommitCallback("comboBaseType",onCommitParametric,this); - mMenuClipboardParams = getChild("clipboard_params_btn"); + mMenuClipboardParams = getChild("clipboard_obj_params_btn"); // Cut mLabelCut = getChild("text cut"); @@ -294,7 +294,6 @@ LLPanelObject::LLPanelObject() mHasClipboardPos(false), mHasClipboardSize(false), mHasClipboardRot(false), - mHasClipboardParams(false), mSizeChanged(FALSE) { mCommitCallbackRegistrar.add("PanelObject.menuDoToSelected", boost::bind(&LLPanelObject::menuDoToSelected, this, _2)); @@ -2109,7 +2108,7 @@ bool LLPanelObject::menuEnableItem(const LLSD& userdata) } else if (command == "params_paste") { - return mHasClipboardParams; + return mClipboardParams.isMap() && !mClipboardParams.emptyMap(); } // copy options else if (command == "psr_copy") @@ -2218,7 +2217,7 @@ void LLPanelObject::onPasteRot() void LLPanelObject::onCopyParams() { LLViewerObject* objectp = mObject; - if (!objectp) + if (!objectp || objectp->isMesh()) { return; } @@ -2226,42 +2225,34 @@ void LLPanelObject::onCopyParams() mClipboardParams.clear(); // Parametrics - if (!objectp->isMesh()) - { - LLVolumeParams params; - getVolumeParams(params); - mClipboardParams["volume_params"] = params.asLLSD(); - } + LLVolumeParams params; + getVolumeParams(params); + mClipboardParams["volume_params"] = params.asLLSD(); // Sculpted Prim if (objectp->getParameterEntryInUse(LLNetworkData::PARAMS_SCULPT)) { LLSculptParams *sculpt_params = (LLSculptParams *)objectp->getParameterEntry(LLNetworkData::PARAMS_SCULPT); - if (!objectp->isMesh()) + LLUUID texture_id = sculpt_params->getSculptTexture(); + if (get_can_copy_texture(texture_id)) { - LLUUID texture_id = sculpt_params->getSculptTexture(); - if (get_can_copy_texture(texture_id)) - { - LL_DEBUGS("FloaterTools") << "Recording texture" << LL_ENDL; - mClipboardParams["sculpt"]["id"] = texture_id; - } - else - { - mClipboardParams["sculpt"]["id"] = LLUUID(SCULPT_DEFAULT_TEXTURE); - } - - mClipboardParams["sculpt"]["type"] = sculpt_params->getSculptType(); + LL_DEBUGS("FloaterTools") << "Recording texture" << LL_ENDL; + mClipboardParams["sculpt"]["id"] = texture_id; + } + else + { + mClipboardParams["sculpt"]["id"] = LLUUID(SCULPT_DEFAULT_TEXTURE); } - } - mHasClipboardParams = TRUE; + mClipboardParams["sculpt"]["type"] = sculpt_params->getSculptType(); + } } void LLPanelObject::onPasteParams() { LLViewerObject* objectp = mObject; - if (!objectp || !mHasClipboardParams) + if (!objectp) { return; } diff --git a/indra/newview/llpanelobject.h b/indra/newview/llpanelobject.h index 5ea3d07699..515dd27c0a 100644 --- a/indra/newview/llpanelobject.h +++ b/indra/newview/llpanelobject.h @@ -191,7 +191,6 @@ protected: bool mHasClipboardPos; bool mHasClipboardSize; bool mHasClipboardRot; - bool mHasClipboardParams; LLPointer mObject; LLPointer mRootObject; diff --git a/indra/newview/llpanelvolume.cpp b/indra/newview/llpanelvolume.cpp index 05d9346f89..a03e85daff 100644 --- a/indra/newview/llpanelvolume.cpp +++ b/indra/newview/llpanelvolume.cpp @@ -50,6 +50,7 @@ //#include "llfirstuse.h" #include "llfocusmgr.h" #include "llmanipscale.h" +#include "llmenubutton.h" #include "llpreviewscript.h" #include "llresmgr.h" #include "llselectmgr.h" @@ -166,6 +167,9 @@ BOOL LLPanelVolume::postBuild() mSpinPhysicsRestitution->setCommitCallback(boost::bind(&LLPanelVolume::sendPhysicsRestitution, this, _1, mSpinPhysicsRestitution)); } + mMenuClipboardFeatures = getChild("clipboard_features_params_btn"); + mMenuClipboardLight = getChild("clipboard_light_params_btn"); + std::map material_name_map; material_name_map["Stone"]= LLTrans::getString("Stone"); material_name_map["Metal"]= LLTrans::getString("Metal"); @@ -206,6 +210,8 @@ LLPanelVolume::LLPanelVolume() { setMouseOpaque(FALSE); + mCommitCallbackRegistrar.add("PanelVolume.menuDoToSelected", boost::bind(&LLPanelVolume::menuDoToSelected, this, _2)); + mEnableCallbackRegistrar.add("PanelVolume.menuEnable", boost::bind(&LLPanelVolume::menuEnableItem, this, _2)); } @@ -407,7 +413,6 @@ void LLPanelVolume::getState( ) gAgentAvatarp->updateMeshVisibility(); } } - // Flexible properties BOOL is_flexible = volobjp && volobjp->isFlexible(); @@ -562,6 +567,9 @@ void LLPanelVolume::getState( ) mObject = objectp; mRootObject = root_objectp; + + mMenuClipboardFeatures->setEnabled(editable && single_volume && volobjp); // Note: physics doesn't need to be limited by single volume + mMenuClipboardLight->setEnabled(editable && single_volume && volobjp); } // static @@ -662,6 +670,9 @@ void LLPanelVolume::clearCtrls() mSpinPhysicsRestitution->setEnabled(FALSE); mComboMaterial->setEnabled( FALSE ); + + mMenuClipboardFeatures->setEnabled(false); + mMenuClipboardLight->setEnabled(false); } // @@ -829,6 +840,290 @@ void LLPanelVolume::onLightSelectTexture(const LLSD& data) } } +void LLPanelVolume::onCopyFeatures() +{ + LLViewerObject* objectp = mObject; + if (!objectp) + { + return; + } + + LLSD clipboard; + + LLVOVolume *volobjp = NULL; + if (objectp && (objectp->getPCode() == LL_PCODE_VOLUME)) + { + volobjp = (LLVOVolume *)objectp; + } + + // Flexi Prim + if (volobjp && volobjp->isFlexible()) + { + LLFlexibleObjectData *attributes = (LLFlexibleObjectData *)objectp->getParameterEntry(LLNetworkData::PARAMS_FLEXIBLE); + if (attributes) + { + clipboard["flex"]["lod"] = attributes->getSimulateLOD(); + clipboard["flex"]["gav"] = attributes->getGravity(); + clipboard["flex"]["ten"] = attributes->getTension(); + clipboard["flex"]["fri"] = attributes->getAirFriction(); + clipboard["flex"]["sen"] = attributes->getWindSensitivity(); + LLVector3 force = attributes->getUserForce(); + clipboard["flex"]["forx"] = force.mV[0]; + clipboard["flex"]["fory"] = force.mV[1]; + clipboard["flex"]["forz"] = force.mV[2]; + } + } + + // Physics + { + clipboard["physics"]["shape"] = objectp->getPhysicsShapeType(); + clipboard["physics"]["gravity"] = objectp->getPhysicsGravity(); + clipboard["physics"]["friction"] = objectp->getPhysicsFriction(); + clipboard["physics"]["density"] = objectp->getPhysicsDensity(); + clipboard["physics"]["restitution"] = objectp->getPhysicsRestitution(); + + U8 material_code = 0; + struct f : public LLSelectedTEGetFunctor + { + U8 get(LLViewerObject* object, S32 te) + { + return object->getMaterial(); + } + } func; + bool material_same = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue(&func, material_code); + // This should always be true since material should be per object. + if (material_same) + { + clipboard["physics"]["material"] = material_code; + } + } + + mClipboardParams["features"] = clipboard; +} + +void LLPanelVolume::onPasteFeatures() +{ + LLViewerObject* objectp = mObject; + if (!objectp && mClipboardParams.has("features")) + { + return; + } + + LLSD &clipboard = mClipboardParams["features"]; + + LLVOVolume *volobjp = NULL; + if (objectp && (objectp->getPCode() == LL_PCODE_VOLUME)) + { + volobjp = (LLVOVolume *)objectp; + } + + // Physics + bool is_root = objectp->isRoot(); + + // Not sure if phantom should go under physics, but doesn't fit elsewhere + BOOL is_phantom = clipboard["is_phantom"].asBoolean() && is_root; + LLSelectMgr::getInstance()->selectionUpdatePhantom(is_phantom); + + BOOL is_physical = clipboard["is_physical"].asBoolean() && is_root; + LLSelectMgr::getInstance()->selectionUpdatePhysics(is_physical); + + if (clipboard.has("physics")) + { + objectp->setPhysicsShapeType((U8)clipboard["physics"]["shape"].asInteger()); + U8 cur_material = objectp->getMaterial(); + U8 material = (U8)clipboard["physics"]["material"].asInteger() | (cur_material & ~LL_MCODE_MASK); + + objectp->setMaterial(material); + objectp->sendMaterialUpdate(); + objectp->setPhysicsGravity(clipboard["physics"]["gravity"].asReal()); + objectp->setPhysicsFriction(clipboard["physics"]["friction"].asReal()); + objectp->setPhysicsDensity(clipboard["physics"]["density"].asReal()); + objectp->setPhysicsRestitution(clipboard["physics"]["restitution"].asReal()); + objectp->updateFlags(TRUE); + } + + // Flexible + bool is_flexible = clipboard.has("flex"); + if (is_flexible && volobjp->canBeFlexible()) + { + LLVOVolume *volobjp = (LLVOVolume *)objectp; + BOOL update_shape = FALSE; + + // do before setParameterEntry or it will think that it is already flexi + update_shape = volobjp->setIsFlexible(is_flexible); + + 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(clipboard["flex"]["lod"].asInteger()); + new_attributes.setGravity(clipboard["flex"]["gav"].asReal()); + new_attributes.setTension(clipboard["flex"]["ten"].asReal()); + new_attributes.setAirFriction(clipboard["flex"]["fri"].asReal()); + new_attributes.setWindSensitivity(clipboard["flex"]["sen"].asReal()); + F32 fx = (F32)clipboard["flex"]["forx"].asReal(); + F32 fy = (F32)clipboard["flex"]["fory"].asReal(); + F32 fz = (F32)clipboard["flex"]["forz"].asReal(); + LLVector3 force(fx, fy, fz); + new_attributes.setUserForce(force); + objectp->setParameterEntry(LLNetworkData::PARAMS_FLEXIBLE, new_attributes, true); + } + + if (update_shape) + { + mObject->sendShapeUpdate(); + LLSelectMgr::getInstance()->selectionUpdatePhantom(volobjp->flagPhantom()); + } + } + else + { + LLVOVolume *volobjp = (LLVOVolume *)objectp; + if (volobjp->setIsFlexible(is_flexible)) + { + mObject->sendShapeUpdate(); + LLSelectMgr::getInstance()->selectionUpdatePhantom(volobjp->flagPhantom()); + } + } +} + +void LLPanelVolume::onCopyLight() +{ + LLViewerObject* objectp = mObject; + if (!objectp) + { + return; + } + + LLSD clipboard; + + LLVOVolume *volobjp = NULL; + if (objectp && (objectp->getPCode() == LL_PCODE_VOLUME)) + { + volobjp = (LLVOVolume *)objectp; + } + + // Light Source + if (volobjp && volobjp->getIsLight()) + { + clipboard["light"]["intensity"] = volobjp->getLightIntensity(); + clipboard["light"]["radius"] = volobjp->getLightRadius(); + clipboard["light"]["falloff"] = volobjp->getLightFalloff(); + LLColor3 color = volobjp->getLightSRGBColor(); + clipboard["light"]["r"] = color.mV[0]; + clipboard["light"]["g"] = color.mV[1]; + clipboard["light"]["b"] = color.mV[2]; + + // Spotlight + if (volobjp->isLightSpotlight()) + { + LLUUID id = volobjp->getLightTextureID(); + if (id.notNull() && get_can_copy_texture(id)) + { + clipboard["spot"]["id"] = id; + LLVector3 spot_params = volobjp->getSpotLightParams(); + clipboard["spot"]["fov"] = spot_params.mV[0]; + clipboard["spot"]["focus"] = spot_params.mV[1]; + clipboard["spot"]["ambiance"] = spot_params.mV[2]; + } + } + } + + mClipboardParams["light"] = clipboard; +} + +void LLPanelVolume::onPasteLight() +{ + LLViewerObject* objectp = mObject; + if (!objectp && mClipboardParams.has("light")) + { + return; + } + + LLSD &clipboard = mClipboardParams["light"]; + + LLVOVolume *volobjp = NULL; + if (objectp && (objectp->getPCode() == LL_PCODE_VOLUME)) + { + volobjp = (LLVOVolume *)objectp; + } + + // Light Source + if (volobjp) + { + if (clipboard.has("light")) + { + volobjp->setIsLight(TRUE); + volobjp->setLightIntensity((F32)clipboard["light"]["intensity"].asReal()); + volobjp->setLightRadius((F32)clipboard["light"]["radius"].asReal()); + volobjp->setLightFalloff((F32)clipboard["light"]["falloff"].asReal()); + F32 r = (F32)clipboard["light"]["r"].asReal(); + F32 g = (F32)clipboard["light"]["g"].asReal(); + F32 b = (F32)clipboard["light"]["b"].asReal(); + volobjp->setLightSRGBColor(LLColor3(r, g, b)); + } + else + { + volobjp->setIsLight(FALSE); + } + + if (clipboard.has("spot")) + { + volobjp->setLightTextureID(clipboard["spot"]["id"].asUUID()); + LLVector3 spot_params; + spot_params.mV[0] = (F32)clipboard["spot"]["fov"].asReal(); + spot_params.mV[1] = (F32)clipboard["spot"]["focus"].asReal(); + spot_params.mV[2] = (F32)clipboard["spot"]["ambiance"].asReal(); + volobjp->setSpotLightParams(spot_params); + } + } +} + +void LLPanelVolume::menuDoToSelected(const LLSD& userdata) +{ + std::string command = userdata.asString(); + + // paste + if (command == "features_paste") + { + onPasteFeatures(); + } + else if (command == "light_paste") + { + onPasteLight(); + } + // copy + else if (command == "features_copy") + { + onCopyFeatures(); + } + else if (command == "light_copy") + { + onCopyLight(); + } +} + +bool LLPanelVolume::menuEnableItem(const LLSD& userdata) +{ + std::string command = userdata.asString(); + + // paste options + if (command == "features_paste") + { + return mClipboardParams.has("features"); + } + else if (command == "light_paste") + { + return mClipboardParams.has("light"); + } + return false; +} + // static void LLPanelVolume::onCommitMaterial( LLUICtrl* ctrl, void* userdata ) { diff --git a/indra/newview/llpanelvolume.h b/indra/newview/llpanelvolume.h index 66117316cf..1651108093 100644 --- a/indra/newview/llpanelvolume.h +++ b/indra/newview/llpanelvolume.h @@ -37,6 +37,7 @@ class LLCheckBoxCtrl; class LLTextBox; class LLUICtrl; class LLButton; +class LLMenuButton; class LLViewerObject; class LLComboBox; class LLColorSwatchCtrl; @@ -73,6 +74,13 @@ public: void onLightCancelTexture(const LLSD& data); void onLightSelectTexture(const LLSD& data); + void onCopyFeatures(); + void onPasteFeatures(); + void onCopyLight(); + void onPasteLight(); + + void menuDoToSelected(const LLSD& userdata); + bool menuEnableItem(const LLSD& userdata); protected: void getState(); @@ -120,6 +128,11 @@ protected: LLSpinCtrl* mSpinPhysicsFriction; LLSpinCtrl* mSpinPhysicsDensity; LLSpinCtrl* mSpinPhysicsRestitution; + + LLMenuButton* mMenuClipboardFeatures; + LLMenuButton* mMenuClipboardLight; + + LLSD mClipboardParams; }; #endif diff --git a/indra/newview/skins/default/xui/en/floater_tools.xml b/indra/newview/skins/default/xui/en/floater_tools.xml index d93ce2af1c..6e08be4866 100644 --- a/indra/newview/skins/default/xui/en/floater_tools.xml +++ b/indra/newview/skins/default/xui/en/floater_tools.xml @@ -1717,7 +1717,7 @@ even though the user gets a free copy. value="Sculpted" /> None Prim Convex Hull + + + + + + + + + + + + + diff --git a/indra/newview/skins/default/xui/en/menu_copy_paste_generic.xml b/indra/newview/skins/default/xui/en/menu_copy_paste_generic.xml deleted file mode 100644 index 8e016e4a1c..0000000000 --- a/indra/newview/skins/default/xui/en/menu_copy_paste_generic.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - diff --git a/indra/newview/skins/default/xui/en/menu_copy_paste_light.xml b/indra/newview/skins/default/xui/en/menu_copy_paste_light.xml new file mode 100644 index 0000000000..941efe7d01 --- /dev/null +++ b/indra/newview/skins/default/xui/en/menu_copy_paste_light.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + diff --git a/indra/newview/skins/default/xui/en/menu_copy_paste_object.xml b/indra/newview/skins/default/xui/en/menu_copy_paste_object.xml new file mode 100644 index 0000000000..8e016e4a1c --- /dev/null +++ b/indra/newview/skins/default/xui/en/menu_copy_paste_object.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + -- cgit v1.3 From 48d2836ce6277f41c172ae5b68f2cb8845df7ad1 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 20 May 2022 23:19:26 +0300 Subject: SL-17436 Tools floater drops negative Z position for attachments --- indra/newview/llpanelobject.cpp | 10 +++++----- indra/newview/skins/default/xui/en/floater_tools.xml | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'indra/newview/llpanelobject.cpp') diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp index 3e6697b3c1..1fd1784d4b 100644 --- a/indra/newview/llpanelobject.cpp +++ b/indra/newview/llpanelobject.cpp @@ -1661,13 +1661,13 @@ void LLPanelObject::sendPosition(BOOL btn_down) if (!regionp) return; - // Clamp the Z height - const F32 height = newpos.mV[VZ]; - const F32 min_height = LLWorld::getInstance()->getMinAllowedZ(mObject, mObject->getPositionGlobal()); - const F32 max_height = LLWorld::getInstance()->getRegionMaxHeight(); - if (!mObject->isAttachment()) { + // Clamp the Z height + const F32 height = newpos.mV[VZ]; + const F32 min_height = LLWorld::getInstance()->getMinAllowedZ(mObject, mObject->getPositionGlobal()); + const F32 max_height = LLWorld::getInstance()->getRegionMaxHeight(); + if ( height < min_height) { newpos.mV[VZ] = min_height; diff --git a/indra/newview/skins/default/xui/en/floater_tools.xml b/indra/newview/skins/default/xui/en/floater_tools.xml index f5214420b4..ade79b8884 100644 --- a/indra/newview/skins/default/xui/en/floater_tools.xml +++ b/indra/newview/skins/default/xui/en/floater_tools.xml @@ -1505,6 +1505,7 @@ even though the user gets a free copy. layout="topleft" left_delta="0" max_val="4096" + min_val="-32" name="Pos Z" text_enabled_color="0 0.8 1 .65" top_pad="3" -- cgit v1.3