void LLMotionController::pauseAllSyncedCharacters(std::vector<LLAnimPauseRequest>& avatar_pause_handles) { // Run over all motions. for (motion_list_t::iterator iter = mActiveMotions.begin(); iter != mActiveMotions.end(); ++iter) { LLMotion* motionp = *iter; AISyncServer* server = motionp->server(); if (server && !server->never_synced() && motionp->isActive()) // Skip motions that aren't synchronized at all or that are not active. { // Run over all clients of the found servers. AISyncServer::client_list_t const& clients = server->getClients(); for (AISyncServer::client_list_t::const_iterator client = clients.begin(); client != clients.end(); ++client) { LLMotion* motion = dynamic_cast<LLMotion*>(client->mClientPtr); if (!motion) { continue; } LLMotionController* controller = motion->getController(); if (controller == this) { continue; } controller->requestPause(avatar_pause_handles); } } } }
//<singu> //----------------------------------------------------------------------------- // toggle_hidden() //----------------------------------------------------------------------------- void LLMotionController::toggle_hidden(void) { mHaveVisibleSyncedMotions = mHidden; // Default is false if we just became invisible (otherwise this value isn't used). mHidden = !mHidden; synceventset_t const visible = mHidden ? 0 : 4; // Run over all motions. for (motion_list_t::iterator iter = mActiveMotions.begin(); iter != mActiveMotions.end(); ++iter) { LLMotion* motionp = *iter; AISyncServer* server = motionp->server(); if (server && !server->never_synced() && motionp->isActive()) // Skip motions that aren't synchronized at all or that are not active. { bool visible_before = server->events_with_at_least_one_client_ready() & 4; server->ready(4, visible, motionp); // Mark that now we are visible or no longer visible. bool visible_after = server->events_with_at_least_one_client_ready() & 4; if (visible_after) // Are there any synchronized motions (left) that ARE visible? { mHaveVisibleSyncedMotions = true; } if (visible_before != visible_after) { // The group as a whole now might need to change whether or not it is animated. AISyncServer::client_list_t const& clients = server->getClients(); for (AISyncServer::client_list_t::const_iterator client = clients.begin(); client != clients.end(); ++client) { LLMotion* motion = dynamic_cast<LLMotion*>(client->mClientPtr); if (!motion) { continue; } LLMotionController* controller = motion->getController(); if (controller == this) { continue; } if (visible_after) { // Us becoming visible means that all synchronized avatars need to be animated again too. controller->setHaveVisibleSyncedMotions(); } else { // Us becoming hidden means that all synchronized avatars might stop animating. controller->refresh_hidden(); // It is extremely unlikely, but harmless, to call this twice on the same controller. } } } } } }
void LLMotionController::refresh_hidden(void) { mHaveVisibleSyncedMotions = !mHidden; // Run over all motions. for (motion_list_t::iterator iter = mActiveMotions.begin(); iter != mActiveMotions.end(); ++iter) { LLMotion* motionp = *iter; AISyncServer* server = motionp->server(); if (server && !server->never_synced() && motionp->isActive()) // Skip motions that aren't synchronized at all or that are not active. { bool visible_after = server->events_with_at_least_one_client_ready() & 4; if (visible_after) // Are there any synchronized motions (left) that ARE visible? { mHaveVisibleSyncedMotions = true; } } } }