From aec6caf5eb89d8cc5ce37a8d59d2a57a3e745320 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Fri, 8 Nov 2019 21:11:48 +0200 Subject: SL-12241 Separated 'flexible' paramenters --- indra/newview/llpanelobject.cpp | 97 +++++++++++++++++----- indra/newview/llpanelobject.h | 1 + .../skins/default/xui/en/menu_build_paste.xml | 8 ++ 3 files changed, 85 insertions(+), 21 deletions(-) diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp index 8a5034db85..872b71268d 100644 --- a/indra/newview/llpanelobject.cpp +++ b/indra/newview/llpanelobject.cpp @@ -321,6 +321,7 @@ LLPanelObject::LLPanelObject() mHasSizeClipboard(FALSE), mHasRotClipboard(FALSE), mPasteParametric(TRUE), + mPasteFlexible(TRUE), mPastePhysics(TRUE), mPasteLight(TRUE) { @@ -2330,30 +2331,19 @@ void LLPanelObject::onPasteParams() } } - // Parametrics - if(mPasteParametric) + if (mPasteFlexible) { - // Sculpted Prim - if (mParamsClipboard.has("sculpt")) - { - LLSculptParams sculpt_params; - LLUUID sculpt_id = mParamsClipboard["sculpt"]["id"].asUUID(); - U8 sculpt_type = (U8)mParamsClipboard["sculpt"]["type"].asInteger(); - sculpt_params.setSculptTexture(sculpt_id, sculpt_type); - objectp->setParameterEntry(LLNetworkData::PARAMS_SCULPT, sculpt_params, TRUE); - } - else + bool is_flexible = mParamsClipboard.has("flex"); + if (is_flexible) { - LLSculptParams *sculpt_params = (LLSculptParams *)objectp->getParameterEntry(LLNetworkData::PARAMS_SCULPT); - if (sculpt_params) + LLVOVolume *volobjp = (LLVOVolume *)objectp; + BOOL update_shape = FALSE; + if (!mPasteParametric) { - objectp->setParameterEntryInUse(LLNetworkData::PARAMS_SCULPT, FALSE, TRUE); + // do before setParameterEntry or it will think that it is already flexi + update_shape = volobjp->setIsFlexible(is_flexible); } - } - // Flexi Params - if (mParamsClipboard.has("flex")) - { if (objectp->getClickAction() == CLICK_ACTION_SIT) { objectp->setClickAction(CLICK_ACTION_NONE); @@ -2372,10 +2362,63 @@ void LLPanelObject::onPasteParams() F32 fx = (F32)mParamsClipboard["flex"]["forx"].asReal(); F32 fy = (F32)mParamsClipboard["flex"]["fory"].asReal(); F32 fz = (F32)mParamsClipboard["flex"]["forz"].asReal(); - LLVector3 force(fx,fy,fz); + LLVector3 force(fx, fy, fz); new_attributes.setUserForce(force); objectp->setParameterEntry(LLNetworkData::PARAMS_FLEXIBLE, new_attributes, true); } + + if (!mPasteParametric && update_shape) + { + mObject->sendShapeUpdate(); + LLSelectMgr::getInstance()->selectionUpdatePhantom(volobjp->flagPhantom()); + } + } + else if (!mPasteParametric) + { + LLVOVolume *volobjp = (LLVOVolume *)objectp; + if (volobjp->setIsFlexible(is_flexible)) + { + mObject->sendShapeUpdate(); + LLSelectMgr::getInstance()->selectionUpdatePhantom(volobjp->flagPhantom()); + } + } + } + // Parametric does updateVolume(), make sure we won't affect flexible + else if (mPasteParametric) + { + LLVOVolume *volobjp = (LLVOVolume *)objectp; + if (volobjp->isFlexible()) + { + if (mClipboardVolumeParams.getPathParams().getCurveType() == LL_PCODE_PATH_LINE) + { + mClipboardVolumeParams.getPathParams().setCurveType(LL_PCODE_PATH_FLEXIBLE); + } + } + else if (mClipboardVolumeParams.getPathParams().getCurveType() == LL_PCODE_PATH_FLEXIBLE) + { + mClipboardVolumeParams.getPathParams().setCurveType(LL_PCODE_PATH_LINE); + } + } + + // Parametrics + if(mPasteParametric) + { + // Sculpted Prim + if (mParamsClipboard.has("sculpt")) + { + LLSculptParams sculpt_params; + LLUUID sculpt_id = mParamsClipboard["sculpt"]["id"].asUUID(); + U8 sculpt_type = (U8)mParamsClipboard["sculpt"]["type"].asInteger(); + sculpt_params.setSculptTexture(sculpt_id, sculpt_type); + objectp->setParameterEntry(LLNetworkData::PARAMS_SCULPT, sculpt_params, TRUE); + } + else + { + LLSculptParams *sculpt_params = (LLSculptParams *)objectp->getParameterEntry(LLNetworkData::PARAMS_SCULPT); + if (sculpt_params) + { + objectp->setParameterEntryInUse(LLNetworkData::PARAMS_SCULPT, FALSE, TRUE); + } } objectp->updateVolume(mClipboardVolumeParams); @@ -2390,6 +2433,10 @@ bool LLPanelObject::pasteCheckMenuItem(const LLSD& userdata) { return mPasteParametric; } + if ("Flexible" == command) + { + return mPasteFlexible; + } if ("Physics" == command) { return mPastePhysics; @@ -2410,6 +2457,10 @@ void LLPanelObject::pasteDoMenuItem(const LLSD& userdata) { mPasteParametric = !mPasteParametric; } + if ("Flexible" == command) + { + mPasteFlexible = !mPasteFlexible; + } if ("Physics" == command) { mPastePhysics = !mPastePhysics; @@ -2425,12 +2476,16 @@ bool LLPanelObject::pasteEnabletMenuItem(const LLSD& userdata) std::string command = userdata.asString(); // Keep at least one option enabled - if (mPasteParametric + mPastePhysics + mPasteLight == 1) + if (mPasteParametric + mPasteFlexible + mPastePhysics + mPasteLight == 1) { if ("Parametric" == command && mPasteParametric) { return false; } + if ("Flexible" == command && mPasteFlexible) + { + return false; + } if ("Physics" == command && mPastePhysics) { return false; diff --git a/indra/newview/llpanelobject.h b/indra/newview/llpanelobject.h index 7161f51c73..0c37e837ad 100644 --- a/indra/newview/llpanelobject.h +++ b/indra/newview/llpanelobject.h @@ -205,6 +205,7 @@ protected: BOOL mHasParamsClipboard; BOOL mPasteParametric; + BOOL mPasteFlexible; BOOL mPastePhysics; BOOL mPasteLight; diff --git a/indra/newview/skins/default/xui/en/menu_build_paste.xml b/indra/newview/skins/default/xui/en/menu_build_paste.xml index f63362dabf..acbef528b8 100644 --- a/indra/newview/skins/default/xui/en/menu_build_paste.xml +++ b/indra/newview/skins/default/xui/en/menu_build_paste.xml @@ -10,6 +10,14 @@ + + + + +