private void HandleAppearanceSend(UUID agentid) { ScenePresence sp = m_scene.GetScenePresence(agentid); if (sp == null) { m_log.WarnFormat("[AVATAR FACTORY MODULE]: Agent {0} no longer in the scene", agentid); return; } // m_log.WarnFormat("[AVATAR FACTORY MODULE]: Handle appearance send for {0}", agentid); // Send the appearance to everyone in the scene sp.SendAppearanceToAllOtherAgents(); sp.ControllingClient.SendAvatarDataImmediate(sp); // Send the appearance back to the avatar // AvatarAppearance avp = sp.Appearance; // sp.ControllingClient.SendAppearance(avp.Owner, avp.VisualParams, avp.Texture.GetBytes()); /* * // this needs to be fixed, the flag should be on scene presence not the region module * // Start the animations if necessary * if (!m_startAnimationSet) * { * sp.Animator.UpdateMovementAnimations(); * m_startAnimationSet = true; * } */ }
private void SendAppearance(ScenePresence sp) { // Send the appearance to everyone in the scene sp.SendAppearanceToAllOtherAgents(); // Send animations back to the avatar as well sp.Animator.SendAnimPack(); }
/// ----------------------------------------------------------------- /// <summary> /// </summary> // ----------------------------------------------------------------- public ResponseBase SetAvatarAppearanceHandler(RequestBase irequest) { if (irequest.GetType() != typeof(SetAvatarAppearanceRequest)) { return(OperationFailed("wrong type")); } SetAvatarAppearanceRequest request = (SetAvatarAppearanceRequest)irequest; // Get the scenepresence for the avatar we are going to update UUID id = request.AvatarID == UUID.Zero ? request._UserAccount.PrincipalID : request.AvatarID; ScenePresence sp = m_scene.GetScenePresence(id); if (sp == null || sp.IsChildAgent) { return(OperationFailed(String.Format("cannot find user {0}", request._UserAccount.PrincipalID))); } // Clean out the current outfit folder, this is to keep v3 viewers from // reloading the old appearance CleanCurrentOutfitFolder(sp); // Delete existing npc attachments m_scene.AttachmentsModule.DeleteAttachmentsFromScene(sp, false); // ---------- Update the appearance and save it ---------- int serial = sp.Appearance.Serial; OSDMap osd = (OSDMap)OSDParser.DeserializeJson(request.SerializedAppearance); sp.Appearance = new AvatarAppearance(osd); sp.Appearance.Serial = serial + 1; m_scene.AvatarService.SetAppearance(sp.UUID, sp.Appearance); m_scene.EventManager.TriggerAvatarAppearanceChanged(sp); // ---------- Send out the new appearance to everyone ---------- // Rez needed attachments m_scene.AttachmentsModule.RezAttachments(sp); // this didn't work, still looking for a way to get the viewer to change its appearance //sp.ControllingClient.SendWearables(sp.Appearance.Wearables, sp.Appearance.Serial++); // this didn't work either, //AddWearablesToCurrentOutfitFolder(sp); sp.SendAvatarDataToAllAgents(); sp.SendAppearanceToAllOtherAgents(); sp.SendAppearanceToAgent(sp); // the viewers seem to ignore this packet when it describes their own avatar return(new ResponseBase(ResponseCode.Success, "")); }
private void HandleAppearanceSend(UUID agentid) { ScenePresence sp = m_scene.GetScenePresence(agentid); if (sp == null) { m_log.WarnFormat("[AVFACTORY]: Agent {0} no longer in the scene", agentid); return; } // m_log.WarnFormat("[AVFACTORY]: Handle appearance send for {0}", agentid); // Send the appearance to everyone in the scene sp.SendAppearanceToAllOtherAgents(); // Send animations back to the avatar as well sp.Animator.SendAnimPack(); }
public bool SendAppearance(UUID agentId) { // m_log.DebugFormat("[AVFACTORY]: Sending appearance for {0}", agentId); ScenePresence sp = m_scene.GetScenePresence(agentId); if (sp == null) { m_log.WarnFormat("[AVFACTORY]: Agent {0} no longer in the scene", agentId); return(false); } // Send the appearance to everyone in the scene sp.SendAppearanceToAllOtherAgents(); // Send animations back to the avatar as well sp.Animator.SendAnimPack(); return(true); }
private void SetPropertyValue(ScenePresence sp, SyncableProperties.Type property, SyncedProperty pSyncInfo) { if (sp == null || pSyncInfo == null) { return; } Object pValue = pSyncInfo.LastUpdateValue; switch (property) { case SyncableProperties.Type.LocalId: sp.LocalId = (uint)pValue; break; case SyncableProperties.Type.AbsolutePosition: sp.AbsolutePosition = (Vector3)pValue; break; case SyncableProperties.Type.AgentCircuitData: DebugLog.WarnFormat("{0}: Received updated AgentCircuitData. Not implemented", LogHeader); break; case SyncableProperties.Type.ParentId: uint localID = (uint)pValue; if (localID == 0) { // DebugLog.DebugFormat("{0}: SetPropertyValue:ParentID. Standup. Input={1}", LogHeader, localID); // DEBUG DEBUG sp.StandUp(); } else { SceneObjectPart parentPart = Scene.GetSceneObjectPart(localID); if (parentPart != null) // TODO ?? { sp.HandleAgentRequestSit(sp.ControllingClient, sp.ControllingClient.AgentId, parentPart.UUID, Vector3.Zero); // DebugLog.DebugFormat("{0}: SetPropertyValue:ParentID. SitRequest. Input={1},sp={2},newParentID={3}", // LogHeader, localID, (string)(sp == null ? "NULL" : sp.Name), sp.ParentID); // DEBUG DEBUG } } //sp.ParentID = (uint)pValue; break; case SyncableProperties.Type.AgentControlFlags: sp.AgentControlFlags = (uint)pValue; break; case SyncableProperties.Type.AllowMovement: sp.AllowMovement = (bool)pValue; break; case SyncableProperties.Type.AvatarAppearance: sp.Appearance.Unpack((OSDMap)pValue); sp.SendAppearanceToAllOtherAgents(); DebugLog.DebugFormat("{0} Received updated AvatarAppearance for uuid {1}.", LogHeader, sp.UUID); break; case SyncableProperties.Type.Animations: UpdateAvatarAnimations(sp, (OSDArray)pValue); break; case SyncableProperties.Type.Rotation: sp.Rotation = (Quaternion)pValue; break; case SyncableProperties.Type.PA_Velocity: if (sp.PhysicsActor != null) { sp.PhysicsActor.Velocity = (Vector3)pValue; } break; case SyncableProperties.Type.RealRegion: ////// NOP ////// break; case SyncableProperties.Type.PA_TargetVelocity: if (sp.PhysicsActor != null) { sp.PhysicsActor.TargetVelocity = (Vector3)pValue; } break; case SyncableProperties.Type.Flying: sp.Flying = (bool)pValue; break; case SyncableProperties.Type.PresenceType: DebugLog.WarnFormat("{0} Received updated PresenceType for uuid {1}. Not implemented", LogHeader, sp.UUID); break; case SyncableProperties.Type.IsColliding: if (sp.PhysicsActor != null) { sp.IsColliding = (bool)pValue; } break; } // When presence values are changed, we tell the simulator with an event GenerateAgentUpdated(sp); }