diff options
| author | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2017-07-06 01:25:10 +0100 | 
|---|---|---|
| committer | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2017-07-06 01:25:10 +0100 | 
| commit | f55667397e75991348fa25b6ad581a36de99acf0 (patch) | |
| tree | 131f55e90c21d7c742b6e942a7f4ceba4289f038 | |
| parent | 2af5332e46b3917d6dce211e576a92d04c3eda8b (diff) | |
SL-722 - handle per-object animation requests, combine for control avatar animation state.
| -rw-r--r-- | indra/newview/app_settings/logcontrol.xml | 1 | ||||
| -rw-r--r-- | indra/newview/llcontrolavatar.cpp | 64 | ||||
| -rw-r--r-- | indra/newview/llcontrolavatar.h | 3 | ||||
| -rw-r--r-- | indra/newview/llviewermessage.cpp | 13 | ||||
| -rw-r--r-- | indra/newview/llvoavatar.cpp | 1 | ||||
| -rw-r--r-- | indra/newview/llvovolume.h | 5 | ||||
| -rw-r--r-- | scripts/testing/lsl/cycle_object_animations.lsl | 6 | 
7 files changed, 82 insertions, 11 deletions
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 @@  						</array>  					<key>tags</key>  						<array> +                          <string>AXON</string>  						<!-- sample entry for debugging specific items	  						     <string>Avatar</string>  						     <string>Inventory</string> diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index bd99f66459..f18d1c636a 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -190,3 +190,67 @@ void LLControlAvatar::updateDebugText()      LLVOAvatar::updateDebugText();  } + +void LLControlAvatar::getAnimatedVolumes(std::vector<LLVOVolume*>& volumes) +{ +    if (!mRootVolp) +    { +        return; +    } + +    volumes.push_back(mRootVolp); +     +	LLViewerObject::const_child_list_t& child_list = mRootVolp->getChildren(); +	for (LLViewerObject::const_child_list_t::const_iterator iter = child_list.begin(); +		 iter != child_list.end(); ++iter) +	{ +		LLViewerObject* childp = *iter; +        LLVOVolume *child_volp = dynamic_cast<LLVOVolume*>(childp); +        if (child_volp && child_volp->isAnimatedObject()) +        { +            volumes.push_back(child_volp); +        } +    } +} + +// This is called after an associated object receives an animation +// message. Combine the signaled animations for all associated objects +// and process any resulting state changes. +void LLControlAvatar::updateAnimations() +{ +    if (!mRootVolp) +    { +        LL_WARNS("AXON") << "No root vol" << LL_ENDL; +        return; +    } + +    std::vector<LLVOVolume*> volumes; +    getAnimatedVolumes(volumes); +     +    // Rebuild mSignaledAnimations from the associated volumes. +	std::map<LLUUID, S32> anims; +    for (std::vector<LLVOVolume*>::iterator vol_it = volumes.begin(); vol_it != volumes.end(); ++vol_it) +    { +        LLVOVolume *volp = *vol_it; +        for (std::map<LLUUID,S32>::iterator anim_it = volp->mObjectSignaledAnimations.begin(); +             anim_it != volp->mObjectSignaledAnimations.end(); +             ++anim_it) +        { +            std::map<LLUUID,S32>::iterator found_anim_it = anims.find(anim_it->first); +            if (found_anim_it != anims.end()) +            { +                // Animation already present, use the larger sequence id +                anims[anim_it->first] = llmax(found_anim_it->second, anim_it->second); +            } +            else +            { +                // Animation not already present, use this sequence id. +                anims[anim_it->first] = anim_it->second; +            } +        } +    } +    mSignaledAnimations = anims; + +    LL_DEBUGS("AXON") << "process animation state changes here" << LL_ENDL; +    processAnimationStateChanges(); +} diff --git a/indra/newview/llcontrolavatar.h b/indra/newview/llcontrolavatar.h index fc7b4aa06d..1be2d58441 100644 --- a/indra/newview/llcontrolavatar.h +++ b/indra/newview/llcontrolavatar.h @@ -51,6 +51,9 @@ public:      void markForDeath();      virtual void idleUpdate(LLAgent &agent, const F64 &time); + +    void getAnimatedVolumes(std::vector<LLVOVolume*>& volumes); +    void updateAnimations();    	virtual void	updateDebugText(); diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 227c6afcb0..ba4c632586 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -5112,22 +5112,19 @@ void process_object_animation(LLMessageSystem *mesgsys, void **user_data)          avatarp->mPlaying = true;  		avatarp->updateVolumeGeom();      } -	avatarp->mSignaledAnimations.clear(); + +	volp->mObjectSignaledAnimations.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; +        volp->mObjectSignaledAnimations[animation_id] = anim_sequence_id;          LL_DEBUGS("AXON") << "got object animation request for object "  -                   << uuid << " animation id " << animation_id << LL_ENDL; +                          << uuid << " animation id " << animation_id << LL_ENDL;      } -	if (num_blocks >= 0) -	{ -        LL_DEBUGS("AXON") << "process animation state changes here" << LL_ENDL; -		avatarp->processAnimationStateChanges(); -	} +    avatarp->updateAnimations();  } diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 9a1629fbfb..b202f1b848 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -721,6 +721,7 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id,  	mCurrentGesticulationLevel = 0; +      	mRuthTimer.reset();  	mRuthDebugTimer.reset();  	mDebugExistenceTimer.reset(); diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h index 27a51d100f..3c0c9facb1 100644 --- a/indra/newview/llvovolume.h +++ b/indra/newview/llvovolume.h @@ -274,6 +274,11 @@ public:      bool isAnimatedObjectStateConsistent() const;      void updateAnimatedObjectState(LLViewerObject *old_parent, LLViewerObject *new_parent); +    // AXON For animated objects, we need to track animations requested +    // per-object, then reconcile those to manage the control avatar +    // animation state. +	std::map<LLUUID, S32> 					mObjectSignaledAnimations; // requested state of Animation name/value +      // Functions that deal with media, or media navigation      // Update this object's media data with the given media data array diff --git a/scripts/testing/lsl/cycle_object_animations.lsl b/scripts/testing/lsl/cycle_object_animations.lsl index 95fa99a191..79c8ff4151 100644 --- a/scripts/testing/lsl/cycle_object_animations.lsl +++ b/scripts/testing/lsl/cycle_object_animations.lsl @@ -9,17 +9,17 @@ cycle_animations()          ItemName = llGetInventoryName(INVENTORY_ANIMATION, count);          if (NowPlaying != "")          { -            llSay(0, "Stopping " + NowPlaying); +            //llSay(0, "Stopping " + NowPlaying);              llStopObjectAnimation(NowPlaying);          } -        llSay(0, "Starting " + ItemName); +        //llSay(0, "Starting " + ItemName);          llStartObjectAnimation(ItemName);          NowPlaying = ItemName;          llSleep(10);      }      if (NowPlaying != "")      { -        llSay(0, "Stopping " + NowPlaying); +        //llSay(0, "Stopping " + NowPlaying);          llStopObjectAnimation(NowPlaying);          llSleep(10);      }  | 
