diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 93119a45ab..31d3ce832f 100755 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -395,7 +395,7 @@ namespace OpenSim.Region.Framework.Scenes } PhysicsActor pa = sceneObject.RootPart.PhysActor; - if (pa is not null && pa.IsPhysical && !vel.IsZero()) + if (pa is not null && pa.IsPhysical && vel.IsNotZero()) { sceneObject.RootPart.ApplyImpulse((vel * sceneObject.GetMass()), false); } @@ -671,7 +671,7 @@ namespace OpenSim.Region.Framework.Scenes protected internal void HandleUndo(IClientAPI remoteClient, UUID primId) { - if (!primId.IsZero()) + if (primId.IsNotZero()) { SceneObjectPart part = m_parentScene.GetSceneObjectPart(primId); part?.Undo(); @@ -680,7 +680,7 @@ namespace OpenSim.Region.Framework.Scenes protected internal void HandleRedo(IClientAPI remoteClient, UUID primId) { - if (!primId.IsZero()) + if (primId.IsNotZero()) { SceneObjectPart part = m_parentScene.GetSceneObjectPart(primId); part?.Redo(); diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index e7d6346c12..b244fbea0e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -193,7 +193,7 @@ namespace OpenSim.Region.Framework.Scenes // needs more exclusion ? return(Backup && !IsTemporary && !inTransit && !UsesPhysics && !IsSelected && !IsAttachmentCheckFull() && !RootPart.Shape.MeshFlagEntry && // animations are not sent correctly for now - RootPart.KeyframeMotion == null && + RootPart.KeyframeMotion is null && (DateTime.UtcNow.Ticks - timeLastChanged > 3000000000) //&& //3000000000 is 5min //(DateTime.UtcNow.Ticks - timeLastChanged > 36000000000) //&& //36000000000 is one hour ); @@ -231,7 +231,7 @@ namespace OpenSim.Region.Framework.Scenes timeLastChanged = DateTime.UtcNow.Ticks; if (!m_hasGroupChanged) timeFirstChanged = timeLastChanged; - if (m_rootPart != null && m_scene != null) + if (m_rootPart is not null && m_scene is not null) { if (m_scene.GetRootAgentCount() == 0) { @@ -633,7 +633,7 @@ namespace OpenSim.Region.Framework.Scenes set { Vector3 val = value; - if (Scene != null + if (Scene is not null && !Scene.PositionIsInCurrentRegion(val) && !IsAttachmentCheckFull() && !Scene.LoadingPrims @@ -660,7 +660,7 @@ namespace OpenSim.Region.Framework.Scenes { RootPart.ScriptSetPhysicsStatus(false); - if (Scene != null) + if (Scene is not null) Scene.SimChat(Utils.StringToBytes("Hit Sandbox Limit"), ChatTypeEnum.DebugChannel, 0x7FFFFFFF, RootPart.AbsolutePosition, Name, UUID, false); @@ -700,7 +700,7 @@ namespace OpenSim.Region.Framework.Scenes } } - if (Scene != null) + if (Scene is not null) Scene.EventManager.TriggerParcelPrimCountTainted(); } @@ -711,7 +711,7 @@ namespace OpenSim.Region.Framework.Scenes Scene sogScene = sog.m_scene; SceneObjectPart root = sog.RootPart; - bool isTeleport = tpdata != null; + bool isTeleport = tpdata is not null; if(!isTeleport) { @@ -749,22 +749,22 @@ namespace OpenSim.Region.Framework.Scenes // if(!m_scene.IsRunning) // return sog; - if (root.KeyframeMotion != null) + if (root.KeyframeMotion is not null) root.KeyframeMotion.StartCrossingCheck(); - if(root.PhysActor != null) + if(root.PhysActor is not null) root.PhysActor.CrossingStart(); IEntityTransferModule entityTransfer = sogScene.RequestModuleInterface(); - if (entityTransfer == null) + if (entityTransfer is null) return sog; Vector3 newpos = Vector3.Zero; OpenSim.Services.Interfaces.GridRegion destination = null; destination = entityTransfer.GetObjectDestination(sog, val, out newpos); - if (destination == null) + if (destination is null) return sog; if (sog.m_sittingAvatars.Count == 0) @@ -797,7 +797,7 @@ namespace OpenSim.Region.Framework.Scenes if(!entityTransfer.checkAgentAccessToRegion(av, destination, newpos, ctx, out reason)) return sog; - m_log.DebugFormat("[SCENE OBJECT]: Avatar {0} needs to be crossed to {1}", av.Name, destination.RegionName); + m_log.Debug($"[SCENE OBJECT]: Avatar {av.Name} needs to be crossed to {destination.RegionName}"); } // We unparent the SP quietly so that it won't @@ -813,7 +813,7 @@ namespace OpenSim.Region.Framework.Scenes avtocrossInfo avinfo = new avtocrossInfo(); SceneObjectPart parentPart = sogScene.GetSceneObjectPart(av.ParentID); - if (parentPart != null) + if (parentPart is not null) { av.ParentUUID = parentPart.UUID; if(parentPart.SitTargetAvatar == av.UUID) @@ -902,7 +902,7 @@ namespace OpenSim.Region.Framework.Scenes ScenePresence av = avinfo.av; av.IsInLocalTransit = true; av.IsInTransit = true; - m_log.DebugFormat("[SCENE OBJECT]: Crossing avatar {0} to {1}", av.Name, val); + m_log.Debug($"[SCENE OBJECT]: Crossing avatar {av.Name} to {val}"); if(av.m_crossingFlags > 0) entityTransfer.CrossAgentToNewRegionAsync(av, newpos, destination, false, ctx); @@ -910,7 +910,7 @@ namespace OpenSim.Region.Framework.Scenes if (av.IsChildAgent) { // avatar crossed do some extra cleanup - if (!av.ParentUUID.IsZero()) + if (av.ParentUUID.IsNotZero()) { av.ClearControls(); av.ParentPart = null; @@ -920,7 +920,7 @@ namespace OpenSim.Region.Framework.Scenes // In any case av.IsInTransit = false; av.m_crossingFlags = 0; - m_log.DebugFormat("[SCENE OBJECT]: Crossing agent {0} {1} completed.", av.Firstname, av.Lastname); + m_log.Debug($"[SCENE OBJECT]: Crossing agent {av.Firstname} {av.Lastname} completed."); } else { @@ -938,8 +938,8 @@ namespace OpenSim.Region.Framework.Scenes av.m_crossingFlags = 0; av.sitAnimation = "SIT"; av.IsInTransit = false; - if(av.Animator!= null) - av.Animator.SetMovementAnimations("STAND"); + + av.Animator?.SetMovementAnimations("STAND"); av.AddToPhysicalScene(false); sogScene.ForEachScenePresence(delegate(ScenePresence oav) { @@ -951,12 +951,12 @@ namespace OpenSim.Region.Framework.Scenes { av.SendAvatarDataToAgent(oav); av.SendAppearanceToAgent(oav); - if (av.Animator != null) - av.Animator.SendAnimPackToClient(oav.ControllingClient); + + av.Animator?.SendAnimPackToClient(oav.ControllingClient); av.SendAttachmentsToAgentNF(oav); // not ok } }); - m_log.DebugFormat("[SCENE OBJECT]: Crossing agent {0} {1} failed.", av.Firstname, av.Lastname); + m_log.Debug($"[SCENE OBJECT]: Crossing agent {av.Firstname} {av.Lastname} failed."); } } @@ -1005,7 +1005,7 @@ namespace OpenSim.Region.Framework.Scenes public void CrossAsyncCompleted(SceneObjectGroup sog) { - if (sog == null || sog.IsDeleted) + if (sog is null || sog.IsDeleted) return; SceneObjectPart rootp = sog.m_rootPart; @@ -1030,10 +1030,10 @@ namespace OpenSim.Region.Framework.Scenes av.sitSOGmoved(); } - if (sog.m_rootPart.KeyframeMotion != null) + if (sog.m_rootPart.KeyframeMotion is not null) sog.m_rootPart.KeyframeMotion.CrossingFailure(); - if (sog.RootPart.PhysActor != null) + if (sog.RootPart.PhysActor is not null) sog.RootPart.PhysActor.CrossingFailure(); sog.inTransit = false; @@ -1058,13 +1058,13 @@ namespace OpenSim.Region.Framework.Scenes public int TeleportObject(UUID sourceID, Vector3 targetPosition, Quaternion rotation, int flags) { - if(inTransit || IsDeleted || IsAttachmentCheckFull() || IsSelected || Scene == null) + if(inTransit || IsDeleted || IsAttachmentCheckFull() || IsSelected || Scene is null) return -1; inTransit = true; PhysicsActor pa = RootPart.PhysActor; - if(/*pa == null ||*/ RootPart.KeyframeMotion != null /*|| m_sittingAvatars.Count == 0*/) + if(/*pa is null ||*/ RootPart.KeyframeMotion is not null /*|| m_sittingAvatars.Count == 0*/) { inTransit = false; return -1; @@ -1117,7 +1117,7 @@ namespace OpenSim.Region.Framework.Scenes float posX = targetPosition.X; float posY = targetPosition.Y; ILandObject land = Scene.LandChannel.GetLandObject(posX, posY); - if(land != null && land != curLand) + if(land is not null && land != curLand) { if(!Scene.Permissions.CanObjectEnterWithScripts(this, land)) { @@ -1270,7 +1270,7 @@ namespace OpenSim.Region.Framework.Scenes // keep as was for now PhysicsActor pa = m_rootPart.PhysActor; - if (pa != null) + if (pa is not null) { pa.Selected = value; @@ -1281,11 +1281,11 @@ namespace OpenSim.Region.Framework.Scenes SceneObjectPart child = parts[i]; PhysicsActor childPa = child.PhysActor; - if (childPa != null) + if (childPa is not null) childPa.Selected = value; } } - if (RootPart.KeyframeMotion != null) + if (RootPart.KeyframeMotion is not null) RootPart.KeyframeMotion.Selected = value; } } @@ -1333,7 +1333,7 @@ namespace OpenSim.Region.Framework.Scenes { get { - if (m_scene != null) + if (m_scene is not null) { return m_scene.RegionInfo.RegionID; } @@ -1472,14 +1472,14 @@ namespace OpenSim.Region.Framework.Scenes XmlNodeList nodes = doc.GetElementsByTagName("SavedScriptState"); if (nodes.Count > 0) { - if (m_savedScriptState == null) + if (m_savedScriptState is null) m_savedScriptState = new Dictionary(); foreach (XmlNode node in nodes) { - if (node.Attributes["UUID"] != null) + if (node.Attributes["UUID"] is not null) { UUID itemid = new UUID(node.Attributes["UUID"].Value); - if (!itemid.IsZero()) + if (itemid.IsNotZero()) m_savedScriptState[itemid] = node.InnerXml; } } @@ -1492,11 +1492,10 @@ namespace OpenSim.Region.Framework.Scenes while (true) { - if (reader.Name == "SavedScriptState" && reader.NodeType == XmlNodeType.Element) + if (reader.Name.Equals("SavedScriptState") && reader.NodeType == XmlNodeType.Element) { -// m_log.DebugFormat("[SCENE OBJECT GROUP]: Loading script state for {0}", Name); - - if (m_savedScriptState == null) + //m_log.DebugFormat("[SCENE OBJECT GROUP]: Loading script state for {0}", Name); + if (m_savedScriptState is null) m_savedScriptState = new Dictionary(); string uuid = reader.GetAttribute("UUID"); @@ -1505,17 +1504,16 @@ namespace OpenSim.Region.Framework.Scenes // so we don't continually keep checking the same SavedScriptedState element. string innerXml = reader.ReadInnerXml(); - if (uuid != null) + if (!string.IsNullOrEmpty(uuid)) { -// m_log.DebugFormat("[SCENE OBJECT GROUP]: Found state for item ID {0} in object {1}", uuid, Name); - + //m_log.DebugFormat("[SCENE OBJECT GROUP]: Found state for item ID {0} in object {1}", uuid, Name); UUID itemid = new UUID(uuid); - if (!itemid.IsZero()) + if (itemid.IsNotZero()) m_savedScriptState[itemid] = innerXml; } else { - m_log.WarnFormat("[SCENE OBJECT GROUP]: SavedScriptState element had no UUID in object {0} id: {1}", Name,UUID); + m_log.Warn($"[SCENE OBJECT GROUP]: SavedScriptState element had no UUID in object {Name} id: {UUID}"); } } else @@ -1565,7 +1563,7 @@ namespace OpenSim.Region.Framework.Scenes for (int i = 0; i < parts.Length; i++) { part = parts[i]; - if (part.KeyframeMotion != null) + if (part.KeyframeMotion is not null) { part.KeyframeMotion.UpdateSceneObject(this); } @@ -1805,7 +1803,7 @@ namespace OpenSim.Region.Framework.Scenes public Vector3 getCenterOffset() { // math is done in GetBoundsRadius(); - if(m_boundsRadius == null) + if(m_boundsRadius is null) GetBoundsRadius(); Quaternion rot = m_rootPart.RotationOffset; @@ -1826,7 +1824,7 @@ namespace OpenSim.Region.Framework.Scenes public float getAreaFactor() { // math is done in GetBoundsRadius(); - if(m_boundsRadius == null) + if(m_boundsRadius is null) GetBoundsRadius(); return m_areaFactor; } @@ -1834,7 +1832,7 @@ namespace OpenSim.Region.Framework.Scenes public float GetBoundsRadius() { // this may need more threading work - if(m_boundsRadius == null) + if(m_boundsRadius is null) { float res = 0; float areaF = 0; @@ -2001,14 +1999,14 @@ namespace OpenSim.Region.Framework.Scenes public void DetachToGround() { ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar); - if (avatar == null) + if (avatar is null) return; m_rootPart.Shape.LastAttachPoint = m_rootPart.Shape.State; m_rootPart.AttachedPos = m_rootPart.OffsetPosition; avatar.RemoveAttachment(this); Vector3 detachedpos = new Vector3(127f,127f,127f); - if (avatar == null) + if (avatar is null) return; detachedpos = avatar.AbsolutePosition; @@ -2040,7 +2038,7 @@ namespace OpenSim.Region.Framework.Scenes { ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar); //Vector3 detachedpos = new Vector3(127f, 127f, 127f); - if (avatar != null) + if (avatar is not null) { //detachedpos = avatar.AbsolutePosition; avatar.RemoveAttachment(this); @@ -2077,7 +2075,7 @@ namespace OpenSim.Region.Framework.Scenes /// public void SetRootPart(SceneObjectPart part) { - if (part == null) + if (part is null) throw new ArgumentNullException("Cannot give SceneObjectGroup a null root SceneObjectPart"); part.SetParent(this); @@ -2129,7 +2127,7 @@ namespace OpenSim.Region.Framework.Scenes // helper provided for parts. public int GetSceneMaxUndo() { - if (m_scene != null) + if (m_scene is not null) return m_scene.MaxUndoCount; return 5; } @@ -2175,7 +2173,7 @@ namespace OpenSim.Region.Framework.Scenes public UUID GetPartsFullID(uint localID) { SceneObjectPart part = GetPart(localID); - if (part != null) + if (part is not null) { return part.UUID; } @@ -2232,7 +2230,7 @@ namespace OpenSim.Region.Framework.Scenes DetachFromBackup(); - if(Scene == null) // should not happen unless restart/shutdown ? + if(Scene is null) // should not happen unless restart/shutdown ? return; SceneObjectPart[] parts = m_parts.GetArray(); @@ -2374,7 +2372,7 @@ namespace OpenSim.Region.Framework.Scenes // Hack to get the physics scene geometries in the right spot // ResetChildPrimPhysicsPositions(); - if (m_rootPart.PhysActor != null) + if (m_rootPart.PhysActor is not null) m_rootPart.PhysActor.Building = false; } else @@ -2414,15 +2412,15 @@ namespace OpenSim.Region.Framework.Scenes { if (!Backup) { -// m_log.DebugFormat( -// "[WATER WARS]: Ignoring backup of {0} {1} since object is not marked to be backed up", Name, UUID); + //m_log.DebugFormat( + // "[WATER WARS]: Ignoring backup of {0} {1} since object is not marked to be backed up", Name, UUID); return; } if (IsDeleted || inTransit || UUID.IsZero()) { -// m_log.DebugFormat( -// "[WATER WARS]: Ignoring backup of {0} {1} since object is marked as already deleted", Name, UUID); + //m_log.DebugFormat( + // "[WATER WARS]: Ignoring backup of {0} {1} since object is marked as already deleted", Name, UUID); return; } @@ -2441,7 +2439,7 @@ namespace OpenSim.Region.Framework.Scenes ILandObject parcel = m_scene.LandChannel.GetLandObject( m_rootPart.GroupPosition.X, m_rootPart.GroupPosition.Y); - if (parcel != null && parcel.LandData != null && + if (parcel is not null && parcel.LandData is not null && parcel.LandData.OtherCleanTime != 0) { if (parcel.LandData.OwnerID != OwnerID && @@ -2466,9 +2464,8 @@ namespace OpenSim.Region.Framework.Scenes } DetachFromBackup(); - m_log.DebugFormat( - "[SCENE OBJECT GROUP]: Returning object {0} due to parcel autoreturn", - RootPart.UUID); + m_log.Debug( + $"[SCENE OBJECT GROUP]: Returning object {RootPart.UUID} due to parcel autoreturn"); m_scene.AddReturn(OwnerID == GroupID ? LastOwnerID : OwnerID, Name, AbsolutePosition, "parcel autoreturn"); m_scene.DeRezObjects(null, new List() { RootPart.LocalId }, UUID.Zero, DeRezAction.Return, UUID.Zero, false); @@ -2507,7 +2504,7 @@ namespace OpenSim.Region.Framework.Scenes { part.Inventory.ProcessInventoryBackup(datastore); - if(part.KeyframeMotion != null) + if(part.KeyframeMotion is not null) { part.KeyframeMotion.Delete(); part.KeyframeMotion = null; @@ -2521,9 +2518,7 @@ namespace OpenSim.Region.Framework.Scenes } catch (Exception e) { - m_log.ErrorFormat( - "[SCENE]: Storing of {0}, {1} in {2} failed with exception {3}{4}", - Name, UUID, m_scene.RegionInfo.RegionName, e.Message, e.StackTrace); + m_log.Error($"[SCENE]: Storing of {Name}, {UUID} in {m_scene.RegionInfo.RegionName} failed: {e.Message}"); } } @@ -2629,13 +2624,13 @@ namespace OpenSim.Region.Framework.Scenes newPart.ApplyPhysics((uint)newPart.Flags,newPart.VolumeDetectActive,true); // copy keyframemotion - if (part.KeyframeMotion != null) + if (part.KeyframeMotion is not null) newPart.KeyframeMotion = part.KeyframeMotion.Copy(dupe); } if (userExposed) { - if (dupe.m_rootPart.PhysActor != null) + if (dupe.m_rootPart.PhysActor is not null) dupe.m_rootPart.PhysActor.Building = false; // tell physics to finish building dupe.InvalidateDeepEffectivePerms(); @@ -2673,7 +2668,7 @@ namespace OpenSim.Region.Framework.Scenes { if (usePhysics) { - if (RootPart.KeyframeMotion != null) + if (RootPart.KeyframeMotion is not null) RootPart.KeyframeMotion.Stop(); RootPart.KeyframeMotion = null; } @@ -2700,7 +2695,7 @@ namespace OpenSim.Region.Framework.Scenes if (IsAttachment) { ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar); - if (avatar != null) + if (avatar is not null) { avatar.PushForce(impulse); } @@ -2709,7 +2704,7 @@ namespace OpenSim.Region.Framework.Scenes { PhysicsActor pa = RootPart.PhysActor; - if (pa != null) + if (pa is not null) { // false to be applied as a impulse pa.AddForce(impulse, false); @@ -2722,7 +2717,7 @@ namespace OpenSim.Region.Framework.Scenes { PhysicsActor pa = RootPart.PhysActor; - if (pa != null) + if (pa is not null) { if (!IsAttachment) { @@ -2747,14 +2742,14 @@ namespace OpenSim.Region.Framework.Scenes { ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar); - if (avatar != null && !avatar.IsSatOnObject) + if (avatar is not null && !avatar.IsSatOnObject) avatar.MoveToTarget(target, false, true, false, tau); } else { PhysicsActor pa = RootPart.PhysActor; - if (pa != null) + if (pa is not null) { pa.PIDTarget = target; pa.PIDTau = tau; @@ -2772,7 +2767,7 @@ namespace OpenSim.Region.Framework.Scenes { ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar); - if (avatar != null) + if (avatar is not null) { avatar.ResetMoveToTarget(); } @@ -2781,7 +2776,7 @@ namespace OpenSim.Region.Framework.Scenes { PhysicsActor pa = RootPart.PhysActor; - if (pa != null) + if (pa is not null) pa.PIDActive = false; RootPart.ScheduleTerseUpdate(); // send a stop information @@ -2798,10 +2793,10 @@ namespace OpenSim.Region.Framework.Scenes return; SceneObjectPart rootpart = m_rootPart; - if (rootpart != null) + if (rootpart is not null) { /* physics still doesnt suport this - if (rootpart.PhysActor != null) + if (rootpart.PhysActor is not null) { rootpart.PhysActor.APIDTarget = new Quaternion(target.X, target.Y, target.Z, target.W); rootpart.PhysActor.APIDStrength = strength; @@ -2823,16 +2818,16 @@ namespace OpenSim.Region.Framework.Scenes if(!UsesPhysics || IsAttachment) return; - if (m_rootPart != null) + if (m_rootPart is not null) m_rootPart.RotLookAt(target, strength, damping); } public void StopLookAt() { SceneObjectPart rootpart = m_rootPart; - if (rootpart != null) + if (rootpart is not null) { - if (rootpart.PhysActor != null) + if (rootpart.PhysActor is not null) { rootpart.PhysActor.APIDActive = false; } @@ -2852,13 +2847,13 @@ namespace OpenSim.Region.Framework.Scenes if(IsAttachment) { ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar); - if (avatar != null) + if (avatar is not null) pa = avatar.PhysicsActor; } else pa = RootPart.PhysActor; - if (pa != null) + if (pa is not null) { if (height != 0f) { @@ -2979,7 +2974,7 @@ namespace OpenSim.Region.Framework.Scenes if (IsAttachment) { ScenePresence sp = m_scene.GetScenePresence(AttachedAvatar); - if (sp != null) + if (sp is not null) sp.SendAttachmentScheduleUpdate(this); return; } @@ -3067,7 +3062,7 @@ namespace OpenSim.Region.Framework.Scenes /// public void ScheduleGroupForTerseUpdate() { -// m_log.DebugFormat("[SOG]: Scheduling terse update for {0} {1}", Name, UUID); + //m_log.DebugFormat("[SOG]: Scheduling terse update for {0} {1}", Name, UUID); SceneObjectPart[] parts = m_parts.GetArray(); for (int i = 0; i < parts.Length; i++) @@ -3090,7 +3085,7 @@ namespace OpenSim.Region.Framework.Scenes public void QueueForUpdateCheck() { - if (m_scene == null) // Need to check here as it's null during object creation + if (m_scene is null) // Need to check here as it's null during object creation return; m_scene.SceneGraph.AddToUpdateList(this); @@ -3107,7 +3102,7 @@ namespace OpenSim.Region.Framework.Scenes if (IsAttachment) { ScenePresence sp = m_scene.GetScenePresence(AttachedAvatar); - if (sp != null) + if (sp is not null) { sp.SendAttachmentUpdate(this, PrimUpdateFlags.TerseUpdate); return; @@ -3193,9 +3188,9 @@ namespace OpenSim.Region.Framework.Scenes // The group being linked need not be a linkset -- it can have just one prim. public void LinkToGroup(SceneObjectGroup objectGroup, bool insert) { -// m_log.DebugFormat( -// "[SCENE OBJECT GROUP]: Linking group with root part {0}, {1} to group with root part {2}, {3}", -// objectGroup.RootPart.Name, objectGroup.RootPart.UUID, RootPart.Name, RootPart.UUID); + //m_log.DebugFormat( + // "[SCENE OBJECT GROUP]: Linking group with root part {0}, {1} to group with root part {2}, {3}", + // objectGroup.RootPart.Name, objectGroup.RootPart.UUID, RootPart.Name, RootPart.UUID); // Linking to ourselves is not a valid operation. if (objectGroup == this) @@ -3249,9 +3244,9 @@ namespace OpenSim.Region.Framework.Scenes // 'linkPart' == the root of the group being linked into this group SceneObjectPart linkPart = objectGroup.m_rootPart; - if (m_rootPart.PhysActor != null) + if (m_rootPart.PhysActor is not null) m_rootPart.PhysActor.Building = true; - if (linkPart.PhysActor != null) + if (linkPart.PhysActor is not null) linkPart.PhysActor.Building = true; // physics flags from group to be applied to linked parts @@ -3323,7 +3318,7 @@ namespace OpenSim.Region.Framework.Scenes linkPart.UpdatePrimFlags(grpusephys, grptemporary, (IsPhantom || (linkPart.Flags & PrimFlags.Phantom) != 0), linkPart.VolumeDetectActive || RootPart.VolumeDetectActive, true); // If the added SOP is physical, also tell the physics engine about the link relationship. - if (linkPart.PhysActor != null && m_rootPart.PhysActor != null && m_rootPart.PhysActor.IsPhysical) + if (linkPart.PhysActor is not null && m_rootPart.PhysActor is not null && m_rootPart.PhysActor.IsPhysical) { linkPart.PhysActor.link(m_rootPart.PhysActor); this.Scene.PhysicsScene.AddPhysicsActorTaint(linkPart.PhysActor); @@ -3352,7 +3347,7 @@ namespace OpenSim.Region.Framework.Scenes part.UpdatePrimFlags(grpusephys, grptemporary, (IsPhantom || (part.Flags & PrimFlags.Phantom) != 0), part.VolumeDetectActive, true); // If the added SOP is physical, also tell the physics engine about the link relationship. - if (part.PhysActor != null && m_rootPart.PhysActor != null && m_rootPart.PhysActor.IsPhysical) + if (part.PhysActor is not null && m_rootPart.PhysActor is not null && m_rootPart.PhysActor.IsPhysical) { part.PhysActor.link(m_rootPart.PhysActor); this.Scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor); @@ -3385,7 +3380,7 @@ namespace OpenSim.Region.Framework.Scenes InvalidBoundsRadius(); InvalidatePartsLinkMaps(); - if (m_rootPart.PhysActor != null) + if (m_rootPart.PhysActor is not null) m_rootPart.PhysActor.Building = false; //HasGroupChanged = true; @@ -3424,16 +3419,13 @@ namespace OpenSim.Region.Framework.Scenes { SceneObjectPart linkPart = GetPart(partID); - if (linkPart != null) + if (linkPart is not null) { return DelinkFromGroup(linkPart, sendEvents); } else { - m_log.WarnFormat("[SCENE OBJECT GROUP]: " + - "DelinkFromGroup(): Child prim {0} not found in object {1}, {2}", - partID, LocalId, UUID); - + m_log.Warn($"[SCENE OBJECT GROUP]: DelinkFromGroup(): prim {partID} not found in object {UUID}"); return null; } } @@ -3456,7 +3448,7 @@ namespace OpenSim.Region.Framework.Scenes // "[SCENE OBJECT GROUP]: Delinking part {0}, {1} from group with root part {2}, {3}", // linkPart.Name, linkPart.UUID, RootPart.Name, RootPart.UUID); - if (m_rootPart.PhysActor != null) + if (m_rootPart.PhysActor is not null) m_rootPart.PhysActor.Building = true; linkPart.ClearUndoState(); @@ -3472,7 +3464,7 @@ namespace OpenSim.Region.Framework.Scenes SceneObjectPart[] parts = m_parts.GetArray(); // Rejigger the linknum's of the remaining SOP's to fill any gap - if (parts.Length == 1 && RootPart != null) + if (parts.Length == 1 && RootPart is not null) { // Single prim left RootPart.LinkNum = 0; @@ -3498,7 +3490,7 @@ namespace OpenSim.Region.Framework.Scenes // (There is a problem here in that we have not yet told the physics // engine about the delink. Someday, linksets should be made first // class objects in the physics engine interface). - if (linkPartPa != null) + if (linkPartPa is not null) { m_scene.PhysicsScene.RemovePrim(linkPartPa); linkPart.PhysActor = null; @@ -3529,7 +3521,7 @@ namespace OpenSim.Region.Framework.Scenes InvalidatePartsLinkMaps(); InvalidateEffectivePerms(); - if (m_rootPart.PhysActor != null) + if (m_rootPart.PhysActor is not null) m_rootPart.PhysActor.Building = false; objectGroup.HasGroupChangedDueToDelink = true; @@ -3550,7 +3542,7 @@ namespace OpenSim.Region.Framework.Scenes if(PrimCount == 1) return; - if (m_rootPart.PhysActor != null) + if (m_rootPart.PhysActor is not null) m_rootPart.PhysActor.Building = true; bool unlinkroot = false; @@ -3582,7 +3574,7 @@ namespace OpenSim.Region.Framework.Scenes // (There is a problem here in that we have not yet told the physics // engine about the delink. Someday, linksets should be made first // class objects in the physics engine interface). - if (linkPartPa != null) + if (linkPartPa is not null) { m_scene.PhysicsScene.RemovePrim(linkPartPa); linkPart.PhysActor = null; @@ -3632,7 +3624,7 @@ namespace OpenSim.Region.Framework.Scenes InvalidBoundsRadius(); - if (m_rootPart.PhysActor != null) + if (m_rootPart.PhysActor is not null) m_rootPart.PhysActor.Building = false; // When we delete a group, we currently have to force persist to the database if the object id has changed @@ -3650,7 +3642,7 @@ namespace OpenSim.Region.Framework.Scenes /// public virtual void DetachFromBackup() { - if (m_scene != null) + if (m_scene is not null) { m_scene.SceneGraph.FireDetachFromBackup(this); if (Backup) @@ -3734,7 +3726,7 @@ namespace OpenSim.Region.Framework.Scenes SceneObjectPart part = GetPart(partID); - if (part == null) + if (part is null) return; if (part.BlockGrab) @@ -3742,7 +3734,7 @@ namespace OpenSim.Region.Framework.Scenes PhysicsActor pa = m_rootPart.PhysActor; - if (pa != null && pa.IsPhysical) + if (pa is not null && pa.IsPhysical) { // empirically convert distance diference to a impulse Vector3 grabforce = pos - AbsolutePosition; @@ -3789,7 +3781,7 @@ namespace OpenSim.Region.Framework.Scenes { PhysicsActor pa = m_rootPart.PhysActor; - if (pa != null) + if (pa is not null) { if (pa.IsPhysical) { @@ -3840,7 +3832,7 @@ namespace OpenSim.Region.Framework.Scenes { PhysicsActor pa = m_rootPart.PhysActor; - if (pa != null && pa.IsPhysical) + if (pa is not null && pa.IsPhysical) { if (m_rootPart.IsWaitingForFirstSpinUpdatePacket) { @@ -3900,7 +3892,7 @@ namespace OpenSim.Region.Framework.Scenes public void SetPartName(string name, uint localID) { SceneObjectPart part = GetPart(localID); - if (part != null) + if (part is not null) { part.Name = name; } @@ -3909,7 +3901,7 @@ namespace OpenSim.Region.Framework.Scenes public void SetPartDescription(string des, uint localID) { SceneObjectPart part = GetPart(localID); - if (part != null) + if (part is not null) { part.Description = des; } @@ -3918,7 +3910,7 @@ namespace OpenSim.Region.Framework.Scenes public void SetPartText(string text, uint localID) { SceneObjectPart part = GetPart(localID); - if (part != null) + if (part is not null) { part.SetText(text); } @@ -3927,7 +3919,7 @@ namespace OpenSim.Region.Framework.Scenes public void SetPartText(string text, UUID partID) { SceneObjectPart part = GetPart(partID); - if (part != null) + if (part is not null) { part.SetText(text); } @@ -3936,7 +3928,7 @@ namespace OpenSim.Region.Framework.Scenes public string GetPartName(uint localID) { SceneObjectPart part = GetPart(localID); - if (part != null) + if (part is not null) { return part.Name; } @@ -3946,7 +3938,7 @@ namespace OpenSim.Region.Framework.Scenes public string GetPartDescription(uint localID) { SceneObjectPart part = GetPart(localID); - if (part != null) + if (part is not null) { return part.Description; } @@ -3963,7 +3955,7 @@ namespace OpenSim.Region.Framework.Scenes /// public void UpdateFlags(bool UsePhysics, bool SetTemporary, bool SetPhantom, bool SetVolumeDetect) { - if (m_scene == null || IsDeleted) + if (m_scene is null || IsDeleted) return; HasGroupChanged = true; @@ -4026,7 +4018,7 @@ namespace OpenSim.Region.Framework.Scenes parts[i].UpdatePrimFlags(UsePhysics, SetTemporary, SetPhantom, SetVolumeDetect, true); } - if (m_rootPart.PhysActor != null) + if (m_rootPart.PhysActor is not null) m_rootPart.PhysActor.Building = false; } else @@ -4038,7 +4030,7 @@ namespace OpenSim.Region.Framework.Scenes public void UpdateExtraParam(uint localID, ushort type, bool inUse, byte[] data) { SceneObjectPart part = GetPart(localID); - if (part != null) + if (part is not null) { part.UpdateExtraParam(type, inUse, data); } @@ -4122,13 +4114,13 @@ namespace OpenSim.Region.Framework.Scenes public void UpdateShape(ObjectShapePacket.ObjectDataBlock shapeBlock, uint localID) { SceneObjectPart part = GetPart(localID); - if (part != null) + if (part is not null) { part.UpdateShape(shapeBlock); PhysicsActor pa = m_rootPart.PhysActor; - if (pa != null) + if (pa is not null) m_scene.PhysicsScene.AddPhysicsActorTaint(pa); } InvalidBoundsRadius(); @@ -4147,7 +4139,7 @@ namespace OpenSim.Region.Framework.Scenes // m_log.DebugFormat( // "[SCENE OBJECT GROUP]: Group resizing {0} {1} from {2} to {3}", Name, LocalId, RootPart.Scale, scale); - if (Scene == null) + if (Scene is null) return; PhysicsActor pa = m_rootPart.PhysActor; @@ -4155,7 +4147,7 @@ namespace OpenSim.Region.Framework.Scenes float minsize = Scene.m_minNonphys; float maxsize = Scene.m_maxNonphys; - if (pa != null && pa.IsPhysical) + if (pa is not null && pa.IsPhysical) { minsize = Scene.m_minPhys; maxsize = Scene.m_maxPhys; @@ -4276,20 +4268,20 @@ namespace OpenSim.Region.Framework.Scenes // m_log.DebugFormat( // "[SCENE OBJECT GROUP]: Group resizing {0} {1} from {2} to {3}", Name, LocalId, RootPart.Scale, fscale); - if (Scene == null || IsDeleted || inTransit || fscale < 0) + if (Scene is null || IsDeleted || inTransit || fscale < 0) return false; // ignore lsl restrictions. let them be done a LSL PhysicsActor pa = m_rootPart.PhysActor; - if(RootPart.KeyframeMotion != null) + if(RootPart.KeyframeMotion is not null) RootPart.KeyframeMotion.Suspend(); float minsize = Scene.m_minNonphys; float maxsize = Scene.m_maxNonphys; // assuming physics is more restrictive - if (pa != null && pa.IsPhysical) + if (pa is not null && pa.IsPhysical) { minsize = Scene.m_minPhys; maxsize = Scene.m_maxPhys; @@ -4326,7 +4318,7 @@ namespace OpenSim.Region.Framework.Scenes newSize.Y = (float)(newSize.Y * fscale); newSize.Z = (float)(newSize.Z * fscale); - if(pa != null) + if(pa is not null) pa.Building = true; RootPart.Scale = newSize; @@ -4353,7 +4345,7 @@ namespace OpenSim.Region.Framework.Scenes } } - if(pa != null) + if(pa is not null) pa.Building = false; InvalidBoundsRadius(); @@ -4362,7 +4354,7 @@ namespace OpenSim.Region.Framework.Scenes m_rootPart.TriggerScriptChangedEvent(Changed.SCALE); ScheduleGroupForFullUpdate(); - if(RootPart.KeyframeMotion != null) + if(RootPart.KeyframeMotion is not null) RootPart.KeyframeMotion.Resume(); return true; @@ -4370,13 +4362,13 @@ namespace OpenSim.Region.Framework.Scenes public float GetMaxGroupResizeScale() { - if (Scene == null || IsDeleted || inTransit) + if (Scene is null || IsDeleted || inTransit) return 1.0f; float maxsize = Scene.m_maxNonphys; PhysicsActor pa = m_rootPart.PhysActor; // assuming physics is more restrictive - if (pa != null && pa.IsPhysical) + if (pa is not null && pa.IsPhysical) maxsize = Scene.m_maxPhys; SceneObjectPart[] parts = m_parts.GetArray(); @@ -4407,13 +4399,13 @@ namespace OpenSim.Region.Framework.Scenes public float GetMinGroupResizeScale() { - if (Scene == null || IsDeleted || inTransit) + if (Scene is null || IsDeleted || inTransit) return 1.0f; float minsize = Scene.m_minNonphys; PhysicsActor pa = m_rootPart.PhysActor; // assuming physics is more restrictive - if (pa != null && pa.IsPhysical) + if (pa is not null && pa.IsPhysical) minsize = Scene.m_minPhys; SceneObjectPart[] parts = m_parts.GetArray(); @@ -4493,10 +4485,10 @@ namespace OpenSim.Region.Framework.Scenes { SceneObjectPart part = GetPart(localID); - if (part != null) + if (part is not null) { // unlock parts position change - if (m_rootPart.PhysActor != null) + if (m_rootPart.PhysActor is not null) m_rootPart.PhysActor.Building = true; if (part.UUID == m_rootPart.UUID) @@ -4508,7 +4500,7 @@ namespace OpenSim.Region.Framework.Scenes part.UpdateOffSet(pos); } - if (m_rootPart.PhysActor != null) + if (m_rootPart.PhysActor is not null) m_rootPart.PhysActor.Building = false; HasGroupChanged = true; @@ -4571,7 +4563,7 @@ namespace OpenSim.Region.Framework.Scenes /* this is done by rootpart RotationOffset set called by UpdateRotation PhysicsActor actor = m_rootPart.PhysActor; - if (actor != null) + if (actor is not null) { actor.Orientation = m_rootPart.RotationOffset; m_scene.PhysicsScene.AddPhysicsActorTaint(actor); @@ -4591,7 +4583,7 @@ namespace OpenSim.Region.Framework.Scenes m_rootPart.UpdateRotation(rot); PhysicsActor actor = m_rootPart.PhysActor; - if (actor != null) + if (actor is not null) { actor.Orientation = m_rootPart.RotationOffset; m_scene.PhysicsScene.AddPhysicsActorTaint(actor); @@ -4619,9 +4611,9 @@ namespace OpenSim.Region.Framework.Scenes SceneObjectPart[] parts = m_parts.GetArray(); - if (part != null) + if (part is not null) { - if (m_rootPart.PhysActor != null) + if (m_rootPart.PhysActor is not null) m_rootPart.PhysActor.Building = true; if (part.UUID == m_rootPart.UUID) @@ -4633,7 +4625,7 @@ namespace OpenSim.Region.Framework.Scenes part.UpdateRotation(rot); } - if (m_rootPart.PhysActor != null) + if (m_rootPart.PhysActor is not null) m_rootPart.PhysActor.Building = false; } } @@ -4646,9 +4638,9 @@ namespace OpenSim.Region.Framework.Scenes public void UpdateSingleRotation(Quaternion rot, Vector3 pos, uint localID) { SceneObjectPart part = GetPart(localID); - if (part != null) + if (part is not null) { - if (m_rootPart.PhysActor != null) + if (m_rootPart.PhysActor is not null) m_rootPart.PhysActor.Building = true; if (part.UUID == m_rootPart.UUID) @@ -4662,7 +4654,7 @@ namespace OpenSim.Region.Framework.Scenes part.OffsetPosition = pos; } - if (m_rootPart.PhysActor != null) + if (m_rootPart.PhysActor is not null) m_rootPart.PhysActor.Building = false; } } @@ -4682,7 +4674,7 @@ namespace OpenSim.Region.Framework.Scenes PhysicsActor pa = m_rootPart.PhysActor; - if (pa != null) + if (pa is not null) { pa.Orientation = m_rootPart.RotationOffset; m_scene.PhysicsScene.AddPhysicsActorTaint(pa); @@ -4723,7 +4715,7 @@ namespace OpenSim.Region.Framework.Scenes { // TODO this still as excessive *.Schedule*Update()s - if (part != null && part.ParentGroup != null) + if (part is not null && part.ParentGroup is not null) { ObjectChangeType change = data.change; bool togroup = ((change & ObjectChangeType.Group) != 0); @@ -4759,20 +4751,20 @@ namespace OpenSim.Region.Framework.Scenes } if ((change & ObjectChangeType.Scale) != 0) { - if (pha != null) + if (pha is not null) pha.Building = true; group.GroupResize(data.scale); updateType = updatetype.none; - if (pha != null) + if (pha is not null) pha.Building = false; } } else { // related to single prim in a link-set ( ie group) - if (pha != null) + if (pha is not null) pha.Building = true; // root part is special @@ -4806,7 +4798,7 @@ namespace OpenSim.Region.Framework.Scenes } } - if (pha != null) + if (pha is not null) pha.Building = false; } @@ -5296,7 +5288,7 @@ namespace OpenSim.Region.Framework.Scenes // Offer the list of script UUIDs to each engine found and accumulate the time foreach (IScriptModule e in engines) { - if (e != null) + if (e is not null) { time += e.GetScriptExecutionTime(ids); } @@ -5334,7 +5326,7 @@ namespace OpenSim.Region.Framework.Scenes // Offer the list of script UUIDs to each engine found and accumulate the memory foreach (IScriptModule e in engines) { - if (e != null) + if (e is not null) { memory += e.GetScriptsMemory(ids); } @@ -5396,7 +5388,7 @@ namespace OpenSim.Region.Framework.Scenes public override string ToString() { - return String.Format("{0} {1} ({2})", Name, UUID, AbsolutePosition); + return $"{Name} {UUID} ({AbsolutePosition})"; } #region ISceneObject @@ -5415,7 +5407,7 @@ namespace OpenSim.Region.Framework.Scenes public virtual string ExtraToXmlString() { - return "" + FromItemID.ToString() + ""; + return $"{FromItemID.ToString()}"; } public virtual void ExtraFromXmlString(string xmlstr) @@ -5424,9 +5416,7 @@ namespace OpenSim.Region.Framework.Scenes id = xmlstr.Replace("", ""); id = id.Replace("", ""); - UUID uuid = UUID.Zero; - UUID.TryParse(id, out uuid); - + UUID.TryParse(id, out UUID uuid); FromItemID = uuid; } @@ -5541,15 +5531,15 @@ namespace OpenSim.Region.Framework.Scenes public bool GetOwnerName(out string FirstName, out string LastName) { - if (RootPart != null) + if (RootPart is not null) { if(RootPart.OwnerID.Equals(RootPart.GroupID)) { IGroupsModule groups = m_scene.RequestModuleInterface(); - if (groups != null) + if (groups is not null) { GroupRecord grprec = groups.GetGroupRecord(RootPart.OwnerID); - if (grprec != null) + if (grprec is not null) { FirstName = string.Empty; LastName = grprec.GroupName; diff --git a/bin/OpenMetaverse.Rendering.Meshmerizer.dll b/bin/OpenMetaverse.Rendering.Meshmerizer.dll index f7d1846c86..d43cc3219b 100755 Binary files a/bin/OpenMetaverse.Rendering.Meshmerizer.dll and b/bin/OpenMetaverse.Rendering.Meshmerizer.dll differ diff --git a/bin/OpenMetaverse.StructuredData.dll b/bin/OpenMetaverse.StructuredData.dll index 277d43cb7a..aaf67fc8b2 100755 Binary files a/bin/OpenMetaverse.StructuredData.dll and b/bin/OpenMetaverse.StructuredData.dll differ diff --git a/bin/OpenMetaverse.dll b/bin/OpenMetaverse.dll index 0025b55bf6..929ca75d75 100755 Binary files a/bin/OpenMetaverse.dll and b/bin/OpenMetaverse.dll differ diff --git a/bin/OpenMetaverseTypes.dll b/bin/OpenMetaverseTypes.dll index a040d45f06..29aad71be8 100755 Binary files a/bin/OpenMetaverseTypes.dll and b/bin/OpenMetaverseTypes.dll differ