From 775420c46a897c8bbbd3cfd0ef0306e376bfa87d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 5 Jun 2020 01:57:17 +0100 Subject: [PATCH] set object select on demand, not when it is created --- OpenSim/Framework/IClientAPI.cs | 2 +- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 8 ++++++-- .../ClientStack/Linden/UDP/LLUDPZeroEncoder.cs | 1 - OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 10 ++++++++-- .../Framework/Scenes/Scene.PacketHandlers.cs | 3 +-- OpenSim/Region/Framework/Scenes/Scene.cs | 14 ++++++++++---- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 2 +- .../Region/Framework/Scenes/SceneObjectGroup.cs | 2 +- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +- .../OptionalModules/DataSnapshot/ObjectSnapshot.cs | 2 +- .../Region/OptionalModules/World/NPC/NPCModule.cs | 3 +-- .../Shared/Api/Implementation/LSL_Api.cs | 2 +- 12 files changed, 32 insertions(+), 19 deletions(-) diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index aa3996f4ed..281357b942 100755 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -221,7 +221,7 @@ namespace OpenSim.Framework public delegate void AddNewPrim( UUID ownerID, UUID groupID, Vector3 RayEnd, Quaternion rot, PrimitiveBaseShape shape, byte bypassRaycast, Vector3 RayStart, UUID RayTargetID, - byte RayEndIsIntersection); + byte RayEndIsIntersection, uint addflags); public delegate void AgentDataUpdate(IClientAPI remoteClient, UUID itemID, UUID ownerID); diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 739725a9af..0a5c2902a5 100755 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -4525,7 +4525,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // no AppearanceData data[pos++] = 0; - // no AppearanceHover + // AppearanceHover vector 3 data[pos++] = 1; Utils.FloatToBytesSafepos(0, data, pos); pos += 4; Utils.FloatToBytesSafepos(0, data, pos); pos += 4; @@ -9310,8 +9310,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (addPacket.AgentData.SessionID != SessionId || addPacket.AgentData.AgentID != AgentId) return; + ObjectAddPacket.ObjectDataBlock datablk = addPacket.ObjectData; PrimitiveBaseShape shape = GetShapeFromAddPacket(addPacket); - OnAddPrim?.Invoke(AgentId, addPacket.AgentData.GroupID, addPacket.ObjectData.RayEnd, addPacket.ObjectData.Rotation, shape, addPacket.ObjectData.BypassRaycast, addPacket.ObjectData.RayStart, addPacket.ObjectData.RayTargetID, addPacket.ObjectData.RayEndIsIntersection); + OnAddPrim?.Invoke(AgentId, addPacket.AgentData.GroupID, datablk.RayEnd, + datablk.Rotation, shape, + datablk.BypassRaycast, datablk.RayStart, datablk.RayTargetID, datablk.RayEndIsIntersection, + datablk.AddFlags); } private void HandleObjectShape(Packet Pack) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPZeroEncoder.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPZeroEncoder.cs index 824bb03643..aa8901453b 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPZeroEncoder.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPZeroEncoder.cs @@ -351,6 +351,5 @@ namespace OpenSim.Region.ClientStack.LindenUDP AddByte((byte)(len)); AddBytes(data, len); } - } } \ No newline at end of file diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 1407768fa3..4ce18b1298 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -2597,8 +2597,8 @@ namespace OpenSim.Region.Framework.Scenes /// The velocity of the rezzed object. /// /// The SceneObjectGroup(s) rezzed, or null if rez was unsuccessful - public virtual List RezObject( - SceneObjectPart sourcePart, TaskInventoryItem item, Vector3 pos, Quaternion? rot, Vector3 vel, int param, bool atRoot) + public virtual List RezObject(SceneObjectPart sourcePart, TaskInventoryItem item, + Vector3 pos, Quaternion? rot, Vector3 vel, int param, bool atRoot, bool rezSelected = false) { if (null == item) return null; @@ -2710,6 +2710,12 @@ namespace OpenSim.Region.Framework.Scenes AddNewSceneObject(group, true, curpos, crot, vel); } + if(rezSelected) + { + group.IsSelected = true; + group.RootPart.CreateSelected = true; + } + // We can only call this after adding the scene object, since the scene object references the scene // to find out if scripts should be activated at all. group.InvalidateEffectivePerms(); diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index ccbe1627df..882a17f423 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs @@ -261,7 +261,6 @@ namespace OpenSim.Region.Framework.Scenes return; bool oldgprSelect = part.ParentGroup.IsSelected; - bool oldSelect = part.IsSelected; part.IsSelected = false; if (oldgprSelect != part.ParentGroup.IsSelected) @@ -271,7 +270,7 @@ namespace OpenSim.Region.Framework.Scenes } // restore targetOmega - if (oldSelect && part.AngularVelocity != Vector3.Zero) + if (part.AngularVelocity != Vector3.Zero) part.ScheduleTerseUpdate(); } diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 9ee2d9f922..3b2afbcd9e 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2512,7 +2512,7 @@ namespace OpenSim.Region.Framework.Scenes /// public virtual void AddNewPrim(UUID ownerID, UUID groupID, Vector3 RayEnd, Quaternion rot, PrimitiveBaseShape shape, byte bypassRaycast, Vector3 RayStart, UUID RayTargetID, - byte RayEndIsIntersection) + byte RayEndIsIntersection, uint addFlags) { Vector3 pos = GetNewRezLocation(RayStart, RayEnd, RayTargetID, rot, bypassRaycast, RayEndIsIntersection, true, new Vector3(0.5f, 0.5f, 0.5f), false); @@ -2521,7 +2521,7 @@ namespace OpenSim.Region.Framework.Scenes // rez ON the ground, not IN the ground // pos.Z += 0.25F; The rez point should now be correct so that its not in the ground - AddNewPrim(ownerID, groupID, pos, rot, shape); + AddNewPrim(ownerID, groupID, pos, rot, shape, addFlags); } else { @@ -2531,8 +2531,8 @@ namespace OpenSim.Region.Framework.Scenes } } - public virtual SceneObjectGroup AddNewPrim( - UUID ownerID, UUID groupID, Vector3 pos, Quaternion rot, PrimitiveBaseShape shape) + public virtual SceneObjectGroup AddNewPrim(UUID ownerID, UUID groupID, + Vector3 pos, Quaternion rot, PrimitiveBaseShape shape, uint addFlags = 0) { //m_log.DebugFormat( // "[SCENE]: Scene.AddNewPrim() pcode {0} called for {1} in {2}", shape.PCode, ownerID, RegionInfo.RegionName); @@ -2567,6 +2567,12 @@ namespace OpenSim.Region.Framework.Scenes if (UserManagementModule != null) sceneObject.RootPart.CreatorIdentification = UserManagementModule.GetUserUUI(ownerID); + if((addFlags & (uint)PrimFlags.CreateSelected) != 0) + { + sceneObject.IsSelected = true; + sceneObject.RootPart.CreateSelected = true; + } + sceneObject.InvalidateDeepEffectivePerms();; sceneObject.ScheduleGroupForFullAnimUpdate(); diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 0ac56cc2a7..625b4dc063 100755 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -1938,7 +1938,7 @@ namespace OpenSim.Region.Framework.Scenes // occur on link to invoke this elsewhere (such as object selection) if (childGroups.Count > 0) { - parentGroup.RootPart.CreateSelected = true; + //parentGroup.RootPart.CreateSelected = true; parentGroup.TriggerScriptChangedEvent(Changed.LINK); } } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 13ad039a65..3412e4799f 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -3250,7 +3250,7 @@ namespace OpenSim.Region.Framework.Scenes linkPart.SetParent(this); - linkPart.CreateSelected = true; + //linkPart.CreateSelected = true; linkPart.UpdatePrimFlags(grpusephys, grptemporary, (IsPhantom || (linkPart.Flags & PrimFlags.Phantom) != 0), linkPart.VolumeDetectActive || RootPart.VolumeDetectActive, true); diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index ed35ecb082..11f754ee4a 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -444,7 +444,7 @@ namespace OpenSim.Region.Framework.Scenes Acceleration = Vector3.Zero; APIDActive = false; Flags = 0; - CreateSelected = true; + CreateSelected = false; TrimPermissions(); AggregateInnerPerms(); } diff --git a/OpenSim/Region/OptionalModules/DataSnapshot/ObjectSnapshot.cs b/OpenSim/Region/OptionalModules/DataSnapshot/ObjectSnapshot.cs index caca3039e5..4546b2012e 100644 --- a/OpenSim/Region/OptionalModules/DataSnapshot/ObjectSnapshot.cs +++ b/OpenSim/Region/OptionalModules/DataSnapshot/ObjectSnapshot.cs @@ -66,7 +66,7 @@ namespace OpenSim.Region.DataSnapshot.Providers client.OnAddPrim += delegate (UUID ownerID, UUID groupID, Vector3 RayEnd, Quaternion rot, PrimitiveBaseShape shape, byte bypassRaycast, Vector3 RayStart, UUID RayTargetID, - byte RayEndIsIntersection) { this.Stale = true; }; + byte RayEndIsIntersection, uint addFlags) { this.Stale = true; }; client.OnLinkObjects += delegate (IClientAPI remoteClient, uint parent, List children) { this.Stale = true; }; client.OnDelinkObjects += delegate(List primIds, IClientAPI clientApi) { this.Stale = true; }; diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 0f4751163e..714ef065bc 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -220,8 +220,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC scene.AuthenticateHandler.AddNewCircuit(npcAvatar.CircuitCode, acd); scene.AddNewAgent(npcAvatar, PresenceType.Npc); - ScenePresence sp; - if (scene.TryGetScenePresence(npcAvatar.AgentId, out sp)) + if (scene.TryGetScenePresence(npcAvatar.AgentId, out ScenePresence sp)) { npcAvatar.Born = born; npcAvatar.ActiveGroupId = groupID; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index ba842f68ec..06b95b9501 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -4506,7 +4506,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api parentPrim.TriggerScriptChangedEvent(Changed.LINK); - parentPrim.RootPart.CreateSelected = true; + parentPrim.RootPart.CreateSelected = false; parentPrim.HasGroupChanged = true; parentPrim.ScheduleGroupForFullUpdate();