Merge remote-tracking branch 'upstream/master' into feature/dotnet6

This commit is contained in:
Mike Dickson 2023-12-20 12:36:42 -05:00
commit 130e4bb53f
68 changed files with 1114 additions and 1120 deletions

View file

@ -2,7 +2,7 @@ name: .msbuildnet6
on:
push:
branches: [ "dotnet6" ]
branches: [ "master" ]
paths:
- '**.cs'
workflow_dispatch:
@ -10,11 +10,10 @@ on:
jobs:
build:
if: github.repository == 'opensim/opensim'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: dotnet6
- name: shortsha
id: vars
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"

View file

@ -1,289 +0,0 @@
<!-- -*- xml -*- -->
<!-- please leave the top comment for us emacs folks -->
<property name="nunitcmd" value="nunit-console" />
<!-- This target produces a source distribution of OpenSimulator -->
<!-- TODO: A few parameters still need to be tweaked after running this - need to do this automatically with sed or similar -->
<target name="distsrc">
<copy file="bin/OpenSim.ini.example" tofile="bin/OpenSim.ini"/>
<copy file="bin/config-include/StandaloneCommon.ini.example" tofile="bin/config-include/StandaloneCommon.ini"/>
<copy file="bin/config-include/FlotsamCache.ini.example" tofile="bin/config-include/FlotsamCache.ini"/>
<!-- delete files generated by runprebuild.sh which had to be run in order to generate the build file for this target-->
<delete>
<fileset basedir="OpenSim">
<include name="**/*.build"/>
<include name="**/*.csproj*"/>
<include name="**/*.dll.build"/>
<include name="**/*.pidb"/>
<exclude name="Tools/OpenSim.32BitLaunch/**"/>
<exclude name="Tools/Robust.32BitLaunch/**"/>
<exclude name="Tools/LaunchSLClient/**"/>
</fileset>
</delete>
<delete>
<fileset>
<include name="OpenSim.build"/>
<include name="OpenSim.sln"/>
</fileset>
</delete>
</target>
<property name="distbindir" value="distbin" />
<!-- This target produces a binary directory called distbin/ in OpenSim/bin which contains everything needed for binary distribution -->
<!-- For safety/laziness sake, we're going to take the approach of deleting known extraneous files here rather than
trying to copy across only the essential ones -->
<target name="distbin">
<delete dir="${distbindir}"/>
<copy todir="${distbindir}">
<fileset>
<include name="**"/>
</fileset>
</copy>
<delete dir="${distbindir}/OpenSim"/>
<delete dir="${distbindir}/Prebuild"/>
<delete dir="${distbindir}/%temp%"/>
<delete dir="${distbindir}/.nant"/>
<delete dir="${distbindir}/ThirdParty"/>
<delete>
<fileset basedir="${distbindir}">
<include name="compile.bat"/>
<include name="BUILDING.md"/>
<include name="Makefile"/>
<include name="nant-color"/>
<include name="OpenSim.*"/>
<include name="prebuild.xml"/>
<include name="runprebuild*"/>
<include name="TESTING.txt"/>
<include name="TestResult.xml"/>
<include name="bin/OpenSim.Server.ini"/>
<include name="bin/Regions/Regions.ini"/>
<include name="bin/*.db"/>
<include name="**/.git/**"/>
<include name=".gitignore"/>
<include name=".hgignore"/>
</fileset>
</delete>
</target>
<target name="test" depends="build, find-nunit">
<setenv name="MONO_THREADS_PER_CPU" value="100" />
<!-- Unit Test Assembly -->
<!-- if you want to add more unit tests it's important that you add
the assembly here as an exec, and you add the fail clause later.
This lets all the unit tests run and tells you if they fail at the
end, instead of stopping short -->
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.tests">
<arg value="./bin/OpenSim.Tests.dll" />
</exec>
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.tests)==0}" />
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.framework.tests">
<arg value="./bin/OpenSim.Framework.Tests.dll" />
</exec>
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.framework.tests)==0}" />
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.framework.servers.tests">
<arg value="./bin/OpenSim.Framework.Servers.Tests.dll" />
</exec>
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.framework.servers.tests)==0}" />
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.framework.serialization.tests">
<arg value="./bin/OpenSim.Framework.Serialization.Tests.dll" />
</exec>
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.framework.serialization.tests)==0}" />
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.region.clientstack.lindencaps.tests">
<arg value="./bin/OpenSim.Region.ClientStack.LindenCaps.Tests.dll" />
</exec>
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.clientstack.lindencaps.tests)==0}" />
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.region.clientstack.lindenudp.tests">
<arg value="./bin/OpenSim.Region.ClientStack.LindenUDP.Tests.dll" />
</exec>
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.clientstack.lindenudp.tests)==0}" />
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.region.scriptengine.tests">
<arg value="./bin/OpenSim.Region.ScriptEngine.Tests.dll" />
</exec>
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.scriptengine.tests)==0}" />
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.region.coremodules.tests">
<arg value="./bin/OpenSim.Region.CoreModules.Tests.dll" />
</exec>
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.coremodules.tests)==0}" />
<!--
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.region.optionalmodules.tests">
<arg value="./bin/OpenSim.Region.OptionalModules.Tests.dll" />
</exec>
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.optionalmodules.tests)==0}" />
-->
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.region.framework.tests">
<arg value="./bin/OpenSim.Region.Framework.Tests.dll" />
</exec>
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.framework.tests)==0}" />
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.data.tests">
<arg value="./bin/OpenSim.Data.Tests.dll" />
</exec>
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.data.tests)==0}" />
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.capabilities.handlers.tests">
<arg value="./bin/OpenSim.Capabilities.Handlers.Tests.dll" />
</exec>
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.capabilities.handlers.tests)==0}" />
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.server.handlers.tests">
<arg value="./bin/OpenSim.Server.Handlers.Tests.dll" />
</exec>
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.server.handlers.tests)==0}" />
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.services.inventoryservice.tests">
<arg value="./bin/OpenSim.Services.InventoryService.Tests.dll" />
</exec>
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.services.inventoryservice.tests)==0}" />
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.tests.permissions">
<arg value="./bin/OpenSim.Tests.Permissions.dll" />
</exec>
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.tests.permissions)==0}" />
<delete dir="%temp%"/>
</target>
<target name="test-stress" depends="build, find-nunit">
<setenv name="MONO_THREADS_PER_CPU" value="100" />
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.tests.stress">
<arg value="./bin/OpenSim.Tests.Stress.dll" />
</exec>
<fail message="Failures reported in stress tests." unless="${int::parse(testresult.opensim.tests.stress)==0}" />
<delete dir="%temp%"/>
</target>
<target name="test-perf" depends="build, find-nunit">
<setenv name="MONO_THREADS_PER_CPU" value="100" />
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.tests.performance">
<arg value="./bin/OpenSim.Tests.Performance.dll" />
</exec>
<fail message="Failures reported in performance tests." unless="${int::parse(testresult.opensim.tests.performance)==0}" />
<delete dir="%temp%"/>
</target>
<target name="find-nunit">
<exec program="which" failonerror="false"
resultproperty="hasnunit2">
<arg value="nunit-console2" />
</exec>
<property name="nunitcmd" value="nunit-console2"
if="${int::parse(hasnunit2)==0}" />
<property name="nunitcmd" value="nunit-console"
if="${int::parse(hasnunit2)==1}" />
</target>
<!-- this is used for panda test execution -->
<!-- work in progress -->
<target name="test-xml" depends="build, find-nunit">
<mkdir dir="test-results" failonerror="false" />
<!-- Unit Test Assembly -->
<exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.tests">
<arg value="./bin/OpenSim.Tests.dll" />
<arg value="-xml=test-results/OpenSim.Tests.dll-Results.xml" />
</exec>
<exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.framework.tests">
<arg value="./bin/OpenSim.Framework.Tests.dll" />
<arg value="-xml=test-results/OpenSim.Framework.Tests.dll-Results.xml" />
</exec>
<exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.framework.serialization.tests">
<arg value="./bin/OpenSim.Framework.Serialization.Tests.dll" />
<arg value="-xml=test-results/OpenSim.Framework.Serialization.Tests.dll-Results.xml" />
</exec>
<exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.framework.servers.tests">
<arg value="./bin/OpenSim.Framework.Servers.Tests.dll" />
<arg value="-xml=test-results/OpenSim.Framework.Servers.Tests.dll-Results.xml" />
</exec>
<exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.region.clientstack.lindencaps.tests">
<arg value="./bin/OpenSim.Region.ClientStack.LindenCaps.Tests.dll" />
<arg value="-xml=test-results/OpenSim.Region.ClientStack.LindenCaps.Tests.dll-Results.xml" />
</exec>
<exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.region.clientstack.lindenudp.tests">
<arg value="./bin/OpenSim.Region.ClientStack.LindenUDP.Tests.dll" />
<arg value="-xml=test-results/OpenSim.Region.ClientStack.LindenUDP.Tests.dll-Results.xml" />
</exec>
<exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.region.scriptengine.tests">
<arg value="./bin/OpenSim.Region.ScriptEngine.Tests.dll" />
<arg value="-xml=test-results/OpenSim.Region.ScriptEngine.Tests.dll-Results.xml" />
</exec>
<exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.region.coremodules.tests">
<arg value="./bin/OpenSim.Region.CoreModules.Tests.dll" />
<arg value="-xml=test-results/OpenSim.Region.CoreModules.Tests.dll-Results.xml" />
</exec>
<!--
<exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.region.optionalmodules.tests">
<arg value="./bin/OpenSim.Region.OptionalModules.Tests.dll" />
<arg value="-xml=test-results/OpenSim.Region.OptionalModules.Tests.dll-Results.xml" />
</exec>
-->
<exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.region.framework.tests">
<arg value="./bin/OpenSim.Region.Framework.Tests.dll" />
<arg value="-xml=test-results/OpenSim.Region.Framework.Tests.dll-Results.xml" />
</exec>
<exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.data.tests">
<arg value="./bin/OpenSim.Data.Tests.dll" />
<arg value="-xml=test-results/OpenSim.Data.Tests.dll-Results.xml" />
</exec>
<exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.capabilities.handlers.tests">
<arg value="./bin/OpenSim.Capabilities.Handlers.Tests.dll" />
<arg value="-xml=test-results/OpenSim.Capabilities.Handlers.Tests.dll-Results.xml" />
</exec>
<exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.server.handlers.tests">
<arg value="./bin/OpenSim.Server.Handlers.Tests.dll" />
<arg value="-xml=test-results/OpenSim.Server.Handlers.Tests.dll-Results.xml" />
</exec>
<exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.services.inventoryservice.tests">
<arg value="./bin/OpenSim.Services.InventoryService.Tests.dll" />
<arg value="-xml=test-results/OpenSim.Services.InventoryService.Tests.dll-Results.xml" />
</exec>
<exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.tests.permissions">
<arg value="./bin/OpenSim.Tests.Permissions.dll" />
<arg value="-xml=test-results/OpenSim.Tests.Permissions.dll-Results.xml" />
</exec>
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.tests)==0}" />
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.framework.tests)==0}" />
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.framework.servers.tests)==0}" />
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.clientstack.lindenudp.tests)==0}" />
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.scriptengine.tests)==0}" />
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.coremodules.tests)==0}" />
<!-- <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.optionalmodules.tests)==0}" /> -->
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.framework.tests)==0}" />
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.data.tests)==0}" />
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.capabilities.handlers.tests)==0}" />
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.services.inventoryservice.tests)==0}" />
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.tests.permissions)==0}" />
</target>
<target name="doxygen">
<exec program="doxygen" workingdir="doc" commandline="doxygen.conf" />
</target>

View file

@ -4,9 +4,6 @@ get or update source from git
`git clone git://opensimulator.org/git/opensim`
change to dotnet6 test branch
`git checkout dotnet6`
# Building on Windows

View file

@ -318,7 +318,7 @@ namespace OpenSim.Groups
{
return m_CacheWrapper.GetAgentGroupRoles(RequestingAgentID, AgentID, GroupID, delegate
{
return m_GroupsService.GetAgentGroupRoles(RequestingAgentID, AgentID, GroupID);
return m_GroupsService.GetAgentGroupRoles(RequestingAgentID, AgentID, GroupID); ;
});
}

View file

@ -78,10 +78,9 @@ namespace OpenSim.Data
public interface IXInventoryData
{
XInventoryFolder[] GetFolder(string field, string val);
XInventoryFolder[] GetFolders(string[] fields, string[] vals);
XInventoryItem[] GetItems(string[] fields, string[] vals);
XInventoryItem[] GetItems(string idfield, string[] ids);
XInventoryItem[] GetItems(string idfield, string id);
bool StoreFolder(XInventoryFolder folder);
bool StoreItem(XInventoryItem item);
@ -125,7 +124,7 @@ namespace OpenSim.Data
/// <param name='id'>UUID of the item</param>
/// <param name='newParent'>UUID of the new parent folder.</param>
bool MoveItem(string id, string newParentFolderID);
bool MoveItems(string[] ids, string[] newParents);
/// <summary>
/// Move a folder to another folder.
/// </summary>

View file

@ -39,8 +39,7 @@ namespace OpenSim.Data.MySQL
{
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected Dictionary<string, FieldInfo> m_Fields =
new Dictionary<string, FieldInfo>();
protected Dictionary<string, FieldInfo> m_Fields = new Dictionary<string, FieldInfo>();
protected List<string> m_ColumnNames = null;
protected string m_Realm;
@ -69,7 +68,7 @@ namespace OpenSim.Data.MySQL
protected void CommonConstruct(string storeName)
{
if (storeName != String.Empty)
if (!string.IsNullOrEmpty(storeName))
{
// We always use a new connection for any Migrations
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
@ -119,7 +118,7 @@ namespace OpenSim.Data.MySQL
using (MySqlCommand cmd = new MySqlCommand())
{
cmd.Parameters.AddWithValue(field, key);
cmd.CommandText = string.Format("select * from {0} where `{1}` = ?{1}", m_Realm, field);
cmd.CommandText = $"select * from {m_Realm} where `{field}` = ?{field}";
return DoQuery(cmd);
}
}
@ -283,10 +282,7 @@ namespace OpenSim.Data.MySQL
{
using (MySqlCommand cmd = new MySqlCommand())
{
string query = String.Format("select * from {0} where {1}",
m_Realm, where);
cmd.CommandText = query;
cmd.CommandText = $"select * from {m_Realm} where {where}"; ;
return DoQuery(cmd);
}
@ -312,9 +308,7 @@ namespace OpenSim.Data.MySQL
// InventoryTransferModule or we may be required to substitute a DBNull here.
if (fi.GetValue(row) == null)
throw new NullReferenceException(
string.Format(
"[MYSQL GENERIC TABLE HANDLER]: Trying to store field {0} for {1} which is unexpectedly null",
fi.Name, row));
$"[MYSQL GENERIC TABLE HANDLER]: Trying to store field {fi.Name} for {row} which is unexpectedly null");
cmd.Parameters.AddWithValue(fi.Name, fi.GetValue(row).ToString());
}
@ -332,7 +326,7 @@ namespace OpenSim.Data.MySQL
}
}
query = String.Format("replace into {0} (`", m_Realm) + String.Join("`,`", names.ToArray()) + "`) values (" + String.Join(",", values.ToArray()) + ")";
query = $"replace into {m_Realm} (`" + String.Join("`,`", names.ToArray()) + "`) values (" + String.Join(",", values.ToArray()) + ")";
cmd.CommandText = query;

View file

