From aec6caf5eb89d8cc5ce37a8d59d2a57a3e745320 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Fri, 8 Nov 2019 21:11:48 +0200 Subject: [PATCH] SL-12241 Separated 'flexible' paramenters --- indra/newview/llpanelobject.cpp | 111 +++++++++++++----- indra/newview/llpanelobject.h | 1 + .../skins/default/xui/en/menu_build_paste.xml | 8 ++ 3 files changed, 92 insertions(+), 28 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,6 +2331,75 @@ void LLPanelObject::onPasteParams() } } + 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) { @@ -2351,33 +2421,6 @@ void LLPanelObject::onPasteParams() } } - // 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); } } @@ -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 @@ + + + + +