From 7691780825940364e3faa7a682490f51491d44dc Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 25 May 2017 11:11:02 +0100 Subject: SL-694 - Added extra param field for flags related to extended mesh functionality. Currently this is just one bit to flag an object as able to animate --- indra/llprimitive/llprimitive.cpp | 65 ++++++++++++++++++++++ indra/llprimitive/llprimitive.h | 22 ++++++++ indra/newview/llpanelvolume.cpp | 37 +++++++++++- indra/newview/llpanelvolume.h | 1 + indra/newview/llviewerobject.cpp | 5 ++ indra/newview/llvovolume.cpp | 53 ++++++++++++++++++ indra/newview/llvovolume.h | 7 +++ .../newview/skins/default/xui/en/floater_tools.xml | 18 ++++-- 8 files changed, 203 insertions(+), 5 deletions(-) (limited to 'indra') diff --git a/indra/llprimitive/llprimitive.cpp b/indra/llprimitive/llprimitive.cpp index bfa65666b5..54b87fec78 100644 --- a/indra/llprimitive/llprimitive.cpp +++ b/indra/llprimitive/llprimitive.cpp @@ -1599,6 +1599,8 @@ BOOL LLNetworkData::isValid(U16 param_type, U32 size) return (size == 17); case PARAMS_LIGHT_IMAGE: return (size == 28); + case PARAMS_EXTENDED_MESH: + return (size == 4); } return FALSE; @@ -2026,3 +2028,66 @@ bool LLLightImageParams::fromLLSD(LLSD& sd) return false; } + +//============================================================================ + +LLExtendedMeshParams::LLExtendedMeshParams() +{ + mFlags = 0; +} + +BOOL LLExtendedMeshParams::pack(LLDataPacker &dp) const +{ + dp.packU32(mFlags, "flags"); + + return TRUE; +} + +BOOL LLExtendedMeshParams::unpack(LLDataPacker &dp) +{ + dp.unpackU32(mFlags, "flags"); + + return TRUE; +} + +bool LLExtendedMeshParams::operator==(const LLNetworkData& data) const +{ + if (data.mType != PARAMS_EXTENDED_MESH) + { + return false; + } + + const LLExtendedMeshParams *param = (const LLExtendedMeshParams*)&data; + if ( (param->mFlags != mFlags) ) + { + return false; + } + + return true; +} + +void LLExtendedMeshParams::copy(const LLNetworkData& data) +{ + const LLExtendedMeshParams *param = (LLExtendedMeshParams*)&data; + mFlags = param->mFlags; +} + +LLSD LLExtendedMeshParams::asLLSD() const +{ + LLSD sd; + + sd["flags"] = LLSD::Integer(mFlags); + + return sd; +} + +bool LLExtendedMeshParams::fromLLSD(LLSD& sd) +{ + if (sd.has("flags")) + { + setFlags( sd["flags"].asInteger()); + return true; + } + + return false; +} diff --git a/indra/llprimitive/llprimitive.h b/indra/llprimitive/llprimitive.h index 19d9d52817..9216c04229 100644 --- a/indra/llprimitive/llprimitive.h +++ b/indra/llprimitive/llprimitive.h @@ -106,6 +106,7 @@ public: PARAMS_LIGHT_IMAGE = 0x40, PARAMS_RESERVED = 0x50, // Used on server-side PARAMS_MESH = 0x60, + PARAMS_EXTENDED_MESH = 0x70, }; public: @@ -288,6 +289,27 @@ public: }; +class LLExtendedMeshParams : public LLNetworkData +{ +protected: + U32 mFlags; + +public: + static const U32 ANIMATED_MESH_ENABLED_FLAG = 0x1 << 0; + + LLExtendedMeshParams(); + /*virtual*/ BOOL pack(LLDataPacker &dp) const; + /*virtual*/ BOOL unpack(LLDataPacker &dp); + /*virtual*/ bool operator==(const LLNetworkData& data) const; + /*virtual*/ void copy(const LLNetworkData& data); + LLSD asLLSD() const; + operator LLSD() const { return asLLSD(); } + bool fromLLSD(LLSD& sd); + + void setFlags(const U32& flags) { mFlags = flags; } + U32 getFlags() const { return mFlags; } + +}; // This code is not naming-standards compliant. Leaving it like this for // now to make the connection to code in diff --git a/indra/newview/llpanelvolume.cpp b/indra/newview/llpanelvolume.cpp index c9f8683e0e..423d0a8d88 100644 --- a/indra/newview/llpanelvolume.cpp +++ b/indra/newview/llpanelvolume.cpp @@ -86,6 +86,7 @@ BOOL LLPanelVolume::postBuild() { // Flexible Objects Parameters { + childSetCommitCallback("Animated Mesh Checkbox Ctrl", boost::bind(&LLPanelVolume::onCommitAnimatedMeshCheckbox, this, _1, _2), NULL); childSetCommitCallback("Flexible1D Checkbox Ctrl", boost::bind(&LLPanelVolume::onCommitIsFlexible, this, _1, _2), NULL); childSetCommitCallback("FlexNumSections",onCommitFlexible,this); getChild("FlexNumSections")->setValidateBeforeCommit(precommitValidate); @@ -347,7 +348,16 @@ void LLPanelVolume::getState( ) getChildView("Light Focus")->setEnabled(false); getChildView("Light Ambiance")->setEnabled(false); } - + + // Animated Mesh + BOOL is_animated_mesh = volobjp && volobjp->getExtendedMeshFlags() & LLExtendedMeshParams::ANIMATED_MESH_ENABLED_FLAG; + getChild("Animated Mesh Checkbox Ctrl")->setValue(is_animated_mesh); + // AXON FIXME CHECK FOR SKIN INFO ALSO + // WHAT ABOUT isPermanentEnforced? + // What about linksets with some skinned objects? + BOOL can_be_animated_mesh = volobjp && volobjp->canBeAnimatedMesh() && editable; + getChildView("Animated Mesh Checkbox Ctrl")->setEnabled(can_be_animated_mesh); + // Flexible properties BOOL is_flexible = volobjp && volobjp->isFlexible(); getChild("Flexible1D Checkbox Ctrl")->setValue(is_flexible); @@ -899,6 +909,31 @@ void LLPanelVolume::onCommitFlexible( LLUICtrl* ctrl, void* userdata ) self->refresh(); } +void LLPanelVolume::onCommitAnimatedMeshCheckbox(LLUICtrl *, void*) +{ + LLViewerObject* objectp = mObject; + if (!objectp || (objectp->getPCode() != LL_PCODE_VOLUME)) + { + return; + } + LLVOVolume *volobjp = (LLVOVolume *)objectp; + BOOL animated_mesh = getChild("Animated Mesh Checkbox Ctrl")->getValue(); + U32 flags = volobjp->getExtendedMeshFlags(); + U32 new_flags = flags; + if (animated_mesh) + { + new_flags |= LLExtendedMeshParams::ANIMATED_MESH_ENABLED_FLAG; + } + else + { + new_flags &= ~LLExtendedMeshParams::ANIMATED_MESH_ENABLED_FLAG; + } + if (new_flags != flags) + { + volobjp->setExtendedMeshFlags(new_flags); + } +} + void LLPanelVolume::onCommitIsFlexible(LLUICtrl *, void*) { if (mObject->flagObjectPermanent()) diff --git a/indra/newview/llpanelvolume.h b/indra/newview/llpanelvolume.h index deb6b6f2a6..d85df69b19 100644 --- a/indra/newview/llpanelvolume.h +++ b/indra/newview/llpanelvolume.h @@ -63,6 +63,7 @@ public: static void onCommitLight( LLUICtrl* ctrl, void* userdata); void onCommitIsFlexible( LLUICtrl* ctrl, void* userdata); static void onCommitFlexible( LLUICtrl* ctrl, void* userdata); + void onCommitAnimatedMeshCheckbox(LLUICtrl* ctrl, void* userdata); static void onCommitPhysicsParam( LLUICtrl* ctrl, void* userdata); static void onCommitMaterial( LLUICtrl* ctrl, void* userdata); diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 1d6daed9cc..030c0ca9f6 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -5458,6 +5458,11 @@ LLViewerObject::ExtraParameter* LLViewerObject::createNewParameterEntry(U16 para new_block = new LLLightImageParams(); break; } + case LLNetworkData::PARAMS_EXTENDED_MESH: + { + new_block = new LLExtendedMeshParams(); + break; + } default: { LL_INFOS() << "Unknown param type." << LL_ENDL; diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 90ba814a15..ed0205704f 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -3269,6 +3269,59 @@ BOOL LLVOVolume::setIsFlexible(BOOL is_flexible) return res; } +//---------------------------------------------------------------------------- +// AXON - methods related to extended mesh flags + +U32 LLVOVolume::getExtendedMeshFlags() const +{ + const LLExtendedMeshParams *param_block = + (const LLExtendedMeshParams *)getParameterEntry(LLNetworkData::PARAMS_EXTENDED_MESH); + if (param_block) + { + return param_block->getFlags(); + } + else + { + return 0; + } +} + +void LLVOVolume::setExtendedMeshFlags(U32 flags) +{ + U32 curr_flags = getExtendedMeshFlags(); + if (curr_flags != flags) + { + bool in_use = (flags != 0); + setParameterEntryInUse(LLNetworkData::PARAMS_EXTENDED_MESH, in_use, true); + LLExtendedMeshParams *param_block = + (LLExtendedMeshParams *)getParameterEntry(LLNetworkData::PARAMS_EXTENDED_MESH); + if (param_block) + { + param_block->setFlags(flags); + } + parameterChanged(LLNetworkData::PARAMS_EXTENDED_MESH, true); + } +} + +bool LLVOVolume::canBeAnimatedMesh() const +{ + if (!isMesh()) + { + return false; + } + const LLMeshSkinInfo* skin = gMeshRepo.getSkinInfo(getVolume()->getParams().getSculptID(), this); + if (!skin) + { + return false; + } + return true; +} + +bool LLVOVolume::isAnimatedMesh() const +{ + return canBeAnimatedMesh() && (getExtendedMeshFlags() & LLExtendedMeshParams::ANIMATED_MESH_ENABLED_FLAG); +} + //---------------------------------------------------------------------------- void LLVOVolume::generateSilhouette(LLSelectNode* nodep, const LLVector3& view_point) diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h index a331908320..5918166aff 100644 --- a/indra/newview/llvovolume.h +++ b/indra/newview/llvovolume.h @@ -261,10 +261,17 @@ public: virtual BOOL isMesh() const; virtual BOOL hasLightTexture() const; + BOOL isVolumeGlobal() const; BOOL canBeFlexible() const; BOOL setIsFlexible(BOOL is_flexible); + // Extended Mesh Properties + U32 getExtendedMeshFlags() const; + void setExtendedMeshFlags(U32 flags); + bool canBeAnimatedMesh() const; + bool isAnimatedMesh() const; + // Functions that deal with media, or media navigation // Update this object's media data with the given media data array diff --git a/indra/newview/skins/default/xui/en/floater_tools.xml b/indra/newview/skins/default/xui/en/floater_tools.xml index ed3cc26851..63e2ed4bb9 100644 --- a/indra/newview/skins/default/xui/en/floater_tools.xml +++ b/indra/newview/skins/default/xui/en/floater_tools.xml @@ -2,7 +2,7 @@ + Date: Tue, 30 May 2017 15:59:23 +0100 Subject: SL-694 - UI initialization, set mType in LLExtendedMeshParams constructor --- indra/llprimitive/llprimitive.cpp | 1 + indra/newview/llpanelvolume.cpp | 1 + 2 files changed, 2 insertions(+) (limited to 'indra') diff --git a/indra/llprimitive/llprimitive.cpp b/indra/llprimitive/llprimitive.cpp index 54b87fec78..c847cf653f 100644 --- a/indra/llprimitive/llprimitive.cpp +++ b/indra/llprimitive/llprimitive.cpp @@ -2033,6 +2033,7 @@ bool LLLightImageParams::fromLLSD(LLSD& sd) LLExtendedMeshParams::LLExtendedMeshParams() { + mType = PARAMS_EXTENDED_MESH; mFlags = 0; } diff --git a/indra/newview/llpanelvolume.cpp b/indra/newview/llpanelvolume.cpp index 423d0a8d88..58cbede57b 100644 --- a/indra/newview/llpanelvolume.cpp +++ b/indra/newview/llpanelvolume.cpp @@ -597,6 +597,7 @@ void LLPanelVolume::clearCtrls() getChildView("Light Radius")->setEnabled(false); getChildView("Light Falloff")->setEnabled(false); + getChildView("Animated Mesh Checkbox Ctrl")->setEnabled(false); getChildView("Flexible1D Checkbox Ctrl")->setEnabled(false); getChildView("FlexNumSections")->setEnabled(false); getChildView("FlexGravity")->setEnabled(false); -- cgit v1.2.3 From 55612611c679efda5d491944dee75f4768749277 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 30 May 2017 22:03:43 +0100 Subject: SL-694 - stub support for ObjectAnimation message type --- indra/llmessage/message_prehash.cpp | 1 + indra/llmessage/message_prehash.h | 1 + indra/newview/llstartup.cpp | 1 + indra/newview/llviewermessage.cpp | 63 +++++++++++++++++++++++++++++++++++-- indra/newview/llviewermessage.h | 1 + 5 files changed, 64 insertions(+), 3 deletions(-) (limited to 'indra') diff --git a/indra/llmessage/message_prehash.cpp b/indra/llmessage/message_prehash.cpp index 1ae8a6ac15..f8e11e324e 100644 --- a/indra/llmessage/message_prehash.cpp +++ b/indra/llmessage/message_prehash.cpp @@ -818,6 +818,7 @@ char const* const _PREHASH_StateSave = LLMessageStringTable::getInstance()->getS char const* const _PREHASH_RoleData = LLMessageStringTable::getInstance()->getString("RoleData"); char const* const _PREHASH_AgentAnimation = LLMessageStringTable::getInstance()->getString("AgentAnimation"); char const* const _PREHASH_AvatarAnimation = LLMessageStringTable::getInstance()->getString("AvatarAnimation"); +char const* const _PREHASH_ObjectAnimation = LLMessageStringTable::getInstance()->getString("ObjectAnimation"); char const* const _PREHASH_LogDwellTime = LLMessageStringTable::getInstance()->getString("LogDwellTime"); char const* const _PREHASH_ParcelGodMarkAsContent = LLMessageStringTable::getInstance()->getString("ParcelGodMarkAsContent"); char const* const _PREHASH_UsePhysics = LLMessageStringTable::getInstance()->getString("UsePhysics"); diff --git a/indra/llmessage/message_prehash.h b/indra/llmessage/message_prehash.h index 7910fde305..334236fb25 100644 --- a/indra/llmessage/message_prehash.h +++ b/indra/llmessage/message_prehash.h @@ -818,6 +818,7 @@ extern char const* const _PREHASH_StateSave; extern char const* const _PREHASH_RoleData; extern char const* const _PREHASH_AgentAnimation; extern char const* const _PREHASH_AvatarAnimation; +extern char const* const _PREHASH_ObjectAnimation; extern char const* const _PREHASH_LogDwellTime; extern char const* const _PREHASH_ParcelGodMarkAsContent; extern char const* const _PREHASH_UsePhysics; diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 33b6352bf5..0c2fcdaf10 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -2384,6 +2384,7 @@ void register_viewer_callbacks(LLMessageSystem* msg) msg->setHandlerFuncFast(_PREHASH_NameValuePair, process_name_value); msg->setHandlerFuncFast(_PREHASH_RemoveNameValuePair, process_remove_name_value); msg->setHandlerFuncFast(_PREHASH_AvatarAnimation, process_avatar_animation); + msg->setHandlerFuncFast(_PREHASH_ObjectAnimation, process_object_animation); msg->setHandlerFuncFast(_PREHASH_AvatarAppearance, process_avatar_appearance); msg->setHandlerFuncFast(_PREHASH_CameraConstraint, process_camera_constraint); msg->setHandlerFuncFast(_PREHASH_AvatarSitResponse, process_avatar_sit_response); diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 507087d1ae..6a6e932b4a 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -103,6 +103,7 @@ #include "llviewerwindow.h" #include "llvlmanager.h" #include "llvoavatarself.h" +#include "llvovolume.h" #include "llworld.h" #include "pipeline.h" #include "llfloaterworldmap.h" @@ -4976,12 +4977,15 @@ void process_avatar_animation(LLMessageSystem *mesgsys, void **user_data) LLUUID animation_id; LLUUID uuid; S32 anim_sequence_id; - LLVOAvatar *avatarp; + LLVOAvatar *avatarp = NULL; mesgsys->getUUIDFast(_PREHASH_Sender, _PREHASH_ID, uuid); - //clear animation flags - avatarp = (LLVOAvatar *)gObjectList.findObject(uuid); + LLViewerObject *objp = gObjectList.findObject(uuid); + if (objp) + { + avatarp = objp->asAvatar(); + } if (!avatarp) { @@ -4993,6 +4997,7 @@ void process_avatar_animation(LLMessageSystem *mesgsys, void **user_data) S32 num_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_AnimationList); S32 num_source_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_AnimationSourceList); + //clear animation flags avatarp->mSignaledAnimations.clear(); if (avatarp->isSelf()) @@ -5063,6 +5068,58 @@ void process_avatar_animation(LLMessageSystem *mesgsys, void **user_data) } } +void process_object_animation(LLMessageSystem *mesgsys, void **user_data) +{ + LLUUID animation_id; + LLUUID uuid; +#if 0 + S32 anim_sequence_id; +#endif + + mesgsys->getUUIDFast(_PREHASH_Sender, _PREHASH_ID, uuid); + + LLViewerObject *objp = gObjectList.findObject(uuid); + if (!objp) + { + LL_WARNS("Messaging") << "Received animation state for unknown object" << uuid << LL_ENDL; + return; + } + + LLVOVolume *volp = dynamic_cast(objp); + if (!volp) + { + LL_WARNS("Messaging") << "Received animation state for non-volume object" << uuid << LL_ENDL; + return; + } + + if (!volp->isAnimatedMesh()) + { + LL_WARNS("Messaging") << "Received animation state for non-animated object" << uuid << LL_ENDL; + return; + } + + LL_WARNS() << "ADD SUPPORT FOR OBJECT ANIMATION HERE" << LL_ENDL; +#if 0 + S32 num_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_AnimationList); + S32 num_source_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_AnimationSourceList); + + avatarp->mSignaledAnimations.clear(); + + for( S32 i = 0; i < num_blocks; i++ ) + { + mesgsys->getUUIDFast(_PREHASH_AnimationList, _PREHASH_AnimID, animation_id, i); + mesgsys->getS32Fast(_PREHASH_AnimationList, _PREHASH_AnimSequenceID, anim_sequence_id, i); + avatarp->mSignaledAnimations[animation_id] = anim_sequence_id; + } + + if (num_blocks) + { + avatarp->processAnimationStateChanges(); + } +#endif +} + + void process_avatar_appearance(LLMessageSystem *mesgsys, void **user_data) { LLUUID uuid; diff --git a/indra/newview/llviewermessage.h b/indra/newview/llviewermessage.h index b0eaa37541..cef6f79812 100644 --- a/indra/newview/llviewermessage.h +++ b/indra/newview/llviewermessage.h @@ -95,6 +95,7 @@ void process_health_message(LLMessageSystem *mesgsys, void **user_data); void process_sim_stats(LLMessageSystem *mesgsys, void **user_data); void process_shooter_agent_hit(LLMessageSystem* msg, void** user_data); void process_avatar_animation(LLMessageSystem *mesgsys, void **user_data); +void process_object_animation(LLMessageSystem *mesgsys, void **user_data); void process_avatar_appearance(LLMessageSystem *mesgsys, void **user_data); void process_camera_constraint(LLMessageSystem *mesgsys, void **user_data); void process_avatar_sit_response(LLMessageSystem *mesgsys, void **user_data); -- cgit v1.2.3 From 74957676fc0b05825abc3af907241479f06fa8c3 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 5 Jun 2017 20:22:59 +0100 Subject: SL-694 - message changes for ObjectAnimation, more logging to validate behavior --- indra/newview/llviewermessage.cpp | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'indra') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 6a6e932b4a..2b62ccd62f 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -5072,51 +5072,50 @@ void process_object_animation(LLMessageSystem *mesgsys, void **user_data) { LLUUID animation_id; LLUUID uuid; -#if 0 S32 anim_sequence_id; -#endif mesgsys->getUUIDFast(_PREHASH_Sender, _PREHASH_ID, uuid); LLViewerObject *objp = gObjectList.findObject(uuid); if (!objp) { - LL_WARNS("Messaging") << "Received animation state for unknown object" << uuid << LL_ENDL; + LL_WARNS("Messaging") << "AXON Received animation state for unknown object" << uuid << LL_ENDL; return; } LLVOVolume *volp = dynamic_cast(objp); if (!volp) { - LL_WARNS("Messaging") << "Received animation state for non-volume object" << uuid << LL_ENDL; + LL_WARNS("Messaging") << "AXON Received animation state for non-volume object" << uuid << LL_ENDL; return; } if (!volp->isAnimatedMesh()) { - LL_WARNS("Messaging") << "Received animation state for non-animated object" << uuid << LL_ENDL; + LL_WARNS("Messaging") << "AXON Received animation state for non-animated object" << uuid << LL_ENDL; return; } - LL_WARNS() << "ADD SUPPORT FOR OBJECT ANIMATION HERE" << LL_ENDL; -#if 0 S32 num_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_AnimationList); - S32 num_source_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_AnimationSourceList); + LL_WARNS() << "AXON handle object animation here, num_blocks " << num_blocks << LL_ENDL; - avatarp->mSignaledAnimations.clear(); + //avatarp->mSignaledAnimations.clear(); + volp->setDebugText(llformat("Animations %d", num_blocks)); for( S32 i = 0; i < num_blocks; i++ ) { mesgsys->getUUIDFast(_PREHASH_AnimationList, _PREHASH_AnimID, animation_id, i); mesgsys->getS32Fast(_PREHASH_AnimationList, _PREHASH_AnimSequenceID, anim_sequence_id, i); - avatarp->mSignaledAnimations[animation_id] = anim_sequence_id; + //avatarp->mSignaledAnimations[animation_id] = anim_sequence_id; + LL_INFOS() << "AXON got object animation request for object " + << uuid << " animation id " << animation_id << LL_ENDL; } if (num_blocks) { - avatarp->processAnimationStateChanges(); + LL_INFOS() << "AXON process animation state changes here" << LL_ENDL; + //avatarp->processAnimationStateChanges(); } -#endif } -- cgit v1.2.3 From c9baf4c66157c601cc4d4e325c7843b3bf9a0cad Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 7 Jun 2017 14:23:49 +0100 Subject: SL-691,SL-694 - viewer can animate objects based on server messaging. First end-to-end demo for animated objects. --- indra/newview/CMakeLists.txt | 2 + indra/newview/llcontrolavatar.cpp | 119 +++++++++++++++++++++++++++++++++++ indra/newview/llcontrolavatar.h | 50 +++++++++++++++ indra/newview/lldrawpoolavatar.cpp | 3 +- indra/newview/llviewermenu.cpp | 2 +- indra/newview/llviewermessage.cpp | 15 +++-- indra/newview/llviewerobject.cpp | 35 +++++++++-- indra/newview/llviewerobject.h | 11 +++- indra/newview/llviewerobjectlist.cpp | 4 +- indra/newview/llviewerobjectlist.h | 2 +- indra/newview/llvoavatar.cpp | 52 +++++++++++---- indra/newview/llvoavatar.h | 8 +++ indra/newview/llvoavatarself.cpp | 2 +- indra/newview/llvograss.cpp | 3 +- indra/newview/llvovolume.cpp | 32 +++++++++- 15 files changed, 305 insertions(+), 35 deletions(-) create mode 100644 indra/newview/llcontrolavatar.cpp create mode 100644 indra/newview/llcontrolavatar.h (limited to 'indra') diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index b4e930d062..3787a25a9b 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -149,6 +149,7 @@ set(viewer_SOURCE_FILES llcommunicationchannel.cpp llcompilequeue.cpp llconfirmationmanager.cpp + llcontrolavatar.cpp llconversationlog.cpp llconversationloglist.cpp llconversationloglistitem.cpp @@ -769,6 +770,7 @@ set(viewer_HEADER_FILES llcommunicationchannel.h llcompilequeue.h llconfirmationmanager.h + llcontrolavatar.h llconversationlog.h llconversationloglist.h llconversationloglistitem.h diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp new file mode 100644 index 0000000000..1ecd3305ed --- /dev/null +++ b/indra/newview/llcontrolavatar.cpp @@ -0,0 +1,119 @@ +/** + * @file llcontrolavatar.cpp + * @brief Implementation for special dummy avatar used to drive rigged meshes. + * + * $LicenseInfo:firstyear=2017&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2017, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" +#include "llcontrolavatar.h" +#include "llagent.h" // Get state values from here +#include "llviewerobjectlist.h" +#include "pipeline.h" +#include "llanimationstates.h" + +LLControlAvatar::LLControlAvatar(const LLUUID& id, const LLPCode pcode, LLViewerRegion* regionp) : + LLVOAvatar(id, pcode, regionp), + mPlaying(false) +{ + mIsControlAvatar = true; +} + +// virtual +LLControlAvatar::~LLControlAvatar() +{ +} + +void LLControlAvatar::matchTransform(LLVOVolume *obj) +{ + setPositionAgent(obj->getRenderPosition()); + //slamPosition(); + + LLQuaternion fix_axes_rot(-F_PI_BY_TWO, LLVector3(0,0,1)); + LLQuaternion obj_rot = obj->getRotation(); + LLQuaternion result_rot = fix_axes_rot * obj_rot; + setRotation(result_rot); + mRoot->setWorldRotation(result_rot); + mRoot->setPosition(obj->getRenderPosition()); +} + +// Based on LLViewerJointAttachment::setupDrawable(), without the attaching part. +void LLControlAvatar::updateGeom(LLVOVolume *obj) +{ + if (!obj->mDrawable) + return; + if (obj->mDrawable->isActive()) + { + obj->mDrawable->makeStatic(FALSE); + } + obj->mDrawable->makeActive(); + gPipeline.markMoved(obj->mDrawable); + gPipeline.markTextured(obj->mDrawable); // face may need to change draw pool to/from POOL_HUD + obj->mDrawable->setState(LLDrawable::USE_BACKLIGHT); + + LLViewerObject::const_child_list_t& child_list = obj->getChildren(); + for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin(); + iter != child_list.end(); ++iter) + { + LLViewerObject* childp = *iter; + if (childp && childp->mDrawable.notNull()) + { + childp->mDrawable->setState(LLDrawable::USE_BACKLIGHT); + gPipeline.markTextured(childp->mDrawable); // face may need to change draw pool to/from POOL_HUD + gPipeline.markMoved(childp->mDrawable); + } + } + + gPipeline.markRebuild(obj->mDrawable, LLDrawable::REBUILD_ALL, TRUE); + obj->markForUpdate(TRUE); + + matchTransform(obj); + //addAttachmentOverridesForObject(obj); +} + +LLControlAvatar *LLControlAvatar::createControlAvatar(LLVOVolume *obj) +{ + // TRIF Lifted from LLPreviewAnimation + LLControlAvatar *cav = (LLControlAvatar*)gObjectList.createObjectViewer(LL_PCODE_LEGACY_AVATAR, gAgent.getRegion(), CO_FLAG_CONTROL_AVATAR); + cav->createDrawable(&gPipeline); + cav->mIsDummy = TRUE; + cav->mSpecialRenderMode = 1; + //cav->setPositionAgent(obj->getRenderPosition()); + //cav->slamPosition(); + //cav->setRotation(obj->getRotation()); + cav->updateJointLODs(); + cav->updateGeometry(cav->mDrawable); + cav->startMotion(ANIM_AGENT_STAND, 5.0f); + cav->hideSkirt(); + + // stop extraneous animations + cav->stopMotion( ANIM_AGENT_HEAD_ROT, TRUE ); + cav->stopMotion( ANIM_AGENT_EYE, TRUE ); + cav->stopMotion( ANIM_AGENT_BODY_NOISE, TRUE ); + cav->stopMotion( ANIM_AGENT_BREATHE_ROT, TRUE ); + + // Sync up position/rotation with object + cav->matchTransform(obj); + + return cav; +} + diff --git a/indra/newview/llcontrolavatar.h b/indra/newview/llcontrolavatar.h new file mode 100644 index 0000000000..c8b1039363 --- /dev/null +++ b/indra/newview/llcontrolavatar.h @@ -0,0 +1,50 @@ +/** + * @file llcontrolavatar.h + * @brief Special dummy avatar used to drive rigged meshes. + * + * $LicenseInfo:firstyear=2017&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2017, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_CONTROLAVATAR_H +#define LL_CONTROLAVATAR_H + +#include "llvoavatar.h" +#include "llvovolume.h" + +class LLControlAvatar: + public LLVOAvatar +{ + LOG_CLASS(LLControlAvatar); + +public: + LLControlAvatar(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp); + virtual ~LLControlAvatar(); + + void matchTransform(LLVOVolume *obj); + void updateGeom(LLVOVolume *obj); + + static LLControlAvatar *createControlAvatar(LLVOVolume *obj); + + bool mPlaying; +}; + +#endif //LL_CONTROLAVATAR_H diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index b221221f16..fa4fd7c533 100644 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -467,7 +467,8 @@ void LLDrawPoolAvatar::renderShadow(S32 pass) } LLVOAvatar *avatarp = (LLVOAvatar *)facep->getDrawable()->getVObj().get(); - if (avatarp->isDead() || avatarp->mIsDummy || avatarp->mDrawable.isNull()) +// AXON fix + if (avatarp->isDead() || /*avatarp->mIsDummy ||*/ avatarp->mDrawable.isNull()) { return; } diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index c68f6b8a15..eddbe16482 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -6907,7 +6907,7 @@ class LLAttachmentEnableDrop : public view_listener_t // Do not enable drop if all faces of object are not enabled if (object && LLSelectMgr::getInstance()->getSelection()->contains(object,SELECT_ALL_TES )) { - S32 attachmentID = ATTACHMENT_ID_FROM_STATE(object->getState()); + S32 attachmentID = ATTACHMENT_ID_FROM_STATE(object->getAttachmentState()); attachment = get_if_there(gAgentAvatarp->mAttachmentPoints, attachmentID, (LLViewerJointAttachment*)NULL); if (attachment) diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 2b62ccd62f..7fd87f99d3 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -55,6 +55,7 @@ #include "llagentcamera.h" #include "llcallingcard.h" #include "llbuycurrencyhtml.h" +#include "llcontrolavatar.h" #include "llfirstuse.h" #include "llfloaterbump.h" #include "llfloaterbuyland.h" @@ -5099,22 +5100,28 @@ void process_object_animation(LLMessageSystem *mesgsys, void **user_data) S32 num_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_AnimationList); LL_WARNS() << "AXON handle object animation here, num_blocks " << num_blocks << LL_ENDL; - //avatarp->mSignaledAnimations.clear(); + LLControlAvatar *avatarp = volp->mControlAvatar; + if (!avatarp->mPlaying) + { + avatarp->mPlaying = true; + avatarp->updateGeom(volp); + } + avatarp->mSignaledAnimations.clear(); volp->setDebugText(llformat("Animations %d", num_blocks)); for( S32 i = 0; i < num_blocks; i++ ) { mesgsys->getUUIDFast(_PREHASH_AnimationList, _PREHASH_AnimID, animation_id, i); mesgsys->getS32Fast(_PREHASH_AnimationList, _PREHASH_AnimSequenceID, anim_sequence_id, i); - //avatarp->mSignaledAnimations[animation_id] = anim_sequence_id; + avatarp->mSignaledAnimations[animation_id] = anim_sequence_id; LL_INFOS() << "AXON got object animation request for object " << uuid << " animation id " << animation_id << LL_ENDL; } - if (num_blocks) + if (num_blocks >= 0) { LL_INFOS() << "AXON process animation state changes here" << LL_ENDL; - //avatarp->processAnimationStateChanges(); + avatarp->processAnimationStateChanges(); } } diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 030c0ca9f6..ff808ba079 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -60,6 +60,7 @@ #include "llbbox.h" #include "llbox.h" #include "llcylinder.h" +#include "llcontrolavatar.h" #include "lldrawable.h" #include "llface.h" #include "llfloaterproperties.h" @@ -138,7 +139,7 @@ const F32 PHYSICS_TIMESTEP = 1.f / 45.f; static LLTrace::BlockTimerStatHandle FTM_CREATE_OBJECT("Create Object"); // static -LLViewerObject *LLViewerObject::createObject(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp) +LLViewerObject *LLViewerObject::createObject(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp, S32 flags) { LLViewerObject *res = NULL; LL_RECORD_BLOCK_TIME(FTM_CREATE_OBJECT); @@ -166,6 +167,12 @@ LLViewerObject *LLViewerObject::createObject(const LLUUID &id, const LLPCode pco } res = gAgentAvatarp; } + else if (flags & CO_FLAG_CONTROL_AVATAR) + { + LLControlAvatar *avatar = new LLControlAvatar(id, pcode, regionp); + avatar->initInstance(); + res = avatar; + } else { LLVOAvatar *avatar = new LLVOAvatar(id, pcode, regionp); @@ -235,6 +242,7 @@ LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRe mText(), mHudText(""), mHudTextColor(LLColor4::white), + mControlAvatar(NULL), mLastInterpUpdateSecs(0.f), mLastMessageUpdateSecs(0.f), mLatestRecvPacketID(0), @@ -259,7 +267,7 @@ LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRe mRotTime(0.f), mAngularVelocityRot(), mPreviousRotation(), - mState(0), + mAttachmentState(0), mMedia(NULL), mClickAction(0), mObjectCost(0), @@ -369,11 +377,18 @@ void LLViewerObject::markDead() ((LLViewerObject *)getParent())->removeChild(this); } LLUUID mesh_id; + // FIXME AXON - need to do this for control avatars too if (av && LLVOAvatar::getRiggedMeshID(this,mesh_id)) { // This case is needed for indirectly attached mesh objects. av->resetJointsOnDetach(mesh_id); } + if (mControlAvatar) + { + LLControlAvatar *av = mControlAvatar; + mControlAvatar = NULL; + av->markDead(); + } // Mark itself as dead mDead = TRUE; @@ -1378,7 +1393,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, U8 state; mesgsys->getU8Fast(_PREHASH_ObjectData, _PREHASH_State, state, block_num ); - mState = state; + mAttachmentState = state; // ...new objects that should come in selected need to be added to the selected list mCreateSelected = ((flags & FLAGS_CREATE_SELECTED) != 0); @@ -1648,7 +1663,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, U8 state; mesgsys->getU8Fast(_PREHASH_ObjectData, _PREHASH_State, state, block_num ); - mState = state; + mAttachmentState = state; break; } @@ -1671,7 +1686,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, U8 state; dp->unpackU8(state, "State"); - mState = state; + mAttachmentState = state; switch(update_type) { @@ -3857,7 +3872,7 @@ const LLVector3 LLViewerObject::getRenderPosition() const if (mDrawable.notNull() && mDrawable->isState(LLDrawable::RIGGED)) { LLVOAvatar* avatar = getAvatar(); - if (avatar) + if (avatar && !mControlAvatar) { return avatar->getPositionAgent(); } @@ -3993,6 +4008,10 @@ void LLViewerObject::setPosition(const LLVector3 &pos, BOOL damped) // position caches need to be up to date on root objects updatePositionCaches(); } + if (mControlAvatar) + { + mControlAvatar->matchTransform(dynamic_cast(this)); + } } void LLViewerObject::setPositionGlobal(const LLVector3d &pos_global, BOOL damped) @@ -6358,6 +6377,10 @@ const std::string& LLViewerObject::getAttachmentItemName() const //virtual LLVOAvatar* LLViewerObject::getAvatar() const { + if (mControlAvatar) + { + return mControlAvatar; + } if (isAttachment()) { LLViewerObject* vobj = (LLViewerObject*) getParent(); diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index 24fcf0517e..e727567957 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -47,6 +47,7 @@ class LLAgent; // TODO: Get rid of this. class LLAudioSource; class LLAudioSourceVO; class LLColor4; +class LLControlAvatar; class LLDataPacker; class LLDataPackerBinaryBuffer; class LLDrawable; @@ -374,7 +375,7 @@ public: void sendShapeUpdate(); - U8 getState() { return mState; } + U8 getAttachmentState() { return mAttachmentState; } F32 getAppAngle() const { return mAppAngle; } F32 getPixelArea() const { return mPixelArea; } @@ -683,6 +684,8 @@ public: static BOOL sUseSharedDrawables; + LLPointer mControlAvatar; + protected: // delete an item in the inventory, but don't tell the // server. This is used internally by remove, update, and @@ -693,8 +696,10 @@ protected: // updateInventory. void doUpdateInventory(LLPointer& item, U8 key, bool is_new); + // Flags for createObject + static const S32 CO_FLAG_CONTROL_AVATAR = 1 << 1; - static LLViewerObject *createObject(const LLUUID &id, LLPCode pcode, LLViewerRegion *regionp); + static LLViewerObject *createObject(const LLUUID &id, LLPCode pcode, LLViewerRegion *regionp, S32 flags = 0); BOOL setData(const U8 *datap, const U32 data_size); @@ -782,7 +787,7 @@ protected: LLQuaternion mAngularVelocityRot; // accumulated rotation from the angular velocity computations LLQuaternion mPreviousRotation; - U8 mState; // legacy + U8 mAttachmentState; // this encodes the attachment id in a somewhat complex way. 0 if not an attachment. LLViewerObjectMedia* mMedia; // NULL if no media associated U8 mClickAction; F32 mObjectCost; //resource cost of this object or -1 if unknown diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index 8f98d66c0c..1f99119d82 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -1942,12 +1942,12 @@ void LLViewerObjectList::resetObjectBeacons() mDebugBeacons.clear(); } -LLViewerObject *LLViewerObjectList::createObjectViewer(const LLPCode pcode, LLViewerRegion *regionp) +LLViewerObject *LLViewerObjectList::createObjectViewer(const LLPCode pcode, LLViewerRegion *regionp, S32 flags) { LLUUID fullid; fullid.generate(); - LLViewerObject *objectp = LLViewerObject::createObject(fullid, pcode, regionp); + LLViewerObject *objectp = LLViewerObject::createObject(fullid, pcode, regionp, flags); if (!objectp) { // LL_WARNS() << "Couldn't create object of type " << LLPrimitive::pCodeToString(pcode) << LL_ENDL; diff --git a/indra/newview/llviewerobjectlist.h b/indra/newview/llviewerobjectlist.h index 94c751acc6..72b2b99004 100644 --- a/indra/newview/llviewerobjectlist.h +++ b/indra/newview/llviewerobjectlist.h @@ -67,7 +67,7 @@ public: inline LLViewerObject *getObject(const S32 index); inline LLViewerObject *findObject(const LLUUID &id); - LLViewerObject *createObjectViewer(const LLPCode pcode, LLViewerRegion *regionp); // Create a viewer-side object + LLViewerObject *createObjectViewer(const LLPCode pcode, LLViewerRegion *regionp, S32 flags = 0); // Create a viewer-side object LLViewerObject *createObjectFromCache(const LLPCode pcode, LLViewerRegion *regionp, const LLUUID &uuid, const U32 local_id); LLViewerObject *createObject(const LLPCode pcode, LLViewerRegion *regionp, const LLUUID &uuid, const U32 local_id, const LLHost &sender); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 3968266c27..7ba264f35a 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -44,6 +44,7 @@ #include "llavatarnamecache.h" #include "llavatarpropertiesprocessor.h" #include "llavatarrendernotifier.h" +#include "llcontrolavatar.h" #include "llexperiencecache.h" #include "llphysicsmotion.h" #include "llviewercontrol.h" @@ -663,7 +664,8 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mLastUpdateRequestCOFVersion(-1), mLastUpdateReceivedCOFVersion(-1), mCachedMuteListUpdateTime(0), - mCachedInMuteList(false) + mCachedInMuteList(false), + mIsControlAvatar(false) { LL_DEBUGS("AvatarRender") << "LLVOAvatar Constructor (0x" << this << ") id:" << mID << LL_ENDL; @@ -1942,7 +1944,7 @@ void LLVOAvatar::resetSkeleton(bool reset_animations) //----------------------------------------------------------------------------- void LLVOAvatar::releaseMeshData() { - if (sInstances.size() < AVATAR_RELEASE_THRESHOLD || mIsDummy) + if (sInstances.size() < AVATAR_RELEASE_THRESHOLD)// || mIsDummy) { return; } @@ -2738,7 +2740,8 @@ void LLVOAvatar::idleUpdateLoadingEffect() LLPartData::LL_PART_EMISSIVE_MASK | // LLPartData::LL_PART_FOLLOW_SRC_MASK | LLPartData::LL_PART_TARGET_POS_MASK ); - if (!isTooComplex()) // do not generate particles for overly-complex avatars + // TRIF skip cloud effects for dummy avs as well + if (!mIsDummy && !isTooComplex()) // do not generate particles for overly-complex avatars { setParticleSource(particle_parameters, getID()); } @@ -3530,7 +3533,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) } // change animation time quanta based on avatar render load - if (!isSelf() && !mIsDummy) + if (!isSelf())// && !mIsDummy) { F32 time_quantum = clamp_rescale((F32)sInstances.size(), 10.f, 35.f, 0.f, 0.25f); F32 pixel_area_scale = clamp_rescale(mPixelArea, 100, 5000, 1.f, 0.f); @@ -3652,7 +3655,8 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) //-------------------------------------------------------------------- // Propagate viewer object rotation to root of avatar //-------------------------------------------------------------------- - if (!isAnyAnimationSignaled(AGENT_NO_ROTATE_ANIMS, NUM_AGENT_NO_ROTATE_ANIMS)) + // FIXME TRIF - just skipping this for now for all dummy avs + if (!mIsDummy && !isAnyAnimationSignaled(AGENT_NO_ROTATE_ANIMS, NUM_AGENT_NO_ROTATE_ANIMS)) { LLQuaternion iQ; LLVector3 upDir( 0.0f, 0.0f, 1.0f ); @@ -4041,7 +4045,7 @@ void LLVOAvatar::updateVisibility() if (mIsDummy) { - visible = TRUE; + visible = FALSE; } else if (mDrawable.isNull()) { @@ -4356,7 +4360,7 @@ U32 LLVOAvatar::renderSkinned() { if (!isSelf() || gAgent.needsRenderHead() || LLPipeline::sShadowRender) { - if (isTextureVisible(TEX_HEAD_BAKED) || mIsDummy) + if (isTextureVisible(TEX_HEAD_BAKED))// || mIsDummy) { LLViewerJoint* head_mesh = getViewerJoint(MESH_ID_HEAD); if (head_mesh) @@ -4366,7 +4370,7 @@ U32 LLVOAvatar::renderSkinned() first_pass = FALSE; } } - if (isTextureVisible(TEX_UPPER_BAKED) || mIsDummy) + if (isTextureVisible(TEX_UPPER_BAKED))// || mIsDummy) { LLViewerJoint* upper_mesh = getViewerJoint(MESH_ID_UPPER_BODY); if (upper_mesh) @@ -4376,7 +4380,7 @@ U32 LLVOAvatar::renderSkinned() first_pass = FALSE; } - if (isTextureVisible(TEX_LOWER_BAKED) || mIsDummy) + if (isTextureVisible(TEX_LOWER_BAKED))// || mIsDummy) { LLViewerJoint* lower_mesh = getViewerJoint(MESH_ID_LOWER_BODY); if (lower_mesh) @@ -4435,6 +4439,8 @@ U32 LLVOAvatar::renderTransparent(BOOL first_pass) } // Can't test for baked hair being defined, since that won't always be the case (not all viewers send baked hair) // TODO: 1.25 will be able to switch this logic back to calling isTextureVisible(); + if (!mIsDummy) + { if ( (getImage(TEX_HAIR_BAKED, 0) && getImage(TEX_HAIR_BAKED, 0)->getID() != IMG_INVISIBLE) || LLDrawPoolAlpha::sShowDebugAlpha) { @@ -4445,6 +4451,7 @@ U32 LLVOAvatar::renderTransparent(BOOL first_pass) } first_pass = FALSE; } + } if (LLPipeline::sImpostorRender) { gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); @@ -5521,12 +5528,26 @@ void LLVOAvatar::rebuildAttachmentOverrides() //----------------------------------------------------------------------------- void LLVOAvatar::addAttachmentOverridesForObject(LLViewerObject *vo) { - LLVOAvatar *av = vo->getAvatarAncestor(); + bool non_attached_case = false; + // FIXME TRIF - will this work if vo has child objects? + if (vo->mControlAvatar) + { + non_attached_case = true; + } + LLVOAvatar *av; + if (non_attached_case) + { + av = vo->mControlAvatar; + } + else + { + av = vo->getAvatarAncestor(); if (!av || (av != this)) { LL_WARNS("Avatar") << "called with invalid avatar" << LL_ENDL; return; } + } LLScopedContextString str("addAttachmentOverridesForObject " + av->getFullname()); @@ -5554,7 +5575,7 @@ void LLVOAvatar::addAttachmentOverridesForObject(LLViewerObject *vo) LLUUID currentId = vobj->getVolume()->getParams().getSculptID(); const LLMeshSkinInfo* pSkinData = gMeshRepo.getSkinInfo( currentId, vobj ); - if ( vobj && vobj->isAttachment() && vobj->isMesh() && pSkinData ) + if ( vobj && (vobj->isAttachment()||non_attached_case) && vobj->isMesh() && pSkinData ) { const int bindCnt = pSkinData->mAlternateBindMatrix.size(); const int jointCnt = pSkinData->mJointNames.size(); @@ -5738,6 +5759,7 @@ void LLVOAvatar::showAttachmentOverrides(bool verbose) const //----------------------------------------------------------------------------- // resetJointsOnDetach //----------------------------------------------------------------------------- +// TRIF handle NPC case void LLVOAvatar::resetJointsOnDetach(LLViewerObject *vo) { LLVOAvatar *av = vo->getAvatarAncestor(); @@ -5766,6 +5788,7 @@ void LLVOAvatar::resetJointsOnDetach(LLViewerObject *vo) //----------------------------------------------------------------------------- // resetJointsOnDetach //----------------------------------------------------------------------------- +// TRIF handle NPC case void LLVOAvatar::resetJointsOnDetach(const LLUUID& mesh_id) { //Subsequent joints are relative to pelvis @@ -6288,7 +6311,7 @@ void LLVOAvatar::removeChild(LLViewerObject *childp) LLViewerJointAttachment* LLVOAvatar::getTargetAttachmentPoint(LLViewerObject* viewer_object) { - S32 attachmentID = ATTACHMENT_ID_FROM_STATE(viewer_object->getState()); + S32 attachmentID = ATTACHMENT_ID_FROM_STATE(viewer_object->getAttachmentState()); // This should never happen unless the server didn't process the attachment point // correctly, but putting this check in here to be safe. @@ -6812,6 +6835,11 @@ BOOL LLVOAvatar::isVisible() const // Determine if we have enough avatar data to render bool LLVOAvatar::getIsCloud() const { + if (mIsDummy) + { + return false; + } + return ( ((const_cast(this))->visualParamWeightsAreDefault())// Do we have a shape? || ( !isTextureDefined(TEX_LOWER_BAKED) || !isTextureDefined(TEX_UPPER_BAKED) diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index bd89d4ef23..2832f940f4 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -233,6 +233,8 @@ public: public: virtual bool isSelf() const { return false; } // True if this avatar is for this viewer's agent + virtual bool isControlAvatar() const { return mIsControlAvatar; } // True if this avatar is a control av (no associated user) + private: //aligned members LL_ALIGN_16(LLVector4a mImpostorExtents[2]); @@ -440,6 +442,12 @@ public: VisualMuteSettings mVisuallyMuteSetting; // Always or never visually mute this AV + //-------------------------------------------------------------------- + // NPC status + //-------------------------------------------------------------------- +public: + bool mIsControlAvatar; + //-------------------------------------------------------------------- // Morph masks //-------------------------------------------------------------------- diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index aa5d82a096..2137bf4eb3 100644 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -2789,7 +2789,7 @@ BOOL LLVOAvatarSelf::needsRenderBeam() // don't render selection beam on hud objects is_touching_or_grabbing = FALSE; } - return is_touching_or_grabbing || (mState & AGENT_STATE_EDITING && LLSelectMgr::getInstance()->shouldShowSelection()); + return is_touching_or_grabbing || (getAttachmentState() & AGENT_STATE_EDITING && LLSelectMgr::getInstance()->shouldShowSelection()); } // static diff --git a/indra/newview/llvograss.cpp b/indra/newview/llvograss.cpp index de63a3963c..e7e4e6f228 100644 --- a/indra/newview/llvograss.cpp +++ b/indra/newview/llvograss.cpp @@ -92,7 +92,8 @@ LLVOGrass::~LLVOGrass() void LLVOGrass::updateSpecies() { - mSpecies = mState; + // TRIF is grass still even supported? This use of state seems odd. + mSpecies = getAttachmentState(); if (!sSpeciesTable.count(mSpecies)) { diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index ed0205704f..a2f417a5cc 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -76,8 +76,13 @@ #include "lldatapacker.h" #include "llviewershadermgr.h" #include "llvoavatar.h" +#include "llcontrolavatar.h" +#include "llvoavatarself.h" #include "llvocache.h" #include "llmaterialmgr.h" +#include "llanimationstates.h" +#include "llinventorytype.h" +#include "llviewerinventory.h" const F32 FORCE_SIMPLE_RENDER_AREA = 512.f; const F32 FORCE_CULL_AREA = 8.f; @@ -3383,7 +3388,7 @@ void LLVOVolume::updateRadius() BOOL LLVOVolume::isAttachment() const { - return mState != 0 ; + return mAttachmentState != 0 ; } BOOL LLVOVolume::isHUDAttachment() const @@ -3391,7 +3396,7 @@ BOOL LLVOVolume::isHUDAttachment() const // *NOTE: we assume hud attachment points are in defined range // since this range is constant for backwards compatibility // reasons this is probably a reasonable assumption to make - S32 attachment_id = ATTACHMENT_ID_FROM_STATE(mState); + S32 attachment_id = ATTACHMENT_ID_FROM_STATE(mAttachmentState); return ( attachment_id >= 31 && attachment_id <= 38 ); } @@ -4825,10 +4830,31 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) vobj->isMesh() && gMeshRepo.getSkinInfo(vobj->getVolume()->getParams().getSculptID(), vobj); + bool rigged_non_attachment = !vobj->isAttachment() && + vobj->isMesh() && + gMeshRepo.getSkinInfo(vobj->getVolume()->getParams().getSculptID(), vobj); + + if (rigged_non_attachment) + { + if (!vobj->mControlAvatar) + { + vobj->mControlAvatar = LLControlAvatar::createControlAvatar(vobj); + vobj->mControlAvatar->addAttachmentOverridesForObject(vobj); + vobj->requestInventory(); + } + if (vobj->mControlAvatar) + { + pAvatarVO = vobj->mControlAvatar; + } + } + bool bake_sunlight = LLPipeline::sBakeSunlight && drawablep->isStatic(); + // TRIF why this variable? Only different from rigged if + // there are no LLFaces associated with the drawable. bool is_rigged = false; + // TRIF handle NPC case if (rigged && pAvatarVO) { pAvatarVO->addAttachmentOverridesForObject(vobj); @@ -4855,7 +4881,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) //sum up face verts and indices drawablep->updateFaceSize(i); - if (rigged) + if (rigged || (vobj->mControlAvatar && vobj->mControlAvatar->mPlaying)) { if (!facep->isState(LLFace::RIGGED)) { //completely reset vertex buffer -- cgit v1.2.3 From c5dc0ee36e8d17fd0cf25f5a1fbdfb8609a64ee0 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 9 Jun 2017 21:13:54 +0100 Subject: SL-704 - code cleanup --- indra/newview/llcontrolavatar.cpp | 5 +--- indra/newview/lldrawpoolavatar.cpp | 2 +- indra/newview/llpanelvolume.cpp | 4 +-- indra/newview/llviewermessage.cpp | 2 +- indra/newview/llvoavatar.cpp | 54 ++++++++++++++++++++------------------ indra/newview/llvograss.cpp | 2 +- indra/newview/llvovolume.cpp | 10 +++---- indra/newview/llvovolume.h | 4 +-- 8 files changed, 42 insertions(+), 41 deletions(-) (limited to 'indra') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 1ecd3305ed..a8caba08af 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -92,14 +92,11 @@ void LLControlAvatar::updateGeom(LLVOVolume *obj) LLControlAvatar *LLControlAvatar::createControlAvatar(LLVOVolume *obj) { - // TRIF Lifted from LLPreviewAnimation + // AXON Lifted from LLPreviewAnimation LLControlAvatar *cav = (LLControlAvatar*)gObjectList.createObjectViewer(LL_PCODE_LEGACY_AVATAR, gAgent.getRegion(), CO_FLAG_CONTROL_AVATAR); cav->createDrawable(&gPipeline); cav->mIsDummy = TRUE; cav->mSpecialRenderMode = 1; - //cav->setPositionAgent(obj->getRenderPosition()); - //cav->slamPosition(); - //cav->setRotation(obj->getRotation()); cav->updateJointLODs(); cav->updateGeometry(cav->mDrawable); cav->startMotion(ANIM_AGENT_STAND, 5.0f); diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index fa4fd7c533..869e37e08c 100644 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -468,7 +468,7 @@ void LLDrawPoolAvatar::renderShadow(S32 pass) LLVOAvatar *avatarp = (LLVOAvatar *)facep->getDrawable()->getVObj().get(); // AXON fix - if (avatarp->isDead() || /*avatarp->mIsDummy ||*/ avatarp->mDrawable.isNull()) + if (avatarp->isDead() || avatarp->mIsDummy || avatarp->mDrawable.isNull()) { return; } diff --git a/indra/newview/llpanelvolume.cpp b/indra/newview/llpanelvolume.cpp index 58cbede57b..f34194db19 100644 --- a/indra/newview/llpanelvolume.cpp +++ b/indra/newview/llpanelvolume.cpp @@ -355,8 +355,8 @@ void LLPanelVolume::getState( ) // AXON FIXME CHECK FOR SKIN INFO ALSO // WHAT ABOUT isPermanentEnforced? // What about linksets with some skinned objects? - BOOL can_be_animated_mesh = volobjp && volobjp->canBeAnimatedMesh() && editable; - getChildView("Animated Mesh Checkbox Ctrl")->setEnabled(can_be_animated_mesh); + BOOL can_be_animated_object = volobjp && volobjp->canBeAnimatedObject() && editable; + getChildView("Animated Mesh Checkbox Ctrl")->setEnabled(can_be_animated_object); // Flexible properties BOOL is_flexible = volobjp && volobjp->isFlexible(); diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 7fd87f99d3..db237d30ea 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -5091,7 +5091,7 @@ void process_object_animation(LLMessageSystem *mesgsys, void **user_data) return; } - if (!volp->isAnimatedMesh()) + if (!volp->isAnimatedObject()) { LL_WARNS("Messaging") << "AXON Received animation state for non-animated object" << uuid << LL_ENDL; return; diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 7ba264f35a..1c9f79b200 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -1944,7 +1944,9 @@ void LLVOAvatar::resetSkeleton(bool reset_animations) //----------------------------------------------------------------------------- void LLVOAvatar::releaseMeshData() { - if (sInstances.size() < AVATAR_RELEASE_THRESHOLD)// || mIsDummy) + // AXON what should we be doing here for control avs? Why are + // dummies treated differently in the first place? + if (sInstances.size() < AVATAR_RELEASE_THRESHOLD || mIsDummy) { return; } @@ -2740,7 +2742,7 @@ void LLVOAvatar::idleUpdateLoadingEffect() LLPartData::LL_PART_EMISSIVE_MASK | // LLPartData::LL_PART_FOLLOW_SRC_MASK | LLPartData::LL_PART_TARGET_POS_MASK ); - // TRIF skip cloud effects for dummy avs as well + // AXON skip cloud effects for dummy avs as well if (!mIsDummy && !isTooComplex()) // do not generate particles for overly-complex avatars { setParticleSource(particle_parameters, getID()); @@ -3533,7 +3535,9 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) } // change animation time quanta based on avatar render load - if (!isSelf())// && !mIsDummy) + // AXON how should control avs be handled here? + bool is_pure_dummy = mIsDummy && !isControlAvatar(); + if (!isSelf() && !is_pure_dummy) { F32 time_quantum = clamp_rescale((F32)sInstances.size(), 10.f, 35.f, 0.f, 0.25f); F32 pixel_area_scale = clamp_rescale(mPixelArea, 100, 5000, 1.f, 0.f); @@ -3655,8 +3659,8 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) //-------------------------------------------------------------------- // Propagate viewer object rotation to root of avatar //-------------------------------------------------------------------- - // FIXME TRIF - just skipping this for now for all dummy avs - if (!mIsDummy && !isAnyAnimationSignaled(AGENT_NO_ROTATE_ANIMS, NUM_AGENT_NO_ROTATE_ANIMS)) + // AXON - also skip for control avatars + if (!isControlAvatar() && !isAnyAnimationSignaled(AGENT_NO_ROTATE_ANIMS, NUM_AGENT_NO_ROTATE_ANIMS)) { LLQuaternion iQ; LLVector3 upDir( 0.0f, 0.0f, 1.0f ); @@ -4356,11 +4360,12 @@ U32 LLVOAvatar::renderSkinned() } BOOL first_pass = TRUE; + bool is_pure_dummy = mIsDummy && !isControlAvatar(); if (!LLDrawPoolAvatar::sSkipOpaque) { if (!isSelf() || gAgent.needsRenderHead() || LLPipeline::sShadowRender) { - if (isTextureVisible(TEX_HEAD_BAKED))// || mIsDummy) + if (isTextureVisible(TEX_HEAD_BAKED) || is_pure_dummy) { LLViewerJoint* head_mesh = getViewerJoint(MESH_ID_HEAD); if (head_mesh) @@ -4370,7 +4375,7 @@ U32 LLVOAvatar::renderSkinned() first_pass = FALSE; } } - if (isTextureVisible(TEX_UPPER_BAKED))// || mIsDummy) + if (isTextureVisible(TEX_UPPER_BAKED) || is_pure_dummy) { LLViewerJoint* upper_mesh = getViewerJoint(MESH_ID_UPPER_BODY); if (upper_mesh) @@ -4380,7 +4385,7 @@ U32 LLVOAvatar::renderSkinned() first_pass = FALSE; } - if (isTextureVisible(TEX_LOWER_BAKED))// || mIsDummy) + if (isTextureVisible(TEX_LOWER_BAKED) || is_pure_dummy) { LLViewerJoint* lower_mesh = getViewerJoint(MESH_ID_LOWER_BODY); if (lower_mesh) @@ -4437,20 +4442,14 @@ U32 LLVOAvatar::renderTransparent(BOOL first_pass) } first_pass = FALSE; } - // Can't test for baked hair being defined, since that won't always be the case (not all viewers send baked hair) - // TODO: 1.25 will be able to switch this logic back to calling isTextureVisible(); - if (!mIsDummy) + if (isTextureVisible(TEX_HAIR_BAKED)) { - if ( (getImage(TEX_HAIR_BAKED, 0) && getImage(TEX_HAIR_BAKED, 0)->getID() != IMG_INVISIBLE) - || LLDrawPoolAlpha::sShowDebugAlpha) - { - LLViewerJoint* hair_mesh = getViewerJoint(MESH_ID_HAIR); - if (hair_mesh) - { - num_indices += hair_mesh->render(mAdjustedPixelArea, first_pass, mIsDummy); - } - first_pass = FALSE; - } + LLViewerJoint* hair_mesh = getViewerJoint(MESH_ID_HAIR); + if (hair_mesh) + { + num_indices += hair_mesh->render(mAdjustedPixelArea, first_pass, mIsDummy); + } + first_pass = FALSE; } if (LLPipeline::sImpostorRender) { @@ -4491,7 +4490,9 @@ U32 LLVOAvatar::renderRigid() gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.5f); } - if (isTextureVisible(TEX_EYES_BAKED) || mIsDummy) + bool is_pure_dummy = mIsDummy && !isControlAvatar(); + + if (isTextureVisible(TEX_EYES_BAKED) || is_pure_dummy) { LLViewerJoint* eyeball_left = getViewerJoint(MESH_ID_EYEBALL_LEFT); LLViewerJoint* eyeball_right = getViewerJoint(MESH_ID_EYEBALL_RIGHT); @@ -5529,7 +5530,7 @@ void LLVOAvatar::rebuildAttachmentOverrides() void LLVOAvatar::addAttachmentOverridesForObject(LLViewerObject *vo) { bool non_attached_case = false; - // FIXME TRIF - will this work if vo has child objects? + // FIXME AXON - will this work if vo has child objects? if (vo->mControlAvatar) { non_attached_case = true; @@ -5759,7 +5760,7 @@ void LLVOAvatar::showAttachmentOverrides(bool verbose) const //----------------------------------------------------------------------------- // resetJointsOnDetach //----------------------------------------------------------------------------- -// TRIF handle NPC case +// AXON handle NPC case void LLVOAvatar::resetJointsOnDetach(LLViewerObject *vo) { LLVOAvatar *av = vo->getAvatarAncestor(); @@ -5788,7 +5789,7 @@ void LLVOAvatar::resetJointsOnDetach(LLViewerObject *vo) //----------------------------------------------------------------------------- // resetJointsOnDetach //----------------------------------------------------------------------------- -// TRIF handle NPC case +// AXON handle NPC case void LLVOAvatar::resetJointsOnDetach(const LLUUID& mesh_id) { //Subsequent joints are relative to pelvis @@ -5867,6 +5868,7 @@ void LLVOAvatar::getGround(const LLVector3 &in_pos_agent, LLVector3 &out_pos_age LLVector3d z_vec(0.0f, 0.0f, 1.0f); LLVector3d p0_global, p1_global; + // AXON update for control avs? if (mIsDummy) { outNorm.setVec(z_vec); @@ -5896,6 +5898,7 @@ F32 LLVOAvatar::getTimeDilation() //----------------------------------------------------------------------------- F32 LLVOAvatar::getPixelArea() const { + // AXON update for control avatars if (mIsDummy) { return 100000.f; @@ -6827,6 +6830,7 @@ void LLVOAvatar::onGlobalColorChanged(const LLTexGlobalColor* global_color) BOOL LLVOAvatar::isVisible() const { + // AXON should we flag control avs as invisible? return mDrawable.notNull() && (!mOrphaned || isSelf()) && (mDrawable->isVisible() || mIsDummy); diff --git a/indra/newview/llvograss.cpp b/indra/newview/llvograss.cpp index e7e4e6f228..337f969f3d 100644 --- a/indra/newview/llvograss.cpp +++ b/indra/newview/llvograss.cpp @@ -92,7 +92,7 @@ LLVOGrass::~LLVOGrass() void LLVOGrass::updateSpecies() { - // TRIF is grass still even supported? This use of state seems odd. + // AXON is grass still even supported? This use of state seems odd. mSpecies = getAttachmentState(); if (!sSpeciesTable.count(mSpecies)) diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index a2f417a5cc..59e1895bc6 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -3308,7 +3308,7 @@ void LLVOVolume::setExtendedMeshFlags(U32 flags) } } -bool LLVOVolume::canBeAnimatedMesh() const +bool LLVOVolume::canBeAnimatedObject() const { if (!isMesh()) { @@ -3322,9 +3322,9 @@ bool LLVOVolume::canBeAnimatedMesh() const return true; } -bool LLVOVolume::isAnimatedMesh() const +bool LLVOVolume::isAnimatedObject() const { - return canBeAnimatedMesh() && (getExtendedMeshFlags() & LLExtendedMeshParams::ANIMATED_MESH_ENABLED_FLAG); + return canBeAnimatedObject() && (getExtendedMeshFlags() & LLExtendedMeshParams::ANIMATED_MESH_ENABLED_FLAG); } //---------------------------------------------------------------------------- @@ -4850,11 +4850,11 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) bool bake_sunlight = LLPipeline::sBakeSunlight && drawablep->isStatic(); - // TRIF why this variable? Only different from rigged if + // AXON why this variable? Only different from rigged if // there are no LLFaces associated with the drawable. bool is_rigged = false; - // TRIF handle NPC case + // AXON handle NPC case if (rigged && pAvatarVO) { pAvatarVO->addAttachmentOverridesForObject(vobj); diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h index 5918166aff..75dabd961a 100644 --- a/indra/newview/llvovolume.h +++ b/indra/newview/llvovolume.h @@ -269,8 +269,8 @@ public: // Extended Mesh Properties U32 getExtendedMeshFlags() const; void setExtendedMeshFlags(U32 flags); - bool canBeAnimatedMesh() const; - bool isAnimatedMesh() const; + bool canBeAnimatedObject() const; + bool isAnimatedObject() const; // Functions that deal with media, or media navigation -- cgit v1.2.3 From b2a06578187af5446b5e24379abc8764f0cd731f Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 16 Jun 2017 16:03:06 +0100 Subject: SL-697 - global scale function for LLControlAvatar, to support arbitrary scaling of animated objects. Not currently used. --- indra/llcharacter/lljoint.cpp | 2 +- indra/newview/llcontrolavatar.cpp | 55 +++++++++++++++++++++++++++++++++++++-- indra/newview/llcontrolavatar.h | 4 +++ indra/newview/llviewermessage.cpp | 8 +++++- 4 files changed, 65 insertions(+), 4 deletions(-) (limited to 'indra') diff --git a/indra/llcharacter/lljoint.cpp b/indra/llcharacter/lljoint.cpp index a3d5679f65..89335a20f5 100644 --- a/indra/llcharacter/lljoint.cpp +++ b/indra/llcharacter/lljoint.cpp @@ -881,7 +881,7 @@ void LLJoint::setWorldRotation( const LLQuaternion& rot ) //-------------------------------------------------------------------- const LLVector3& LLJoint::getScale() { - return mXform.getScale(); + return mXform.getScale(); } //-------------------------------------------------------------------- diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index a8caba08af..03a374ebdb 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -33,7 +33,8 @@ LLControlAvatar::LLControlAvatar(const LLUUID& id, const LLPCode pcode, LLViewerRegion* regionp) : LLVOAvatar(id, pcode, regionp), - mPlaying(false) + mPlaying(false), + mGlobalScale(1.0f) { mIsControlAvatar = true; } @@ -56,6 +57,35 @@ void LLControlAvatar::matchTransform(LLVOVolume *obj) mRoot->setPosition(obj->getRenderPosition()); } +void LLControlAvatar::setGlobalScale(F32 scale) +{ + if (scale <= 0.0) + { + LL_WARNS() << "invalid global scale " << scale << LL_ENDL; + return; + } + if (scale != mGlobalScale) + { + F32 adjust_scale = scale/mGlobalScale; + LL_INFOS() << "scale " << scale << " adjustment " << adjust_scale << LL_ENDL; + // AXON - should we be scaling from the pelvis or the root? + recursiveScaleJoint(mPelvisp,adjust_scale); + mGlobalScale = scale; + } +} + +void LLControlAvatar::recursiveScaleJoint(LLJoint* joint, F32 factor) +{ + joint->setScale(factor * joint->getScale()); + + for (LLJoint::child_list_t::iterator iter = joint->mChildren.begin(); + iter != joint->mChildren.end(); ++iter) + { + LLJoint* child = *iter; + recursiveScaleJoint(child, factor); + } +} + // Based on LLViewerJointAttachment::setupDrawable(), without the attaching part. void LLControlAvatar::updateGeom(LLVOVolume *obj) { @@ -86,8 +116,29 @@ void LLControlAvatar::updateGeom(LLVOVolume *obj) gPipeline.markRebuild(obj->mDrawable, LLDrawable::REBUILD_ALL, TRUE); obj->markForUpdate(TRUE); + // Note that attachment overrides aren't needed here, have already + // been applied at the time the mControlAvatar was created, in + // llvovolume.cpp. + matchTransform(obj); - //addAttachmentOverridesForObject(obj); + + // AXON testing scale + + // What should the scale be? What we really want is the ratio + // between the scale at which the object was originally designed + // and rigged, and the scale to which it has been subsequently + // modified - for example, if the object has been scaled down by a + // factor of 2 then we should use 0.5 as the global scale. But we + // don't have the original scale stored anywhere, just the current + // scale. Possibilities - 1) remember the original scale + // somewhere, 2) add another field to let the user specify the + // global scale, 3) approximate the original scale by looking at + // the proportions of the skeleton after joint positions have + // been applied + + //LLVector3 obj_scale = obj->getScale(); + //F32 obj_scale_z = llmax(obj_scale[2],0.1f); + //setGlobalScale(obj_scale_z/2.0f); // roughly fit avatar height range (2m) into object height } LLControlAvatar *LLControlAvatar::createControlAvatar(LLVOVolume *obj) diff --git a/indra/newview/llcontrolavatar.h b/indra/newview/llcontrolavatar.h index c8b1039363..a783b9228f 100644 --- a/indra/newview/llcontrolavatar.h +++ b/indra/newview/llcontrolavatar.h @@ -42,9 +42,13 @@ public: void matchTransform(LLVOVolume *obj); void updateGeom(LLVOVolume *obj); + void setGlobalScale(F32 scale); + void recursiveScaleJoint(LLJoint *joint, F32 factor); static LLControlAvatar *createControlAvatar(LLVOVolume *obj); bool mPlaying; + + F32 mGlobalScale; }; #endif //LL_CONTROLAVATAR_H diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index db237d30ea..f359c1455f 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -5097,10 +5097,16 @@ void process_object_animation(LLMessageSystem *mesgsys, void **user_data) return; } + LLControlAvatar *avatarp = volp->mControlAvatar; + if (!avatarp) + { + LL_WARNS() << "AXON no control avatar, ignoring" << LL_ENDL; + return; + } + S32 num_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_AnimationList); LL_WARNS() << "AXON handle object animation here, num_blocks " << num_blocks << LL_ENDL; - LLControlAvatar *avatarp = volp->mControlAvatar; if (!avatarp->mPlaying) { avatarp->mPlaying = true; -- cgit v1.2.3 From e0d6a6a40192caa5b9d62165da5f23a5ade6e4b0 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 19 Jun 2017 20:44:04 +0100 Subject: SL-725 - suppress default animations for LLControlAvatar, using a new mEnableDefaultAnimations field --- indra/newview/llcontrolavatar.cpp | 4 +++- indra/newview/llviewermessage.cpp | 1 - indra/newview/llvoavatar.cpp | 30 ++++++++++++++++++++++++------ indra/newview/llvoavatar.h | 5 +++-- 4 files changed, 30 insertions(+), 10 deletions(-) (limited to 'indra') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 03a374ebdb..8027ea9c73 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -30,6 +30,7 @@ #include "llviewerobjectlist.h" #include "pipeline.h" #include "llanimationstates.h" +#include "llviewercontrol.h" LLControlAvatar::LLControlAvatar(const LLUUID& id, const LLPCode pcode, LLViewerRegion* regionp) : LLVOAvatar(id, pcode, regionp), @@ -37,6 +38,7 @@ LLControlAvatar::LLControlAvatar(const LLUUID& id, const LLPCode pcode, LLViewer mGlobalScale(1.0f) { mIsControlAvatar = true; + mEnableDefaultMotions = false; } // virtual @@ -150,7 +152,7 @@ LLControlAvatar *LLControlAvatar::createControlAvatar(LLVOVolume *obj) cav->mSpecialRenderMode = 1; cav->updateJointLODs(); cav->updateGeometry(cav->mDrawable); - cav->startMotion(ANIM_AGENT_STAND, 5.0f); + //cav->startMotion(ANIM_AGENT_STAND, 5.0f); cav->hideSkirt(); // stop extraneous animations diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index f359c1455f..df69d6d197 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -5113,7 +5113,6 @@ void process_object_animation(LLMessageSystem *mesgsys, void **user_data) avatarp->updateGeom(volp); } avatarp->mSignaledAnimations.clear(); - volp->setDebugText(llformat("Animations %d", num_blocks)); for( S32 i = 0; i < num_blocks; i++ ) { diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 1c9f79b200..c1331bf521 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -665,7 +665,8 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mLastUpdateReceivedCOFVersion(-1), mCachedMuteListUpdateTime(0), mCachedInMuteList(false), - mIsControlAvatar(false) + mIsControlAvatar(false), + mEnableDefaultMotions(true) { LL_DEBUGS("AvatarRender") << "LLVOAvatar Constructor (0x" << this << ") id:" << mID << LL_ENDL; @@ -1798,7 +1799,11 @@ void LLVOAvatar::buildCharacter() mAahMorph = getVisualParam( "Express_Open_Mouth" ); } - startDefaultMotions(); + // Currently disabled for control avatars (animated objects), enabled for all others. + if (mEnableDefaultMotions) + { + startDefaultMotions(); + } //------------------------------------------------------------------------- // restart any currently active motions @@ -3411,6 +3416,7 @@ void LLVOAvatar::updateDebugText() addDebugText(mBakedTextureDebugText); } + // Develop -> Avatar -> Animation Info if (LLVOAvatar::sShowAnimationDebug) { for (LLMotionController::motion_list_t::iterator iter = mMotionController.getActiveMotions().begin(); @@ -5042,7 +5048,10 @@ void LLVOAvatar::processAnimationStateChanges() else if (mInAir && !mIsSitting) { stopMotion(ANIM_AGENT_WALK_ADJUST); - startMotion(ANIM_AGENT_FLY_ADJUST); + if (mEnableDefaultMotions) + { + startMotion(ANIM_AGENT_FLY_ADJUST); + } } else { @@ -5052,13 +5061,19 @@ void LLVOAvatar::processAnimationStateChanges() if ( isAnyAnimationSignaled(AGENT_GUN_AIM_ANIMS, NUM_AGENT_GUN_AIM_ANIMS) ) { - startMotion(ANIM_AGENT_TARGET); + if (mEnableDefaultMotions) + { + startMotion(ANIM_AGENT_TARGET); + } stopMotion(ANIM_AGENT_BODY_NOISE); } else { stopMotion(ANIM_AGENT_TARGET); - startMotion(ANIM_AGENT_BODY_NOISE); + if (mEnableDefaultMotions) + { + startMotion(ANIM_AGENT_BODY_NOISE); + } } // clear all current animations @@ -6670,7 +6685,10 @@ void LLVOAvatar::getOffObject() mRoot->setRotation(cur_rotation_world); mRoot->getXform()->update(); - startMotion(ANIM_AGENT_BODY_NOISE); + if (mEnableDefaultMotions) + { + startMotion(ANIM_AGENT_BODY_NOISE); + } if (isSelf()) { diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 2832f940f4..2b71cfbe61 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -242,7 +242,7 @@ private: //aligned members // Updates //-------------------------------------------------------------------- public: - void updateDebugText(); + virtual void updateDebugText(); virtual BOOL updateCharacter(LLAgent &agent); void idleUpdateVoiceVisualizer(bool voice_enabled); void idleUpdateMisc(bool detailed_update); @@ -443,10 +443,11 @@ public: VisualMuteSettings mVisuallyMuteSetting; // Always or never visually mute this AV //-------------------------------------------------------------------- - // NPC status + // animated object status //-------------------------------------------------------------------- public: bool mIsControlAvatar; + bool mEnableDefaultMotions; //-------------------------------------------------------------------- // Morph masks -- cgit v1.2.3 From 4907e437c1a9523e3b3d098403da8c780c6345f9 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 20 Jun 2017 15:04:11 +0100 Subject: SL-731 - control avatar has pointer back to associated volume. Can use this link to find associated inventory item name for an animation in debug display. --- indra/newview/llcontrolavatar.cpp | 43 ++++++++++++++++++--------------------- indra/newview/llcontrolavatar.h | 6 ++++-- indra/newview/llviewermessage.cpp | 2 +- indra/newview/llviewerobject.cpp | 2 +- indra/newview/llvoavatar.cpp | 25 ++++++++++++++++++++--- 5 files changed, 48 insertions(+), 30 deletions(-) (limited to 'indra') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 8027ea9c73..61055f6f58 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -46,17 +46,17 @@ LLControlAvatar::~LLControlAvatar() { } -void LLControlAvatar::matchTransform(LLVOVolume *obj) +void LLControlAvatar::matchVolumeTransform() { - setPositionAgent(obj->getRenderPosition()); + setPositionAgent(mVolp->getRenderPosition()); //slamPosition(); LLQuaternion fix_axes_rot(-F_PI_BY_TWO, LLVector3(0,0,1)); - LLQuaternion obj_rot = obj->getRotation(); + LLQuaternion obj_rot = mVolp->getRotation(); LLQuaternion result_rot = fix_axes_rot * obj_rot; setRotation(result_rot); mRoot->setWorldRotation(result_rot); - mRoot->setPosition(obj->getRenderPosition()); + mRoot->setPosition(mVolp->getRenderPosition()); } void LLControlAvatar::setGlobalScale(F32 scale) @@ -89,20 +89,20 @@ void LLControlAvatar::recursiveScaleJoint(LLJoint* joint, F32 factor) } // Based on LLViewerJointAttachment::setupDrawable(), without the attaching part. -void LLControlAvatar::updateGeom(LLVOVolume *obj) +void LLControlAvatar::updateVolumeGeom() { - if (!obj->mDrawable) + if (!mVolp->mDrawable) return; - if (obj->mDrawable->isActive()) + if (mVolp->mDrawable->isActive()) { - obj->mDrawable->makeStatic(FALSE); + mVolp->mDrawable->makeStatic(FALSE); } - obj->mDrawable->makeActive(); - gPipeline.markMoved(obj->mDrawable); - gPipeline.markTextured(obj->mDrawable); // face may need to change draw pool to/from POOL_HUD - obj->mDrawable->setState(LLDrawable::USE_BACKLIGHT); + mVolp->mDrawable->makeActive(); + gPipeline.markMoved(mVolp->mDrawable); + gPipeline.markTextured(mVolp->mDrawable); // face may need to change draw pool to/from POOL_HUD + mVolp->mDrawable->setState(LLDrawable::USE_BACKLIGHT); - LLViewerObject::const_child_list_t& child_list = obj->getChildren(); + LLViewerObject::const_child_list_t& child_list = mVolp->getChildren(); for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin(); iter != child_list.end(); ++iter) { @@ -115,14 +115,14 @@ void LLControlAvatar::updateGeom(LLVOVolume *obj) } } - gPipeline.markRebuild(obj->mDrawable, LLDrawable::REBUILD_ALL, TRUE); - obj->markForUpdate(TRUE); + gPipeline.markRebuild(mVolp->mDrawable, LLDrawable::REBUILD_ALL, TRUE); + mVolp->markForUpdate(TRUE); // Note that attachment overrides aren't needed here, have already // been applied at the time the mControlAvatar was created, in // llvovolume.cpp. - matchTransform(obj); + matchVolumeTransform(); // AXON testing scale @@ -147,6 +147,9 @@ LLControlAvatar *LLControlAvatar::createControlAvatar(LLVOVolume *obj) { // AXON Lifted from LLPreviewAnimation LLControlAvatar *cav = (LLControlAvatar*)gObjectList.createObjectViewer(LL_PCODE_LEGACY_AVATAR, gAgent.getRegion(), CO_FLAG_CONTROL_AVATAR); + + cav->mVolp = obj; + cav->createDrawable(&gPipeline); cav->mIsDummy = TRUE; cav->mSpecialRenderMode = 1; @@ -155,14 +158,8 @@ LLControlAvatar *LLControlAvatar::createControlAvatar(LLVOVolume *obj) //cav->startMotion(ANIM_AGENT_STAND, 5.0f); cav->hideSkirt(); - // stop extraneous animations - cav->stopMotion( ANIM_AGENT_HEAD_ROT, TRUE ); - cav->stopMotion( ANIM_AGENT_EYE, TRUE ); - cav->stopMotion( ANIM_AGENT_BODY_NOISE, TRUE ); - cav->stopMotion( ANIM_AGENT_BREATHE_ROT, TRUE ); - // Sync up position/rotation with object - cav->matchTransform(obj); + cav->matchVolumeTransform(); return cav; } diff --git a/indra/newview/llcontrolavatar.h b/indra/newview/llcontrolavatar.h index a783b9228f..f29388e035 100644 --- a/indra/newview/llcontrolavatar.h +++ b/indra/newview/llcontrolavatar.h @@ -39,8 +39,8 @@ public: LLControlAvatar(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp); virtual ~LLControlAvatar(); - void matchTransform(LLVOVolume *obj); - void updateGeom(LLVOVolume *obj); + void matchVolumeTransform(); + void updateVolumeGeom(); void setGlobalScale(F32 scale); void recursiveScaleJoint(LLJoint *joint, F32 factor); @@ -49,6 +49,8 @@ public: bool mPlaying; F32 mGlobalScale; + + LLVOVolume *mVolp; }; #endif //LL_CONTROLAVATAR_H diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index df69d6d197..ff33fe79fa 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -5110,7 +5110,7 @@ void process_object_animation(LLMessageSystem *mesgsys, void **user_data) if (!avatarp->mPlaying) { avatarp->mPlaying = true; - avatarp->updateGeom(volp); + avatarp->updateVolumeGeom(); } avatarp->mSignaledAnimations.clear(); diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index ff808ba079..f1c7cfae0d 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -4010,7 +4010,7 @@ void LLViewerObject::setPosition(const LLVector3 &pos, BOOL damped) } if (mControlAvatar) { - mControlAvatar->matchTransform(dynamic_cast(this)); + mControlAvatar->matchVolumeTransform(); } } diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index c1331bf521..c1b0f42c84 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -3426,8 +3426,27 @@ void LLVOAvatar::updateDebugText() if (motionp->getMinPixelArea() < getPixelArea()) { std::string output; - if (motionp->getName().empty()) + std::string motion_name = motionp->getName(); + if (motion_name.empty()) { + if (isControlAvatar()) + { + LLControlAvatar *control_av = dynamic_cast(this); + // Try to get name from inventory of associated object + LLVOVolume *volp = control_av->mVolp; + if (volp) + { + volp->requestInventory(); // AXON should be a no-op if already requested or fetched? + LLViewerInventoryItem* item = volp->getInventoryItemByAsset(motionp->getID()); + if (item) + { + motion_name = item->getName(); + } + } + } + } + if (motion_name.empty()) + { output = llformat("%s - %d", gAgent.isGodlikeWithoutAdminMenuFakery() ? motionp->getID().asString().c_str() : @@ -3437,8 +3456,8 @@ void LLVOAvatar::updateDebugText() else { output = llformat("%s - %d", - motionp->getName().c_str(), - (U32)motionp->getPriority()); + motion_name.c_str(), + (U32)motionp->getPriority()); } addDebugText(output); } -- cgit v1.2.3 From 30b241d8a30ef48d39064f7edc844aa653c396e8 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 20 Jun 2017 20:19:42 +0100 Subject: SL-731 - don't fetch animated object inventory unless needed for debug display --- indra/newview/llvovolume.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 59e1895bc6..150769845b 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4840,7 +4840,6 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) { vobj->mControlAvatar = LLControlAvatar::createControlAvatar(vobj); vobj->mControlAvatar->addAttachmentOverridesForObject(vobj); - vobj->requestInventory(); } if (vobj->mControlAvatar) { -- cgit v1.2.3 From 3c8ff04c0fa5c891a0454d7542f78f65eb5032dc Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 21 Jun 2017 15:25:50 +0100 Subject: SL-722 - animated object checkbox is based on state of root prim. Enabled only when root prim or whole linkset is being edited. --- indra/newview/llpanelvolume.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'indra') diff --git a/indra/newview/llpanelvolume.cpp b/indra/newview/llpanelvolume.cpp index f34194db19..5e87c174d6 100644 --- a/indra/newview/llpanelvolume.cpp +++ b/indra/newview/llpanelvolume.cpp @@ -238,6 +238,11 @@ void LLPanelVolume::getState( ) { volobjp = (LLVOVolume *)objectp; } + LLVOVolume *root_volobjp = NULL; + if (root_objectp && (root_objectp->getPCode() == LL_PCODE_VOLUME)) + { + root_volobjp = (LLVOVolume *)root_objectp; + } if( !objectp ) { @@ -350,13 +355,17 @@ void LLPanelVolume::getState( ) } // Animated Mesh - BOOL is_animated_mesh = volobjp && volobjp->getExtendedMeshFlags() & LLExtendedMeshParams::ANIMATED_MESH_ENABLED_FLAG; + BOOL is_animated_mesh = root_volobjp && root_volobjp->isAnimatedObject(); getChild("Animated Mesh Checkbox Ctrl")->setValue(is_animated_mesh); // AXON FIXME CHECK FOR SKIN INFO ALSO // WHAT ABOUT isPermanentEnforced? // What about linksets with some skinned objects? - BOOL can_be_animated_object = volobjp && volobjp->canBeAnimatedObject() && editable; - getChildView("Animated Mesh Checkbox Ctrl")->setEnabled(can_be_animated_object); + BOOL enabled_animated_object_box = FALSE; + if (root_volobjp && root_volobjp == volobjp) + { + enabled_animated_object_box = root_volobjp && root_volobjp->canBeAnimatedObject() && editable; + } + getChildView("Animated Mesh Checkbox Ctrl")->setEnabled(enabled_animated_object_box); // Flexible properties BOOL is_flexible = volobjp && volobjp->isFlexible(); -- cgit v1.2.3 From b6aedb116f60b9e4823f61b945b3f374d9267c1d Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 27 Jun 2017 14:15:42 +0100 Subject: SL-722 - in progress on managing animated object state with linksets --- indra/newview/llcontrolavatar.cpp | 28 ++++++++--------- indra/newview/llcontrolavatar.h | 2 +- indra/newview/llviewermessage.cpp | 2 +- indra/newview/llviewerobject.cpp | 65 +++++++++++++++++++++++++++++++++------ indra/newview/llviewerobject.h | 11 +++++++ indra/newview/llvoavatar.cpp | 6 ++-- indra/newview/llvovolume.cpp | 30 +++++++++++------- 7 files changed, 105 insertions(+), 39 deletions(-) (limited to 'indra') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 61055f6f58..26c4865e4c 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -48,15 +48,15 @@ LLControlAvatar::~LLControlAvatar() void LLControlAvatar::matchVolumeTransform() { - setPositionAgent(mVolp->getRenderPosition()); + setPositionAgent(mRootVolp->getRenderPosition()); //slamPosition(); LLQuaternion fix_axes_rot(-F_PI_BY_TWO, LLVector3(0,0,1)); - LLQuaternion obj_rot = mVolp->getRotation(); + LLQuaternion obj_rot = mRootVolp->getRotation(); LLQuaternion result_rot = fix_axes_rot * obj_rot; setRotation(result_rot); mRoot->setWorldRotation(result_rot); - mRoot->setPosition(mVolp->getRenderPosition()); + mRoot->setPosition(mRootVolp->getRenderPosition()); } void LLControlAvatar::setGlobalScale(F32 scale) @@ -91,18 +91,18 @@ void LLControlAvatar::recursiveScaleJoint(LLJoint* joint, F32 factor) // Based on LLViewerJointAttachment::setupDrawable(), without the attaching part. void LLControlAvatar::updateVolumeGeom() { - if (!mVolp->mDrawable) + if (!mRootVolp->mDrawable) return; - if (mVolp->mDrawable->isActive()) + if (mRootVolp->mDrawable->isActive()) { - mVolp->mDrawable->makeStatic(FALSE); + mRootVolp->mDrawable->makeStatic(FALSE); } - mVolp->mDrawable->makeActive(); - gPipeline.markMoved(mVolp->mDrawable); - gPipeline.markTextured(mVolp->mDrawable); // face may need to change draw pool to/from POOL_HUD - mVolp->mDrawable->setState(LLDrawable::USE_BACKLIGHT); + mRootVolp->mDrawable->makeActive(); + gPipeline.markMoved(mRootVolp->mDrawable); + gPipeline.markTextured(mRootVolp->mDrawable); // face may need to change draw pool to/from POOL_HUD + mRootVolp->mDrawable->setState(LLDrawable::USE_BACKLIGHT); - LLViewerObject::const_child_list_t& child_list = mVolp->getChildren(); + LLViewerObject::const_child_list_t& child_list = mRootVolp->getChildren(); for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin(); iter != child_list.end(); ++iter) { @@ -115,8 +115,8 @@ void LLControlAvatar::updateVolumeGeom() } } - gPipeline.markRebuild(mVolp->mDrawable, LLDrawable::REBUILD_ALL, TRUE); - mVolp->markForUpdate(TRUE); + gPipeline.markRebuild(mRootVolp->mDrawable, LLDrawable::REBUILD_ALL, TRUE); + mRootVolp->markForUpdate(TRUE); // Note that attachment overrides aren't needed here, have already // been applied at the time the mControlAvatar was created, in @@ -148,7 +148,7 @@ LLControlAvatar *LLControlAvatar::createControlAvatar(LLVOVolume *obj) // AXON Lifted from LLPreviewAnimation LLControlAvatar *cav = (LLControlAvatar*)gObjectList.createObjectViewer(LL_PCODE_LEGACY_AVATAR, gAgent.getRegion(), CO_FLAG_CONTROL_AVATAR); - cav->mVolp = obj; + cav->mRootVolp = obj; cav->createDrawable(&gPipeline); cav->mIsDummy = TRUE; diff --git a/indra/newview/llcontrolavatar.h b/indra/newview/llcontrolavatar.h index f29388e035..bb54cc5b2d 100644 --- a/indra/newview/llcontrolavatar.h +++ b/indra/newview/llcontrolavatar.h @@ -50,7 +50,7 @@ public: F32 mGlobalScale; - LLVOVolume *mVolp; + LLVOVolume *mRootVolp; }; #endif //LL_CONTROLAVATAR_H diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index ff33fe79fa..f8cdb5bf92 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -5097,7 +5097,7 @@ void process_object_animation(LLMessageSystem *mesgsys, void **user_data) return; } - LLControlAvatar *avatarp = volp->mControlAvatar; + LLControlAvatar *avatarp = volp->getControlAvatar(); if (!avatarp) { LL_WARNS() << "AXON no control avatar, ignoring" << LL_ENDL; diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index f1c7cfae0d..bd0e864f80 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -383,11 +383,9 @@ void LLViewerObject::markDead() // This case is needed for indirectly attached mesh objects. av->resetJointsOnDetach(mesh_id); } - if (mControlAvatar) + if (getControlAvatar()) { - LLControlAvatar *av = mControlAvatar; - mControlAvatar = NULL; - av->markDead(); + unlinkControlAvatar(); } // Mark itself as dead @@ -2917,6 +2915,55 @@ void LLViewerObject::fetchInventoryFromServer() } } +LLControlAvatar *LLViewerObject::getControlAvatar() +{ + return getRootEdit()->mControlAvatar.get(); +} + +LLControlAvatar *LLViewerObject::getControlAvatar() const +{ + return getRootEdit()->mControlAvatar.get(); +} + +void LLViewerObject::linkControlAvatar() +{ + if (!getControlAvatar() && isRootEdit()) + { + LLVOVolume *volp = dynamic_cast(this); + if (!volp) + { + LL_WARNS() << "called with null or non-volume object" << LL_ENDL; + return; + } + mControlAvatar = LLControlAvatar::createControlAvatar(volp); + } + if (getControlAvatar()) + { + getControlAvatar()->addAttachmentOverridesForObject(this); + } + else + { + LL_WARNS() << "no control avatar found!" << LL_ENDL; + } +} + +void LLViewerObject::unlinkControlAvatar() +{ + if (getControlAvatar()) + { + getControlAvatar()->resetJointsOnDetach(this); + } + if (isRootEdit()) + { + // This will remove the entire linkset from the control avatar + LLControlAvatar *av = mControlAvatar; + mControlAvatar = NULL; + av->markDead(); + } + // For non-root prims, removing from the linkset will + // automatically remove the control avatar connection. +} + struct LLFilenameAndTask { LLUUID mTaskID; @@ -3872,7 +3919,7 @@ const LLVector3 LLViewerObject::getRenderPosition() const if (mDrawable.notNull() && mDrawable->isState(LLDrawable::RIGGED)) { LLVOAvatar* avatar = getAvatar(); - if (avatar && !mControlAvatar) + if (avatar && !getControlAvatar()) { return avatar->getPositionAgent(); } @@ -4008,9 +4055,9 @@ void LLViewerObject::setPosition(const LLVector3 &pos, BOOL damped) // position caches need to be up to date on root objects updatePositionCaches(); } - if (mControlAvatar) + if (getControlAvatar() && isRootEdit()) { - mControlAvatar->matchVolumeTransform(); + getControlAvatar()->matchVolumeTransform(); } } @@ -6377,9 +6424,9 @@ const std::string& LLViewerObject::getAttachmentItemName() const //virtual LLVOAvatar* LLViewerObject::getAvatar() const { - if (mControlAvatar) + if (getControlAvatar()) { - return mControlAvatar; + return getControlAvatar(); } if (isAttachment()) { diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index e727567957..bef00e2bab 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -684,6 +684,17 @@ public: static BOOL sUseSharedDrawables; +public: + // Returns mControlAvatar for the edit root prim of this linkset + LLControlAvatar *getControlAvatar(); + LLControlAvatar *getControlAvatar() const; + + // Create or connect to an existing control av as applicable + void linkControlAvatar(); + // Remove any reference to control av for this prim + void unlinkControlAvatar(); + +private: LLPointer mControlAvatar; protected: diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index beb6f08899..c268ab5f3c 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -3433,7 +3433,7 @@ void LLVOAvatar::updateDebugText() { LLControlAvatar *control_av = dynamic_cast(this); // Try to get name from inventory of associated object - LLVOVolume *volp = control_av->mVolp; + LLVOVolume *volp = control_av->mRootVolp; if (volp) { volp->requestInventory(); // AXON should be a no-op if already requested or fetched? @@ -5565,14 +5565,14 @@ void LLVOAvatar::addAttachmentOverridesForObject(LLViewerObject *vo) { bool non_attached_case = false; // FIXME AXON - will this work if vo has child objects? - if (vo->mControlAvatar) + if (vo->getControlAvatar()) { non_attached_case = true; } LLVOAvatar *av; if (non_attached_case) { - av = vo->mControlAvatar; + av = vo->getControlAvatar(); } else { diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 150769845b..da24d9f9c2 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -3311,6 +3311,10 @@ void LLVOVolume::setExtendedMeshFlags(U32 flags) bool LLVOVolume::canBeAnimatedObject() const { if (!isMesh()) + { + return false; + } + if (isAttachment()) { return false; } @@ -4830,20 +4834,24 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) vobj->isMesh() && gMeshRepo.getSkinInfo(vobj->getVolume()->getParams().getSculptID(), vobj); - bool rigged_non_attachment = !vobj->isAttachment() && - vobj->isMesh() && - gMeshRepo.getSkinInfo(vobj->getVolume()->getParams().getSculptID(), vobj); - - if (rigged_non_attachment) + if (vobj->isAnimatedObject()) { - if (!vobj->mControlAvatar) + if (!vobj->getControlAvatar()) { - vobj->mControlAvatar = LLControlAvatar::createControlAvatar(vobj); - vobj->mControlAvatar->addAttachmentOverridesForObject(vobj); + vobj->linkControlAvatar(); } - if (vobj->mControlAvatar) + if (vobj->getControlAvatar()) + { + pAvatarVO = vobj->getControlAvatar(); + } + } + else + { + // Not animated but has a control avatar - probably + // the checkbox has changed since the last rebuild. + if (vobj->getControlAvatar()) { - pAvatarVO = vobj->mControlAvatar; + vobj->unlinkControlAvatar(); } } @@ -4880,7 +4888,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) //sum up face verts and indices drawablep->updateFaceSize(i); - if (rigged || (vobj->mControlAvatar && vobj->mControlAvatar->mPlaying)) + if (rigged || (vobj->getControlAvatar() && vobj->getControlAvatar()->mPlaying)) { if (!facep->isState(LLFace::RIGGED)) { //completely reset vertex buffer -- cgit v1.2.3 From 7af46e7fe37552175c46a9366e9574bb9c716a68 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 27 Jun 2017 20:24:15 +0100 Subject: SL-722 - defer markDead() for LLControlAvatar when unlinking. Fixes asset crash in pipeline. Also added various checks for mDrawable null in llvoavatar.cpp. --- indra/newview/llcontrolavatar.cpp | 24 +++++++++++++++-- indra/newview/llcontrolavatar.h | 9 +++++++ indra/newview/llviewerobject.cpp | 2 +- indra/newview/llvoavatar.cpp | 55 +++++++++++++++++++++++++++------------ 4 files changed, 70 insertions(+), 20 deletions(-) (limited to 'indra') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 26c4865e4c..6fc3d52fe7 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -35,7 +35,8 @@ LLControlAvatar::LLControlAvatar(const LLUUID& id, const LLPCode pcode, LLViewerRegion* regionp) : LLVOAvatar(id, pcode, regionp), mPlaying(false), - mGlobalScale(1.0f) + mGlobalScale(1.0f), + mMarkedForDeath(false) { mIsControlAvatar = true; mEnableDefaultMotions = false; @@ -155,7 +156,6 @@ LLControlAvatar *LLControlAvatar::createControlAvatar(LLVOVolume *obj) cav->mSpecialRenderMode = 1; cav->updateJointLODs(); cav->updateGeometry(cav->mDrawable); - //cav->startMotion(ANIM_AGENT_STAND, 5.0f); cav->hideSkirt(); // Sync up position/rotation with object @@ -164,3 +164,23 @@ LLControlAvatar *LLControlAvatar::createControlAvatar(LLVOVolume *obj) return cav; } +void LLControlAvatar::markForDeath() +{ + mMarkedForDeath = true; +} + +// static +void LLControlAvatar::idleUpdate(LLAgent &agent, const F64 &time) +{ + if (mMarkedForDeath) + { + markDead(); + mMarkedForDeath = false; + } + else + { + LLVOAvatar::idleUpdate(agent,time); + } +} + + diff --git a/indra/newview/llcontrolavatar.h b/indra/newview/llcontrolavatar.h index bb54cc5b2d..5cca0ab9dd 100644 --- a/indra/newview/llcontrolavatar.h +++ b/indra/newview/llcontrolavatar.h @@ -46,11 +46,20 @@ public: void recursiveScaleJoint(LLJoint *joint, F32 factor); static LLControlAvatar *createControlAvatar(LLVOVolume *obj); + // Delayed kill so we don't make graphics pipeline unhappy calling + // markDead() inside other graphics pipeline operations. + void markForDeath(); + + virtual void idleUpdate(LLAgent &agent, const F64 &time); + bool mPlaying; F32 mGlobalScale; LLVOVolume *mRootVolp; + + bool mMarkedForDeath; + }; #endif //LL_CONTROLAVATAR_H diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index bd0e864f80..06efb1bc3a 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -2958,7 +2958,7 @@ void LLViewerObject::unlinkControlAvatar() // This will remove the entire linkset from the control avatar LLControlAvatar *av = mControlAvatar; mControlAvatar = NULL; - av->markDead(); + av->markForDeath(); } // For non-root prims, removing from the linkset will // automatically remove the control avatar connection. diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index c268ab5f3c..4ed924f828 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -1225,8 +1225,6 @@ const LLVector3 LLVOAvatar::getRenderPosition() const { return getPosition() * mDrawable->getParent()->getRenderMatrix(); } - - } void LLVOAvatar::updateDrawable(BOOL force_damped) @@ -1243,6 +1241,10 @@ void LLVOAvatar::onShift(const LLVector4a& shift_vector) void LLVOAvatar::updateSpatialExtents(LLVector4a& newMin, LLVector4a &newMax) { + if (mDrawable.isNull()) + { + return; + } if (isImpostor() && !needsImpostorUpdate()) { LLVector3 delta = getRenderPosition() - @@ -1971,15 +1973,15 @@ void LLVOAvatar::releaseMeshData() LLFace* facep = mDrawable->getFace(0); if (facep) { - facep->setSize(0, 0); - for(S32 i = mNumInitFaces ; i < mDrawable->getNumFaces(); i++) - { - facep = mDrawable->getFace(i); + facep->setSize(0, 0); + for(S32 i = mNumInitFaces ; i < mDrawable->getNumFaces(); i++) + { + facep = mDrawable->getFace(i); if (facep) { - facep->setSize(0, 0); - } - } + facep->setSize(0, 0); + } + } } } @@ -2003,6 +2005,10 @@ void LLVOAvatar::releaseMeshData() void LLVOAvatar::restoreMeshData() { llassert(!isSelf()); + if (mDrawable.isNull()) + { + return; + } //LL_INFOS() << "Restoring" << LL_ENDL; mMeshValid = TRUE; @@ -2580,13 +2586,16 @@ void LLVOAvatar::idleUpdateMisc(bool detailed_update) } } - mDrawable->movePartition(); - - //force a move if sitting on an active object - if (getParent() && ((LLViewerObject*) getParent())->mDrawable->isActive()) - { - gPipeline.markMoved(mDrawable, TRUE); - } + if (mDrawable.notNull()) + { + mDrawable->movePartition(); + + //force a move if sitting on an active object + if (getParent() && ((LLViewerObject*) getParent())->mDrawable->isActive()) + { + gPipeline.markMoved(mDrawable, TRUE); + } + } } void LLVOAvatar::idleUpdateAppearanceAnimation() @@ -3504,7 +3513,9 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) //-------------------------------------------------------------------- bool visually_muted = isVisuallyMuted(); - if (visible && (!isSelf() || visually_muted) && !mIsDummy && sUseImpostors && !mNeedsAnimUpdate && !sFreezeCounter) + // AXON FIXME this expression is a crawling horror + if (mDrawable.notNull() && visible && (!isSelf() || visually_muted) && + !mIsDummy && sUseImpostors && !mNeedsAnimUpdate && !sFreezeCounter) { const LLVector4a* ext = mDrawable->getSpatialExtents(); LLVector4a size; @@ -4223,6 +4234,11 @@ U32 LLVOAvatar::renderSkinned() return num_indices; } + if (mDrawable.isNull()) + { + return num_indices; + } + LLFace* face = mDrawable->getFace(0); bool needs_rebuild = !face || !face->getVertexBuffer() || mDrawable->isState(LLDrawable::REBUILD_GEOMETRY); @@ -8845,6 +8861,11 @@ void LLVOAvatar::updateFreezeCounter(S32 counter) BOOL LLVOAvatar::updateLOD() { + if (mDrawable.isNull()) + { + return FALSE; + } + if (isImpostor() && 0 != mDrawable->getNumFaces() && mDrawable->getFace(0)->hasGeometry()) { return TRUE; -- cgit v1.2.3 From 0b57379b127b9ef5f925f52176544ac8f447ce1f Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 27 Jun 2017 20:52:02 +0100 Subject: SL-722 - animated mesh checkbox inactive unless there's a single object or linkset, all volumes --- indra/newview/llpanelvolume.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'indra') diff --git a/indra/newview/llpanelvolume.cpp b/indra/newview/llpanelvolume.cpp index 5e87c174d6..c5fbc1f71b 100644 --- a/indra/newview/llpanelvolume.cpp +++ b/indra/newview/llpanelvolume.cpp @@ -266,6 +266,8 @@ void LLPanelVolume::getState( ) BOOL editable = root_objectp->permModify() && !root_objectp->isPermanentEnforced(); BOOL single_volume = LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME ) && LLSelectMgr::getInstance()->getSelection()->getObjectCount() == 1; + BOOL single_root_volume = LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME ) && + LLSelectMgr::getInstance()->getSelection()->getRootObjectCount() == 1; // Select Single Message if (single_volume) @@ -355,7 +357,7 @@ void LLPanelVolume::getState( ) } // Animated Mesh - BOOL is_animated_mesh = root_volobjp && root_volobjp->isAnimatedObject(); + BOOL is_animated_mesh = single_root_volume && root_volobjp && root_volobjp->isAnimatedObject(); getChild("Animated Mesh Checkbox Ctrl")->setValue(is_animated_mesh); // AXON FIXME CHECK FOR SKIN INFO ALSO // WHAT ABOUT isPermanentEnforced? @@ -363,7 +365,7 @@ void LLPanelVolume::getState( ) BOOL enabled_animated_object_box = FALSE; if (root_volobjp && root_volobjp == volobjp) { - enabled_animated_object_box = root_volobjp && root_volobjp->canBeAnimatedObject() && editable; + enabled_animated_object_box = single_root_volume && root_volobjp && root_volobjp->canBeAnimatedObject() && editable; } getChildView("Animated Mesh Checkbox Ctrl")->setEnabled(enabled_animated_object_box); -- cgit v1.2.3 From c2280848e1714329172ea4c0881993aa62f3cd8f Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 28 Jun 2017 22:17:28 +0100 Subject: SL-722 - work on support for animated object state when linkset-altering operations take place --- indra/newview/llviewerobject.cpp | 1 - indra/newview/llviewerobject.h | 2 +- indra/newview/llvovolume.cpp | 107 ++++++++++++++++++++++++++++++++++++++- indra/newview/llvovolume.h | 2 + 4 files changed, 108 insertions(+), 4 deletions(-) (limited to 'indra') diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 06efb1bc3a..9a6153d3e6 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -377,7 +377,6 @@ void LLViewerObject::markDead() ((LLViewerObject *)getParent())->removeChild(this); } LLUUID mesh_id; - // FIXME AXON - need to do this for control avatars too if (av && LLVOAvatar::getRiggedMeshID(this,mesh_id)) { // This case is needed for indirectly attached mesh objects. diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index bef00e2bab..1967841fd9 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -694,7 +694,7 @@ public: // Remove any reference to control av for this prim void unlinkControlAvatar(); -private: +protected: LLPointer mControlAvatar; protected: diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index da24d9f9c2..b22d1c45a8 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -1391,7 +1391,8 @@ void LLVOVolume::updateFaceFlags() BOOL LLVOVolume::setParent(LLViewerObject* parent) { BOOL ret = FALSE ; - if (parent != getParent()) + LLViewerObject *old_parent = (LLViewerObject*) getParent(); + if (parent != old_parent) { ret = LLViewerObject::setParent(parent); if (ret && mDrawable) @@ -1399,6 +1400,7 @@ BOOL LLVOVolume::setParent(LLViewerObject* parent) gPipeline.markMoved(mDrawable); gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_VOLUME, TRUE); } + updateAnimatedObjectState(old_parent, parent); } return ret ; @@ -3328,7 +3330,108 @@ bool LLVOVolume::canBeAnimatedObject() const bool LLVOVolume::isAnimatedObject() const { - return canBeAnimatedObject() && (getExtendedMeshFlags() & LLExtendedMeshParams::ANIMATED_MESH_ENABLED_FLAG); + LLVOVolume *root_vol = (LLVOVolume*)getRootEdit(); + bool can_be_animated = canBeAnimatedObject(); + bool root_can_be_animated = root_vol->canBeAnimatedObject(); + bool root_is_animated = root_vol->getExtendedMeshFlags() & LLExtendedMeshParams::ANIMATED_MESH_ENABLED_FLAG; + if (can_be_animated && root_can_be_animated && root_is_animated) + { + return true; + } + return false; +} + +// Make sure animated objects in a linkset are consistent. The rules are: +// Only the root of a linkset can have the animated object flag set +// Only the root of a linkset can have a control avatar (iff the animated object flag is set) +// Only skinned mesh volumes can have the animated object flag set, or a control avatar +bool LLVOVolume::isAnimatedObjectStateConsistent() const +{ + if (!canBeAnimatedObject()) + { + if ((getExtendedMeshFlags() & LLExtendedMeshParams::ANIMATED_MESH_ENABLED_FLAG) || + mControlAvatar.notNull()) + { + LL_WARNS("AXON") << "Non animatable object has mesh enabled flag or mControlAvatar. Flags " + << getExtendedMeshFlags() << " cav " << mControlAvatar.get() << LL_ENDL; + return false; + } + } + if (!isRootEdit()) + { + if ((getExtendedMeshFlags() & LLExtendedMeshParams::ANIMATED_MESH_ENABLED_FLAG) || + mControlAvatar.notNull()) + { + LL_WARNS("AXON") << "Non root object has mesh enabled flag or mControlAvatar. Flags " + << getExtendedMeshFlags() << " cav " << mControlAvatar.get() << LL_ENDL; + return false; + } + } + // If we get here, we have a potentially animatable root volume. + bool is_animation_enabled = getExtendedMeshFlags() & LLExtendedMeshParams::ANIMATED_MESH_ENABLED_FLAG; + bool has_control_avatar = (mControlAvatar.notNull()); + if (is_animation_enabled != has_control_avatar) + { + LL_WARNS("AXON") << "Inconsistent state: animation enabled " << is_animation_enabled + << " has control avatar " << has_control_avatar + << " flags " << getExtendedMeshFlags() << " cav " << mControlAvatar.get() << LL_ENDL; + return false; + } + return true; +} + +// Called any time parenting changes for a volume. Update flags and +// control av accordingly. This is called after parent has been +// changed to new_parent. +void LLVOVolume::updateAnimatedObjectState(LLViewerObject *old_parent, LLViewerObject *new_parent) +{ + LLVOVolume *old_volp = dynamic_cast(old_parent); + LLVOVolume *new_volp = dynamic_cast(new_parent); + + if (new_parent) + { + // Object should inherit control avatar and animated mesh flag + // from parent, so clear them out from our own state + if (getExtendedMeshFlags() & LLExtendedMeshParams::ANIMATED_MESH_ENABLED_FLAG) + { + setExtendedMeshFlags(getExtendedMeshFlags() & ~LLExtendedMeshParams::ANIMATED_MESH_ENABLED_FLAG); + } + if (mControlAvatar.notNull()) + { + LLControlAvatar *av = mControlAvatar; + mControlAvatar = NULL; + av->markForDeath(); + } + // If this succeeds now, it's because the new_parent is an animated object + if (isAnimatedObject()) + { + getControlAvatar()->addAttachmentOverridesForObject(this); + } + } + if (old_volp && old_volp->isAnimatedObject()) + { + // W have been removed from an animated object, need to do cleanup. + old_volp->getControlAvatar()->resetJointsOnDetach(this); + } + + if (old_volp) + { + if (!old_volp->isAnimatedObjectStateConsistent()) + { + LL_WARNS("AXON") << "old_volp failed consistency check" << LL_ENDL; + } + } + if (new_volp) + { + if (!new_volp->isAnimatedObjectStateConsistent()) + { + LL_WARNS("AXON") << "new_volp failed consistency check" << LL_ENDL; + } + } + if (!isAnimatedObjectStateConsistent()) + { + LL_WARNS("AXON") << "child object failed consistency check" << LL_ENDL; + } } //---------------------------------------------------------------------------- diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h index 75dabd961a..27a51d100f 100644 --- a/indra/newview/llvovolume.h +++ b/indra/newview/llvovolume.h @@ -271,6 +271,8 @@ public: void setExtendedMeshFlags(U32 flags); bool canBeAnimatedObject() const; bool isAnimatedObject() const; + bool isAnimatedObjectStateConsistent() const; + void updateAnimatedObjectState(LLViewerObject *old_parent, LLViewerObject *new_parent); // Functions that deal with media, or media navigation -- cgit v1.2.3 From 999b0b47b59cb6be6f229066825bdec88f00304e Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 29 Jun 2017 14:15:58 +0100 Subject: SL-722 - crash fix --- indra/newview/llvovolume.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index b22d1c45a8..911575138b 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -3320,6 +3320,10 @@ bool LLVOVolume::canBeAnimatedObject() const { return false; } + if (!getVolume()) + { + return false; + } const LLMeshSkinInfo* skin = gMeshRepo.getSkinInfo(getVolume()->getParams().getSculptID(), this); if (!skin) { -- cgit v1.2.3 From a09cc5f4bb9ccf93db7233d0b1fd0142803b2f23 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 30 Jun 2017 20:49:23 +0100 Subject: SL-731 - added a hook for debug text specific to control avatars. Also renamed resetJointsOnDetach to removeAttachmentOverridesForObject to make the connection to addAttachmentOverridesForObject more obvious. --- indra/newview/llcontrolavatar.cpp | 6 ++++ indra/newview/llcontrolavatar.h | 2 ++ indra/newview/llviewermessage.cpp | 6 ++-- indra/newview/llviewerobject.cpp | 17 +++++---- indra/newview/llvoavatar.cpp | 76 +++++++++++++++++++-------------------- indra/newview/llvoavatar.h | 4 +-- indra/newview/llvovolume.cpp | 2 +- 7 files changed, 60 insertions(+), 53 deletions(-) (limited to 'indra') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 6fc3d52fe7..bd99f66459 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -183,4 +183,10 @@ void LLControlAvatar::idleUpdate(LLAgent &agent, const F64 &time) } } +//virtual +void LLControlAvatar::updateDebugText() +{ + addDebugText("I'm a control avatar"); + LLVOAvatar::updateDebugText(); +} diff --git a/indra/newview/llcontrolavatar.h b/indra/newview/llcontrolavatar.h index 5cca0ab9dd..fc7b4aa06d 100644 --- a/indra/newview/llcontrolavatar.h +++ b/indra/newview/llcontrolavatar.h @@ -52,6 +52,8 @@ public: virtual void idleUpdate(LLAgent &agent, const F64 &time); + virtual void updateDebugText(); + bool mPlaying; F32 mGlobalScale; diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index f8cdb5bf92..227c6afcb0 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -5105,7 +5105,7 @@ void process_object_animation(LLMessageSystem *mesgsys, void **user_data) } S32 num_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_AnimationList); - LL_WARNS() << "AXON handle object animation here, num_blocks " << num_blocks << LL_ENDL; + LL_DEBUGS("AXON") << "handle object animation here, num_blocks " << num_blocks << LL_ENDL; if (!avatarp->mPlaying) { @@ -5119,13 +5119,13 @@ void process_object_animation(LLMessageSystem *mesgsys, void **user_data) mesgsys->getUUIDFast(_PREHASH_AnimationList, _PREHASH_AnimID, animation_id, i); mesgsys->getS32Fast(_PREHASH_AnimationList, _PREHASH_AnimSequenceID, anim_sequence_id, i); avatarp->mSignaledAnimations[animation_id] = anim_sequence_id; - LL_INFOS() << "AXON got object animation request for object " + LL_DEBUGS("AXON") << "got object animation request for object " << uuid << " animation id " << animation_id << LL_ENDL; } if (num_blocks >= 0) { - LL_INFOS() << "AXON process animation state changes here" << LL_ENDL; + LL_DEBUGS("AXON") << "process animation state changes here" << LL_ENDL; avatarp->processAnimationStateChanges(); } } diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 9a6153d3e6..c6051650cf 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -371,17 +371,19 @@ void LLViewerObject::markDead() //LL_INFOS() << "Marking self " << mLocalID << " as dead." << LL_ENDL; // Root object of this hierarchy unlinks itself. - LLVOAvatar *av = getAvatarAncestor(); if (getParent()) { ((LLViewerObject *)getParent())->removeChild(this); } LLUUID mesh_id; - if (av && LLVOAvatar::getRiggedMeshID(this,mesh_id)) - { - // This case is needed for indirectly attached mesh objects. - av->resetJointsOnDetach(mesh_id); - } + { + LLVOAvatar *av = getAvatar(); + if (av && LLVOAvatar::getRiggedMeshID(this,mesh_id)) + { + // This case is needed for indirectly attached mesh objects. + av->removeAttachmentOverridesForObject(mesh_id); + } + } if (getControlAvatar()) { unlinkControlAvatar(); @@ -2950,7 +2952,7 @@ void LLViewerObject::unlinkControlAvatar() { if (getControlAvatar()) { - getControlAvatar()->resetJointsOnDetach(this); + getControlAvatar()->removeAttachmentOverridesForObject(this); } if (isRootEdit()) { @@ -5187,6 +5189,7 @@ LLVOAvatar* LLViewerObject::asAvatar() // If this object is directly or indirectly parented by an avatar, return it. LLVOAvatar* LLViewerObject::getAvatarAncestor() { + LL_ERRS("AXON") << "this method has been targetted for termination. Use getAvatar()." << LL_ENDL; LLViewerObject *pobj = (LLViewerObject*) getParent(); while (pobj) { diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 4ed924f828..9a1629fbfb 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -1409,13 +1409,29 @@ void LLVOAvatar::renderCollisionVolumes() static F32 sphere_scale = 1.0f; static F32 center_dot_scale = 0.05f; - static LLVector3 CV_COLOR_OCCLUDED(0.0f, 0.0f, 1.0f); - static LLVector3 CV_COLOR_VISIBLE(0.5f, 0.5f, 1.0f); - static LLVector3 DOT_COLOR_OCCLUDED(1.0f, 1.0f, 1.0f); - static LLVector3 DOT_COLOR_VISIBLE(1.0f, 1.0f, 1.0f); + static LLVector3 BLUE(0.0f, 0.0f, 1.0f); + static LLVector3 PASTEL_BLUE(0.5f, 0.5f, 1.0f); + static LLVector3 RED(1.0f, 0.0f, 0.0f); + static LLVector3 PASTEL_RED(1.0f, 0.5f, 0.5f); + static LLVector3 WHITE(1.0f, 1.0f, 1.0f); + - render_sphere_and_line(begin_pos, end_pos, sphere_scale, CV_COLOR_OCCLUDED, CV_COLOR_VISIBLE); - render_sphere_and_line(begin_pos, end_pos, center_dot_scale, DOT_COLOR_OCCLUDED, DOT_COLOR_VISIBLE); + LLVector3 cv_color_occluded; + LLVector3 cv_color_visible; + LLVector3 dot_color_occluded(WHITE); + LLVector3 dot_color_visible(WHITE); + if (isControlAvatar()) + { + cv_color_occluded = RED; + cv_color_visible = PASTEL_RED; + } + else + { + cv_color_occluded = BLUE; + cv_color_visible = PASTEL_BLUE; + } + render_sphere_and_line(begin_pos, end_pos, sphere_scale, cv_color_occluded, cv_color_visible); + render_sphere_and_line(begin_pos, end_pos, center_dot_scale, dot_color_occluded, dot_color_visible); gGL.popMatrix(); } @@ -1427,9 +1443,6 @@ void LLVOAvatar::renderCollisionVolumes() mNameText->lineSegmentIntersect(unused, unused, unused, TRUE); } - - mDebugText.clear(); - addDebugText(ostr.str()); } void LLVOAvatar::renderBones() @@ -3357,8 +3370,7 @@ bool LLVOAvatar::isInMuteList() void LLVOAvatar::updateDebugText() { - // clear debug text - mDebugText.clear(); + // Leave mDebugText uncleared here, in case a derived class has added some state first if (gSavedSettings.getBOOL("DebugAvatarAppearanceMessage")) { @@ -3482,8 +3494,7 @@ void LLVOAvatar::updateDebugText() { setDebugText(mDebugText); } - mDebugText.clear(); - + mDebugText.clear(); } //------------------------------------------------------------------------ @@ -5579,28 +5590,13 @@ void LLVOAvatar::rebuildAttachmentOverrides() //----------------------------------------------------------------------------- void LLVOAvatar::addAttachmentOverridesForObject(LLViewerObject *vo) { - bool non_attached_case = false; - // FIXME AXON - will this work if vo has child objects? - if (vo->getControlAvatar()) - { - non_attached_case = true; - } - LLVOAvatar *av; - if (non_attached_case) - { - av = vo->getControlAvatar(); - } - else + if (vo->getAvatar() != this) { - av = vo->getAvatarAncestor(); - if (!av || (av != this)) - { LL_WARNS("Avatar") << "called with invalid avatar" << LL_ENDL; return; - } } - LLScopedContextString str("addAttachmentOverridesForObject " + av->getFullname()); + LLScopedContextString str("addAttachmentOverridesForObject " + vo->getAvatar()->getFullname()); // Process all children LLViewerObject::const_child_list_t& children = vo->getChildren(); @@ -5626,7 +5622,7 @@ void LLVOAvatar::addAttachmentOverridesForObject(LLViewerObject *vo) LLUUID currentId = vobj->getVolume()->getParams().getSculptID(); const LLMeshSkinInfo* pSkinData = gMeshRepo.getSkinInfo( currentId, vobj ); - if ( vobj && (vobj->isAttachment()||non_attached_case) && vobj->isMesh() && pSkinData ) + if ( vobj && vobj->isMesh() && pSkinData ) { const int bindCnt = pSkinData->mAlternateBindMatrix.size(); const int jointCnt = pSkinData->mJointNames.size(); @@ -5808,15 +5804,15 @@ void LLVOAvatar::showAttachmentOverrides(bool verbose) const } //----------------------------------------------------------------------------- -// resetJointsOnDetach +// removeAttachmentOverridesForObject //----------------------------------------------------------------------------- // AXON handle NPC case -void LLVOAvatar::resetJointsOnDetach(LLViewerObject *vo) +void LLVOAvatar::removeAttachmentOverridesForObject(LLViewerObject *vo) { - LLVOAvatar *av = vo->getAvatarAncestor(); - if (!av || (av != this)) + if (vo->getAvatar() != this) { LL_WARNS("Avatar") << "called with invalid avatar" << LL_ENDL; + return; } // Process all children @@ -5825,22 +5821,22 @@ void LLVOAvatar::resetJointsOnDetach(LLViewerObject *vo) it != children.end(); ++it) { LLViewerObject *childp = *it; - resetJointsOnDetach(childp); + removeAttachmentOverridesForObject(childp); } // Process self. LLUUID mesh_id; if (getRiggedMeshID(vo,mesh_id)) { - resetJointsOnDetach(mesh_id); + removeAttachmentOverridesForObject(mesh_id); } } //----------------------------------------------------------------------------- -// resetJointsOnDetach +// removeAttachmentOverridesForObject //----------------------------------------------------------------------------- // AXON handle NPC case -void LLVOAvatar::resetJointsOnDetach(const LLUUID& mesh_id) +void LLVOAvatar::removeAttachmentOverridesForObject(const LLUUID& mesh_id) { //Subsequent joints are relative to pelvis avatar_joint_list_t::iterator iter = mSkeleton.begin(); @@ -6559,7 +6555,7 @@ void LLVOAvatar::cleanupAttachedMesh( LLViewerObject* pVO ) LLUUID mesh_id; if (getRiggedMeshID(pVO, mesh_id)) { - resetJointsOnDetach(mesh_id); + removeAttachmentOverridesForObject(mesh_id); if ( gAgentCamera.cameraCustomizeAvatar() ) { gAgent.unpauseAnimation(); diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 2b71cfbe61..406b9d8a22 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -202,8 +202,8 @@ public: LLJoint* getJoint(S32 num); void addAttachmentOverridesForObject(LLViewerObject *vo); - void resetJointsOnDetach(const LLUUID& mesh_id); - void resetJointsOnDetach(LLViewerObject *vo); + void removeAttachmentOverridesForObject(const LLUUID& mesh_id); + void removeAttachmentOverridesForObject(LLViewerObject *vo); bool jointIsRiggedTo(const std::string& joint_name); bool jointIsRiggedTo(const std::string& joint_name, const LLViewerObject *vo); void clearAttachmentOverrides(); diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 911575138b..94556a9f70 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -3415,7 +3415,7 @@ void LLVOVolume::updateAnimatedObjectState(LLViewerObject *old_parent, LLViewerO if (old_volp && old_volp->isAnimatedObject()) { // W have been removed from an animated object, need to do cleanup. - old_volp->getControlAvatar()->resetJointsOnDetach(this); + old_volp->getControlAvatar()->removeAttachmentOverridesForObject(this); } if (old_volp) -- cgit v1.2.3 From 2af5332e46b3917d6dce211e576a92d04c3eda8b Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 30 Jun 2017 21:59:39 +0100 Subject: Added cycle_object_animations.lsl. Also change to test.cpp to see if it affects a g++ internal compiler error. --- indra/test/test.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'indra') diff --git a/indra/test/test.cpp b/indra/test/test.cpp index 630af2b73b..e42374d56b 100644 --- a/indra/test/test.cpp +++ b/indra/test/test.cpp @@ -34,7 +34,6 @@ * */ - #include "linden_common.h" #include "llerrorcontrol.h" #include "lltut.h" @@ -685,5 +684,4 @@ int main(int argc, char **argv) return retval; //delete mycallback; - } -- cgit v1.2.3 From f55667397e75991348fa25b6ad581a36de99acf0 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 6 Jul 2017 01:25:10 +0100 Subject: SL-722 - handle per-object animation requests, combine for control avatar animation state. --- indra/newview/app_settings/logcontrol.xml | 1 + indra/newview/llcontrolavatar.cpp | 64 +++++++++++++++++++++++++++++++ indra/newview/llcontrolavatar.h | 3 ++ indra/newview/llviewermessage.cpp | 13 +++---- indra/newview/llvoavatar.cpp | 1 + indra/newview/llvovolume.h | 5 +++ 6 files changed, 79 insertions(+), 8 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/logcontrol.xml b/indra/newview/app_settings/logcontrol.xml index ecd7c4bc36..ddd07dba80 100644 --- a/indra/newview/app_settings/logcontrol.xml +++ b/indra/newview/app_settings/logcontrol.xml @@ -50,6 +50,7 @@ tags + AXON default-level INFO print-location false + log-always-flush true + + enabled-log-types-mask 0xFFFFFFFF settings -- cgit v1.2.3 From 9ae973ec5b271b99d192644cc094ef2d1e3ded2a Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 27 Aug 2018 14:22:42 +0100 Subject: SL-944 - mac build error fix: wants override to be used throughout a class if it is used at all --- indra/llcommon/llerror.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'indra') diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp index 3e4dd708a8..843244ce92 100644 --- a/indra/llcommon/llerror.cpp +++ b/indra/llcommon/llerror.cpp @@ -96,7 +96,7 @@ namespace { } virtual void recordMessage(LLError::ELevel level, - const std::string& message) + const std::string& message) override { int syslogPriority = LOG_CRIT; switch (level) { @@ -152,7 +152,7 @@ namespace { bool okay() { return mFile.good(); } virtual void recordMessage(LLError::ELevel level, - const std::string& message) + const std::string& message) override { if (LLError::getAlwaysFlush()) { @@ -183,7 +183,7 @@ namespace { } virtual void recordMessage(LLError::ELevel level, - const std::string& message) + const std::string& message) override { if (ANSI_PROBE == mUseANSI) mUseANSI = (checkANSI() ? ANSI_YES : ANSI_NO); @@ -248,7 +248,7 @@ namespace { } virtual void recordMessage(LLError::ELevel level, - const std::string& message) + const std::string& message) override { mBuffer->addLine(message); } @@ -270,7 +270,7 @@ namespace { } virtual void recordMessage(LLError::ELevel level, - const std::string& message) + const std::string& message) override { debugger_print(message); } -- cgit v1.2.3 From 795aedf4a922f17aac667afc0c368e7fe18b0e03 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 6 Sep 2018 19:47:51 +0100 Subject: SL-966 - size and pos limit calcs moved to sep method. Global scale option for testing of size limits. --- indra/newview/app_settings/settings.xml | 11 ++++ indra/newview/llcontrolavatar.cpp | 91 +++++++++++++++++++++------------ indra/newview/llcontrolavatar.h | 7 ++- 3 files changed, 76 insertions(+), 33 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index f911008879..0277d09ae1 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -2226,6 +2226,17 @@ Value 0 + AnimatedObjectsGlobalScale + + Comment + Temporary testing: allow an extra scale factor to be forced on animated objects. + Persist + 1 + Type + F32 + Value + 1.00 + AvatarBoundingBoxComplexity Comment diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 83d42f6ccf..fdef60612f 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -35,12 +35,16 @@ #include "llviewerregion.h" #include "llskinningutil.h" +const F32 LLControlAvatar::MAX_LEGAL_OFFSET = 3.0f; +const F32 LLControlAvatar::MAX_LEGAL_SIZE = 16.0f; + LLControlAvatar::LLControlAvatar(const LLUUID& id, const LLPCode pcode, LLViewerRegion* regionp) : LLVOAvatar(id, pcode, regionp), mPlaying(false), mGlobalScale(1.0f), mMarkedForDeath(false), - mRootVolp(NULL) + mRootVolp(NULL), + mScaleConstraintFixup(1.0) { mIsDummy = TRUE; mIsControlAvatar = true; @@ -68,6 +72,44 @@ void LLControlAvatar::initInstance() mInitFlags |= 1<<4; } +void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_scale_fixup) const +{ + new_pos_fixup = LLVector3(); + new_scale_fixup = 1.0f; + LLVector3 vol_pos = mRootVolp->getRenderPosition(); + + // Fix up position if needed to prevent visual encroachment + if (box_valid_and_non_zero(getLastAnimExtents())) // wait for state to settle down + { + // The goal here is to ensure that the extent of the avatar's + // bounding box does not wander too far from the + // official position of the corresponding volume. We + // do this by tracking the distance and applying a + // correction to the control avatar position if + // needed. + LLVector3 uncorrected_extents[2]; + uncorrected_extents[0] = (getLastAnimExtents()[0] - mPositionConstraintFixup)/mScaleConstraintFixup; + uncorrected_extents[1] = (getLastAnimExtents()[1] - mPositionConstraintFixup)/mScaleConstraintFixup; + LLVector3 uncorrected_size = uncorrected_extents[1]-uncorrected_extents[0]; + F32 uncorrected_max_size = llmax(uncorrected_size[0],uncorrected_size[1],uncorrected_size[2]); + LLVector3 pos_box_offset = point_to_box_offset(vol_pos, uncorrected_extents); + F32 offset_dist = pos_box_offset.length(); + if (offset_dist > MAX_LEGAL_OFFSET) + { + F32 target_dist = (offset_dist - MAX_LEGAL_OFFSET); + new_pos_fixup = (target_dist/offset_dist)*pos_box_offset; + LL_INFOS("ConstraintFix") << "pos fix, offset_dist " << offset_dist << " pos fixup " + << new_pos_fixup << LL_ENDL; + } + if (uncorrected_max_size > MAX_LEGAL_SIZE) + { + new_scale_fixup = MAX_LEGAL_SIZE/uncorrected_max_size; + LL_INFOS("ConstraintFix") << "scale fix, uncorrected_size " << uncorrected_size << " fixup " + << mScaleConstraintFixup << LL_ENDL; + } + } +} + void LLControlAvatar::matchVolumeTransform() { if (mRootVolp) @@ -96,37 +138,16 @@ void LLControlAvatar::matchVolumeTransform() } else { - LLVector3 vol_pos = mRootVolp->getRenderPosition(); - LLVector3 pos_box_offset; - LLVector3 box_offset; - // Fix up position if needed to prevent visual encroachment - if (box_valid_and_non_zero(getLastAnimExtents())) // wait for state to settle down - { - const F32 MAX_LEGAL_OFFSET = 3.0; - - // The goal here is to ensure that the extent of the avatar's - // bounding box does not wander too far from the - // official position of the corresponding volume. We - // do this by tracking the distance and applying a - // correction to the control avatar position if - // needed. - LLVector3 uncorrected_extents[2]; - uncorrected_extents[0] = getLastAnimExtents()[0] - mPositionConstraintFixup; - uncorrected_extents[1] = getLastAnimExtents()[1] - mPositionConstraintFixup; - pos_box_offset = point_to_box_offset(vol_pos, uncorrected_extents); - F32 offset_dist = pos_box_offset.length(); - if (offset_dist > MAX_LEGAL_OFFSET) - { - F32 target_dist = (offset_dist - MAX_LEGAL_OFFSET); - box_offset = (target_dist/offset_dist)*pos_box_offset; - } - } + LLVector3 new_pos_fixup; + F32 new_scale_fixup; + getNewConstraintFixups(new_pos_fixup, new_scale_fixup); - mPositionConstraintFixup = box_offset; - - // Currently if you're doing something like playing an + mPositionConstraintFixup = new_pos_fixup; + mScaleConstraintFixup = new_scale_fixup; + + // FIXME: Currently if you're doing something like playing an // animation that moves the pelvis (on an avatar or // animated object), the name tag and debug text will be // left behind. Ideally setPosition() would follow the @@ -152,6 +173,9 @@ void LLControlAvatar::matchVolumeTransform() mRoot->setWorldRotation(bind_rot*obj_rot); setPositionAgent(vol_pos); mRoot->setPosition(vol_pos + mPositionConstraintFixup); + + F32 global_scale = gSavedSettings.getF32("AnimatedObjectsGlobalScale"); + setGlobalScale(global_scale * mScaleConstraintFixup); } } } @@ -371,10 +395,13 @@ void LLControlAvatar::updateDebugText() addDebugText(llformat("tris %d (est %.1f, streaming %.1f), verts %d", total_tris, est_tris, est_streaming_tris, total_verts)); addDebugText(llformat("pxarea %s rank %d", LLStringOps::getReadableNumber(getPixelArea()).c_str(), getVisibilityRank())); addDebugText(llformat("lod_radius %s dists %s", LLStringOps::getReadableNumber(lod_radius).c_str(),cam_dist_string.c_str())); - if (mPositionConstraintFixup.length() > 0.0f) + if (mPositionConstraintFixup.length() > 0.0f || mScaleConstraintFixup != 1.0f) { - addDebugText(llformat("pos fix (%.1f %.1f %.1f)", - mPositionConstraintFixup[0], mPositionConstraintFixup[1], mPositionConstraintFixup[2])); + addDebugText(llformat("pos fix (%.1f %.1f %.1f) scale %f", + mPositionConstraintFixup[0], + mPositionConstraintFixup[1], + mPositionConstraintFixup[2], + mScaleConstraintFixup)); } #if 0 diff --git a/indra/newview/llcontrolavatar.h b/indra/newview/llcontrolavatar.h index c72dc03efc..9924697938 100644 --- a/indra/newview/llcontrolavatar.h +++ b/indra/newview/llcontrolavatar.h @@ -40,9 +40,10 @@ public: virtual void initInstance(); // Called after construction to initialize the class. virtual ~LLControlAvatar(); + void getNewConstraintFixups(LLVector3& new_pos_constraint, F32& new_scale_constraint) const; void matchVolumeTransform(); void updateVolumeGeom(); - + void setGlobalScale(F32 scale); void recursiveScaleJoint(LLJoint *joint, F32 factor); static LLControlAvatar *createControlAvatar(LLVOVolume *obj); @@ -81,7 +82,11 @@ public: bool mMarkedForDeath; LLVector3 mPositionConstraintFixup; + F32 mScaleConstraintFixup; + static const F32 MAX_LEGAL_OFFSET; + static const F32 MAX_LEGAL_SIZE; + }; typedef std::map signaled_animation_map_t; -- cgit v1.2.3 From f8533d1fdb6dd6699deb8249e5f7e6ea70939dd4 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 7 Sep 2018 13:48:42 +0100 Subject: SL-966 - updated logic for size/pos constraints --- indra/newview/llcontrolavatar.cpp | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) (limited to 'indra') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index fdef60612f..adad959412 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -87,25 +87,33 @@ void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_ // do this by tracking the distance and applying a // correction to the control avatar position if // needed. - LLVector3 uncorrected_extents[2]; - uncorrected_extents[0] = (getLastAnimExtents()[0] - mPositionConstraintFixup)/mScaleConstraintFixup; - uncorrected_extents[1] = (getLastAnimExtents()[1] - mPositionConstraintFixup)/mScaleConstraintFixup; - LLVector3 uncorrected_size = uncorrected_extents[1]-uncorrected_extents[0]; - F32 uncorrected_max_size = llmax(uncorrected_size[0],uncorrected_size[1],uncorrected_size[2]); - LLVector3 pos_box_offset = point_to_box_offset(vol_pos, uncorrected_extents); + const LLVector3 *extents = getLastAnimExtents(); + LLVector3 box_dims = extents[1]-extents[0]; + F32 max_size = llmax(box_dims[0],box_dims[1],box_dims[2]); + LLVector3 pos_box_offset = point_to_box_offset(vol_pos, getLastAnimExtents()); F32 offset_dist = pos_box_offset.length(); if (offset_dist > MAX_LEGAL_OFFSET) { F32 target_dist = (offset_dist - MAX_LEGAL_OFFSET); - new_pos_fixup = (target_dist/offset_dist)*pos_box_offset; - LL_INFOS("ConstraintFix") << "pos fix, offset_dist " << offset_dist << " pos fixup " - << new_pos_fixup << LL_ENDL; + new_pos_fixup = mPositionConstraintFixup + (target_dist/offset_dist)*pos_box_offset; + LL_DEBUGS("ConstraintFix") << getFullname() << " pos fix, offset_dist " << offset_dist << " pos fixup " + << new_pos_fixup << " was " << mPositionConstraintFixup << LL_ENDL; } - if (uncorrected_max_size > MAX_LEGAL_SIZE) + else if (offset_dist < MAX_LEGAL_OFFSET-1 && mPositionConstraintFixup.length()>0.01f) { - new_scale_fixup = MAX_LEGAL_SIZE/uncorrected_max_size; - LL_INFOS("ConstraintFix") << "scale fix, uncorrected_size " << uncorrected_size << " fixup " - << mScaleConstraintFixup << LL_ENDL; + new_pos_fixup = mPositionConstraintFixup * 0.9; + LL_DEBUGS("ConstraintFix") << getFullname() << " pos fixup reduced " + << new_pos_fixup << " was " << mPositionConstraintFixup << LL_ENDL; + } + else + { + new_pos_fixup = mPositionConstraintFixup; + } + if (max_size/mScaleConstraintFixup > MAX_LEGAL_SIZE) + { + new_scale_fixup = mScaleConstraintFixup*MAX_LEGAL_SIZE/max_size; + LL_DEBUGS("ConstraintFix") << getFullname() << " scale fix, max_size " << max_size << " fixup " + << mScaleConstraintFixup << " -> " << new_scale_fixup << LL_ENDL; } } } -- cgit v1.2.3 From 55419ccd4368d8fd0766936ef52fa1d911a46962 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 7 Sep 2018 13:53:19 +0100 Subject: SL-966 - max size = 64 --- indra/newview/llcontrolavatar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index adad959412..54b1a0dcaf 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -36,7 +36,7 @@ #include "llskinningutil.h" const F32 LLControlAvatar::MAX_LEGAL_OFFSET = 3.0f; -const F32 LLControlAvatar::MAX_LEGAL_SIZE = 16.0f; +const F32 LLControlAvatar::MAX_LEGAL_SIZE = 64.0f; LLControlAvatar::LLControlAvatar(const LLUUID& id, const LLPCode pcode, LLViewerRegion* regionp) : LLVOAvatar(id, pcode, regionp), -- cgit v1.2.3 From 007a126256219e47c9dd3ba0eafeffe4e6f12ef8 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 7 Sep 2018 14:32:48 +0100 Subject: SL-944 - logcontrol.xml update --- indra/newview/app_settings/logcontrol.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/app_settings/logcontrol.xml b/indra/newview/app_settings/logcontrol.xml index 08741327a5..482012cdd6 100644 --- a/indra/newview/app_settings/logcontrol.xml +++ b/indra/newview/app_settings/logcontrol.xml @@ -17,7 +17,7 @@ For example, value of 10 = 2|8 would enable logging only to SecondLife.log and the viewer debug console. Note: RecordToFile is always enabled in release builds. --> - enabled-log-types-mask 0xFFFFFFFF + enabled-log-types-mask 255 settings -- cgit v1.2.3 From d6cec8d68de437a3ccc66739cdabc9de6631dddc Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 7 Sep 2018 16:00:43 +0100 Subject: SL-944 - enabled log types consistent notation in xml and cpp --- indra/llcommon/llerror.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp index 843244ce92..0d19287dd9 100644 --- a/indra/llcommon/llerror.cpp +++ b/indra/llcommon/llerror.cpp @@ -502,7 +502,7 @@ namespace LLError mPrintLocation(false), mDefaultLevel(LLError::LEVEL_DEBUG), mLogAlwaysFlush(true), - mEnabledLogTypesMask(0xFFFFFFFF), + mEnabledLogTypesMask(255), mFunctionLevelMap(), mClassLevelMap(), mFileLevelMap(), -- cgit v1.2.3 From e4e4ad3c09bdc06f738f60bbfd7899036ad6553f Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 10 Sep 2018 20:13:35 +0100 Subject: SL-966 - animated object size/pos constraints cont, including some settings for debugging. additional options to anim_tool.py for making test animations --- indra/newview/app_settings/settings.xml | 22 ++++++++++++++++++++++ indra/newview/llcontrolavatar.cpp | 24 ++++++++++++++++++------ 2 files changed, 40 insertions(+), 6 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 0277d09ae1..3ad8b6cded 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -2237,6 +2237,28 @@ Value 1.00 + AnimatedObjectsMaxLegalOffset + + Comment + Max visual offset between object position and rendered position + Persist + 1 + Type + F32 + Value + 3.0 + + AnimatedObjectsMaxLegalSize + + Comment + Max bounding box size for animated object's rendered position + Persist + 1 + Type + F32 + Value + 64.0 + AvatarBoundingBoxComplexity Comment diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 54b1a0dcaf..96cdb7f01d 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -74,6 +74,18 @@ void LLControlAvatar::initInstance() void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_scale_fixup) const { + + F32 max_legal_offset = MAX_LEGAL_OFFSET; + if (gSavedSettings.getControl("AnimatedObjectsMaxLegalOffset")) + { + max_legal_offset = gSavedSettings.getF32("AnimatedObjectsMaxLegalOffset"); + } + F32 max_legal_size = MAX_LEGAL_SIZE; + if (gSavedSettings.getControl("AnimatedObjectsMaxLegalSize")) + { + max_legal_size = gSavedSettings.getF32("AnimatedObjectsMaxLegalSize"); + } + new_pos_fixup = LLVector3(); new_scale_fixup = 1.0f; LLVector3 vol_pos = mRootVolp->getRenderPosition(); @@ -90,16 +102,16 @@ void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_ const LLVector3 *extents = getLastAnimExtents(); LLVector3 box_dims = extents[1]-extents[0]; F32 max_size = llmax(box_dims[0],box_dims[1],box_dims[2]); - LLVector3 pos_box_offset = point_to_box_offset(vol_pos, getLastAnimExtents()); + LLVector3 pos_box_offset = point_to_box_offset(vol_pos, extents); F32 offset_dist = pos_box_offset.length(); - if (offset_dist > MAX_LEGAL_OFFSET) + if (offset_dist > max_legal_offset) { - F32 target_dist = (offset_dist - MAX_LEGAL_OFFSET); + F32 target_dist = (offset_dist - max_legal_offset); new_pos_fixup = mPositionConstraintFixup + (target_dist/offset_dist)*pos_box_offset; LL_DEBUGS("ConstraintFix") << getFullname() << " pos fix, offset_dist " << offset_dist << " pos fixup " << new_pos_fixup << " was " << mPositionConstraintFixup << LL_ENDL; } - else if (offset_dist < MAX_LEGAL_OFFSET-1 && mPositionConstraintFixup.length()>0.01f) + else if (offset_dist < max_legal_offset-1 && mPositionConstraintFixup.length()>0.01f) { new_pos_fixup = mPositionConstraintFixup * 0.9; LL_DEBUGS("ConstraintFix") << getFullname() << " pos fixup reduced " @@ -109,9 +121,9 @@ void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_ { new_pos_fixup = mPositionConstraintFixup; } - if (max_size/mScaleConstraintFixup > MAX_LEGAL_SIZE) + if (max_size/mScaleConstraintFixup > max_legal_size) { - new_scale_fixup = mScaleConstraintFixup*MAX_LEGAL_SIZE/max_size; + new_scale_fixup = mScaleConstraintFixup*max_legal_size/max_size; LL_DEBUGS("ConstraintFix") << getFullname() << " scale fix, max_size " << max_size << " fixup " << mScaleConstraintFixup << " -> " << new_scale_fixup << LL_ENDL; } -- cgit v1.2.3 From c5a2aa0028ea1a31ec2c09f849dd6cb807c7340a Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 17 Sep 2018 20:34:43 +0100 Subject: SL-9671 - refresh simulator features on region change --- indra/newview/llagent.cpp | 10 ++++++++++ indra/newview/llviewerregion.cpp | 4 +++- 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 901294d6b4..d656d0b16c 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -881,6 +881,16 @@ void LLAgent::setRegion(LLViewerRegion *regionp) { gSky.mVOGroundp->setRegion(regionp); } + + if (regionp->capabilitiesReceived()) + { + regionp->requestSimulatorFeatures(); + } + else + { + regionp->setCapabilitiesReceivedCallback(boost::bind(&LLViewerRegion::requestSimulatorFeatures, regionp)); + } + } else { diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 92e1d86365..527c8e61f2 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -2151,6 +2151,8 @@ void LLViewerRegion::getInfo(LLSD& info) void LLViewerRegion::requestSimulatorFeatures() { + LL_DEBUGS("SimulatorFeatures") << "region " << getName() << " ptr " << this + << " trying to request SimulatorFeatures" << LL_ENDL; // kick off a request for simulator features std::string url = getCapability("SimulatorFeatures"); if (!url.empty()) @@ -2198,7 +2200,7 @@ void LLViewerRegion::setSimulatorFeatures(const LLSD& sim_features) std::stringstream str; LLSDSerialize::toPrettyXML(sim_features, str); - LL_INFOS() << str.str() << LL_ENDL; + LL_INFOS() << "region " << getName() << " " << str.str() << LL_ENDL; mSimulatorFeatures = sim_features; setSimulatorFeaturesReceived(true); -- cgit v1.2.3 From 301821337bf692d9f8d56230dc620efa74fcd275 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 19 Sep 2018 15:53:44 +0100 Subject: SL-9680, SL-9673 - set attachment distance floor at 0.01 to avoid triggering divide-by-zero prevention logic. Force HUD attachments to always be full detail. --- indra/newview/lldrawable.cpp | 14 ++++++++------ indra/newview/llvovolume.cpp | 24 +++++++++++++++--------- 2 files changed, 23 insertions(+), 15 deletions(-) (limited to 'indra') diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 6f48b8a968..55db721ccf 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -913,12 +913,14 @@ void LLDrawable::updateDistance(LLCamera& camera, bool force_update) LLVector3 cam_region_pos = LLVector3(cam_pos - volume->getRegion()->getOriginGlobal()); LLVector3 cam_to_box_offset = point_to_box_offset(cam_region_pos, av_box); - //LL_DEBUGS("DynamicBox") << volume->getAvatar()->getFullname() - // << " pos (ignored) " << pos - // << " cam pos " << cam_pos - // << " cam region pos " << cam_region_pos - // << " box " << av_box[0] << "," << av_box[1] << LL_ENDL; - mDistanceWRTCamera = ll_round(cam_to_box_offset.magVec(), 0.01f); + mDistanceWRTCamera = llmax(0.01f, ll_round(cam_to_box_offset.magVec(), 0.01f)); + LL_DEBUGS("DynamicBox") << volume->getAvatar()->getFullname() + << " pos (ignored) " << pos + << " cam pos " << cam_pos + << " cam region pos " << cam_region_pos + << " box " << av_box[0] << "," << av_box[1] + << " -> dist " << mDistanceWRTCamera + << LL_ENDL; mVObjp->updateLOD(); return; } diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 8de97c711d..913460b3d1 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -1344,24 +1344,22 @@ BOOL LLVOVolume::calcLOD() const LLVector3* box = avatar->getLastAnimExtents(); LLVector3 diag = box[1] - box[0]; radius = diag.magVec() * 0.5f; - //LL_DEBUGS("DynamicBox") << avatar->getFullname() << " diag " << diag << " radius " << radius << LL_ENDL; + LL_DEBUGS("DynamicBox") << avatar->getFullname() << " diag " << diag << " radius " << radius << LL_ENDL; } else { // Volume in a rigged mesh attached to a regular avatar. -#if 0 // Note this isn't really a radius, so distance calcs are off by factor of 2 - radius = avatar->getBinRadius(); -#else + //radius = avatar->getBinRadius(); // SL-937: add dynamic box handling for rigged mesh on regular avatars. const LLVector3* box = avatar->getLastAnimExtents(); LLVector3 diag = box[1] - box[0]; radius = diag.magVec(); // preserve old BinRadius behavior - 2x off -#endif + LL_DEBUGS("DynamicBox") << avatar->getFullname() << " diag " << diag << " radius " << radius << LL_ENDL; } if (distance <= 0.f || radius <= 0.f) { - LL_DEBUGS("CalcLOD") << "avatar distance/radius uninitialized, skipping" << LL_ENDL; + LL_DEBUGS("DynamicBox","CalcLOD") << "avatar distance/radius uninitialized, skipping" << LL_ENDL; return FALSE; } } @@ -1371,7 +1369,7 @@ BOOL LLVOVolume::calcLOD() radius = getVolume() ? getVolume()->mLODScaleBias.scaledVec(getScale()).length() : getScale().length(); if (distance <= 0.f || radius <= 0.f) { - LL_DEBUGS("CalcLOD") << "non-avatar distance/radius uninitialized, skipping" << LL_ENDL; + LL_DEBUGS("DynamicBox","CalcLOD") << "non-avatar distance/radius uninitialized, skipping" << LL_ENDL; return FALSE; } } @@ -1414,7 +1412,15 @@ BOOL LLVOVolume::calcLOD() mLODAdjustedDistance = distance; - cur_detail = computeLODDetail(ll_round(distance, 0.01f), ll_round(radius, 0.01f), lod_factor); + if (isHUDAttachment()) + { + // HUDs always show at highest detail + cur_detail = 3; + } + else + { + cur_detail = computeLODDetail(ll_round(distance, 0.01f), ll_round(radius, 0.01f), lod_factor); + } if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TRIANGLE_COUNT) && mDrawable->getFace(0)) { @@ -1434,7 +1440,7 @@ BOOL LLVOVolume::calcLOD() if (cur_detail != mLOD) { - LL_DEBUGS("CalcLOD") << "new LOD " << cur_detail << " change from " << mLOD + LL_DEBUGS("DynamicBox","CalcLOD") << "new LOD " << cur_detail << " change from " << mLOD << " distance " << distance << " radius " << radius << " rampDist " << rampDist << " drawable rigged? " << (mDrawable ? (S32) mDrawable->isState(LLDrawable::RIGGED) : (S32) -1) << " mRiggedVolume " << (void*)getRiggedVolume() -- cgit v1.2.3 From 963945b3ab258ea445e1d9757fc5a89ce397ff7b Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 25 Sep 2018 16:39:26 +0100 Subject: SL-1291 - fixed some issues with selection highlighting of objects rezzed while in build mode. Not clear whether this addresses the original issue, which isn't reproing --- indra/newview/llcontrolavatar.cpp | 2 +- indra/newview/llviewermessage.cpp | 2 +- indra/newview/llviewerobject.cpp | 6 +++++- 3 files changed, 7 insertions(+), 3 deletions(-) (limited to 'indra') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 96cdb7f01d..0efed8ab7c 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -508,7 +508,7 @@ void LLControlAvatar::updateAnimations() if (!mPlaying) { mPlaying = true; - if (!mRootVolp->isAnySelected()) + //if (!mRootVolp->isAnySelected()) { updateVolumeGeom(); mRootVolp->recursiveMarkForUpdate(TRUE); diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index dc11bc28e5..b74c5b9b8a 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -4049,7 +4049,7 @@ void process_object_animation(LLMessageSystem *mesgsys, void **user_data) if (!avatarp->mPlaying) { avatarp->mPlaying = true; - if (!avatarp->mRootVolp->isAnySelected()) + //if (!avatarp->mRootVolp->isAnySelected()) { avatarp->updateVolumeGeom(); avatarp->mRootVolp->recursiveMarkForUpdate(TRUE); diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index f963f8a0c8..dcd09f66c7 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -3015,6 +3015,10 @@ void LLViewerObject::updateControlAvatar() if (getControlAvatar()) { getControlAvatar()->updateAnimations(); + if (isSelected()) + { + LLSelectMgr::getInstance()->pauseAssociatedAvatars(); + } } } @@ -3040,7 +3044,7 @@ void LLViewerObject::linkControlAvatar() if (!cav->mPlaying) { cav->mPlaying = true; - if (!cav->mRootVolp->isAnySelected()) + //if (!cav->mRootVolp->isAnySelected()) { cav->updateVolumeGeom(); cav->mRootVolp->recursiveMarkForUpdate(TRUE); -- cgit v1.2.3 From 4d4255c27b45ed5e32fe7c4870e2ce3ed10cb140 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 27 Sep 2018 19:34:41 +0100 Subject: SL-1350 - keep control avatar rotation synced to corresponding root drawable --- indra/newview/llcontrolavatar.cpp | 11 ++++++++++- indra/newview/lldrawable.cpp | 5 ++++- indra/newview/llvoavatar.cpp | 3 ++- 3 files changed, 16 insertions(+), 3 deletions(-) (limited to 'indra') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 0efed8ab7c..a620f2abe9 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -175,7 +175,16 @@ void LLControlAvatar::matchVolumeTransform() // complexity info and such line up better. Should defer // this until avatars also get fixed. - LLQuaternion obj_rot = mRootVolp->getRotation(); + LLQuaternion obj_rot; + if (mRootVolp->mDrawable) + { + obj_rot = mRootVolp->mDrawable->getRotation(); + } + else + { + obj_rot = mRootVolp->getRotation(); + } + LLMatrix3 bind_mat; LLQuaternion bind_rot; diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 55db721ccf..8c6cbc020b 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -52,7 +52,6 @@ #include "llviewerwindow.h" #include "llvocache.h" #include "llcontrolavatar.h" -#include "llcallstack.h" #include "lldrawpoolavatar.h" const F32 MIN_INTERPOLATE_DISTANCE_SQUARED = 0.001f * 0.001f; @@ -730,6 +729,10 @@ F32 LLDrawable::updateXform(BOOL undamped) mXform.setRotation(target_rot); mXform.setScale(LLVector3(1,1,1)); //no scale in drawable transforms (IT'S A RULE!) mXform.updateMatrix(); + if (isRoot() && mVObjp->isAnimatedObject() && mVObjp->getControlAvatar()) + { + mVObjp->getControlAvatar()->matchVolumeTransform(); + } if (mSpatialBridge) { diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index dba99c7e98..1f72aed5b4 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -4168,7 +4168,8 @@ void LLVOAvatar::updateRootPositionAndRotation(LLAgent& agent, F32 speed, bool w LLControlAvatar *cav = dynamic_cast(this); if (cav) { - cav->matchVolumeTransform(); + // SL-1350: Moved to LLDrawable::updateXform() + //cav->matchVolumeTransform(); } else { -- cgit v1.2.3 From 2c81ace766546da0ea11efd4fa27cf1717eb5411 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 28 Sep 2018 19:13:17 +0100 Subject: SL-1290 - stop animations immediately if avatar is paused --- indra/llcharacter/llmotioncontroller.cpp | 3 ++- indra/newview/llvovolume.cpp | 2 -- 2 files changed, 2 insertions(+), 3 deletions(-) (limited to 'indra') diff --git a/indra/llcharacter/llmotioncontroller.cpp b/indra/llcharacter/llmotioncontroller.cpp index 3116403616..c48d02b652 100644 --- a/indra/llcharacter/llmotioncontroller.cpp +++ b/indra/llcharacter/llmotioncontroller.cpp @@ -441,7 +441,8 @@ BOOL LLMotionController::stopMotionLocally(const LLUUID &id, BOOL stop_immediate { // if already inactive, return false LLMotion *motion = findMotion(id); - return stopMotionInstance(motion, stop_immediate); + // SL-1290: always stop immediate if paused + return stopMotionInstance(motion, stop_immediate||mPaused); } BOOL LLMotionController::stopMotionInstance(LLMotion* motion, BOOL stop_immediate) diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 913460b3d1..192307dc8b 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4726,7 +4726,6 @@ void LLRiggedVolume::update(const LLMeshSkinInfo* skin, LLVOAvatar* avatar, cons } else { -#if 1 bool is_paused = avatar && avatar->areAnimationsPaused(); if (is_paused) { @@ -4736,7 +4735,6 @@ void LLRiggedVolume::update(const LLMeshSkinInfo* skin, LLVOAvatar* avatar, cons return; } } -#endif } -- cgit v1.2.3 From aacb7eb25fd4caceaafb145ed550e14cebeef665 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 1 Oct 2018 16:11:09 +0100 Subject: SL-9773 - treat animated object attachments the same as other rigged attachments for purposes of visibility in mouselook. --- indra/newview/llcontrolavatar.cpp | 14 ++++++++++++++ indra/newview/llcontrolavatar.h | 2 ++ indra/newview/lldrawpoolavatar.cpp | 2 +- indra/newview/llvoavatar.cpp | 6 ++++++ indra/newview/llvoavatar.h | 1 + indra/newview/llvoavatarself.cpp | 6 ++++++ indra/newview/llvoavatarself.h | 3 +++ 7 files changed, 33 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index a620f2abe9..28c02b0434 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -574,3 +574,17 @@ std::string LLControlAvatar::getFullname() const return "AO_no_root_vol"; } } + +// virtual +bool LLControlAvatar::shouldRenderRigged() const +{ + if (mRootVolp && mRootVolp->isAttachment()) + { + LLVOAvatar *attached_av = mRootVolp->getAvatarAncestor(); + if (attached_av) + { + return attached_av->shouldRenderRigged(); + } + } + return true; +} diff --git a/indra/newview/llcontrolavatar.h b/indra/newview/llcontrolavatar.h index 9924697938..f7f8db2717 100644 --- a/indra/newview/llcontrolavatar.h +++ b/indra/newview/llcontrolavatar.h @@ -73,6 +73,8 @@ public: virtual std::string getFullname() const; + /* virtual */ bool shouldRenderRigged() const; + bool mPlaying; F32 mGlobalScale; diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index 905428b090..d5e86143f1 100644 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -1709,7 +1709,7 @@ void LLDrawPoolAvatar::updateRiggedFaceVertexBuffer( void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow) { - if (avatar->isSelf() && !gAgent.needsRenderAvatar()) + if (!avatar->shouldRenderRigged()) { return; } diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 1f72aed5b4..93885a4472 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -7464,6 +7464,12 @@ void LLVOAvatar::onGlobalColorChanged(const LLTexGlobalColor* global_color) updateMeshTextures(); } +// virtual +bool LLVOAvatar::shouldRenderRigged() const +{ + return true; +} + // FIXME: We have an mVisible member, set in updateVisibility(), but this // function doesn't return it! isVisible() and mVisible are used // different places for different purposes. mVisible seems to be more diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 25c89f96d7..985559f2d6 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -756,6 +756,7 @@ private: //-------------------------------------------------------------------- public: BOOL isVisible() const; + virtual bool shouldRenderRigged() const; void setVisibilityRank(U32 rank); U32 getVisibilityRank() const { return mVisibilityRank; } static S32 sNumVisibleAvatars; // Number of instances of this class diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index b3a2d7951c..dcaade55a6 100644 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -2701,6 +2701,12 @@ void LLVOAvatarSelf::onCustomizeEnd(bool disable_camera_switch) } } +// virtual +bool LLVOAvatarSelf::shouldRenderRigged() const +{ + return gAgent.needsRenderAvatar(); +} + // HACK: this will null out the avatar's local texture IDs before the TE message is sent // to ensure local texture IDs are not sent to other clients in the area. // this is a short-term solution. The long term solution will be to not set the texture diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h index f9f90bb323..b0fdae9bf0 100644 --- a/indra/newview/llvoavatarself.h +++ b/indra/newview/llvoavatarself.h @@ -312,6 +312,9 @@ public: //-------------------------------------------------------------------- // Visibility //-------------------------------------------------------------------- + + /* virtual */ bool shouldRenderRigged() const; + public: bool sendAppearanceMessage(LLMessageSystem *mesgsys) const; -- cgit v1.2.3 From 5bb0b393a9ee634db1fbbde2645a6374704e184c Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 2 Oct 2018 22:02:42 +0100 Subject: SL-966 - behavior improvements and visualization, bonus removal of unrelated duplicate code in llappviewer.cpp --- indra/newview/llappviewer.cpp | 6 ------ indra/newview/llcontrolavatar.cpp | 13 +++++++++++-- indra/newview/llspatialpartition.cpp | 17 ++++++++++++++++- indra/newview/llvoavatar.cpp | 2 +- 4 files changed, 28 insertions(+), 10 deletions(-) (limited to 'indra') diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 03927f2d7c..4374caacdf 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -3918,12 +3918,6 @@ void LLAppViewer::requestQuit() gAgentAvatarp->updateAvatarRezMetrics(true); // force a last packet to be sent. } - // Try to send last batch of avatar rez metrics. - if (!gDisconnected && isAgentAvatarValid()) - { - gAgentAvatarp->updateAvatarRezMetrics(true); // force a last packet to be sent. - } - LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral*)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE); effectp->setPositionGlobal(gAgent.getPositionGlobal()); effectp->setColor(LLColor4U(gAgent.getEffectColor())); diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 28c02b0434..18d6e6d6e7 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -35,6 +35,8 @@ #include "llviewerregion.h" #include "llskinningutil.h" +//#pragma optimize("", off) + const F32 LLControlAvatar::MAX_LEGAL_OFFSET = 3.0f; const F32 LLControlAvatar::MAX_LEGAL_SIZE = 64.0f; @@ -111,9 +113,16 @@ void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_ LL_DEBUGS("ConstraintFix") << getFullname() << " pos fix, offset_dist " << offset_dist << " pos fixup " << new_pos_fixup << " was " << mPositionConstraintFixup << LL_ENDL; } - else if (offset_dist < max_legal_offset-1 && mPositionConstraintFixup.length()>0.01f) + else if (offset_dist < max_legal_offset-1) { - new_pos_fixup = mPositionConstraintFixup * 0.9; + if (mPositionConstraintFixup.length()>0.01f) + { + new_pos_fixup = mPositionConstraintFixup * 0.9; + } + else + { + new_pos_fixup = LLVector3(); + } LL_DEBUGS("ConstraintFix") << getFullname() << " pos fixup reduced " << new_pos_fixup << " was " << mPositionConstraintFixup << LL_ENDL; } diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index ee77556047..f25ab0709b 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -53,6 +53,9 @@ #include "llvolumemgr.h" #include "lltextureatlas.h" #include "llviewershadermgr.h" +#include "llcontrolavatar.h" + +//#pragma optimize("", off) static LLTrace::BlockTimerStatHandle FTM_FRUSTUM_CULL("Frustum Culling"); static LLTrace::BlockTimerStatHandle FTM_CULL_REBOUND("Cull Rebound Partition"); @@ -2170,7 +2173,19 @@ void renderBoundingBox(LLDrawable* drawable, BOOL set_color = TRUE) gGL.diffuseColor4f(0,0.5f,0,1); // dark green break; default: - gGL.diffuseColor4f(1,0,1,1); // magenta + LLControlAvatar *cav = dynamic_cast(drawable->getVObj()->asAvatar()); + if (cav) + { + bool has_pos_constraint = (cav->mPositionConstraintFixup != LLVector3()); + bool has_scale_constraint = (cav->mScaleConstraintFixup != 1.0f); + F32 r = 1.0f * has_scale_constraint; + F32 g = 1.0f * has_pos_constraint; + gGL.diffuseColor4f(r,g,0,1); + } + else + { + gGL.diffuseColor4f(1,0,1,1); // magenta + } break; } } diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 93885a4472..b49f22007b 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -4169,7 +4169,7 @@ void LLVOAvatar::updateRootPositionAndRotation(LLAgent& agent, F32 speed, bool w if (cav) { // SL-1350: Moved to LLDrawable::updateXform() - //cav->matchVolumeTransform(); + cav->matchVolumeTransform(); } else { -- cgit v1.2.3 From 0fd67838cf011e81f18822f699e8a140d4f761ad Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 3 Oct 2018 10:29:11 +0100 Subject: SL-966 - tweaks to scale/pos constraint logic --- indra/newview/llcontrolavatar.cpp | 24 +++++------------------- indra/newview/llspatialpartition.cpp | 4 ++-- 2 files changed, 7 insertions(+), 21 deletions(-) (limited to 'indra') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 18d6e6d6e7..64f8423a66 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -102,34 +102,20 @@ void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_ // correction to the control avatar position if // needed. const LLVector3 *extents = getLastAnimExtents(); + LLVector unshift_extents; + unshift_extents[0] = extents[0] - mPositionConstraintFixup; + unshift_extents[1] = extents[1] - mPositionConstraintFixup; LLVector3 box_dims = extents[1]-extents[0]; F32 max_size = llmax(box_dims[0],box_dims[1],box_dims[2]); - LLVector3 pos_box_offset = point_to_box_offset(vol_pos, extents); + LLVector3 pos_box_offset = point_to_box_offset(vol_pos, unshift_extents); F32 offset_dist = pos_box_offset.length(); if (offset_dist > max_legal_offset) { F32 target_dist = (offset_dist - max_legal_offset); - new_pos_fixup = mPositionConstraintFixup + (target_dist/offset_dist)*pos_box_offset; + new_pos_fixup = (target_dist/offset_dist)*pos_box_offset; LL_DEBUGS("ConstraintFix") << getFullname() << " pos fix, offset_dist " << offset_dist << " pos fixup " << new_pos_fixup << " was " << mPositionConstraintFixup << LL_ENDL; } - else if (offset_dist < max_legal_offset-1) - { - if (mPositionConstraintFixup.length()>0.01f) - { - new_pos_fixup = mPositionConstraintFixup * 0.9; - } - else - { - new_pos_fixup = LLVector3(); - } - LL_DEBUGS("ConstraintFix") << getFullname() << " pos fixup reduced " - << new_pos_fixup << " was " << mPositionConstraintFixup << LL_ENDL; - } - else - { - new_pos_fixup = mPositionConstraintFixup; - } if (max_size/mScaleConstraintFixup > max_legal_size) { new_scale_fixup = mScaleConstraintFixup*max_legal_size/max_size; diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index f25ab0709b..32aa974bf1 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -2178,8 +2178,8 @@ void renderBoundingBox(LLDrawable* drawable, BOOL set_color = TRUE) { bool has_pos_constraint = (cav->mPositionConstraintFixup != LLVector3()); bool has_scale_constraint = (cav->mScaleConstraintFixup != 1.0f); - F32 r = 1.0f * has_scale_constraint; - F32 g = 1.0f * has_pos_constraint; + F32 r = 0.5 + 0.5 * has_scale_constraint; + F32 g = 0.5 + 0.5 * has_pos_constraint; gGL.diffuseColor4f(r,g,0,1); } else -- cgit v1.2.3 From 8078b30574fc0a317b8dc7aadfc09516d3638ab0 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 3 Oct 2018 13:11:50 +0100 Subject: SL-966 - bug fixes, added lerp control for algorithm tweaking --- indra/newview/app_settings/settings.xml | 11 +++++++++++ indra/newview/llcontrolavatar.cpp | 8 +++++++- 2 files changed, 18 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 3ad8b6cded..bacd2c992b 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -2259,6 +2259,17 @@ Value 64.0 + AnimatedObjectsPosLerp + + Comment + How strongly to weight new position vs. previous frame in position constraints. + Persist + 1 + Type + F32 + Value + 1.0 + AvatarBoundingBoxComplexity Comment diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 64f8423a66..96aaab80fa 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -87,6 +87,11 @@ void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_ { max_legal_size = gSavedSettings.getF32("AnimatedObjectsMaxLegalSize"); } + F32 lerp_weight = 0.5f; // hysteresis. 1.0 = immediately slam to new value, 0.0 = ignore new value + if (gSavedSettings.getControl("AnimatedObjectsPosLerp")) + { + lerp_weight = gSavedSettings.getF32("AnimatedObjectsPosLerp"); + } new_pos_fixup = LLVector3(); new_scale_fixup = 1.0f; @@ -102,7 +107,7 @@ void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_ // correction to the control avatar position if // needed. const LLVector3 *extents = getLastAnimExtents(); - LLVector unshift_extents; + LLVector3 unshift_extents[2]; unshift_extents[0] = extents[0] - mPositionConstraintFixup; unshift_extents[1] = extents[1] - mPositionConstraintFixup; LLVector3 box_dims = extents[1]-extents[0]; @@ -116,6 +121,7 @@ void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_ LL_DEBUGS("ConstraintFix") << getFullname() << " pos fix, offset_dist " << offset_dist << " pos fixup " << new_pos_fixup << " was " << mPositionConstraintFixup << LL_ENDL; } + new_pos_fixup = lerp_weight * new_pos_fixup + (1.0f - lerp_weight)*mPositionConstraintFixup; if (max_size/mScaleConstraintFixup > max_legal_size) { new_scale_fixup = mScaleConstraintFixup*max_legal_size/max_size; -- cgit v1.2.3 From 2fc7dcf22f6c04614a5dfc09104e919220f30525 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 3 Oct 2018 20:48:57 +0100 Subject: SL-966 - added scale constraints for animated object attachments --- indra/newview/app_settings/settings.xml | 11 ------- indra/newview/llcontrolavatar.cpp | 57 +++++++++++++++++---------------- 2 files changed, 29 insertions(+), 39 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index bacd2c992b..3ad8b6cded 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -2259,17 +2259,6 @@ Value 64.0 - AnimatedObjectsPosLerp - - Comment - How strongly to weight new position vs. previous frame in position constraints. - Persist - 1 - Type - F32 - Value - 1.0 - AvatarBoundingBoxComplexity Comment diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 96aaab80fa..4b70d625d4 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -87,15 +87,10 @@ void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_ { max_legal_size = gSavedSettings.getF32("AnimatedObjectsMaxLegalSize"); } - F32 lerp_weight = 0.5f; // hysteresis. 1.0 = immediately slam to new value, 0.0 = ignore new value - if (gSavedSettings.getControl("AnimatedObjectsPosLerp")) - { - lerp_weight = gSavedSettings.getF32("AnimatedObjectsPosLerp"); - } new_pos_fixup = LLVector3(); new_scale_fixup = 1.0f; - LLVector3 vol_pos = mRootVolp->getRenderPosition(); + LLVector3 vol_pos = mRootVolp->getRenderPosition(); // Fix up position if needed to prevent visual encroachment if (box_valid_and_non_zero(getLastAnimExtents())) // wait for state to settle down @@ -111,22 +106,26 @@ void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_ unshift_extents[0] = extents[0] - mPositionConstraintFixup; unshift_extents[1] = extents[1] - mPositionConstraintFixup; LLVector3 box_dims = extents[1]-extents[0]; - F32 max_size = llmax(box_dims[0],box_dims[1],box_dims[2]); - LLVector3 pos_box_offset = point_to_box_offset(vol_pos, unshift_extents); - F32 offset_dist = pos_box_offset.length(); - if (offset_dist > max_legal_offset) - { - F32 target_dist = (offset_dist - max_legal_offset); - new_pos_fixup = (target_dist/offset_dist)*pos_box_offset; - LL_DEBUGS("ConstraintFix") << getFullname() << " pos fix, offset_dist " << offset_dist << " pos fixup " - << new_pos_fixup << " was " << mPositionConstraintFixup << LL_ENDL; - } - new_pos_fixup = lerp_weight * new_pos_fixup + (1.0f - lerp_weight)*mPositionConstraintFixup; - if (max_size/mScaleConstraintFixup > max_legal_size) + F32 box_size = llmax(box_dims[0],box_dims[1],box_dims[2]); + + if (!mRootVolp->isAttachment()) + { + LLVector3 pos_box_offset = point_to_box_offset(vol_pos, unshift_extents); + F32 offset_dist = pos_box_offset.length(); + if (offset_dist > max_legal_offset || mPositionConstraintFixup != LLVector3()) + { + F32 target_dist = (offset_dist - max_legal_offset); + new_pos_fixup = (target_dist/offset_dist)*pos_box_offset; + LL_DEBUGS("ConstraintFix") << getFullname() << " pos fix, offset_dist " << offset_dist << " pos fixup " + << new_pos_fixup << " was " << mPositionConstraintFixup << LL_ENDL; + } + } + if (box_size/mScaleConstraintFixup > max_legal_size) { - new_scale_fixup = mScaleConstraintFixup*max_legal_size/max_size; - LL_DEBUGS("ConstraintFix") << getFullname() << " scale fix, max_size " << max_size << " fixup " - << mScaleConstraintFixup << " -> " << new_scale_fixup << LL_ENDL; + new_scale_fixup = mScaleConstraintFixup*max_legal_size/box_size; + LL_DEBUGS("ConstraintFix") << getFullname() << " scale fix, box_size " << box_size << " fixup " + << mScaleConstraintFixup << " max legal " << max_legal_size + << " -> new scale " << new_scale_fixup << LL_ENDL; } } } @@ -135,6 +134,12 @@ void LLControlAvatar::matchVolumeTransform() { if (mRootVolp) { + LLVector3 new_pos_fixup; + F32 new_scale_fixup; + getNewConstraintFixups(new_pos_fixup, new_scale_fixup); + mPositionConstraintFixup = new_pos_fixup; + mScaleConstraintFixup = new_scale_fixup; + if (mRootVolp->isAttachment()) { LLVOAvatar *attached_av = mRootVolp->getAvatarAncestor(); @@ -151,6 +156,9 @@ void LLControlAvatar::matchVolumeTransform() mRoot->setWorldPosition(obj_pos + joint_pos); mRoot->setWorldRotation(obj_rot * joint_rot); setRotation(mRoot->getRotation()); + + F32 global_scale = gSavedSettings.getF32("AnimatedObjectsGlobalScale"); + setGlobalScale(global_scale * mScaleConstraintFixup); } else { @@ -161,13 +169,6 @@ void LLControlAvatar::matchVolumeTransform() { LLVector3 vol_pos = mRootVolp->getRenderPosition(); - LLVector3 new_pos_fixup; - F32 new_scale_fixup; - getNewConstraintFixups(new_pos_fixup, new_scale_fixup); - - mPositionConstraintFixup = new_pos_fixup; - mScaleConstraintFixup = new_scale_fixup; - // FIXME: Currently if you're doing something like playing an // animation that moves the pelvis (on an avatar or // animated object), the name tag and debug text will be -- cgit v1.2.3 From 5bb57186350fe00ccdc3f28acc3a55861745e193 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 8 Oct 2018 16:16:56 +0100 Subject: SL-9805 - optimization for avatar rigging info updates --- indra/newview/llvoavatar.cpp | 33 ++++++++++++++++++++++++--------- indra/newview/llvoavatar.h | 4 +++- 2 files changed, 27 insertions(+), 10 deletions(-) (limited to 'indra') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index b49f22007b..85019d5ae0 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -1418,14 +1418,7 @@ void LLVOAvatar::calculateSpatialExtents(LLVector4a& newMin, LLVector4a& newMax) // Stretch bounding box by rigged mesh joint boxes if (box_detail>=3) { - // FIXME could try to cache unless something has changed about attached rigged meshes, - // but needs more logic based on volume states. - - //if (mRiggingInfoTab.needsUpdate()) - { - updateRiggingInfo(); - //mJointRiggingInfoTab.setNeedsUpdate(false); - } + updateRiggingInfo(); for (S32 joint_num = 0; joint_num < LL_CHARACTER_MAX_ANIMATED_JOINTS; joint_num++) { LLJoint *joint = getJoint(joint_num); @@ -9624,9 +9617,31 @@ void LLVOAvatar::getAssociatedVolumes(std::vector& volumes) void LLVOAvatar::updateRiggingInfo() { LL_DEBUGS("RigSpammish") << getFullname() << " updating rig tab" << LL_ENDL; - mJointRiggingInfoTab.clear(); std::vector volumes; getAssociatedVolumes(volumes); + + // Get current rigging info key + std::map curr_rigging_info_key; + for (std::vector::iterator it = volumes.begin(); it != volumes.end(); ++it) + { + LLVOVolume *vol = *it; + if (vol->isMesh() && vol->getVolume()) + { + const LLUUID& mesh_id = vol->getVolume()->getParams().getSculptID(); + S32 max_lod = llmax(vol->getLOD(), vol->mLastRiggingInfoLOD); + curr_rigging_info_key[mesh_id] = max_lod; + } + } + + // Check for key change, which indicates some change in volume composition or LOD. + if (curr_rigging_info_key == mLastRiggingInfoKey) + { + return; + } + + // Something changed. Update. + mLastRiggingInfoKey = curr_rigging_info_key; + mJointRiggingInfoTab.clear(); for (std::vector::iterator it = volumes.begin(); it != volumes.end(); ++it) { LLVOVolume *vol = *it; diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 985559f2d6..e6b1477758 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -220,7 +220,9 @@ public: // virtual void updateRiggingInfo(); - + // This encodes mesh id and LOD, so we can see whether display is up-to-date. + std::map mLastRiggingInfoKey; + std::set mActiveOverrideMeshes; virtual void onActiveOverrideMeshesChanged(); -- cgit v1.2.3 From ae041779ccc83b1acc8a01528918d52aab9f565f Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 10 Oct 2018 14:37:49 +0100 Subject: SL-9849 - debug option for show impostor extents --- indra/newview/llpipelinelistener.cpp | 6 +- indra/newview/llviewermenu.cpp | 10 ++- indra/newview/llviewermenu.h | 2 +- indra/newview/llvoavatar.cpp | 62 ++++++++++++----- indra/newview/pipeline.cpp | 4 +- indra/newview/pipeline.h | 79 +++++++++++----------- indra/newview/skins/default/xui/en/menu_viewer.xml | 10 +++ 7 files changed, 109 insertions(+), 64 deletions(-) (limited to 'indra') diff --git a/indra/newview/llpipelinelistener.cpp b/indra/newview/llpipelinelistener.cpp index dfbe689f56..f11cdcf876 100644 --- a/indra/newview/llpipelinelistener.cpp +++ b/indra/newview/llpipelinelistener.cpp @@ -87,7 +87,7 @@ namespace { U32 render_feature = feature_from_string( iter->asString() ); if ( render_feature != 0 ) { - LLPipeline::toggleRenderDebugControl( render_feature ); + LLPipeline::toggleRenderDebugFeatureControl( render_feature ); } } } @@ -123,7 +123,7 @@ namespace { iter != request["displays"].endArray(); ++iter) { - U32 info_display = info_display_from_string( iter->asString() ); + U64 info_display = info_display_from_string( iter->asString() ); if ( info_display != 0 ) { LLPipeline::toggleRenderDebug( info_display ); @@ -134,7 +134,7 @@ namespace { void has_info_display_wrapper(LLSD const& request) { LLEventAPI::Response response(LLSD(), request); - U32 info_display = info_display_from_string( request["display"].asString() ); + U64 info_display = info_display_from_string( request["display"].asString() ); if ( info_display != 0 ) { response["value"] = gPipeline.hasRenderDebugMask(info_display); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index d2c26dd6e7..6c52f118ad 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -964,7 +964,7 @@ class LLAdvancedSetDisplayTextureDensity : public view_listener_t ////////////////// // INFO DISPLAY // ////////////////// -U32 info_display_from_string(std::string info_display) +U64 info_display_from_string(std::string info_display) { if ("verify" == info_display) { @@ -1082,6 +1082,10 @@ U32 info_display_from_string(std::string info_display) { return LLPipeline::RENDER_DEBUG_TRIANGLE_COUNT; } + else if ("impostors" == info_display) + { + return LLPipeline::RENDER_DEBUG_IMPOSTORS; + } else { LL_WARNS() << "unrecognized feature name '" << info_display << "'" << LL_ENDL; @@ -1093,7 +1097,7 @@ class LLAdvancedToggleInfoDisplay : public view_listener_t { bool handleEvent(const LLSD& userdata) { - U32 info_display = info_display_from_string( userdata.asString() ); + U64 info_display = info_display_from_string( userdata.asString() ); LL_INFOS("ViewerMenu") << "toggle " << userdata.asString() << LL_ENDL; @@ -1111,7 +1115,7 @@ class LLAdvancedCheckInfoDisplay : public view_listener_t { bool handleEvent(const LLSD& userdata) { - U32 info_display = info_display_from_string( userdata.asString() ); + U64 info_display = info_display_from_string( userdata.asString() ); bool new_value = false; if ( info_display != 0 ) diff --git a/indra/newview/llviewermenu.h b/indra/newview/llviewermenu.h index 7abb0c8e74..6882405407 100644 --- a/indra/newview/llviewermenu.h +++ b/indra/newview/llviewermenu.h @@ -143,7 +143,7 @@ void handle_export_selected( void * ); // Convert strings to internal types U32 render_type_from_string(std::string render_type); U32 feature_from_string(std::string feature); -U32 info_display_from_string(std::string info_display); +U64 info_display_from_string(std::string info_display); class LLViewerMenuHolderGL : public LLMenuHolderGL { diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 85019d5ae0..34e82d878a 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -4943,22 +4943,52 @@ U32 LLVOAvatar::renderImpostor(LLColor4U color, S32 diffuse_channel) left *= mImpostorDim.mV[0]; up *= mImpostorDim.mV[1]; - LLGLEnable test(GL_ALPHA_TEST); - gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.f); - - gGL.color4ubv(color.mV); - gGL.getTexUnit(diffuse_channel)->bind(&mImpostor); - gGL.begin(LLRender::QUADS); - gGL.texCoord2f(0,0); - gGL.vertex3fv((pos+left-up).mV); - gGL.texCoord2f(1,0); - gGL.vertex3fv((pos-left-up).mV); - gGL.texCoord2f(1,1); - gGL.vertex3fv((pos-left+up).mV); - gGL.texCoord2f(0,1); - gGL.vertex3fv((pos+left+up).mV); - gGL.end(); - gGL.flush(); + if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_IMPOSTORS)) + { + LLGLEnable blend(GL_BLEND); + gGL.setSceneBlendType(LLRender::BT_ADD); + gGL.getTexUnit(diffuse_channel)->unbind(LLTexUnit::TT_TEXTURE); + + // gGL.begin(LLRender::QUADS); + // gGL.vertex3fv((pos+left-up).mV); + // gGL.vertex3fv((pos-left-up).mV); + // gGL.vertex3fv((pos-left+up).mV); + // gGL.vertex3fv((pos+left+up).mV); + // gGL.end(); + + + gGL.begin(LLRender::LINES); + gGL.color4f(1.f,1.f,1.f,1.f); + glLineWidth(2.f); + gGL.vertex3fv((pos+left-up).mV); + gGL.vertex3fv((pos-left-up).mV); + gGL.vertex3fv((pos-left-up).mV); + gGL.vertex3fv((pos-left+up).mV); + gGL.vertex3fv((pos-left+up).mV); + gGL.vertex3fv((pos+left+up).mV); + gGL.vertex3fv((pos+left+up).mV); + gGL.vertex3fv((pos+left-up).mV); + gGL.end(); + gGL.flush(); + } + { + LLGLEnable test(GL_ALPHA_TEST); + gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.f); + + gGL.color4ubv(color.mV); + gGL.getTexUnit(diffuse_channel)->bind(&mImpostor); + gGL.begin(LLRender::QUADS); + gGL.texCoord2f(0,0); + gGL.vertex3fv((pos+left-up).mV); + gGL.texCoord2f(1,0); + gGL.vertex3fv((pos-left-up).mV); + gGL.texCoord2f(1,1); + gGL.vertex3fv((pos-left+up).mV); + gGL.texCoord2f(0,1); + gGL.vertex3fv((pos+left+up).mV); + gGL.end(); + gGL.flush(); + } return 6; } diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 4bfa749d9f..b493219851 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -6856,7 +6856,7 @@ bool LLPipeline::toggleRenderTypeControlNegated(S32 type) } //static -void LLPipeline::toggleRenderDebug(U32 bit) +void LLPipeline::toggleRenderDebug(U64 bit) { if (gPipeline.hasRenderDebugMask(bit)) { @@ -6871,7 +6871,7 @@ void LLPipeline::toggleRenderDebug(U32 bit) //static -bool LLPipeline::toggleRenderDebugControl(U32 bit) +bool LLPipeline::toggleRenderDebugControl(U64 bit) { return gPipeline.hasRenderDebugMask(bit); } diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 85c13487ee..29fe1cbd33 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -330,10 +330,10 @@ public: void addTrianglesDrawn(S32 index_count, U32 render_type = LLRender::TRIANGLES); bool hasRenderDebugFeatureMask(const U32 mask) const { return bool(mRenderDebugFeatureMask & mask); } - bool hasRenderDebugMask(const U32 mask) const { return bool(mRenderDebugMask & mask); } + bool hasRenderDebugMask(const U64 mask) const { return bool(mRenderDebugMask & mask); } void setAllRenderDebugFeatures() { mRenderDebugFeatureMask = 0xffffffff; } void clearAllRenderDebugFeatures() { mRenderDebugFeatureMask = 0x0; } - void setAllRenderDebugDisplays() { mRenderDebugMask = 0xffffffff; } + void setAllRenderDebugDisplays() { mRenderDebugMask = 0xffffffffffffffff; } void clearAllRenderDebugDisplays() { mRenderDebugMask = 0x0; } bool hasRenderType(const U32 type) const; @@ -357,11 +357,11 @@ public: // For UI control of render features static bool hasRenderTypeControl(U32 data); - static void toggleRenderDebug(U32 data); + static void toggleRenderDebug(U64 data); static void toggleRenderDebugFeature(U32 data); static void toggleRenderTypeControl(U32 data); static bool toggleRenderTypeControlNegated(S32 data); - static bool toggleRenderDebugControl(U32 data); + static bool toggleRenderDebugControl(U64 data); static bool toggleRenderDebugFeatureControl(U32 data); static void setRenderDebugFeatureControl(U32 bit, bool value); @@ -500,40 +500,41 @@ public: RENDER_DEBUG_FEATURE_FOOT_SHADOWS = 0x0100, }; - enum LLRenderDebugMask + enum LLRenderDebugMask: U64 { - RENDER_DEBUG_COMPOSITION = 0x00000001, - RENDER_DEBUG_VERIFY = 0x00000002, - RENDER_DEBUG_BBOXES = 0x00000004, - RENDER_DEBUG_OCTREE = 0x00000008, - RENDER_DEBUG_WIND_VECTORS = 0x00000010, - RENDER_DEBUG_OCCLUSION = 0x00000020, - RENDER_DEBUG_POINTS = 0x00000040, - RENDER_DEBUG_TEXTURE_PRIORITY = 0x00000080, - RENDER_DEBUG_TEXTURE_AREA = 0x00000100, - RENDER_DEBUG_FACE_AREA = 0x00000200, - RENDER_DEBUG_PARTICLES = 0x00000400, - RENDER_DEBUG_GLOW = 0x00000800, // not used - RENDER_DEBUG_TEXTURE_ANIM = 0x00001000, - RENDER_DEBUG_LIGHTS = 0x00002000, - RENDER_DEBUG_BATCH_SIZE = 0x00004000, - RENDER_DEBUG_ALPHA_BINS = 0x00008000, // not used - RENDER_DEBUG_RAYCAST = 0x00010000, - RENDER_DEBUG_AVATAR_DRAW_INFO = 0x00020000, - RENDER_DEBUG_SHADOW_FRUSTA = 0x00040000, - RENDER_DEBUG_SCULPTED = 0x00080000, - RENDER_DEBUG_AVATAR_VOLUME = 0x00100000, - RENDER_DEBUG_AVATAR_JOINTS = 0x00200000, - RENDER_DEBUG_BUILD_QUEUE = 0x00400000, - RENDER_DEBUG_AGENT_TARGET = 0x00800000, - RENDER_DEBUG_UPDATE_TYPE = 0x01000000, - RENDER_DEBUG_PHYSICS_SHAPES = 0x02000000, - RENDER_DEBUG_NORMALS = 0x04000000, - RENDER_DEBUG_LOD_INFO = 0x08000000, - RENDER_DEBUG_RENDER_COMPLEXITY = 0x10000000, - RENDER_DEBUG_ATTACHMENT_BYTES = 0x20000000, // not used - RENDER_DEBUG_TEXEL_DENSITY = 0x40000000, - RENDER_DEBUG_TRIANGLE_COUNT = 0x80000000 + RENDER_DEBUG_COMPOSITION = 0x00000001, + RENDER_DEBUG_VERIFY = 0x00000002, + RENDER_DEBUG_BBOXES = 0x00000004, + RENDER_DEBUG_OCTREE = 0x00000008, + RENDER_DEBUG_WIND_VECTORS = 0x00000010, + RENDER_DEBUG_OCCLUSION = 0x00000020, + RENDER_DEBUG_POINTS = 0x00000040, + RENDER_DEBUG_TEXTURE_PRIORITY = 0x00000080, + RENDER_DEBUG_TEXTURE_AREA = 0x00000100, + RENDER_DEBUG_FACE_AREA = 0x00000200, + RENDER_DEBUG_PARTICLES = 0x00000400, + RENDER_DEBUG_GLOW = 0x00000800, // not used + RENDER_DEBUG_TEXTURE_ANIM = 0x00001000, + RENDER_DEBUG_LIGHTS = 0x00002000, + RENDER_DEBUG_BATCH_SIZE = 0x00004000, + RENDER_DEBUG_ALPHA_BINS = 0x00008000, // not used + RENDER_DEBUG_RAYCAST = 0x00010000, + RENDER_DEBUG_AVATAR_DRAW_INFO = 0x00020000, + RENDER_DEBUG_SHADOW_FRUSTA = 0x00040000, + RENDER_DEBUG_SCULPTED = 0x00080000, + RENDER_DEBUG_AVATAR_VOLUME = 0x00100000, + RENDER_DEBUG_AVATAR_JOINTS = 0x00200000, + RENDER_DEBUG_BUILD_QUEUE = 0x00400000, + RENDER_DEBUG_AGENT_TARGET = 0x00800000, + RENDER_DEBUG_UPDATE_TYPE = 0x01000000, + RENDER_DEBUG_PHYSICS_SHAPES = 0x02000000, + RENDER_DEBUG_NORMALS = 0x04000000, + RENDER_DEBUG_LOD_INFO = 0x08000000, + RENDER_DEBUG_RENDER_COMPLEXITY = 0x10000000, + RENDER_DEBUG_ATTACHMENT_BYTES = 0x20000000, // not used + RENDER_DEBUG_TEXEL_DENSITY = 0x40000000, + RENDER_DEBUG_TRIANGLE_COUNT = 0x80000000, + RENDER_DEBUG_IMPOSTORS = 0x100000000 }; public: @@ -670,10 +671,10 @@ protected: std::stack mRenderTypeEnableStack; U32 mRenderDebugFeatureMask; - U32 mRenderDebugMask; + U64 mRenderDebugMask; + U64 mOldRenderDebugMask; std::stack mRenderDebugFeatureStack; - U32 mOldRenderDebugMask; ///////////////////////////////////////////// // diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 8490d792fa..42744b561f 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -3570,6 +3570,16 @@ function="Advanced.ToggleInfoDisplay" parameter="agent target" /> + + + +