@ -28,8 +28,6 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Text;
using System.Reflection;
using log4net;
using OpenMetaverse;
using OpenSim.Framework;
@ -38,20 +36,22 @@ using MySqlConnector;
namespace OpenSim.Data.MySQL
{
/// <summary>
/// A MySQL Interface for the Asset Server
/// A MySQL Interface for the Inventory Server
/// </summary>
public class MySQLXInventoryData : IXInventoryData
{
private MySqlFolderHandler m_Folders;
private MySqlItemHandler m_Items;
public MySQLXInventoryData(string conn, string realm)
{
m_Folders = new MySqlFolderHandler(
conn, "inventoryfolders", "InventoryStore");
m_Items = new MySqlItemHandler(
conn, "inventoryitems", String.Empty);
m_Folders = new MySqlFolderHandler(conn, "inventoryfolders", "InventoryStore");
m_Items = new MySqlItemHandler(conn, "inventoryitems", string.Empty);
}
public XInventoryFolder[] GetFolder(string field, string val)
{
return m_Folders.Get(field, val);
}
public XInventoryFolder[] GetFolders(string[] fields, string[] vals)
@ -64,16 +64,6 @@ namespace OpenSim.Data.MySQL
return m_Items.Get(fields, vals);
}
public XInventoryItem[] GetItems(string field, string[] vals)
{
return m_Items.Get(field, vals);
}
public XInventoryItem[] GetItems(string fields, string val)
{
return m_Items.Get(fields, val);
}
public bool StoreFolder(XInventoryFolder folder)
{
if (folder.folderName.Length > 64)
@ -85,9 +75,9 @@ namespace OpenSim.Data.MySQL
public bool StoreItem(XInventoryItem item)
{
if (item.inventoryName.Length > 64)
item.inventoryName = item.inventoryName.Substring(0, 64);
item.inventoryName = item.inventoryName[..64];
if (item.inventoryDescription.Length > 128)
item.inventoryDescription = item.inventoryDescription.Substring(0, 128);
item.inventoryDescription = item.inventoryDescription[..128];
return m_Items.Store(item);
}
@ -117,11 +107,6 @@ namespace OpenSim.Data.MySQL
return m_Items.MoveItem(id, newParent);
}
public bool MoveItems(string[] ids, string[] newParents)
{
return m_Items.MoveItems(ids, newParents);
}
public bool MoveFolder(string id, string newParent)
{
return m_Folders.MoveFolder(id, newParent);
@ -140,10 +125,9 @@ namespace OpenSim.Data.MySQL
public class MySqlItemHandler : MySqlInventoryHandler<XInventoryItem>
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
//private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public MySqlItemHandler(string c, string t, string m) :
base(c, t, m)
public MySqlItemHandler(string c, string t, string m) : base(c, t, m)
{
}
@ -156,7 +140,8 @@ namespace OpenSim.Data.MySQL
if (!base.Delete(field, val))
return false;
IncrementFolderVersion(retrievedItems[0].parentFolderID);
// Don't increment folder version here since Delete(string, string) calls Delete(string[], string[])
//IncrementFolderVersion(retrievedItems[0].parentFolderID);
return true;
}
@ -182,7 +167,7 @@ namespace OpenSim.Data.MySQL
public bool MoveItem(string id, string newParent)
{
XInventoryItem[] retrievedItems = Get("inventoryID", id);
XInventoryItem[] retrievedItems = Get(new string[] { "inventoryID" }, new string[] { id });
if (retrievedItems.Length == 0)
return false;
@ -198,188 +183,8 @@ namespace OpenSim.Data.MySQL
return false;
}
IncrementFolderVersion(newParent);
if(oldParent.ToString() != newParent)
IncrementFolderVersion(oldParent);
return true;
}
public bool MoveItems(string[] ids, string[] newParents)
{
int len = ids.Length;
if(len == 0)
return false;
MySqlConnection dbcon;
MySqlCommand cmd;
MySqlDataReader rdr;
try
{
dbcon = new MySqlConnection(m_connectionString);
dbcon.Open();
}
catch
{
return false;
}
HashSet<string> changedfolders = new HashSet<string>();
try
{
UUID utmp;
int flast = len - 1;
StringBuilder sb = new StringBuilder(1024);
sb.AppendFormat("select parentFolderID from {0} where inventoryID IN ('", m_Realm);
for (int i = 0 ; i < len ; ++i)
{
sb.Append(ids[i]);
if(i < flast)
sb.Append("','");
else
sb.Append("')");
}
string[] oldparents = new string[len];
int l = 0;
using (cmd = new MySqlCommand())
{
cmd.CommandText = sb.ToString();
cmd.Connection = dbcon;
rdr = cmd.ExecuteReader();
while (rdr.Read() && l < len)
{
if(!(rdr[0] is string))
oldparents[l++] = null;
else
oldparents[l++] = (string)rdr[0];
}
rdr.Close();
}
if(l == 0)
return false;
l = 0;
sb = new StringBuilder(1024);
string sbformat = String.Format("insert into {0} (inventoryID,parentFolderID) values{1} on duplicate key update parentFolderID = values(parentFolderID)", m_Realm,"{0}");
for(int k = 0; k < len; k++)
{
string oldid = oldparents[k];
if(String.IsNullOrWhiteSpace(oldid) || !UUID.TryParse(oldid, out utmp))
continue;
string newParent = newParents[k];
if(String.IsNullOrWhiteSpace(newParent) || !UUID.TryParse(newParent, out utmp))
continue;
string id = ids[k];
if(id == oldid)
continue;
sb.AppendFormat("(\'{0}\',\'{1}\')",id, newParent);
if(k < flast)
sb.Append(",");
if(!changedfolders.Contains(newParent))
changedfolders.Add(newParent);
if(!changedfolders.Contains(oldid))
changedfolders.Add(oldid);
++l;
}
if(l == 0)
return false;
oldparents = null;
newParents = null;
ids = null;
using (cmd = new MySqlCommand())
{
using(MySqlTransaction trans = dbcon.BeginTransaction())
{
cmd.Connection = dbcon;
cmd.Transaction = trans;
try
{
cmd.CommandText = string.Format(sbformat,sb.ToString());
int r = cmd.ExecuteNonQuery();
if(r == 2 * l)
trans.Commit();
else
{
// we did got insertions so need to bail out
trans.Rollback();
return false;
}
}
catch
{
trans.Rollback();
return false;
}
}
}
if(changedfolders.Count == 0)
return true;
sb = new StringBuilder(256);
sb.Append("insert into inventoryfolders (folderID) values");
l = 0;
flast = changedfolders.Count - 1;
foreach(UUID uu in changedfolders)
{
sb.AppendFormat("(\'{0}\')",uu);
if(l < flast)
sb.Append(",");
++l;
}
changedfolders = null;
sb.Append(" on duplicate key update version = version + 1");
using (cmd = new MySqlCommand())
{
using(MySqlTransaction trans = dbcon.BeginTransaction())
{
cmd.Connection = dbcon;
cmd.Transaction = trans;
cmd.CommandText = sb.ToString();
try
{
int r = cmd.ExecuteNonQuery();
if(r == 2 * l)
trans.Commit();
else
{
// we did got insertions so need to bail out
trans.Rollback();
}
}
catch
{
trans.Rollback();
}
}
}
}
catch
{
return false;
}
finally
{
dbcon.Close();
}
IncrementFolderVersion(newParent);
return true;
}
@ -390,7 +195,7 @@ namespace OpenSim.Data.MySQL
{
// cmd.CommandText = String.Format("select * from inventoryitems where avatarId = ?uuid and assetType = ?type and flags & 1", m_Realm);
cmd.CommandText = String.Format("select * from inventoryitems where avatarId = ?uuid and assetType = ?type and flags & 1");
cmd.CommandText = "select * from inventoryitems where avatarId = ?uuid and assetType = ?type and flags & 1";
cmd.Parameters.AddWithValue("?uuid", principalID.ToString());
cmd.Parameters.AddWithValue("?type", (int)AssetType.Gesture);
@ -411,13 +216,14 @@ namespace OpenSim.Data.MySQL
// cmd.CommandText = String.Format("select bit_or(inventoryCurrentPermissions) as inventoryCurrentPermissions from inventoryitems where avatarID = ?PrincipalID and assetID = ?AssetID group by assetID", m_Realm);
cmd.CommandText = String.Format("select bit_or(inventoryCurrentPermissions) as inventoryCurrentPermissions from inventoryitems where avatarID = ?PrincipalID and assetID = ?AssetID group by assetID");
cmd.CommandText = "select bit_or(inventoryCurrentPermissions) as inventoryCurrentPermissions from inventoryitems where avatarID = ?PrincipalID and assetID = ?AssetID group by assetID";
cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString());
cmd.Parameters.AddWithValue("?AssetID", assetID.ToString());
using (IDataReader reader = cmd.ExecuteReader())
{
int perms = 0;
if (reader.Read())
@ -446,8 +252,7 @@ namespace OpenSim.Data.MySQL
{
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public MySqlFolderHandler(string c, string t, string m) :
base(c, t, m)
public MySqlFolderHandler(string c, string t, string m) : base(c, t, m)
{
}
@ -462,9 +267,7 @@ namespace OpenSim.Data.MySQL
using (MySqlCommand cmd = new MySqlCommand())
{
cmd.CommandText
= String.Format(
"update {0} set parentFolderID = ?ParentFolderID where folderID = ?folderID", m_Realm);
cmd.CommandText = $"update {m_Realm} set parentFolderID = ?ParentFolderID where folderID = ?folderID";
cmd.Parameters.AddWithValue("?ParentFolderID", newParentFolderID);
cmd.Parameters.AddWithValue("?folderID", id);
@ -503,15 +306,15 @@ namespace OpenSim.Data.MySQL
// m_log.DebugFormat("[MYSQL FOLDER HANDLER]: Incrementing version on folder {0}", folderID);
// Util.PrintCallStack();
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
using (MySqlConnection dbcon = new(m_connectionString))
{
dbcon.Open();
using (MySqlCommand cmd = new MySqlCommand())
using (MySqlCommand cmd = new())
{
cmd.Connection = dbcon;
cmd.CommandText = String.Format("update inventoryfolders set version=version+1 where folderID = ?folderID");
cmd.CommandText = "update inventoryfolders set version=version+1 where folderID = ?folderID";
cmd.Parameters.AddWithValue("?folderID", folderID);
try

View file

@ -64,6 +64,11 @@ namespace OpenSim.Data.PGSQL
return newUUID;
}
public XInventoryFolder[] GetFolder(string field, string val)
{
return m_Folders.Get(field, val);
}
public XInventoryFolder[] GetFolders(string[] fields, string[] vals)
{
return m_Folders.Get(fields, vals);
@ -74,16 +79,6 @@ namespace OpenSim.Data.PGSQL
return m_Items.Get(fields, vals);
}
public XInventoryItem[] GetItems(string field, string[] vals)
{
return m_Items.Get(field, vals);
}
public XInventoryItem[] GetItems(string field, string id)
{
return m_Items.Get(field, id);
}
public bool StoreFolder(XInventoryFolder folder)
{
if (folder.folderName.Length > 64)
@ -126,13 +121,6 @@ namespace OpenSim.Data.PGSQL
return m_Items.MoveItem(id, newParent);
}
public bool MoveItems(string[] ids, string[] newParents)
{
for(int i = 0; i< ids.Length; ++i)
m_Items.MoveItem(ids[i], newParents[i]);
return true;
}
public bool MoveFolder(string id, string newParent)
{
return m_Folders.MoveFolder(id, newParent);

View file

@ -29,7 +29,6 @@ using System;
using System.Collections.Generic;
using System.Data;
using System.Reflection;
using System.Text;
using log4net;
using System.Data.SQLite;
@ -120,44 +119,7 @@ namespace OpenSim.Data.SQLite
public virtual T[] Get(string field, string key)
{
List<string> terms = new List<string>();
using (SQLiteCommand cmd = new SQLiteCommand())
{
cmd.Parameters.Add(new SQLiteParameter(":" + field, key));
string query = String.Format("select * from {0} where `{1}` = :{1}",m_Realm, field);
cmd.CommandText = query;
return DoQuery(cmd);
}
}
public virtual T[] Get(string field, string[] keys)
{
int flen = keys.Length;
if(flen == 0)
return new T[0];
int flast = flen - 1;
StringBuilder sb = new StringBuilder(1024);
sb.AppendFormat("select * from {0} where {1} IN('", m_Realm, field);
using (SQLiteCommand cmd = new SQLiteCommand())
{
for (int i = 0 ; i < flen ; i++)
{
sb.Append(keys[i]);
if(i < flast)
sb.Append("','");
else
sb.Append("')");
}
cmd.CommandText = sb.ToString();
return DoQuery(cmd);
}
return Get(new string[] { field }, new string[] { key });
}
public virtual T[] Get(string[] fields, string[] keys)

View file

@ -2836,6 +2836,11 @@ namespace OpenSim.Data.SQLite
da.InsertCommand.Connection = conn;
da.UpdateCommand = createUpdateCommand("regionenvironment", "region_id=:region_id", ds.Tables["regionenvironment"]);
da.UpdateCommand.Connection = conn;
SqliteCommand delete = new SqliteCommand("delete from regionenvironment where region_id= :region_id");
delete.Parameters.Add(createSqliteParameter("region_id", typeof(String)));
da.DeleteCommand = delete;
da.DeleteCommand.Connection = conn;
}
private void setupRegionSpawnPointsCommands(SQLiteDataAdapter da, SQLiteConnection conn)

View file

@ -57,6 +57,11 @@ namespace OpenSim.Data.SQLite
conn, "inventoryitems", String.Empty);
}
public XInventoryFolder[] GetFolder(string field, string val)
{
return m_Folders.Get(field, val);
}
public XInventoryFolder[] GetFolders(string[] fields, string[] vals)
{
return m_Folders.Get(fields, vals);
@ -66,14 +71,6 @@ namespace OpenSim.Data.SQLite
{
return m_Items.Get(fields, vals);
}
public XInventoryItem[] GetItems(string field, string[] vals)
{
return m_Items.Get(field, vals);
}
public XInventoryItem[] GetItems(string field, string val)
{
return m_Items.Get(field, val);
}
public bool StoreFolder(XInventoryFolder folder)
{
@ -118,13 +115,6 @@ namespace OpenSim.Data.SQLite
return m_Items.MoveItem(id, newParent);
}
public bool MoveItems(string[] ids, string[] newParents)
{
for(int i = 0; i< ids.Length; ++i)
m_Items.MoveItem(ids[i], newParents[i]);
return true;
}
public bool MoveFolder(string id, string newParent)
{
return m_Folders.MoveFolder(id, newParent);

View file

@ -68,6 +68,9 @@ namespace OpenSim.Framework
public static readonly UUID EmptyNotecardID = new UUID(EmptyNotecard);
public static readonly byte[] EmptyNotecardData = osUTF8.GetASCIIBytes("Linden text version 2\n{\nLLEmbeddedItems version 1\n{\ncount 0\n}\nText length 0\n}\n\0");
public static readonly string DefaultMaterial = "968cbad0-4dad-d64e-71b5-72bf13ad051a";
public static readonly UUID DefaultMaterialID = new UUID(DefaultMaterial);
public static readonly string m_MrOpenSimIDString = "11111111-1111-0000-0000-000100bba000";
public static readonly UUID m_MrOpenSimID = new UUID(m_MrOpenSimIDString);
public static readonly DateTime m_MrOpenSimBorn = new DateTime(2007, 1, 1, 0, 0, 0, DateTimeKind.Utc);

View file

@ -607,7 +607,7 @@ namespace OpenSim.Framework
{
None = 0,
AttachmentPoint = 1 << 0,
Material = 1 << 1,
MaterialOvr = 1 << 1,
ClickAction = 1 << 2,
Scale = 1 << 3,
ParentID = 1 << 4,
@ -630,11 +630,13 @@ namespace OpenSim.Framework
Sound = 1 << 21,
TerseUpdate = Position | Rotation | Velocity | Acceleration | AngularVelocity,
FullUpdate = 0x00ffffff,
FullUpdate = 0x00ffffff & ~MaterialOvr,
Animations = 1 << 24,
FullUpdatewithAnim = FullUpdate | Animations,
FullUpdatewithMatOvr = FullUpdate | MaterialOvr,
FullUpdatewithAnimMatOvr = FullUpdate | Animations | MaterialOvr,
UpdateProbe = 0x10000000, // 1 << 28
SendInTransit = 0x20000000, // 1 << 29

View file

@ -48,9 +48,7 @@ namespace OpenSim.Framework
private short _type;
/// <summary>
/// This is used to denote the version of the client, needed
/// because of the changes clients have with inventory from
/// time to time (1.19.1 caused us some fits there).
/// This is used to denote the version of folder
/// </summary>
private ushort _version;

View file

@ -27,6 +27,7 @@
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace OpenSim.Framework
@ -170,7 +171,7 @@ namespace OpenSim.Framework
{
lock (m_syncRoot)
{
if (m_array == null)
if (m_array is null)
{
if(m_dict.Count == 0)
return Array.Empty<TValue>();
@ -180,5 +181,11 @@ namespace OpenSim.Framework
return m_array;
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public Span<TValue> GetSpan()
{
return new Span<TValue>(GetArray());
}
}
}

View file

@ -33,6 +33,8 @@ using System.Reflection;
using log4net;
using LukeSkywalker.IPNetwork;
using Nini.Config;
using IPNetwork = LukeSkywalker.IPNetwork.IPNetwork;
namespace OpenSim.Framework
{

View file

@ -971,15 +971,11 @@ namespace OpenSim.Framework
TotalBytesLength += 9 + 2 + 4; // data
}
if (RenderMaterials != null)
bool hasRenderMaterials = RenderMaterials is not null && RenderMaterials.entries is not null && RenderMaterials.entries.Length > 0;
if (hasRenderMaterials)
{
ExtraParamsNum++;
if (RenderMaterials.entries == null || RenderMaterials.entries.Length == 0)
TotalBytesLength++;
else
{
TotalBytesLength += 1 + 17 * RenderMaterials.entries.Length + 2 + 4; // data
}
TotalBytesLength += 1 + 17 * RenderMaterials.entries.Length + 2 + 4; // data
}
byte[] safeReturnBytes = new byte[TotalBytesLength];
@ -1067,7 +1063,7 @@ namespace OpenSim.Framework
*returnBytes++ = ReflectionProbe.Flags;
}
if (RenderMaterials != null && RenderMaterials.entries != null && RenderMaterials.entries.Length > 0)
if (hasRenderMaterials)
{
*returnBytes = MaterialsEP; returnBytes += 2;
@ -1508,10 +1504,12 @@ namespace OpenSim.Framework
// byte: high entry override utf8 length
// utf8 bytes: override
if (RenderMaterials is null || RenderMaterials.overrides is null || RenderMaterials.overrides.Length == 0)
if (RenderMaterials is null)
return null;
osUTF8 sb = OSUTF8Cached.Acquire();
if (RenderMaterials.overrides is null || RenderMaterials.overrides.Length == 0)
return new byte[] { 0 }; // store so outdated viewer caches can be updated
int nentries = 0;
for (int i = 0; i < RenderMaterials.overrides.Length; i++)
{
@ -1519,8 +1517,9 @@ namespace OpenSim.Framework
nentries++;
}
if(nentries == 0)
return null;
return new byte[] { 0 };
osUTF8 sb = OSUTF8Cached.Acquire();
sb.Append((byte)nentries);
for (int i = 0; i < RenderMaterials.overrides.Length; i++)
{
@ -1537,13 +1536,20 @@ namespace OpenSim.Framework
public void RenderMaterialsOvrFromRawBin(byte[] data)
{
if (RenderMaterials is not null && RenderMaterials.overrides != null)
if (RenderMaterials is not null && RenderMaterials.overrides is not null)
RenderMaterials.overrides = null;
if (data is null || data.Length < 16)
if (data is null || data.Length < 1)
return;
int nentries = data[0];
if(nentries > 128)
if (nentries > 128)
return;
if (nentries == 0) // for outdated viewer caches
{
RenderMaterials ??= new Primitive.RenderMaterials();
return;
}
int indx = 1;
Primitive.RenderMaterials.RenderMaterialOverrideEntry[] overrides = new Primitive.RenderMaterials.RenderMaterialOverrideEntry[nentries];
try
@ -1554,14 +1560,18 @@ namespace OpenSim.Framework
int ovrlen = data[indx++];
ovrlen += data[indx++] << 8;
overrides[i].data = Utils.BytesToString(data,indx, ovrlen);
if(overrides[i].data.StartsWith("{\"asset")) // ignore old test data
return;
indx += ovrlen;
}
RenderMaterials ??= new Primitive.RenderMaterials();
RenderMaterials.overrides = overrides;
}
catch
{
return;
}
RenderMaterials ??= new Primitive.RenderMaterials();
RenderMaterials.overrides = overrides;
}
/// <summary>

View file

@ -174,10 +174,10 @@ namespace OpenSim.Framework.Servers
m_consoleAppender.Console = (ConsoleBase)m_console;
// If there is no threshold set then the threshold is effectively everything.
if (null == m_consoleAppender.Threshold)
if (m_consoleAppender.Threshold is null)
m_consoleAppender.Threshold = Level.All;
Notice(String.Format("Console log level is {0}", m_consoleAppender.Threshold));
//Notice($"Console log level is {m_consoleAppender.Threshold}");
}
if (m_logFileAppender != null && startupConfig != null)

View file

@ -318,7 +318,6 @@ namespace OpenSim.Framework
["type"] = "sky"
};
if (reflectionProbeAmbiance != 0f)
map["reflection_probe_ambiance"] = reflectionProbeAmbiance;
return map;

View file

@ -46,7 +46,7 @@ namespace OpenSim.Region.ClientStack.Linden
{
UpdateInventoryItemAsset(httpRequest, httpResponse, map, (byte)AssetType.Material);
}
public void UpdateGestureItemAsset(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse, OSDMap map)
{
UpdateInventoryItemAsset(httpRequest, httpResponse, map, (byte)AssetType.Gesture);

View file

@ -53,7 +53,7 @@ namespace OpenSim.Region.ClientStack.Linden
public OSHttpRequest request;
}
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
//private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
/// <summary>
/// Control whether requests will be processed asynchronously.

View file

@ -290,7 +290,7 @@ namespace OpenSim.Region.ClientStack.Linden
rootGroup.LinkToGroup(allparts[j]);
}
rootGroup.ScheduleGroupForFullAnimUpdate();
rootGroup.ScheduleGroupForUpdate(PrimUpdateFlags.FullUpdatewithAnimMatOvr);
httpResponse.StatusCode = (int)HttpStatusCode.OK;
httpResponse.RawBuffer = Util.UTF8NBGetbytes(String.Format("<llsd><map><key>local_id</key>{0}</map></llsd>", ConvertUintToBytes(allparts[0].LocalId)));

View file

@ -706,7 +706,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// <returns>true if the handler was added. This is currently always the case.</returns>
public bool AddLocalPacketHandler(PacketType packetType, PacketMethod handler, bool doAsync)
{
lock (m_packetHandlers)
lock (m_packetHandlers)
return m_packetHandlers.TryAdd(packetType, new PacketProcessor() { method = handler, Async = doAsync});
}
@ -991,13 +991,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
else
pos.ToBytes(data + 42); //54
look.ToBytes(data + 54); // 66
//Utils.UInt64ToBytesSafepos(regInfo.RegionHandle, data + 66); // 74
//Utils.UIntToBytesSafepos((uint)Util.UnixTimeSinceEpoch(), data + 74); //78
Utils.UInt64ToBytes(regInfo.RegionHandle, data + 66); // 74
Utils.IntToBytes((int)Util.UnixTimeSinceEpoch(), data + 74); //78
//Utils.UInt64ToBytesSafepos(regInfo.RegionHandle, data + 66); // 74
//Utils.UIntToBytesSafepos((uint)Util.UnixTimeSinceEpoch(), data + 74); //78
Utils.UInt64ToBytes(regInfo.RegionHandle, data + 66); // 74
Utils.IntToBytes((int)Util.UnixTimeSinceEpoch(), data + 74); //78
//SimData
int len = m_regionChannelVersion.Length;
//SimData
int len = m_regionChannelVersion.Length;
if(len == 0)
{
data[78] = 0;
@ -1350,11 +1350,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
GAPIRP.TransactionData.TotalNumItems = (uint)Proposals.Length;
GAPIRP.ProposalData = new GroupActiveProposalItemReplyPacket.ProposalDataBlock[Proposals.Length];
int i = 0;
foreach (GroupActiveProposals Proposal in Proposals)
{
int i = 0;
foreach (GroupActiveProposals Proposal in Proposals)
{
GAPIRP.ProposalData[i++] = new GroupActiveProposalItemReplyPacket.ProposalDataBlock()
{
{
VoteCast = Utils.StringToBytes("false"),
VoteID = new UUID(Proposal.VoteID),
VoteInitiator = new UUID(Proposal.VoteInitiator),
@ -1366,8 +1366,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
ProposalText = Utils.StringToBytes(Proposal.ProposalText),
AlreadyVoted = false
};
}
}
}
OutPacket(GAPIRP, ThrottleOutPacketType.Task);
*/
}
@ -1375,11 +1375,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public void SendGroupVoteHistory(UUID groupID, UUID transactionID, GroupVoteHistory[] Votes)
{
/* not in use and broken
GroupVoteHistoryItemReplyPacket GVHIRP = new GroupVoteHistoryItemReplyPacket();
GroupVoteHistoryItemReplyPacket GVHIRP = new GroupVoteHistoryItemReplyPacket();
GVHIRP.AgentData.AgentID = m_agentId;
GVHIRP.AgentData.GroupID = groupID;
GVHIRP.TransactionData.TransactionID = transactionID;
GVHIRP.AgentData.AgentID = m_agentId;
GVHIRP.AgentData.GroupID = groupID;
GVHIRP.TransactionData.TransactionID = transactionID;
if (Votes.Length == 0)
{
@ -1410,24 +1410,24 @@ namespace OpenSim.Region.ClientStack.LindenUDP
int i = 0;
foreach (GroupVoteHistory Vote in Votes)
{
GVHIRP.HistoryItemData.VoteID = new UUID(Vote.VoteID);
GVHIRP.HistoryItemData.VoteInitiator = new UUID(Vote.VoteInitiator);
GVHIRP.HistoryItemData.Majority = (float)Convert.ToInt32(Vote.Majority);
GVHIRP.HistoryItemData.Quorum = Convert.ToInt32(Vote.Quorum);
GVHIRP.HistoryItemData.TerseDateID = Utils.StringToBytes(Vote.TerseDateID);
GVHIRP.HistoryItemData.StartDateTime = Utils.StringToBytes(Vote.StartDateTime);
GVHIRP.HistoryItemData.EndDateTime = Utils.StringToBytes(Vote.EndDateTime);
GVHIRP.HistoryItemData.VoteType = Utils.StringToBytes(Vote.VoteType);
GVHIRP.HistoryItemData.VoteResult = Utils.StringToBytes(Vote.VoteResult);
GVHIRP.HistoryItemData.ProposalText = Utils.StringToBytes(Vote.ProposalText);
GroupVoteHistoryItemReplyPacket.VoteItemBlock VoteItem = new GroupVoteHistoryItemReplyPacket.VoteItemBlock();
GVHIRP.VoteItem = new GroupVoteHistoryItemReplyPacket.VoteItemBlock[1];
VoteItem.CandidateID = UUID.Zero;
VoteItem.NumVotes = 0; //TODO: FIX THIS!!!
VoteItem.VoteCast = Utils.StringToBytes("Yes");
GVHIRP.VoteItem[i] = VoteItem;
i++;
}
GVHIRP.HistoryItemData.VoteID = new UUID(Vote.VoteID);
GVHIRP.HistoryItemData.VoteInitiator = new UUID(Vote.VoteInitiator);
GVHIRP.HistoryItemData.Majority = (float)Convert.ToInt32(Vote.Majority);
GVHIRP.HistoryItemData.Quorum = Convert.ToInt32(Vote.Quorum);
GVHIRP.HistoryItemData.TerseDateID = Utils.StringToBytes(Vote.TerseDateID);
GVHIRP.HistoryItemData.StartDateTime = Utils.StringToBytes(Vote.StartDateTime);
GVHIRP.HistoryItemData.EndDateTime = Utils.StringToBytes(Vote.EndDateTime);
GVHIRP.HistoryItemData.VoteType = Utils.StringToBytes(Vote.VoteType);
GVHIRP.HistoryItemData.VoteResult = Utils.StringToBytes(Vote.VoteResult);
GVHIRP.HistoryItemData.ProposalText = Utils.StringToBytes(Vote.ProposalText);
GroupVoteHistoryItemReplyPacket.VoteItemBlock VoteItem = new GroupVoteHistoryItemReplyPacket.VoteItemBlock();
GVHIRP.VoteItem = new GroupVoteHistoryItemReplyPacket.VoteItemBlock[1];
VoteItem.CandidateID = UUID.Zero;
VoteItem.NumVotes = 0; //TODO: FIX THIS!!!
VoteItem.VoteCast = Utils.StringToBytes("Yes");
GVHIRP.VoteItem[i] = VoteItem;
i++;
}
}
OutPacket(GVHIRP, ThrottleOutPacketType.Task);
*/
@ -1810,8 +1810,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
ICapabilitiesModule capsModule = m_scene.RequestModuleInterface<ICapabilitiesModule>();
if (capsModule is not null) // can happen when shutting down.
{
agentData.CapsPath = capsModule.GetCapsPath(m_agentId);
agentData.ChildrenCapSeeds = new Dictionary<ulong, string>(capsModule.GetChildrenSeeds(m_agentId));
agentData.CapsPath = capsModule.GetCapsPath(m_agentId);
agentData.ChildrenCapSeeds = new Dictionary<ulong, string>(capsModule.GetChildrenSeeds(m_agentId));
}
return agentData;
}
@ -2600,9 +2600,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
FolderID = folder.ID,
ParentID = folder.ParentID,
Type = (sbyte)folder.Type,
// Leaving this here for now, just in case we need to do this for a while
//if (folderBlock.Type == InventoryItemBase.SUITCASE_FOLDER_TYPE)
// folderBlock.Type = InventoryItemBase.SUITCASE_FOLDER_FAKE_TYPE;
// Leaving this here for now, just in case we need to do this for a while
//if (folderBlock.Type == InventoryItemBase.SUITCASE_FOLDER_TYPE)
// folderBlock.Type = InventoryItemBase.SUITCASE_FOLDER_FAKE_TYPE;
Name = Util.StringToBytes256(folder.Name)
};
@ -3498,11 +3498,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (eq is null)
{
ScriptRunningReplyPacket scriptRunningReply = new();
scriptRunningReply.Script.ObjectID = objectID;
scriptRunningReply.Script.ItemID = itemID;
scriptRunningReply.Script.Running = running;
OutPacket(scriptRunningReply, ThrottleOutPacketType.Task);
}
scriptRunningReply.Script.ObjectID = objectID;
scriptRunningReply.Script.ItemID = itemID;
scriptRunningReply.Script.Running = running;
OutPacket(scriptRunningReply, ThrottleOutPacketType.Task);
}
else
{
eq.ScriptRunningEvent(objectID, itemID, running, m_agentId);
@ -4345,10 +4345,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[count];
AgentWearablesUpdatePacket.WearableDataBlock awb;
int idx = 0;
for (int i = 0; i < wearables.Length; i++)
{
for (int j = 0; j < wearables[i].Count; j++)
{
for (int i = 0; i < wearables.Length; i++)
{
for (int j = 0; j < wearables[i].Count; j++)
{
awb = new AgentWearablesUpdatePacket.WearableDataBlock
{
WearableType = (byte)i,
@ -4357,11 +4357,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
};
aw.WearableData[idx++] = awb;
//m_log.DebugFormat(
// "[APPEARANCE]: Sending wearable item/asset {0} {1} (index {2}) for {3}",
// awb.ItemID, awb.AssetID, i, Name);
}
}
//m_log.DebugFormat(
// "[APPEARANCE]: Sending wearable item/asset {0} {1} (index {2}) for {3}",
// awb.ItemID, awb.AssetID, i, Name);
}
}
OutPacket(aw, ThrottleOutPacketType.Task);
}
@ -4969,11 +4969,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
useCompressUpdate = grp.IsViewerCachable;
istree = (part.Shape.PCode == (byte)PCode.Grass || part.Shape.PCode == (byte)PCode.NewTree || part.Shape.PCode == (byte)PCode.Tree);
if(!istree && part.Shape.RenderMaterials is not null &&
part.Shape.ReflectionProbe is null &&
part.Shape.RenderMaterials.overrides is not null &&
part.Shape.RenderMaterials.overrides.Length > 0)
hasMaterialOverride = true;
if((updateFlags & PrimUpdateFlags.MaterialOvr) != 0)
hasMaterialOverride = !istree && part.Shape.RenderMaterials is not null;
}
else if (update.Entity is ScenePresence presence)
{
@ -5498,63 +5495,56 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
foreach (SceneObjectPart sop in needMaterials)
{
Primitive.RenderMaterials.RenderMaterialOverrideEntry[] overrides = sop.Shape.RenderMaterials.overrides;
/*
osUTF8 sbinner = LLSDxmlEncode2.Start();
LLSDxmlEncode2.AddArray(sbinner);
LLSDxmlEncode2.AddMap(sbinner);
LLSDxmlEncode2.AddElem("object_id", sop.UUID, sbinner);
LLSDxmlEncode2.AddElem("region_handle_low", (int)m_scene.RegionInfo.WorldLocX, sbinner);
LLSDxmlEncode2.AddElem("region_handle_high", (int)m_scene.RegionInfo.WorldLocY, sbinner);
LLSDxmlEncode2.AddArray("sides", sbinner);
foreach (Primitive.RenderMaterials.RenderMaterialOverrideEntry ovr in overrides)
LLSDxmlEncode2.AddElem(ovr.te_index, sbinner);
LLSDxmlEncode2.AddEndArray(sbinner);
LLSDxmlEncode2.AddArray("gltf_json", sbinner);
foreach (Primitive.RenderMaterials.RenderMaterialOverrideEntry ovr in overrides)
{
LLSDxmlEncode2.AddElem(ovr.data, sbinner);
}
LLSDxmlEncode2.AddEndArray(sbinner);
LLSDxmlEncode2.AddEndMapAndArray(sbinner);
LLSDxmlEncode2.AddEnd(sbinner);
*/
OSDMap data = new OSDMap(6);
data["local_id"] = sop.LocalId;
data["object_id"] = sop.UUID;
data["region_handle_x"]= (int)m_scene.RegionInfo.WorldLocX;
data["region_handle_y"]= (int)m_scene.RegionInfo.WorldLocY;
OSDArray sides = new OSDArray();
OSDArray gltf = new OSDArray();
foreach (Primitive.RenderMaterials.RenderMaterialOverrideEntry ovr in overrides)
if(sop.Shape.RenderMaterials is null)
continue;
string inner;
if (sop.Shape.RenderMaterials.overrides is not null &&
sop.Shape.RenderMaterials.overrides.Length > 0)
{
sides.Add(ovr.te_index);
gltf.Add(ovr.data);
OSDMap data = new(3)
{
["id"] = (int)sop.LocalId
};
OSDArray sides = new();
OSDArray sidesdata = new();
foreach (Primitive.RenderMaterials.RenderMaterialOverrideEntry ovr in sop.Shape.RenderMaterials.overrides)
{
sides.Add(ovr.te_index);
sidesdata.Add(string.IsNullOrEmpty(ovr.data) ? new OSD() : new OSDllsdxml(ovr.data));
}
data["te"] = sides;
data["od"] = sidesdata;
inner = OSDParser.SerializeLLSDNotation(data);
if (inner.Length < 4)
continue;
}
data["sides"] = sides;
data["gltf_json"] = gltf;
else
inner = $"{{'id':i{sop.LocalId},'od':[],'te':[]}}";
string inner = OSDParser.SerializeLLSDNotationFull(data);
byte[] innerB = Util.UTF8NBGetbytes(inner);
if (innerB.Length > 4096 - 16)
{
m_log.Debug($"[LLCLIENTVIEW]: GenericStreamingMessage packet too large ({innerB.Length})");
continue;
}
osUTF8 sb = eq.StartEvent("LargeGenericMessage");
LLSDxmlEncode2.AddArrayAndMap("AgentData", sb);
LLSDxmlEncode2.AddElem("AgentID", m_agentId, sb);
//LLSDxmlEncode2.AddElem("TransactionID", UUID.Zero, sb);
//LLSDxmlEncode2.AddElem("SessionID", m_sessionId, sb);
LLSDxmlEncode2.AddEndMapAndArray(sb);
UDPPacketBuffer buf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint);
byte[] dataptr = buf.Data;
LLSDxmlEncode2.AddArrayAndMap("MethodData", sb);
LLSDxmlEncode2.AddElem("Method", "GLTFMaterialOverride", sb);
LLSDxmlEncode2.AddElem("Invoice", UUID.Zero, sb);
LLSDxmlEncode2.AddEndMapAndArray(sb);
//setup header
Buffer.BlockCopy(GenericStreamingMessageHeader, 0, dataptr, 0, 7);
Utils.UInt16ToBytes(16757, dataptr, 7);
dataptr[9] = (byte)(innerB.Length);
dataptr[10] = (byte)(innerB.Length >> 8);
LLSDxmlEncode2.AddArrayAndMap("ParamList", sb);
//LLSDxmlEncode2.AddElem("Parameter", sbinner, sb);
LLSDxmlEncode2.AddElem("Parameter", inner, sb);
LLSDxmlEncode2.AddEndMapAndArray(sb);
//OSUTF8Cached.Release(sbinner);
eq.Enqueue(eq.EndEventToBytes(sb), AgentId);
Buffer.BlockCopy(innerB, 0, dataptr, 11, innerB.Length);
buf.DataLength = innerB.Length + 11;
// send it
m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task);
}
}
#endregion Packet Sending
@ -5583,35 +5573,42 @@ namespace OpenSim.Region.ClientStack.LindenUDP
#endregion
}
static private readonly byte[] GenericStreamingMessageHeader = new byte[] {
Helpers.MSG_RELIABLE,
0, 0, 0, 0, // sequence number
0, // extra
31 // ID 31 (high frequency)
};
// hack.. dont use
/*
public void SendPartFullUpdate(ISceneEntity ent, uint? parentID)
{
if (ent is SceneObjectPart)
{
SceneObjectPart part = (SceneObjectPart)ent;
ObjectUpdatePacket packet = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate);
packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
packet.RegionData.TimeDilation = Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f);
packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1];
ObjectUpdatePacket.ObjectDataBlock blk = CreatePrimUpdateBlock(part, mysp);
if (parentID.HasValue)
/*
public void SendPartFullUpdate(ISceneEntity ent, uint? parentID)
{
blk.ParentID = parentID.Value;
if (ent is SceneObjectPart)
{
SceneObjectPart part = (SceneObjectPart)ent;
ObjectUpdatePacket packet = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate);
packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
packet.RegionData.TimeDilation = Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f);
packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1];
ObjectUpdatePacket.ObjectDataBlock blk = CreatePrimUpdateBlock(part, mysp);
if (parentID.HasValue)
{
blk.ParentID = parentID.Value;
}
packet.ObjectData[0] = blk;
OutPacket(packet, ThrottleOutPacketType.Task, true);
}
// m_log.DebugFormat(
// "[LLCLIENTVIEW]: Sent {0} updates in ProcessEntityUpdates() for {1} {2} in {3}",
// updatesThisCall, Name, SceneAgent.IsChildAgent ? "child" : "root", Scene.Name);
//
}
packet.ObjectData[0] = blk;
OutPacket(packet, ThrottleOutPacketType.Task, true);
}
// m_log.DebugFormat(
// "[LLCLIENTVIEW]: Sent {0} updates in ProcessEntityUpdates() for {1} {2} in {3}",
// updatesThisCall, Name, SceneAgent.IsChildAgent ? "child" : "root", Scene.Name);
//
}
*/
*/
public void ReprioritizeUpdates()
{
m_entityUpdates.Reprioritize(UpdatePriorityHandler);
@ -6699,7 +6696,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
};
if (num >= notifyCount)
break;
}
}
pack.Data = dataBlock;
}
@ -10558,7 +10555,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
return; // only do inventory not assets
if (updatetask.AgentData.SessionID.NotEqual(m_sessionId) || updatetask.AgentData.AgentID.NotEqual(m_agentId))
return;
return;
TaskInventoryItem newTaskItem = new()
{
@ -11147,7 +11144,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList)
{
if(Utils.TryParseSingle(Utils.BytesToString(block.Parameter), out float timeSeconds))
OnEstateRestartSimRequest?.Invoke(this, (int)timeSeconds);
OnEstateRestartSimRequest?.Invoke(this, (int)timeSeconds);
}
}
return;
@ -11212,9 +11209,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
if(OnEstateDebugRegionRequest is not null)
{
bool scripted = convertParamStringToBool(messagePacket.ParamList[0].Parameter);
bool collisionEvents = convertParamStringToBool(messagePacket.ParamList[1].Parameter);
bool physics = convertParamStringToBool(messagePacket.ParamList[2].Parameter);
bool scripted = convertParamStringToBool(messagePacket.ParamList[0].Parameter);
bool collisionEvents = convertParamStringToBool(messagePacket.ParamList[1].Parameter);
bool physics = convertParamStringToBool(messagePacket.ParamList[2].Parameter);
OnEstateDebugRegionRequest?.Invoke(this, messagePacket.MethodData.Invoice,
m_agentId, scripted, collisionEvents, physics);
@ -11249,17 +11246,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
switch(p0)
{
case "bake":
OnBakeTerrain?.Invoke(this);
OnBakeTerrain?.Invoke(this);
break;
case "download filename":
if (messagePacket.ParamList.Length > 1)
OnRequestTerrain?.Invoke(this, Utils.BytesToString(messagePacket.ParamList[1].Parameter));
if (messagePacket.ParamList.Length > 1)
OnRequestTerrain?.Invoke(this, Utils.BytesToString(messagePacket.ParamList[1].Parameter));
break;
case "upload filename":
if (messagePacket.ParamList.Length > 1)
OnUploadTerrain?.Invoke(this, Utils.BytesToString(messagePacket.ParamList[1].Parameter));
if (messagePacket.ParamList.Length > 1)
OnUploadTerrain?.Invoke(this, Utils.BytesToString(messagePacket.ParamList[1].Parameter));
break;
default:
@ -11290,7 +11287,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
param1 = Convert.ToUInt32(Utils.BytesToString(messagePacket.ParamList[1].Parameter));
}
catch {}
}
}
OnEstateManageTelehub?.Invoke(this, messagePacket.MethodData.Invoice, messagePacket.AgentData.AgentID, command, param1);
}
return;
@ -11853,7 +11850,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (eventInfoRequestPacket.AgentData.SessionID.NotEqual(m_sessionId) || eventInfoRequestPacket.AgentData.AgentID.NotEqual(m_agentId))
return;
OnEventInfoRequest?.Invoke(this, eventInfoRequestPacket.EventData.EventID);
OnEventInfoRequest?.Invoke(this, eventInfoRequestPacket.EventData.EventID);
}
#endregion
@ -12431,7 +12428,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
private void HandleStartLure(Packet Pack)
{
if(OnStartLure is null)
return;
return;
StartLurePacket startLureRequest = (StartLurePacket)Pack;
if (startLureRequest.AgentData.SessionID.NotEqual(m_sessionId) || startLureRequest.AgentData.AgentID.NotEqual(m_agentId))
@ -12712,7 +12709,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (packet.Type == PacketType.LogoutRequest)
{
if (((LogoutRequestPacket)packet).AgentData.SessionID.NotEqual(m_sessionId))
return;
return;
}
Logout(this);
}
@ -12761,7 +12758,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (cacheItems is null)
{
for (int i = 0; i < cachedtex.WearableData.Length; i++)
{
{
cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock()
{
TextureIndex = cachedtex.WearableData[i].TextureIndex,

View file

@ -1491,6 +1491,113 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
}
Monitor.Exit(m_asyncRequestsLock);
}
/*
string serverURI = string.Empty;
bool foreign = GetUserProfileServerURI(avatarID, out serverURI);
UserAccount account = null;
Dictionary<string,object> userInfo;
if (!foreign)
{
account = Scene.UserAccountService.GetUserAccount(Scene.RegionInfo.ScopeID, avatarID);
}
else
{
userInfo = new Dictionary<string, object>();
}
Byte[] membershipType = new Byte[1];
string born = string.Empty;
uint flags = 0x00;
if (null != account)
{
if (account.UserTitle.Length == 0)
membershipType[0] = (Byte)((account.UserFlags & 0xf00) >> 8);
else
membershipType = Utils.StringToBytes(account.UserTitle);
born = Util.ToDateTime(account.Created).ToString(
"M/d/yyyy", CultureInfo.InvariantCulture);
flags = (uint)(account.UserFlags & 0xff);
}
else
{
if (GetUserAccountData(avatarID, out userInfo) == true)
{
if ((string)userInfo["user_title"].Length == 0)
membershipType[0] = (Byte)(((Byte)userInfo["user_flags"] & 0xf00) >> 8);
else
membershipType = Utils.StringToBytes((string)userInfo["user_title"]);
int val_born = (int)userInfo["user_created"];
if(val_born != 0)
born = Util.ToDateTime(val_born).ToString(
"M/d/yyyy", CultureInfo.InvariantCulture);
// picky, picky
int val_flags = (int)userInfo["user_flags"];
flags = (uint)(val_flags & 0xff);
}
}
props = new UserProfileProperties();
props.UserId = avatarID;
string result = string.Empty;
if(!GetProfileData(ref props, foreign, serverURI, out result))
{
props.AboutText ="Profile not available at this time. User may still be unknown to this grid";
}
if(!m_allowUserProfileWebURLs)
props.WebUrl ="";
HashSet<IClientAPI> clients;
lock(m_profilesCache)
{
if(!m_profilesCache.TryGetValue(props.UserId, out uce) || uce == null)
uce = new UserProfileCacheEntry();
uce.props = props;
uce.born = born;
uce.membershipType = membershipType;
uce.flags = flags;
clients = uce.ClientsWaitingProps;
uce.ClientsWaitingProps = null;
m_profilesCache.AddOrUpdate(props.UserId, uce, PROFILECACHEEXPIRE);
}
// if on same region force online
if(p != null && !p.IsDeleted)
flags |= 0x10;
if(clients == null)
{
remoteClient.SendAvatarProperties(props.UserId, props.AboutText, born, membershipType , props.FirstLifeText, flags,
props.FirstLifeImageId, props.ImageId, props.WebUrl, props.PartnerId);
remoteClient.SendAvatarInterestsReply(props.UserId, (uint)props.WantToMask, props.WantToText,
(uint)props.SkillsMask, props.SkillsText, props.Language);
}
else
{
if(!clients.Contains(remoteClient))
clients.Add(remoteClient);
foreach(IClientAPI cli in clients)
{
if(!cli.IsActive)
continue;
cli.SendAvatarProperties(props.UserId, props.AboutText, born, membershipType , props.FirstLifeText, flags,
props.FirstLifeImageId, props.ImageId, props.WebUrl, props.PartnerId);
cli.SendAvatarInterestsReply(props.UserId, (uint)props.WantToMask, props.WantToText,
(uint)props.SkillsMask, props.SkillsText, props.Language);
}
}
*/
}
/// <summary>

View file

@ -26,12 +26,15 @@
*/
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using log4net;
using Nini.Config;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Framework.Console;
using OpenSim.Framework.Servers;
using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Region.Framework.Interfaces;

View file

@ -218,7 +218,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
name, description, flags, callbackID, asset.FullID, asset.Type, invType,
(uint)PermissionMask.AllAndExport, (uint)PermissionMask.AllAndExport,
everyonemask, nextOwnerMask, groupmask,
creationDate, false); // Data from viewer
creationDate);
return;
}
switch (assetType)
@ -241,7 +241,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
name, description, flags, callbackID, assetID, (sbyte)AssetType.Settings, invType,
(uint)PermissionMask.AllAndExport, (uint)PermissionMask.AllAndExport,
everyonemask, nextOwnerMask, groupmask,
creationDate, false); // Data from viewer
creationDate);
return;
}
case (sbyte)AssetType.LSLText:
@ -251,7 +251,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
name, description, flags, callbackID, Constants.DefaultScriptID, (sbyte)AssetType.LSLText, invType,
(uint)PermissionMask.AllAndExport, (uint)PermissionMask.AllAndExport,
everyonemask, nextOwnerMask, groupmask,
creationDate, false); // Data from viewer
creationDate); // Data from viewer
return;
}
case (sbyte)AssetType.Notecard:
@ -261,7 +261,17 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
name, description, flags, callbackID, Constants.EmptyNotecardID, (sbyte)AssetType.Notecard, invType,
(uint)PermissionMask.AllAndExport, (uint)PermissionMask.AllAndExport,
everyonemask, nextOwnerMask, groupmask,
creationDate, false); // Data from viewer
creationDate);
return;
}
case (sbyte)AssetType.Material:
{
m_Scene.CreateNewInventoryItem(
remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID,
name, description, flags, callbackID, Constants.DefaultMaterialID, (sbyte)AssetType.Material, invType,
(uint)PermissionMask.AllAndExport, (uint)PermissionMask.AllAndExport,
everyonemask, nextOwnerMask, groupmask,
creationDate);
return;
}
@ -278,7 +288,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
name, description, flags, callbackID, UUID.Zero, assetType, invType,
(uint)PermissionMask.AllAndExport, (uint)PermissionMask.AllAndExport,
everyonemask, nextOwnerMask, groupmask,
creationDate, false); // Data from viewer
creationDate);
}
else
{
@ -1095,7 +1105,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
group.CreateScriptInstances(0, true, m_Scene.DefaultScriptEngine, 1);
rootPart.ParentGroup.ResumeScripts();
group.ScheduleGroupForFullAnimUpdate();
group.ScheduleGroupForUpdate(PrimUpdateFlags.FullUpdatewithAnimMatOvr);
}
else
m_Scene.AddNewSceneObject(group, true, false);

