diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs index 0d6d3e0..28bc0ee 100644 --- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs +++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs @@ -113,7 +113,7 @@ namespace OpenSim.Data.SQLite { try { - DllmapConfigHelper. RegisterAssembly(typeof(SqliteConnection).Assembly); + DllmapConfigHelper.RegisterAssembly(typeof(SqliteConnection).Assembly); m_connectionString = connectionString; diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index ecb60b7..81d7c82 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -334,9 +334,6 @@ namespace OpenSim.Region.ClientStack.Linden oreq = new SimpleOSDMapHandler("POST", GetNewCapPath(), UpdateGestureItemAsset); m_HostCapsObj.RegisterSimpleHandler("UpdateGestureAgentInventory", oreq, true); m_HostCapsObj.RegisterSimpleHandler("UpdateGestureTaskInventory", oreq, false); - - m_HostCapsObj.RegisterSimpleHandler("ModifyMaterialParams", - new SimpleStreamHandler(GetNewCapPath(), ModifyMaterialParams), true); } if (TaskScriptUpdatedCall != null) @@ -2712,89 +2709,5 @@ namespace OpenSim.Region.ClientStack.Linden response.StatusCode = (int)HttpStatusCode.OK; } } - public void ModifyMaterialParams(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) - { - if (httpRequest.HttpMethod != "POST") - { - httpResponse.StatusCode = (int)HttpStatusCode.NotFound; - return; - } - OSDArray req; - try - { - req = (OSDArray)OSDParser.DeserializeLLSDXml(httpRequest.InputStream); - OSD tmp; - foreach (OSDMap map in req) - { - if (!map.TryGetValue("object_id", out tmp)) - continue; - - UUID id = tmp.AsUUID(); - if (id.IsZero()) - continue; - UUID assetID; - int side; - if (map.TryGetValue("side", out tmp)) - side = tmp.AsInteger(); - else - side = 0; - - if (map.TryGetValue("asset_id", out tmp)) - assetID = tmp.AsUUID(); - else - assetID = UUID.Zero; - - string assetdata = string.Empty; - if (map.TryGetValue("gltf_json", out tmp)) - { - assetdata = tmp.AsString(); - } - - SceneObjectPart sop = m_Scene.GetSceneObjectPart(id); - if(sop is null) - continue; - PrimitiveBaseShape pbs = sop.Shape; - if(pbs is null) - continue; - if(pbs.RenderMaterials is null) - { - var entries = new Primitive.RenderMaterials.RenderMaterialEntry[1]; - entries[0].te_index = (byte)side; - entries[0].id = assetID; - pbs.RenderMaterials = new Primitive.RenderMaterials - { - entries = entries - }; - } - else - { - int i = 0; - for (; i < pbs.RenderMaterials.entries.Length; i++ ) - { - if (pbs.RenderMaterials.entries[i].te_index == side) - { - pbs.RenderMaterials.entries[i].id = assetID; - break; - } - } - if( i == pbs.RenderMaterials.entries.Length) - { - Array.Resize(ref pbs.RenderMaterials.entries, i + 1); - pbs.RenderMaterials.entries[i].te_index = (byte)side; - pbs.RenderMaterials.entries[i].id = assetID; - } - } - sop.ParentGroup.HasGroupChanged = true; - sop.ScheduleFullUpdate(); - } - httpResponse.StatusCode = (int)HttpStatusCode.OK; - return; - } - catch - { - httpResponse.StatusCode = (int)HttpStatusCode.BadRequest; - return; - } - } } } \ No newline at end of file diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs index 81ed3ca..ba44bd1 100644 --- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs +++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs @@ -163,8 +163,8 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction string description, string name, sbyte invType, sbyte type, byte wearableType, uint nextOwnerMask) { -// m_log.DebugFormat( -// "[TRANSACTIONS MANAGER] Called HandleItemCreationFromTransaction with item {0}", name); + //m_log.DebugFormat( + // "[TRANSACTIONS MANAGER] Called HandleItemCreationFromTransaction with item {0}", name); AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId); diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 99adeaf..2486f30 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2225,7 +2225,7 @@ namespace OpenSim.Region.Framework.Scenes ParentGroup.Scene.EventManager.TriggerOnSceneObjectPartCopy(dupe, this, userExposed); -// m_log.DebugFormat("[SCENE OBJECT PART]: Clone of {0} {1} finished", Name, UUID); + //m_log.DebugFormat("[SCENE OBJECT PART]: Clone of {0} {1} finished", Name, UUID); return dupe; } diff --git a/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs b/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs index e1d31dd..adb248e 100644 --- a/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs +++ b/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs @@ -235,7 +235,13 @@ namespace OpenSim.Region.OptionalModules.Materials caps.RegisterSimpleHandler("RenderMaterials", new SimpleStreamHandler("/" + UUID.Random(), (httpRequest, httpResponse) - => preprocess(httpRequest, httpResponse,agentID) + => preprocess(httpRequest, httpResponse, agentID) + )); + + caps.RegisterSimpleHandler("ModifyMaterialParams", + new SimpleStreamHandler("/" + UUID.Random(), + (httpRequest, httpResponse) + => ModifyMaterialParams(httpRequest, httpResponse, agentID) )); } @@ -901,5 +907,119 @@ namespace OpenSim.Region.OptionalModules.Materials } } } + + public void ModifyMaterialParams(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse, UUID agentID) + { + if (httpRequest.HttpMethod != "POST") + { + httpResponse.StatusCode = (int)HttpStatusCode.NotFound; + return; + } + OSDArray req; + try + { + req = (OSDArray)OSDParser.DeserializeLLSDXml(httpRequest.InputStream); + httpRequest.InputStream.Dispose(); + + OSD tmp; + HashSet<SceneObjectPart> changedSOPs = new(); + + foreach (OSDMap map in req) + { + if (!map.TryGetValue("object_id", out tmp)) + continue; + UUID sopid = tmp.AsUUID(); + if (sopid.IsZero()) + continue; + + SceneObjectPart sop = m_scene.GetSceneObjectPart(sopid); + if (sop is null) + continue; + + PrimitiveBaseShape pbs = sop.Shape; + if (pbs is null) + continue; + + if (!map.TryGetValue("side", out tmp)) + continue; + int side = tmp.AsInteger(); + + UUID assetID; + if (map.TryGetValue("asset_id", out tmp)) + assetID = tmp.AsUUID(); + else + assetID = UUID.Zero; + + if (map.TryGetValue("gltf_json", out tmp)) + { + string assetdata = tmp.AsString(); + if (!string.IsNullOrEmpty(assetdata)) + { + if (pbs.RenderMaterials is not null) + { + int sideIndex = 0; + while (sideIndex < pbs.RenderMaterials.entries.Length) + { + if (pbs.RenderMaterials.entries[sideIndex].te_index == side) + break; + sideIndex++; + } + if (sideIndex < pbs.RenderMaterials.entries.Length) + { + + + changedSOPs.Add(sop); + } + } + } + } + + if (assetID.IsNotZero()) + { + if (pbs.RenderMaterials is null) + { + var entries = new Primitive.RenderMaterials.RenderMaterialEntry[1]; + entries[0].te_index = (byte)side; + entries[0].id = assetID; + pbs.RenderMaterials = new Primitive.RenderMaterials + { + entries = entries + }; + } + else + { + int i = 0; + while(i < pbs.RenderMaterials.entries.Length) + { + if (pbs.RenderMaterials.entries[i].te_index == side) + { + pbs.RenderMaterials.entries[i].id = assetID; + break; + } + i++; + } + if (i == pbs.RenderMaterials.entries.Length) + { + Array.Resize(ref pbs.RenderMaterials.entries, i + 1); + pbs.RenderMaterials.entries[i].te_index = (byte)side; + pbs.RenderMaterials.entries[i].id = assetID; + } + } + changedSOPs.Add(sop); + } + } + foreach(SceneObjectPart sop in changedSOPs) + { + sop.ParentGroup.HasGroupChanged = true; + sop.ScheduleFullUpdate(); + } + + httpResponse.StatusCode = (int)HttpStatusCode.OK; + } + catch + { + httpResponse.StatusCode = (int)HttpStatusCode.BadRequest; + } + } } }