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.2.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 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 232 insertions(+), 1 deletion(-) (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); + } +} -- cgit v1.2.3 From c45eff54cbf4a273f57ec62a23dd33c93fbb0c94 Mon Sep 17 00:00:00 2001 From: Kadah_Coba 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.2.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 ++++++++++++++++++++++++---------------- 1 file changed, 260 insertions(+), 171 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; } -- cgit v1.2.3 From 43bf63efd0b0a1e8705ce25115eac00c3a34230b Mon Sep 17 00:00:00 2001 From: Kadah_Coba Date: Wed, 17 Apr 2019 02:41:33 -0700 Subject: Added translation support for build tools paste buttons tooltips --- indra/newview/llpanelobject.cpp | 65 ++++++++++++++++------------------------- 1 file changed, 25 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; } -- cgit v1.2.3 From 733f799c4359d32778b5f345ae434152467334bc Mon Sep 17 00:00:00 2001 From: Kadah_Coba Date: Fri, 6 Sep 2019 20:46:23 -0700 Subject: Cleanup object copy/paste functions --- indra/newview/llpanelobject.cpp | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 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 -- cgit v1.2.3 From 379b480f0e9d6947f0da8f15dbcb7e7010f0509a Mon Sep 17 00:00:00 2001 From: maxim_productengine 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.2.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.2.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.2.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.2.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.2.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 ++++++++++++++++++++++++++++++++--------- 1 file changed, 76 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; -- cgit v1.2.3 From f67a88314ba957827bdeab9567e01ef6d55c233e Mon Sep 17 00:00:00 2001 From: maxim_productengine 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.2.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/llpanelobject.cpp | 42 ++++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 17 deletions(-) (limited to 'indra/newview/llpanelobject.cpp') 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(); } -- cgit v1.2.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/llpanelobject.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llpanelobject.cpp') 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.2.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/llpanelobject.cpp | 479 +--------------------------------------- 1 file changed, 1 insertion(+), 478 deletions(-) (limited to 'indra/newview/llpanelobject.cpp') 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(); -} -- cgit v1.2.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 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 74 insertions(+), 8 deletions(-) (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] ); -- cgit v1.2.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 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (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 ); -- cgit v1.2.3 From 1310fac3b10b3927cb502008c156c16631b97663 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 17 Jun 2020 23:38:55 +0300 Subject: SL-13359 #5 Implemented revised changes --- indra/newview/llpanelobject.cpp | 219 ++++++++++++++++++++++++++++++++++------ 1 file changed, 190 insertions(+), 29 deletions(-) (limited to 'indra/newview/llpanelobject.cpp') 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); + } +} -- cgit v1.2.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 ++++++++++++++++------------------------- 1 file changed, 17 insertions(+), 26 deletions(-) (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; } -- cgit v1.2.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 +++++----- 1 file changed, 5 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; -- cgit v1.2.3