View file

@ -1053,9 +1053,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
Data = data
};
//m_assetService.Store(asset);
//return true; // not right
return !string.IsNullOrEmpty(m_assetService.Store(asset));
m_assetService.Store(asset);
return true; // not right
}
/// <summary>

View file

@ -1041,53 +1041,33 @@ namespace OpenSim.Region.Framework.Scenes
return;
}
if (newName.Length == 0)
if (string.IsNullOrEmpty(newName))
newName = item.Name;
AssetBase asset = AssetService.Get(item.AssetID.ToString());
if (asset is not null)
if (remoteClient.AgentId.Equals(oldAgentID)
|| (LibraryService is not null
&& LibraryService.LibraryRootFolder is not null
&& oldAgentID.Equals(LibraryService.LibraryRootFolder.Owner)))
{
if (newName.Length != 0)
{
asset.Name = newName;
}
else
{
newName = item.Name;
}
if (remoteClient.AgentId.Equals(oldAgentID)
|| (LibraryService is not null
&& LibraryService.LibraryRootFolder is not null
&& oldAgentID.Equals(LibraryService.LibraryRootFolder.Owner)))
{
CreateNewInventoryItem(
remoteClient, item.CreatorId, item.CreatorData, newFolderID,
newName, item.Description, item.Flags, callbackID, item.AssetID, (sbyte)item.AssetType, (sbyte)item.InvType,
item.BasePermissions, item.CurrentPermissions, item.EveryOnePermissions,
item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch(), false);
}
else
{
// If item is transfer or permissions are off or calling agent is allowed to copy item owner's inventory item.
if (((item.CurrentPermissions & (uint)PermissionMask.Transfer) != 0)
&& (m_permissions.BypassPermissions()
|| m_permissions.CanCopyUserInventory(remoteClient.AgentId, oldItemID)))
{
CreateNewInventoryItem(
remoteClient, item.CreatorId, item.CreatorData, newFolderID, newName, item.Description, item.Flags, callbackID,
item.AssetID, (sbyte)item.AssetType, (sbyte)item.InvType,
item.NextPermissions, item.NextPermissions, item.EveryOnePermissions & item.NextPermissions,
item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch(), false);
}
}
CreateNewInventoryItem(
remoteClient, item.CreatorId, item.CreatorData, newFolderID,
newName, item.Description, item.Flags, callbackID, item.AssetID, (sbyte)item.AssetType, (sbyte)item.InvType,
item.BasePermissions, item.CurrentPermissions, item.EveryOnePermissions,
item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch());
}
else
{
m_log.ErrorFormat(
"[AGENT INVENTORY]: Could not copy item {0} since asset {1} could not be found",
item.Name, item.AssetID);
// If item is transfer or permissions are off or calling agent is allowed to copy item owner's inventory item.
if (((item.CurrentPermissions & (uint)PermissionMask.Transfer) != 0)
&& (m_permissions.BypassPermissions()
|| m_permissions.CanCopyUserInventory(remoteClient.AgentId, oldItemID)))
{
CreateNewInventoryItem(
remoteClient, item.CreatorId, item.CreatorData, newFolderID, newName, item.Description, item.Flags, callbackID,
item.AssetID, (sbyte)item.AssetType, (sbyte)item.InvType,
item.NextPermissions, item.NextPermissions, item.EveryOnePermissions & item.NextPermissions,
item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch());
}
}
}
@ -1170,6 +1150,17 @@ namespace OpenSim.Region.Framework.Scenes
string name, string description, uint flags, uint callbackID, UUID assetID, sbyte assetType, sbyte invType,
uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate,
bool assetUpload)
{
CreateNewInventoryItem(
remoteClient, creatorID, creatorData, folderID,
name, description, flags, callbackID, assetID, assetType, invType,
baseMask, currentMask, everyoneMask, nextOwnerMask, groupMask, creationDate);
}
public void CreateNewInventoryItem(
IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID,
string name, string description, uint flags, uint callbackID, UUID assetID, sbyte assetType, sbyte invType,
uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate)
{
InventoryItemBase item = new()
{
@ -2816,7 +2807,7 @@ namespace OpenSim.Region.Framework.Scenes
if(humanRez)
group.ResumeScripts();
group.ScheduleGroupForFullAnimUpdate();
group.ScheduleGroupForUpdate(PrimUpdateFlags.FullUpdatewithAnimMatOvr);
}
return objlist;

View file

@ -176,9 +176,10 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectGroup sog = part.ParentGroup;
if(!sog.IsDeleted)
{
PrimUpdateFlags update = PrimUpdateFlags.FullUpdate;
if (sog.RootPart.Shape.MeshFlagEntry)
update = PrimUpdateFlags.FullUpdatewithAnim;
PrimUpdateFlags update = sog.RootPart.Shape.MeshFlagEntry ?
PrimUpdateFlags.FullUpdatewithAnim : PrimUpdateFlags.FullUpdate;
if(part.Shape.RenderMaterials is not null)
update |= PrimUpdateFlags.MaterialOvr;
part.SendUpdate(remoteClient, update);
}
}

View file

@ -2597,8 +2597,7 @@ namespace OpenSim.Region.Framework.Scenes
sceneObject.InvalidateDeepEffectivePerms();
sceneObject.ScheduleGroupForFullAnimUpdate();
sceneObject.ScheduleGroupForUpdate(PrimUpdateFlags.FullUpdatewithAnimMatOvr);
return sceneObject;
}
@ -2793,9 +2792,11 @@ namespace OpenSim.Region.Framework.Scenes
for(int i = 0; i < partList.Length; ++i)
{
SceneObjectPart part = partList[i];
if (part is null)
continue;
if (removeScripts)
part.Inventory.SendReleaseScriptsControl();
part.Inventory?.SendReleaseScriptsControl();
if (part.KeyframeMotion is not null)
{

View file

@ -497,7 +497,7 @@ namespace OpenSim.Region.Framework.Scenes
}
if (sendClientUpdates)
sceneObject.ScheduleGroupForFullAnimUpdate();
sceneObject.ScheduleGroupForUpdate(PrimUpdateFlags.FullUpdatewithAnimMatOvr);
if (attachToBackup)
sceneObject.AttachToBackup();
@ -2189,7 +2189,7 @@ namespace OpenSim.Region.Framework.Scenes
copy.ResumeScripts();
copy.HasGroupChanged = true;
copy.ScheduleGroupForFullAnimUpdate();
copy.ScheduleGroupForUpdate(PrimUpdateFlags.FullUpdatewithAnimMatOvr);
return copy;
}
}

View file

@ -1025,7 +1025,7 @@ namespace OpenSim.Region.Framework.Scenes
sog.inTransit = false;
AttachToBackup();
sog.ScheduleGroupForFullAnimUpdate();
sog.ScheduleGroupForUpdate(PrimUpdateFlags.FullUpdatewithAnimMatOvr);
}
private class TeleportObjectData
@ -1520,10 +1520,9 @@ namespace OpenSim.Region.Framework.Scenes
m_rootPart.LocalId = m_scene.AllocateLocalId();
SceneObjectPart[] parts = m_parts.GetArray();
SceneObjectPart part;
for (int i = 0; i < parts.Length; i++)
{
part = parts[i];
SceneObjectPart part = parts[i];
part.KeyframeMotion?.UpdateSceneObject(this);
if (Object.ReferenceEquals(part, m_rootPart))
@ -1602,10 +1601,9 @@ namespace OpenSim.Region.Framework.Scenes
maxZ = scale.Z;
SceneObjectPart[] parts = m_parts.GetArray();
SceneObjectPart part;
for (int i = 0; i < parts.Length; ++i)
{
part = parts[i];
SceneObjectPart part = parts[i];
if(part.LocalId == rootid)
continue;
@ -1673,10 +1671,9 @@ namespace OpenSim.Region.Framework.Scenes
Vector3 absPos = AbsolutePosition;
SceneObjectPart[] parts = m_parts.GetArray();
SceneObjectPart part;
for(int i = 0; i< parts.Length; ++i)
{
part = parts[i];
SceneObjectPart part = parts[i];
Vector3 offset = part.GetWorldPosition() - absPos;
Vector3 scale = part.Scale * 0.5f;
@ -1796,12 +1793,12 @@ namespace OpenSim.Region.Framework.Scenes
float areaF = 0;
float partR;
Vector3 offset = Vector3.Zero;
SceneObjectPart p;
SceneObjectPart[] parts = m_parts.GetArray();
for (int i = 0; i < parts.Length; i++)
{
p = parts[i];
SceneObjectPart p = parts[i];
partR = 0.5f * p.Scale.Length();
if(p != RootPart)
{
@ -1840,13 +1837,10 @@ namespace OpenSim.Region.Framework.Scenes
bool ComplexCost = false;
SceneObjectPart p;
SceneObjectPart[] parts = m_parts.GetArray();
for (int i = 0; i < parts.Length; i++)
{
p = parts[i];
if (p.UsesComplexCost)
if (parts[i].UsesComplexCost)
{
ComplexCost = true;
break;
@ -1862,7 +1856,7 @@ namespace OpenSim.Region.Framework.Scenes
for (int i = 0; i < parts.Length; i++)
{
p = parts[i];
SceneObjectPart p = parts[i];
cost = p.StreamingCost;
tmpcost = p.SimulationCost;
@ -2460,20 +2454,34 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="remoteClient"></param>
public void SendFullAnimUpdateToClient(IClientAPI remoteClient)
{
PrimUpdateFlags update = PrimUpdateFlags.FullUpdate;
if (RootPart.Shape.MeshFlagEntry)
update = PrimUpdateFlags.FullUpdatewithAnim;
PrimUpdateFlags update = RootPart.Shape.MeshFlagEntry ?
PrimUpdateFlags.FullUpdatewithAnim :
PrimUpdateFlags.FullUpdate;
if (RootPart.Shape.RenderMaterials is not null &&
RootPart.Shape.ReflectionProbe is null &&
RootPart.Shape.RenderMaterials.overrides is not null &&
RootPart.Shape.RenderMaterials.overrides.Length > 0)
RootPart.SendUpdate(remoteClient, update | PrimUpdateFlags.MaterialOvr);
else
RootPart.SendUpdate(remoteClient, update);
SceneObjectPart[] parts = m_parts.GetArray();
for (int i = 0; i < parts.Length; i++)
{
SceneObjectPart part = parts[i];
if (part != RootPart)
if (part.LocalId != RootPart.LocalId)
{
if (part.Shape.RenderMaterials is not null &&
part.Shape.ReflectionProbe is null &&
part.Shape.RenderMaterials.overrides is not null &&
part.Shape.RenderMaterials.overrides.Length > 0)
part.SendUpdate(remoteClient, update | PrimUpdateFlags.MaterialOvr);
else
part.SendUpdate(remoteClient, update);
}
}
}
public void SendUpdateProbes(IClientAPI remoteClient)
{
@ -2485,7 +2493,7 @@ namespace OpenSim.Region.Framework.Scenes
for (int i = 0; i < parts.Length; i++)
{
SceneObjectPart part = parts[i];
if (part != RootPart)
if (part.LocalId != RootPart.LocalId)
part.SendUpdate(remoteClient, update);
}
}
@ -2565,7 +2573,7 @@ namespace OpenSim.Region.Framework.Scenes
dupe.HasGroupChanged = true;
dupe.AttachToBackup();
dupe.ScheduleGroupForFullAnimUpdate();
dupe.ScheduleGroupForUpdate(PrimUpdateFlags.FullUpdatewithAnimMatOvr);
}
dupe.InvalidatePartsLinkMaps();
@ -2969,6 +2977,26 @@ namespace OpenSim.Region.Framework.Scenes
}
}
public void ScheduleGroupForUpdate(PrimUpdateFlags update)
{
//if (IsAttachment)
// m_log.DebugFormat("[SOG]: Scheduling full update for {0} {1}", Name, LocalId);
if (Scene.GetNumberOfClients() == 0)
return;
SceneObjectPart[] parts = m_parts.GetArray();
if (!RootPart.Shape.MeshFlagEntry)
update &= ~PrimUpdateFlags.Animations;
RootPart.ScheduleUpdate(update);
for (int i = 0; i < parts.Length; i++)
{
SceneObjectPart part = parts[i];
if (part != RootPart)
part.ScheduleUpdate(update);
}
}
/// <summary>
/// Schedule a terse update for this scene object to all interested viewers.
/// </summary>
@ -3055,10 +3083,9 @@ namespace OpenSim.Region.Framework.Scenes
return RootPart;
Span<SceneObjectPart> parts = m_parts.GetArray().AsSpan();
SceneObjectPart sop;
if (linknum <= parts.Length)
{
sop = parts[linknum - 1];
SceneObjectPart sop = parts[linknum - 1];
if (sop.LinkNum == linknum)
return sop;
}
@ -4153,7 +4180,7 @@ namespace OpenSim.Region.Framework.Scenes
{
SceneObjectPart obPart = parts[i];
if (obPart.UUID.NotEqual(m_rootPart.UUID))
if (obPart != m_rootPart)
{
Vector3 currentpos = obPart.OffsetPosition;
currentpos.X *= x;
@ -4445,7 +4472,7 @@ namespace OpenSim.Region.Framework.Scenes
for (int i = 0; i < parts.Length; i++)
{
SceneObjectPart obPart = parts[i];
if (obPart.UUID != m_rootPart.UUID)
if (obPart != m_rootPart)
obPart.OffsetPosition += diff;
}
@ -4596,7 +4623,7 @@ namespace OpenSim.Region.Framework.Scenes
for (int i = 0; i < parts.Length; i++)
{
SceneObjectPart prim = parts[i];
if (prim.UUID != m_rootPart.UUID)
if (prim != m_rootPart)
{
Quaternion NewRot = oldParentRot * prim.RotationOffset;
NewRot = Quaternion.Inverse(axRot) * NewRot;

View file

@ -59,6 +59,7 @@ namespace OpenSim.Region.Framework.Scenes
TELEPORT = 512,
REGION_RESTART = 1024,
MEDIA = 2048,
MATERIAL = 4096,
ANIMATION = 16384,
POSITION = 32768
}
@ -3230,11 +3231,14 @@ namespace OpenSim.Region.Framework.Scenes
public void ScheduleUpdate(PrimUpdateFlags update)
{
if (ParentGroup == null || ParentGroup.IsDeleted || ParentGroup.Scene == null)
if (ParentGroup is null || ParentGroup.IsDeleted)
return;
if (Animations == null)
if (Animations is null)
update &= ~PrimUpdateFlags.Animations;
if (Shape is null || Shape.RenderMaterials is null)
update &= ~PrimUpdateFlags.MaterialOvr;
if (update == PrimUpdateFlags.None)
return;
@ -3244,12 +3248,14 @@ namespace OpenSim.Region.Framework.Scenes
if (ParentGroup.Scene.GetNumberOfClients() == 0)
return;
bool isfull = false;
bool isfull;
if (ParentGroup.IsAttachment)
{
update |= PrimUpdateFlags.FullUpdate;
isfull = true;
}
else
isfull = (update & PrimUpdateFlags.FullUpdate) == PrimUpdateFlags.FullUpdate;
lock (UpdateFlagLock)
UpdateFlag |= update;

View file

@ -28,6 +28,7 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Text;
using log4net;
using OpenMetaverse;
@ -217,7 +218,9 @@ namespace OpenSim.Region.Framework.Scenes
new UUID("9f496bd2-589a-709f-16cc-69bf7df1d36c"),
new UUID("15dd911d-be82-2856-26db-27659b142875"),
new UUID("b8c8b2a3-9008-1771-3bfc-90924955ab2d"),
new UUID("42ecd00b-9947-a97c-400a-bbc9174c7aeb")
new UUID("42ecd00b-9947-a97c-400a-bbc9174c7aeb"),
new UUID("ffffffff-ffff-ffff-ffff-ffffffffffff"),
Constants.DefaultMaterialID
};
/// <summary>
@ -342,7 +345,7 @@ namespace OpenSim.Region.Framework.Scenes
if (m_assetUuidsToInspect.Contains(uuid))
return false;
// m_log.DebugFormat("[UUID GATHERER]: Adding asset {0} for inspection", uuid);
//m_log.DebugFormat("[UUID GATHERER]: Adding asset {0} for inspection", uuid);
m_assetUuidsToInspect.Enqueue(uuid);
return true;
@ -359,8 +362,8 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="sceneObject">The scene object for which to gather assets</param>
public void AddForInspection(SceneObjectGroup sceneObject)
{
// m_log.DebugFormat(
// "[UUID GATHERER]: Getting assets for object {0}, {1}", sceneObject.Name, sceneObject.UUID);
//m_log.DebugFormat(
// "[UUID GATHERER]: Getting assets for object {0}, {1}", sceneObject.Name, sceneObject.UUID);
if(sceneObject.IsDeleted)
return;
@ -415,8 +418,8 @@ namespace OpenSim.Region.Framework.Scenes
{
for (int j = 0; j < part.Shape.RenderMaterials.overrides.Length; ++j)
{
//if(!string.IsNullOrEmpty(part.Shape.RenderMaterials.overrides[j].data))
//AddForInspection(part.Shape.RenderMaterials.overrides[j].data, (sbyte)AssetType.Material);
if(!string.IsNullOrEmpty(part.Shape.RenderMaterials.overrides[j].data))
RecordEmbeddedAssetDataUuids(part.Shape.RenderMaterials.overrides[j].data);
}
}
}
@ -581,7 +584,6 @@ namespace OpenSim.Region.Framework.Scenes
if(UncertainAssetsUUIDs.Contains(assetUuid))
UncertainAssetsUUIDs.Remove(assetUuid);
sbyte assetType = assetBase.Type;
if(assetBase.Data == null || assetBase.Data.Length == 0)
{
@ -591,7 +593,12 @@ namespace OpenSim.Region.Framework.Scenes
return;
}
sbyte assetType = assetBase.Type;
GatheredUuids[assetUuid] = assetType;
if (assetBase.Data.Length < 36)
return;
try
{
switch ((AssetType)assetType)
@ -766,6 +773,7 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary>
/// <param name="uuid"></param>
/// <returns></returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
protected virtual AssetBase GetAsset(UUID uuid)
{
return m_assetService.Get(uuid.ToString());
@ -775,23 +783,63 @@ namespace OpenSim.Region.Framework.Scenes
/// Record the asset uuids embedded within the given text (e.g. a script).
/// </summary>
/// <param name="textAsset"></param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private void RecordEmbeddedAssetDataUuids(AssetBase textAsset)
{
// m_log.DebugFormat("[ASSET GATHERER]: Getting assets for uuid references in asset {0}", embeddingAssetId);
RecordEmbeddedAssetDataUuids(new osUTF8(textAsset.Data));
}
if(textAsset.Data.Length < 36)
return;
private unsafe void RecordEmbeddedAssetDataUuids(osUTF8 data)
{
//if (data.Length < 36)
// return;
List<UUID> ids = Util.GetUUIDsOnData(textAsset.Data, 0, textAsset.Data.Length);
if (ids is null)
return;
for (int i = 0; i < ids.Count; ++i)
int indx = 8;
while(indx < data.Length - 28)
{
if (ids[i].IsZero())
continue;
UncertainAssetsUUIDs.Add(ids[i]);
AddForInspection(ids[i]);
if (data[indx] == (byte)'-')
{
if (osUTF8Slice.TryParseUUID(new osUTF8Slice(data.GetArray(), indx - 8 , 36), out UUID id))
{
if (id.IsNotZero())
{
UncertainAssetsUUIDs.Add(id);
AddForInspection(id);
}
indx += 37;
}
else
indx += 9;
}
else
indx++;
}
}
private unsafe void RecordEmbeddedAssetDataUuids(ReadOnlySpan<char> data)
{
if (data.Length < 36)
return;
int indx = 8;
while (indx < data.Length - 28)
{
if (data[indx] == '-')
{
if (UUID.TryParse(data.Slice(indx - 8, 36), out UUID id))
{
if (id.IsNotZero())
{
UncertainAssetsUUIDs.Add(id);
AddForInspection(id);
}
indx += 37;
}
else
indx += 9;
}
else
indx++;
}
}
@ -923,7 +971,7 @@ namespace OpenSim.Region.Framework.Scenes
return false;
osUTF8Slice tmp = data.SubUTF8(0, indx);
data.SubUTF8Self(indx + 1);
data.SubUTF8Self(indx);
return osUTF8Slice.TryParseUUID(tmp, out id);
}
@ -937,7 +985,7 @@ namespace OpenSim.Region.Framework.Scenes
return false;
osUTF8Slice tmp = data.SubUTF8(0, indx);
data.SubUTF8Self(indx + 1);
data.SubUTF8Self(indx);
return osUTF8Slice.TryParseUUID(tmp, out id);
}
@ -953,7 +1001,7 @@ namespace OpenSim.Region.Framework.Scenes
return false;
osUTF8Slice tmp = data.SubUTF8(0, indx);
data.SubUTF8Self(indx + 1);
data.SubUTF8Self(indx);
tmp.SelfTrim();
if(tmp.Length == 0)
@ -984,6 +1032,7 @@ namespace OpenSim.Region.Framework.Scenes
private static readonly byte[] AssetIDB = osUTF8.GetASCIIBytes("AssetID");
private static readonly byte[] texturesB = osUTF8.GetASCIIBytes("textures");
private static readonly byte[] parametersB = osUTF8.GetASCIIBytes("parameters");
private static readonly byte[] MatOvrdB = osUTF8.GetASCIIBytes("MatOvrd");
/// <summary>
/// Get all the asset uuids associated with a given object. This includes both those directly associated with
@ -1071,11 +1120,16 @@ namespace OpenSim.Region.Framework.Scenes
{
GatheredUuids[teid] = (sbyte)AssetType.Texture;
}
if(ps.RenderMaterials is not null && ps.RenderMaterials.entries is not null &&
ps.RenderMaterials.entries.Length > 0)
{
foreach(Primitive.RenderMaterials.RenderMaterialEntry re in ps.RenderMaterials.entries)
AddForInspection(re.id, (sbyte)AssetType.Material);
if(ps.RenderMaterials is not null)
{
if (ps.RenderMaterials.entries is not null)
{
for (int j = 0; j < ps.RenderMaterials.entries.Length; ++j)
{
if (ps.RenderMaterials.entries[j].id.IsNotZero())
AddForInspection(ps.RenderMaterials.entries[j].id, (sbyte)AssetType.Material);
}
}
}
/* multiple store
teid = ps.SculptTexture; //??
@ -1160,6 +1214,16 @@ namespace OpenSim.Region.Framework.Scenes
break;
}
}
else if (nodeName.StartsWith(MatOvrdB))
{
if (nodeName.EndsWith((byte)'/'))
continue;
if (TryGetXMLBinary(data, out byte[] ovrbytes) && ovrbytes != null && ovrbytes.Length > 36)
{
RecordEmbeddedAssetDataUuids(new osUTF8(ovrbytes));
}
}
}
}
@ -1243,7 +1307,7 @@ namespace OpenSim.Region.Framework.Scenes
osUTF8Slice tmp = data.SubUTF8(0, indx);
if(osUTF8Slice.TryParseUUID(tmp, out UUID id) && id.IsNotZero())
GatheredUuids[id] = (sbyte)AssetType.Texture;
data.SubUTF8Self(indx + 1);
data.SubUTF8Self(indx);
}
}
}

View file

@ -928,26 +928,21 @@ namespace OpenSim.Region.OptionalModules.Materials
else
overridedata = string.Empty;
bool changed = false;
if (map.TryGetValue("asset_id", out tmp))
{
UUID assetID = tmp.AsUUID();
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
{
pbs.RenderMaterials ??= new Primitive.RenderMaterials();
if (pbs.RenderMaterials.entries is null)
{
var entries = new Primitive.RenderMaterials.RenderMaterialEntry[1];
entries[0].te_index = (byte)side;
entries[0].id = assetID;
pbs.RenderMaterials.entries = entries;
changed = true;
}
else
{
@ -955,8 +950,12 @@ namespace OpenSim.Region.OptionalModules.Materials
while (indx < pbs.RenderMaterials.entries.Length)
{
if (pbs.RenderMaterials.entries[indx].te_index == side)
{
if(pbs.RenderMaterials.entries[indx].id .NotEqual(assetID))
{
pbs.RenderMaterials.entries[indx].id = assetID;
changed = true;
}
break;
}
indx++;
@ -966,23 +965,26 @@ namespace OpenSim.Region.OptionalModules.Materials
Array.Resize(ref pbs.RenderMaterials.entries, indx + 1);
pbs.RenderMaterials.entries[indx].te_index = (byte)side;
pbs.RenderMaterials.entries[indx].id = assetID;
}
changed = true;
}
}
if (string.IsNullOrEmpty(overridedata))
RemoveMaterialOverride(ref pbs.RenderMaterials.overrides, side);
changed |= RemoveMaterialOverride(ref pbs.RenderMaterials.overrides, side);
else
AddMaterialOverride(ref pbs.RenderMaterials.overrides, overridedata, side);
changed |= AddMaterialOverride(ref pbs.RenderMaterials.overrides, overridedata, side);
if(changed)
changedSOPs.Add(sop);
}
else if(pbs.RenderMaterials is not null)
{
bool changed = RemoveMaterialEntry(ref pbs.RenderMaterials.entries, side);
changed = RemoveMaterialEntry(ref pbs.RenderMaterials.entries, side);
changed |= RemoveMaterialOverride(ref pbs.RenderMaterials.overrides, side);
if(pbs.RenderMaterials.entries is null && pbs.RenderMaterials.overrides is null)
pbs.RenderMaterials = null;
//if(pbs.RenderMaterials.entries is null && pbs.RenderMaterials.overrides is null)
// pbs.RenderMaterials = null;
// keep not null so viewer caches can be updated
if(changed)
changedSOPs.Add(sop);
}
@ -991,7 +993,8 @@ namespace OpenSim.Region.OptionalModules.Materials
{
if (string.IsNullOrEmpty(overridedata))
{
if (RemoveMaterialOverride(ref pbs.RenderMaterials.overrides, side))
changedSOPs.Add(sop);
}
else
{
@ -1003,7 +1006,7 @@ namespace OpenSim.Region.OptionalModules.Materials
foreach (SceneObjectPart sop in changedSOPs)
{
sop.ParentGroup.HasGroupChanged = true;
sop.ScheduleFullUpdate();
sop.ScheduleUpdate(PrimUpdateFlags.MaterialOvr | PrimUpdateFlags.FullUpdate);
}
httpResponse.RawBuffer = XMLkeyMaterialSucess;
@ -1051,8 +1054,7 @@ namespace OpenSim.Region.OptionalModules.Materials
return false;
int indx = 0;
while(overrides[indx].te_index != side && indx < overrides.Length)
indx++;
while( overrides[indx].te_index != side && ++indx < overrides.Length);
if (indx >= overrides.Length)
return false;
@ -1074,6 +1076,316 @@ namespace OpenSim.Region.OptionalModules.Materials
private static bool AddMaterialOverride(ref RenderMaterials.RenderMaterialOverrideEntry[] overrides, string data, int side)
{
OSD tst;
try
{
tst = OSDParser.DeserializeJson(data);
if(tst is not OSDMap mainArr)
return false;
OSD tmposd;
if (!mainArr.TryGetValue("materials", out tmposd) ||
tmposd is not OSDArray materialsArray ||
materialsArray.Count < 1 ||
materialsArray[0] is not OSDMap material)
return false;
UUID[] texturesURIs = null;
if (mainArr.TryGetValue("images", out tmposd) && tmposd is OSDArray imagesArray && imagesArray.Count > 0 && imagesArray.Count < 16)
{
Span<UUID> imageURIs = stackalloc UUID[imagesArray.Count];
for (int i = 0; i < imagesArray.Count; i++)
{
if (imagesArray[i] is OSDMap tmpim && tmpim.TryGetValue("uri", out OSD tmpimuri) && tmpimuri is OSDString tmpimuristr)
{
if(UUID.TryParse(tmpimuristr.value, out UUID tmpid))
imageURIs[i] = tmpid;
}
}
if (mainArr.TryGetValue("textures", out tmposd) && tmposd is OSDArray texturesArray && texturesArray.Count > 0 && texturesArray.Count < 16)
{
texturesURIs = new UUID[texturesArray.Count];
for (int i = 0; i < texturesArray.Count; i++)
{
if (texturesArray[i] is OSDMap tmptm && tmptm.TryGetValue("source", out OSD tmptmsrc) && tmptmsrc is OSDInteger tmptmsrci)
{
int v = tmptmsrci.value;
if( v < imageURIs.Length)
texturesURIs[i] = imageURIs[v];
}
}
}
}
bool hasTexURIS = texturesURIs is not null;
OSDMap outosd = new();
OSDArray ti = new OSDArray(4);
bool texturesChanged = false;
Span<UUID> textureIDs = stackalloc UUID[4];
Span<bool> textureIDchanged = stackalloc bool[4];
if (material.TryGetValue("pbrMetallicRoughness", out tmposd) && tmposd is OSDMap pmrMap && pmrMap.Count > 0)
{
if (pmrMap.TryGetValue("baseColorTexture", out tmposd) && tmposd is OSDMap pmrMapbct && pmrMapbct.Count > 0)
{
if (hasTexURIS && pmrMapbct.TryGetValue("index", out tmposd) && tmposd is OSDInteger pmrMapbcti)
{
int v = pmrMapbcti.value;
if (v < texturesURIs.Length)
{
textureIDs[0] = texturesURIs[v];
textureIDchanged[0] = true;
texturesChanged = true;
}
}
if (pmrMapbct.TryGetValue("extensions", out tmposd) && tmposd is OSDMap bcext)
{
if (bcext.TryGetValue("KHR_texture_transform", out tmposd) && tmposd is OSDMap bctr)
{
OSDMap tmpmap = new OSDMap();
if (bctr.TryGetValue("offset", out tmposd) && tmposd is OSDArray bcoffset)
{
tmpmap["o"] = bcoffset;
}
if (bctr.TryGetValue("rotation", out tmposd) && tmposd is OSDReal bcrotation)
{
tmpmap["r"] = bcrotation;
}
if (bctr.TryGetValue("scale", out tmposd) && tmposd is OSDArray bcscale)
{
tmpmap["s"] = bcscale;
}
ti.Add(tmpmap);
}
}
}
if (pmrMap.TryGetValue("metallicRoughnessTexture", out tmposd) && tmposd is OSDMap pmrMapmrt && pmrMapmrt.Count > 0)
{
if (hasTexURIS && pmrMapmrt.TryGetValue("index", out tmposd) && tmposd is OSDInteger pmrMapbcti)
{
int v = pmrMapbcti.value;
if (v < texturesURIs.Length)
{
textureIDs[2] = texturesURIs[v];
textureIDchanged[2] = true;
texturesChanged = true;
}
}
if (pmrMapmrt.TryGetValue("extensions", out tmposd) && tmposd is OSDMap bcext)
{
if (bcext.TryGetValue("KHR_texture_transform", out tmposd) && tmposd is OSDMap bctr)
{
OSDMap tmpmap = new OSDMap();
if (bctr.TryGetValue("offset", out tmposd) && tmposd is OSDArray bcoffset)
{
tmpmap["o"] = bcoffset;
}
if (bctr.TryGetValue("rotation", out tmposd) && tmposd is OSDReal bcrotation)
{
tmpmap["r"] = bcrotation;
}
if (bctr.TryGetValue("scale", out tmposd) && tmposd is OSDArray bcscale)
{
tmpmap["s"] = bcscale;
}
while(ti.Count < 2)
ti.Add(new OSD());
ti.Add(tmpmap);
}
}
}
if (pmrMap.TryGetValue("baseColorFactor", out tmposd) && tmposd is OSDArray baseColorFactor)
{
outosd["bc"] = baseColorFactor;
}
if (pmrMap.TryGetValue("metallicFactor", out tmposd) && tmposd is OSDReal metallicFactor)
{
outosd["mf"] = metallicFactor;
}
if (pmrMap.TryGetValue("roughnessFactor", out tmposd) && tmposd is OSDReal roughnessFactor)
{
outosd["rf"] = roughnessFactor;
}
}
if (material.TryGetValue("normalTexture", out tmposd) && tmposd is OSDMap ntMap && ntMap.Count > 0)
{
if (hasTexURIS && ntMap.TryGetValue("index", out tmposd) && tmposd is OSDInteger ntMapi)
{
int v = ntMapi.value;
if (v < texturesURIs.Length)
{
textureIDs[1] = texturesURIs[v];
textureIDchanged[1] = true;
texturesChanged = true;
}
}
if (ntMap.TryGetValue("extensions", out tmposd) && tmposd is OSDMap bcext)
{
if (bcext.TryGetValue("KHR_texture_transform", out tmposd) && tmposd is OSDMap bctr)
{
OSDMap tmpmap = new OSDMap();
if (bctr.TryGetValue("offset", out tmposd) && tmposd is OSDArray bcoffset)
{
tmpmap["o"] = bcoffset;
}
if (bctr.TryGetValue("rotation", out tmposd) && tmposd is OSDReal bcrotation)
{
tmpmap["r"] = bcrotation;
}
if (bctr.TryGetValue("scale", out tmposd) && tmposd is OSDArray bcscale)
{
tmpmap["s"] = bcscale;
}
if (ti.Count < 2)
{
if (ti.Count == 0)
ti.Add(new OSD());
ti.Add(tmpmap);
}
else
ti[1] = tmpmap;
}
}
}
if (material.TryGetValue("occlusionTexture", out tmposd) && tmposd is OSDMap otMap && otMap.Count > 0)
{
if (hasTexURIS && otMap.TryGetValue("index", out tmposd) && tmposd is OSDInteger otMapi)
{
int v = otMapi.value;
if (v < texturesURIs.Length)
{
textureIDs[2] = texturesURIs[v];
textureIDchanged[2] = true;
texturesChanged = true;
}
}
if (otMap.TryGetValue("extensions", out tmposd) && tmposd is OSDMap bcext)
{
if (bcext.TryGetValue("KHR_texture_transform", out tmposd) && tmposd is OSDMap bctr)
{
OSDMap tmpmap = new OSDMap();
if (bctr.TryGetValue("offset", out tmposd) && tmposd is OSDArray bcoffset)
{
tmpmap["o"] = bcoffset;
}
if (bctr.TryGetValue("rotation", out tmposd) && tmposd is OSDReal bcrotation)
{
tmpmap["r"] = bcrotation;
}
if (bctr.TryGetValue("scale", out tmposd) && tmposd is OSDArray bcscale)
{
tmpmap["s"] = bcscale;
}
if (ti.Count > 2)
ti[2] = tmpmap;
else
{
while (ti.Count < 2)
ti.Add(new OSD());
ti.Add(tmpmap);
}
}
}
}
if (material.TryGetValue("emissiveTexture", out tmposd) && tmposd is OSDMap etMap && etMap.Count > 0)
{
if (hasTexURIS && etMap.TryGetValue("index", out tmposd) && tmposd is OSDInteger etMapi)
{
int v = etMapi.value;
if (v < texturesURIs.Length)
{
textureIDs[3] = texturesURIs[v];
textureIDchanged[3] = true;
texturesChanged = true;
}
}
if (etMap.TryGetValue("extensions", out tmposd) && tmposd is OSDMap bcext)
{
if (bcext.TryGetValue("KHR_texture_transform", out tmposd) && tmposd is OSDMap bctr)
{
OSDMap tmpmap = new OSDMap();
if (bctr.TryGetValue("offset", out tmposd) && tmposd is OSDArray bcoffset)
{
tmpmap["o"] = bcoffset;
}
if (bctr.TryGetValue("rotation", out tmposd) && tmposd is OSDReal bcrotation)
{
tmpmap["r"] = bcrotation;
}
if (bctr.TryGetValue("scale", out tmposd) && tmposd is OSDArray bcscale)
{
tmpmap["s"] = bcscale;
}
if (ti.Count > 3)
ti[3] = tmpmap;
else
{
while (ti.Count < 3)
ti.Add(new OSD());
ti.Add(tmpmap);
}
}
}
}
if (material.TryGetValue("alphaMode", out tmposd) && tmposd is OSDString aMode)
{
outosd["am"] = aMode.value switch
{
"BLEND" => 1,
"MASK" => 2,
_ => 0
};
}
if (material.TryGetValue("alphaCutoff", out tmposd) && tmposd is OSDReal alphaCutoff)
{
outosd["ac"] = alphaCutoff;
}
if (material.TryGetValue("emissiveFactor", out tmposd) && tmposd is OSDArray emissiveFactor)
{
outosd["ec"] = emissiveFactor;
}
if (material.TryGetValue("doubleSided", out tmposd) && tmposd is OSDBoolean doubleSided)
{
outosd["ds"] = doubleSided;
}
if (texturesChanged)
{
OSDArray tex = new(textureIDs.Length);
for(int i = 0; i < textureIDs.Length; i++)
{
if (textureIDchanged[i])
tex.Add(textureIDs[i]);
else
tex.Add(new OSD());
}
outosd["tex"] = tex;
}
if(ti.Count > 0)
outosd["ti"] = ti;
if (outosd.Count == 0)
return false;
data = OSDParser.SerializeLLSDNotation(outosd);
}
catch
{
return false;
}
if (overrides is null)
{
var entries = new RenderMaterials.RenderMaterialOverrideEntry[1];
@ -1088,22 +1400,20 @@ namespace OpenSim.Region.OptionalModules.Materials
{
if (overrides[indx].te_index == side)
{
overrides[indx].data = data;
return true;
}
indx++;
}
if (indx == overrides.Length)
{
Array.Resize(ref overrides, indx + 1);
overrides[indx].te_index = (byte)side;
if(overrides[indx].data != data)
{
overrides[indx].data = data;
return true;
}
}
return false;
}
indx++;
}
Array.Resize(ref overrides, indx + 1);
overrides[indx].te_index = (byte)side;
overrides[indx].data = data;
return true;
}
}
}

View file

@ -249,6 +249,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
[StructLayout(LayoutKind.Sequential)]
internal struct ContactGeom
{
internal Vector3 pos;
internal Vector3 normal;
internal dReal depth;
@ -269,6 +270,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
internal Vector3 t2;
}
[StructLayout(LayoutKind.Sequential)]
internal struct Mass
{

View file

@ -9706,6 +9706,83 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
break;
case ScriptBaseClass.PRIM_REFLECTION_PROBE:
if (remain < 4)
return new LSL_List();
bool reflection_probe_active;
float reflection_probe_ambiance;
float reflection_probe_clip_distance;
int reflection_probe_flags;
try
{
reflection_probe_active = rules.GetIntegerItem(idx++) != 0;
}
catch (InvalidCastException)
{
Error(originFunc, $"Error running rule #{rulesParsed} -> PRIM_REFLECTION_PROBE: arg #{idx - idxStart - 1} - parameter 1 (active) must be integer");
return new LSL_List();
}
try
{
reflection_probe_ambiance = rules.GetStrictFloatItem(idx++);
}
catch (InvalidCastException)
{
Error(originFunc, $"Error running rule #{rulesParsed} -> PRIM_REFLECTION_PROBE: arg #{idx - idxStart - 1} - parameter 2 (ambiance) must be float");
return new LSL_List();
}
try
{
reflection_probe_clip_distance = rules.GetStrictFloatItem(idx++);
}
catch (InvalidCastException)
{
Error(originFunc, $"Error running rule #{rulesParsed} -> PRIM_REFLECTION_PROBE: arg #{idx - idxStart - 1} - parameter 3 (clip_distance) must be float");
return new LSL_List();
}
try
{
reflection_probe_flags = rules.GetIntegerItem(idx++);
}
catch (InvalidCastException)
{
Error(originFunc, $"Error running rule #{rulesParsed} -> PRIM_REFLECTION_PROBE: arg #{idx - idxStart - 1} - parameter 4 (flags) must be integer");
return new LSL_List();
}
bool probechanged;
if(reflection_probe_active)
{
probechanged = part.Shape.ReflectionProbe is null;
if(probechanged)
part.Shape.ReflectionProbe = new();
reflection_probe_ambiance = Utils.Clamp(reflection_probe_ambiance, 0f, 100f);
probechanged |= part.Shape.ReflectionProbe.Ambiance != reflection_probe_ambiance;
part.Shape.ReflectionProbe.Ambiance = reflection_probe_ambiance;
reflection_probe_clip_distance = Utils.Clamp(reflection_probe_clip_distance, 0f, 1024f);
probechanged |= part.Shape.ReflectionProbe.ClipDistance != reflection_probe_clip_distance;
part.Shape.ReflectionProbe.ClipDistance = reflection_probe_clip_distance;
probechanged |= part.Shape.ReflectionProbe.Flags != reflection_probe_flags;
part.Shape.ReflectionProbe.Flags = (byte)reflection_probe_flags;
}
else
{
probechanged = part.Shape.ReflectionProbe is not null;
part.Shape.ReflectionProbe = null;
}
if(probechanged)
{
part.ParentGroup.HasGroupChanged = true;
part.ScheduleFullUpdate();
}
break;
case ScriptBaseClass.PRIM_GLOW:
if (remain < 2)
return new LSL_List();
@ -10388,7 +10465,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
part.Shape.ProjectionEntry = true;
part.Shape.ProjectionTextureUUID = stexID;
part.Shape.ProjectionFOV = Util.Clamp(fov, 0, 3.0f);
part.Shape.ProjectionFocus = Util.Clamp(focus, 0, 20.0f);
part.Shape.ProjectionFocus = Util.Clamp(focus, -20.0f, 20.0f);
part.Shape.ProjectionAmbiance = Util.Clamp(amb, 0, 1.0f);
part.ParentGroup.HasGroupChanged = true;
@ -11462,6 +11539,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
res.Add(new LSL_Float(shape.LightFalloff)); // falloff
break;
case ScriptBaseClass.PRIM_REFLECTION_PROBE:
shape = part.Shape;
if (shape.ReflectionProbe is null)
{
res.Add(new LSL_Integer(0));
res.Add(new LSL_Float(0f)); // ambiance
res.Add(new LSL_Float(0f)); // clip
res.Add(new LSL_Float(0f)); // flags
}
else
{
res.Add(new LSL_Integer(1));
res.Add(new LSL_Float(shape.ReflectionProbe.Ambiance)); // ambiance
res.Add(new LSL_Float(shape.ReflectionProbe.ClipDistance)); // clip
res.Add(new LSL_Float(shape.ReflectionProbe.Flags)); // flags
}
break;
case ScriptBaseClass.PRIM_GLOW:
if (remain < 1)
return new LSL_List();
@ -17220,12 +17315,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
case ScriptBaseClass.PRIM_POINT_LIGHT:
res.Add(new LSL_Integer(0));
res.Add(new LSL_Vector(0f,0f,0f));
res.Add(new LSL_Vector(0f, 0f, 0f));
res.Add(new LSL_Float(0f)); // intensity
res.Add(new LSL_Float(0f)); // radius
res.Add(new LSL_Float(0f)); // falloff
break;
case ScriptBaseClass.PRIM_REFLECTION_PROBE:
res.Add(new LSL_Integer(0));
res.Add(new LSL_Float(0f)); // ambiance
res.Add(new LSL_Float(0f)); // clip
res.Add(new LSL_Float(0f)); // flags
break;
case ScriptBaseClass.PRIM_GLOW:
if (remain < 1)
return new LSL_List();

View file

@ -486,33 +486,33 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
LSL_Rotation llGetMoonRotation();
LSL_Rotation llGetRegionMoonRotation();
LSL_String llChar(LSL_Integer unicode);
LSL_String llChar(LSL_Integer unicode);
LSL_Integer llOrd(LSL_String s, LSL_Integer index);
LSL_Integer llHash(LSL_String s);
LSL_String llReplaceSubString(LSL_String src, LSL_String pattern, LSL_String replacement, int count);
LSL_String llReplaceSubString(LSL_String src, LSL_String pattern, LSL_String replacement, int count);
void llLinkAdjustSoundVolume(LSL_Integer linknumber, LSL_Float volume);
void llLinkStopSound(LSL_Integer linknumber);
void llLinkSetSoundQueueing(int linknumber, int queue);
void llLinkPlaySound(LSL_Integer linknumber, string sound, double volume);
void llLinkPlaySound(LSL_Integer linknumber, string sound, double volume, LSL_Integer flags);
void llLinkSetSoundRadius(int linknumber, double radius);
void llLinkAdjustSoundVolume(LSL_Integer linknumber, LSL_Float volume);
void llLinkStopSound(LSL_Integer linknumber);
void llLinkSetSoundQueueing(int linknumber, int queue);
void llLinkPlaySound(LSL_Integer linknumber, string sound, double volume);
void llLinkPlaySound(LSL_Integer linknumber, string sound, double volume, LSL_Integer flags);
void llLinkSetSoundRadius(int linknumber, double radius);
LSL_Vector llLinear2sRGB(LSL_Vector src);
LSL_Vector llsRGB2Linear(LSL_Vector src);
LSL_Vector llLinear2sRGB(LSL_Vector src);
LSL_Vector llsRGB2Linear(LSL_Vector src);
LSL_Integer llLinksetDataWrite(LSL_String name, LSL_String value);
LSL_Integer llLinksetDataWriteProtected(LSL_String name, LSL_String value, LSL_String pass);
void llLinksetDataReset();
LSL_Integer llLinksetDataAvailable();
LSL_Integer llLinksetDataCountKeys();
LSL_Integer llLinksetDataDelete(LSL_String name);
LSL_Integer llLinksetDataDeleteProtected(LSL_String name, LSL_String pass);
LSL_List llLinksetDataDeleteFound(LSL_String pattern, LSL_String pass);
LSL_Integer llLinksetDataCountFound(LSL_String pattern);
LSL_List llLinksetDataFindKeys(LSL_String pattern, LSL_Integer start, LSL_Integer count);
LSL_List llLinksetDataListKeys(LSL_Integer start, LSL_Integer count);
LSL_String llLinksetDataRead(LSL_String name);
LSL_String llLinksetDataReadProtected(LSL_String name, LSL_String pass);
LSL_Integer llLinksetDataWrite(LSL_String name, LSL_String value);
LSL_Integer llLinksetDataWriteProtected(LSL_String name, LSL_String value, LSL_String pass);
void llLinksetDataReset();
LSL_Integer llLinksetDataAvailable();
LSL_Integer llLinksetDataCountKeys();
LSL_Integer llLinksetDataDelete(LSL_String name);
LSL_Integer llLinksetDataDeleteProtected(LSL_String name, LSL_String pass);
LSL_List llLinksetDataDeleteFound(LSL_String pattern, LSL_String pass);
LSL_Integer llLinksetDataCountFound(LSL_String pattern);
LSL_List llLinksetDataFindKeys(LSL_String pattern, LSL_Integer start, LSL_Integer count);
LSL_List llLinksetDataListKeys(LSL_Integer start, LSL_Integer count);
LSL_String llLinksetDataRead(LSL_String name);
LSL_String llLinksetDataReadProtected(LSL_String name, LSL_String pass);
}
}
}

View file

@ -433,7 +433,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
public const int PRIM_FULLBRIGHT = 20;
public const int PRIM_FLEXIBLE = 21;
public const int PRIM_TEXGEN = 22;
public const int PRIM_POINT_LIGHT = 23; // Huh?
public const int PRIM_POINT_LIGHT = 23;
//ApiDesc not supported
public const int PRIM_CAST_SHADOWS = 24; // Not implemented, here for completeness sake
public const int PRIM_GLOW = 25;
@ -457,6 +457,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
public const int PRIM_SIT_TARGET = 41;
public const int PRIM_PROJECTOR = 42;
public const int PRIM_REFLECTION_PROBE = 44;
// parameters
@ -529,6 +531,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
public const int PRIM_PHYSICS_SHAPE_NONE = 1;
public const int PRIM_PHYSICS_SHAPE_CONVEX = 2;
// PRIM_REFLECTION_PROBE flags
public const int PRIM_REFLECTION_PROBE_BOX = 1 << 0; // 1
public const int PRIM_REFLECTION_PROBE_DYNAMIC = 1 << 1; // 2
public const int PROFILE_NONE = 0;
public const int PROFILE_SCRIPT_MEMORY = 1;

View file

@ -2786,4 +2786,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
}
}
}
}

View file

@ -39,6 +39,5 @@ namespace OpenSim.Region.ScriptEngine.Shared
public ScriptException(string message, Exception innerException) : base(message, innerException) {}
public ScriptException(SerializationInfo info, StreamingContext context) :base(info, context) {}
}
}

View file

@ -929,20 +929,15 @@ namespace OpenSim.Region.ScriptEngine.Yengine
*/
private void GenerateStateEventHandlers(string statename, TokenStateBody body)
{
Dictionary<string, TokenDeclVar> statehandlers = new ();
Dictionary<string, TokenDeclVar> statehandlers = new();
for(Token t = body.eventFuncs; t != null; t = t.nextToken)
{
TokenDeclVar tdv = (TokenDeclVar)t;
string eventname = tdv.GetSimpleName();
if(statehandlers.ContainsKey(eventname))
{
ErrorMsg(tdv, "event handler " + eventname + " already defined for state " + statename);
}
else
{
statehandlers.Add(eventname, tdv);
if(statehandlers.TryAdd(eventname, tdv))
GenerateEventHandler(statename, tdv);
}
else
ErrorMsg(tdv, "event handler " + eventname + " already defined for state " + statename);
}
}
@ -3575,7 +3570,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine
// Maybe it is a fixed array access.
string basetypestring = baseCompValu.type.ToString();
if(basetypestring.EndsWith("]"))
if(basetypestring.EndsWith(']'))
{
TokenRVal subRVal = lVal.subRVal;
int nSubs = 1;
@ -4328,7 +4323,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine
//
// Make sure we don't include comparisons (such as ==, >=, etc).
// Nothing like +=, -=, %=, etc, generate a boolean, only the comparisons.
if ((binOpStr.outtype != typeof(bool)) && opcodeIndex.EndsWith("=") && (opcodeIndex != "!="))
if ((binOpStr.outtype != typeof(bool)) && opcodeIndex.EndsWith('=') && (opcodeIndex != "!="))
{
if (token.rValLeft is not TokenLVal)
{
@ -4371,7 +4366,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine
// So look up the key as if we didn't have the "=" to tell us if the operation is legal.
// Also, the binary operation's output type must be the same as the L-value type.
// Likewise, integer += float not allowed because result is float, but float += integer is ok.
if(opcodeIndex.EndsWith("="))
if(opcodeIndex.EndsWith('='))
{
string op = opcodeIndex[..^1];
key = leftIndex + op + rightIndex;
@ -6320,9 +6315,6 @@ namespace OpenSim.Region.ScriptEngine.Yengine
{
this.stateName = stateName;
}
protected ScriptUndefinedStateException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
}
/**
@ -6346,13 +6338,6 @@ namespace OpenSim.Region.ScriptEngine.Yengine
{
this.thrown = thrown;
}
/**
* @brief Used by serialization/deserialization.
*/
protected ScriptThrownException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
}
/**
@ -6366,9 +6351,6 @@ namespace OpenSim.Region.ScriptEngine.Yengine
{
this.newState = newState;
}
protected ScriptChangeStateException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
}
/**
@ -6419,9 +6401,6 @@ namespace OpenSim.Region.ScriptEngine.Yengine
public class ScriptBadCallNoException: Exception
{
public ScriptBadCallNoException(int callNo) : base("bad callNo " + callNo) { }
protected ScriptBadCallNoException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
}
public class CVVMismatchException: Exception

View file

@ -113,7 +113,8 @@ namespace OpenSim.Region.ScriptEngine.Yengine
{ typeof(TokenKwOrOr), 100 },
{ typeof(TokenKwAndAnd), 120 },
//{ typeof(TokenKwAndAnd), 120 },
{ typeof(TokenKwAndAnd), 100 },
{ typeof(TokenKwOr), 140 },

View file

@ -147,7 +147,7 @@ namespace OpenSim.Services.HypergridService
if (simService is not null)
m_SimulationService = simService;
else if (!string.IsNullOrEmpty(simulationService))
else if (simulationService != string.Empty)
m_SimulationService = ServerUtils.LoadPlugin<ISimulationService>(simulationService, args);
string[] possibleAccessControlConfigSections = new string[] { "AccessControl", "GatekeeperService" };

View file

@ -297,10 +297,6 @@ namespace OpenSim.Services.InventoryService
Items = new List<InventoryItemBase>()
};
InventoryFolderBase f = GetFolder(principalID, folderID);
if (f == null)
return inventory;
XInventoryFolder[] folders = m_Database.GetFolders(
new string[] { "parentFolderID"},
new string[] { folderID.ToString() });
@ -321,8 +317,12 @@ namespace OpenSim.Services.InventoryService
inventory.Items.Add(ConvertToOpenSim(i));
}
inventory.Version = f.Version;
inventory.OwnerID = f.Owner;
InventoryFolderBase f = GetFolder(principalID, folderID);
if (f != null)
{
inventory.Version = f.Version;
inventory.OwnerID = f.Owner;
}
inventory.FolderID = folderID;
return inventory;
@ -561,20 +561,12 @@ namespace OpenSim.Services.InventoryService
{
// Principal is b0rked. *sigh*
//
int len = items.Count;
if(len == 0)
return false;
string[] ids = new string[len];
string[] folders = new string[len];
int i=0;
foreach (InventoryItemBase it in items)
foreach (InventoryItemBase i in items)
{
ids[i] = it.ID.ToString();
folders[i++] = it.Folder.ToString();
m_Database.MoveItem(i.ID.ToString(), i.Folder.ToString());
}
return m_Database.MoveItems(ids, folders);
return true;
}
public virtual bool DeleteItems(UUID principalID, List<UUID> itemIDs)
@ -601,39 +593,18 @@ namespace OpenSim.Services.InventoryService
{
// Just use the ID... *facepalms*
//
if(principalID.IsZero())
{
foreach (UUID id in itemIDs)
m_Database.DeleteItems("inventoryID", id.ToString());
}
else
{
string u = principalID.ToString();
string[] fields = new string[] { "avatarID", "inventoryID" };
foreach (UUID id in itemIDs)
m_Database.DeleteItems(
fields,
new string[] { u, id.ToString()});
}
foreach (UUID id in itemIDs)
m_Database.DeleteItems("inventoryID", id.ToString());
}
return true;
}
public virtual InventoryItemBase GetItem(UUID principalID, UUID itemID)
{
XInventoryItem[] items;
if (principalID.IsZero())
{
items = m_Database.GetItems(
XInventoryItem[] items = m_Database.GetItems(
new string[] { "inventoryID" },
new string[] { itemID.ToString() });
}
else
{
items = m_Database.GetItems(
new string[] { "avatarID", "inventoryID" },
new string[] { principalID.ToString(), itemID.ToString() });
}
if (items.Length == 0)
return null;
@ -643,63 +614,19 @@ namespace OpenSim.Services.InventoryService
public virtual InventoryItemBase[] GetMultipleItems(UUID userID, UUID[] ids)
{
int len = ids.Length;
if(len == 0)
return new InventoryItemBase[0];
InventoryItemBase[] items = new InventoryItemBase[ids.Length];
int i = 0;
foreach (UUID id in ids)
items[i++] = GetItem(userID, id);
string[] sids = new string[len];
int i;
for(i = 0; i< len; ++i)
sids[i] = ids[i].ToString();
XInventoryItem[] xits = m_Database.GetItems("inventoryID", sids);
sids = null;
len = xits.Length;
InventoryItemBase[] items = new InventoryItemBase[len];
i = 0;
if(userID.IsZero())
{
for (i = 0; i < len; ++i)
{
if (xits[i] == null)
items[i] = null;
else
items[i] = ConvertToOpenSim(xits[i]);
}
}
else
{
for (i = 0; i < len; ++i)
{
if (xits[i] == null)
items[i] = null;
else if (xits[i].avatarID.Equals(userID))
items[i] = ConvertToOpenSim(xits[i]);
else
items[i] = null;
}
}
return items;
}
public virtual InventoryFolderBase GetFolder(UUID principalID, UUID folderID)
{
XInventoryFolder[] folders;
if(principalID.IsZero())
{
folders = m_Database.GetFolders(
new string[] { "folderID" },
XInventoryFolder[] folders = m_Database.GetFolders(
new string[] { "folderID"},
new string[] { folderID.ToString() });
}
else
{
folders = m_Database.GetFolders(
new string[] { "agentID", "folderID" },
new string[] { principalID.ToString(), folderID.ToString() });
}
if (folders.Length == 0)
return null;

View file

@ -64,43 +64,5 @@ namespace Amib.Threading
{
}
}
/// <summary>
/// Represents an exception in case IWorkItemResult.GetResult has been canceled
/// </summary>
[Serializable]
public sealed partial class WorkItemCancelException
{
public WorkItemCancelException(SerializationInfo si, StreamingContext sc)
: base(si, sc)
{
}
}
/// <summary>
/// Represents an exception in case IWorkItemResult.GetResult has been timed out
/// </summary>
[Serializable]
public sealed partial class WorkItemTimeoutException
{
public WorkItemTimeoutException(SerializationInfo si, StreamingContext sc)
: base(si, sc)
{
}
}
/// <summary>
/// Represents an exception in case IWorkItemResult.GetResult has been timed out
/// </summary>
[Serializable]
public sealed partial class WorkItemResultException
{
public WorkItemResultException(SerializationInfo si, StreamingContext sc)
: base(si, sc)
{
}
}
#endregion
}

View file

@ -1,8 +1,6 @@
<configuration>
<dllmap os="windows" cpu="x86" dll="BulletSim" target="lib32/BulletSim" />
<dllmap os="windows" cpu="x86-64,ia64" dll="BulletSim" target="lib64/BulletSim" />
<dllmap os="windows" cpu="x86-64" dll="BulletSim" target="lib64/BulletSim-3.26-20231207-x86_64.dll" />
<dllmap os="osx" dll="BulletSim" target="lib64/libBulletSim.dylib" />
<dllmap os="!windows,osx" cpu="x86" dll="BulletSim" target="lib32/libBulletSim.so" />
<dllmap os="!windows,osx" cpu="x86-64" dll="BulletSim" target="lib64/libBulletSim.so" />
<dllmap os="!windows,osx" cpu="x86-64" dll="BulletSim" target="lib64/libBulletSim-3.26-20231207-x86_64.so" />
<dllmap os="!windows,osx" cpu="arm64" dll="BulletSim" target="lib64/libBulletSim-arm64.so" />
</configuration>

View file

@ -7253,13 +7253,13 @@ f0eb469c-b2f3-4d64-802a-1ac709cb91e6
<map>
<key>arguments</key><array>
<map><key>avatar</key><map><key>type</key><string>string</string></map></map>
<map><key>target</key><map><key>type</key><string>string</string></map></map>
</array>
</map>
<key>osForceOtherSit</key>
<map>
<key>arguments</key><array>
<map><key>avatar</key><map><key>type</key><string>string</string></map></map>
<map><key>target</key><map><key>type</key><string>string</string></map></map>
</array>
</map>
<key>osFormatString</key>

View file

@ -27,6 +27,10 @@
<Key Name="file" Value="LandmarksAssetSet/LandmarksAssetSet.xml"/>
</Section>
<Section Name="Materials AssetSet">
<Key Name="file" Value="MaterialsAssetSet/MaterialsAssetSet.xml"/>
</Section>
<Section Name="Notecards AssetSet">
<Key Name="file" Value="NotecardsAssetSet/NotecardsAssetSet.xml"/>
</Section>

View file

@ -0,0 +1,10 @@
<Nini>
<Section Name="Default Render Material">
<Key Name="assetID" Value="968cbad0-4dad-d64e-71b5-72bf13ad051a" />
<Key Name="name" Value="Default Render Material" />
<Key Name="assetType" Value="57" />
<Key Name="fileName" Value="968cbad0-4dad-d64e-71b5-72bf13ad051a.dat" />
</Section>
</Nini>

Binary file not shown.

Binary file not shown.

View file

@ -30,6 +30,18 @@
<Key Name="assetType" Value="56" />
<Key Name="fileName" Value="Midday.dat" />
</Section>
<Section Name="MiddayRP">
<Key Name="assetID" Value="651510b8-5f4d-8991-1592-e7eeab2a5a06" />
<Key Name="name" Value="MiddayRP" />
<Key Name="assetType" Value="56" />
<Key Name="fileName" Value="MiddayRP.dat" />
</Section>
<Section Name="MiddayNRP">
<Key Name="assetID" Value="cef49723-0292-af49-9b14-9598a616b8a3" />
<Key Name="name" Value="MiddayNRP" />
<Key Name="assetType" Value="56" />
<Key Name="fileName" Value="MiddayNRP.dat" />
</Section>
<Section Name="Sunset">
<Key Name="assetID" Value="084e26cd-a900-28e8-08d0-64a9de5c15e2" />
<Key Name="name" Value="Sunset" />

Binary file not shown.

Binary file not shown.

Binary file not shown.

7
bin/lib64/BulletSimVersionInfo Executable file
View file

@ -0,0 +1,7 @@
BuildDate=20231207
BulletSimVersion=1.3
BulletSimGitVersion=c6dd28b934f844cc5cc5012ad302ad742e6c3785
BulletSimGitVersionShort=c6dd28b
BulletVersion=3.26
BulletGitVersion=6bb8d1123d8a55d407b19fd3357c724d0f5c9d3c
BulletGitVersionShort=6bb8d11

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.