Merge remote-tracking branch 'upstream/master' into sasquatch-prebuild-maint through 10/20

This commit is contained in:
Mike Dickson 2022-10-20 00:28:04 -04:00
commit da00c7e675
110 changed files with 4150 additions and 2246 deletions

23
.gitattributes vendored
View file

@ -1,3 +1,20 @@
* text=auto eol=lf
*.{cmd,[cC][mM][dD]} text eol=crlf
*.{bat,[bB][aA][tT]} text eol=crlf
*.lsl binary
*.dat binary
*.bmp binary
*.BMP binary
*.gif binary
*.ico binary
*.j2c binary
*.j2k binary
*.jpg binary
*.png binary
*.tga binary
*.tif binary
*.db2 binary
*.llm binary
*.nib binary
*.rtf binary
*.ttf binary
*.ogg binary
*.dll binary
*.exe binary

57
.github/workflows/msbuild48.yml vendored Normal file
View file

@ -0,0 +1,57 @@
name: .msbuild48
on:
push:
branches: [ "master" ]
paths:
- '**.cs'
workflow_dispatch:
jobs:
build:
if: github.repository == 'opensim/opensim'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: shortsha
id: vars
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
- name: preBuild
run: bash ${GITHUB_WORKSPACE}/runprebuild48.sh
- name: Build
id: build
run: msbuild /p:Configuration=Release OpenSim.sln
- name: release
if: success()
run: zip -r LastBuild.zip bin ThirdPartyLicenses README.md CONTRIBUTORS.txt LICENSE.txt
- uses: softprops/action-gh-release@v1
if: success()
with:
tag_name: r${{ steps.vars.outputs.sha_short }}
name: LastAutoBuild
files: LastBuild.zip
- name: report push to irc
if: github.event_name == 'push'
uses: rectalogic/notify-irc@v1
with:
channel: "#opensim-dev"
server: "irc.libera.chat"
nickname: osgithub
message: |
${{ github.actor }} pushed to ${{ github.repository }}
${{ join(github.event.commits.*.message, '\n') }}
mono framework4.8 compile: ${{ steps.build.conclusion }}
- name: manual report to irc
if: github.event_name == 'workflow_dispatch'
uses: rectalogic/notify-irc@v1
with:
channel: "#opensim-dev"
server: "irc.libera.chat"
nickname: osgithub
message: |
${{ github.repository }}
mono framework4.8 compile: ${{ steps.build.conclusion }}

View file

@ -1,23 +0,0 @@
^tailor.state.old$
^tailor.state.journal$
\.csproj$
\.csproj\.user$
\.mdp$
\.mds$
\.dll\.build$
^bin/Debug/.+\.dll$
^bin/.+\.db$
^bin/OpenSim\.ini$
^bin/OpenSim\.log$
^bin/estate_settings\.xml$
^bin/Regions
bin/.+\.dll.mdb$
bin/addin-db-
bin/.+\.dll$
bin/.+\.maddin$
Examples/.+\.dll$
^bin/.+\.exe
^(OpenSim|Prebuild)/.+\.(exe|exe\.build|exe\.mdb)$
^OpenSim\.(build|sln)$
^Prebuild/Prebuild\.(build|sln)$
.+~$

View file

@ -597,8 +597,7 @@ namespace OpenSim.Groups
string giver = notice.noticeData.AttachmentOwnerID;
UUID attachmentUUID = notice.noticeData.AttachmentItemID;
if (attachmentUUID == null || attachmentUUID.IsZero() ||
giver == null || giver == UUID.ZeroString )
if (attachmentUUID.IsZero() || giver == null || giver == UUID.ZeroString )
return;
if (m_debugEnabled)

View file

@ -72,7 +72,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
{
while (tries > 0)
{
RegionInfo[] regionInfos = new RegionInfo[] { };
RegionInfo[] regionInfos = Array.Empty<RegionInfo>();
int regionCount = 0;
HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(url);
webRequest.Timeout = 30000; //30 Second Timeout
@ -118,10 +118,10 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
if (((HttpWebResponse)ex.Response).StatusCode == HttpStatusCode.NotFound)
{
if (!allowRegionless)
throw ex;
throw;
}
else
throw ex;
throw;
}
if (regionCount > 0 || allowRegionless)

View file

@ -1216,11 +1216,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController
m_log.InfoFormat("[RADMIN]: CreateUser: User {0} {1} created, UUID {2}", firstName, lastName, account.PrincipalID);
}
catch (Exception e)
catch
{
responseData["avatar_uuid"] = UUID.Zero.ToString();
throw e;
throw;
}
m_log.Info("[RADMIN]: CreateUser: request complete");
@ -1446,11 +1445,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController
firstName, lastName,
account.PrincipalID);
}
catch (Exception e)
catch
{
responseData["avatar_uuid"] = UUID.Zero.ToString();
throw e;
throw;
}
m_log.Info("[RADMIN]: UpdateUserAccount: request complete");
@ -1583,7 +1581,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
{
responseData["success"] = false;
responseData["error"] = e.Message;
throw e;
throw;
}
m_log.Info("[RADMIN]: AuthenticateUser: request complete");
@ -1668,11 +1666,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController
responseData["loaded"] = true;
}
catch (Exception e)
catch
{
responseData["loaded"] = false;
throw e;
throw;
}
m_log.Info("[RADMIN]: Load OAR Administrator Request complete");
@ -1792,11 +1789,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController
responseData["saved"] = true;
}
catch (Exception e)
catch
{
responseData["saved"] = false;
throw e;
throw;
}
m_log.Info("[RADMIN]: Save OAR Request complete");
@ -1856,12 +1852,11 @@ namespace OpenSim.ApplicationPlugins.RemoteController
responseData["loaded"] = true;
}
catch (Exception e)
catch
{
responseData["loaded"] = false;
responseData["switched"] = false;
throw e;
throw;
}
m_log.Info("[RADMIN]: Load XML Administrator Request complete");
@ -1909,12 +1904,11 @@ namespace OpenSim.ApplicationPlugins.RemoteController
responseData["saved"] = true;
}
catch (Exception e)
catch
{
responseData["saved"] = false;
responseData["switched"] = false;
throw e;
throw;
}
m_log.Info("[RADMIN]: Save XML Administrator Request complete");

View file

@ -68,7 +68,8 @@ namespace OpenSim.Capabilities.Handlers
{"animatn_id", AssetType.Animation},
{"gesture_id", AssetType.Gesture},
{"mesh_id", AssetType.Mesh},
{"settings_id", AssetType.Settings}
{"settings_id", AssetType.Settings},
{"material_id", AssetType.Material}
};
private IAssetService m_assetService;
@ -118,8 +119,7 @@ namespace OpenSim.Capabilities.Handlers
if (string.IsNullOrEmpty(assetStr))
return;
UUID assetID = UUID.Zero;
if(!UUID.TryParse(assetStr, out assetID))
if(!UUID.TryParse(assetStr, out UUID assetID))
return;
ManualResetEventSlim done = new ManualResetEventSlim(false);

View file

@ -246,7 +246,7 @@ namespace OpenSim.Data.MySQL
}
byte[] hash;
using (HashAlgorithm hasher = new SHA256CryptoServiceProvider())
using (HashAlgorithm hasher = SHA256.Create())
hash = hasher.ComputeHash(asset.Data);
// m_log.DebugFormat(

View file

@ -63,7 +63,7 @@ namespace OpenSim.Data.PGSQL
/// <summary>
/// We can reuse this for all hashing since all methods are single-threaded through m_dbBLock
/// </summary>
private HashAlgorithm hasher = new SHA256CryptoServiceProvider();
private HashAlgorithm hasher = SHA256.Create();
#region IPlugin Members

View file

@ -289,7 +289,7 @@ namespace OpenSim.Data.SQLite
metadata.CreatorID = row["CreatorID"].ToString();
// Current SHA1s are not stored/computed.
metadata.SHA1 = new byte[] {};
metadata.SHA1 = Array.Empty<byte>();
return metadata;
}

View file

@ -58,6 +58,7 @@ namespace OpenSim.Framework.AssetLoader.Filesystem
}
else
{
asset.Data = Array.Empty<byte>();
m_log.InfoFormat("[ASSETS]: Instantiated: [{0}]", name);
}
@ -145,9 +146,13 @@ namespace OpenSim.Framework.AssetLoader.Filesystem
string assetIdStr = source.Configs[i].GetString("assetID", UUID.Random().ToString());
string name = source.Configs[i].GetString("name", String.Empty);
sbyte type = (sbyte)source.Configs[i].GetInt("assetType", 0);
string assetPath = Path.Combine(dir, source.Configs[i].GetString("fileName", String.Empty));
AssetBase newAsset = CreateAsset(assetIdStr, name, assetPath, type);
string assetPath = source.Configs[i].GetString("fileName", String.Empty);
AssetBase newAsset;
if (string.IsNullOrEmpty(assetPath))
newAsset = CreateAsset(assetIdStr, name, null, type);
else
newAsset = CreateAsset(assetIdStr, name, Path.Combine(dir, assetPath), type);
newAsset.Type = type;
assets.Add(newAsset);

View file

@ -746,9 +746,7 @@ namespace OpenSim.Framework.Console
protected void FireOnOutput(string text)
{
OnOutputDelegate onOutput = OnOutput;
if (onOutput != null)
onOutput(text);
OnOutput?.Invoke(text);
}
/// <summary>

View file

@ -91,14 +91,13 @@ namespace OpenSim.Framework.Console
public virtual void Output(string format, params object[] components)
{
string level = null;
//string level = null;
if (components != null && components.Length > 0)
{
if (components[0] == null || components[0] is ConsoleLevel)
ConsoleLevel cl = components[0] as ConsoleLevel;
if (cl != null)
{
if (components[0] is ConsoleLevel)
level = ((ConsoleLevel)components[0]).ToString();
//level = cl.ToString();
if (components.Length > 1)
{
object[] tmp = new object[components.Length - 1];
@ -108,13 +107,9 @@ namespace OpenSim.Framework.Console
else
components = null;
}
}
string text;
if (components == null || components.Length == 0)
text = format;
else
text = String.Format(format, components);
string text = (components == null || components.Length == 0) ? format : String.Format(format, components);
System.Console.WriteLine(text);
}

View file

@ -52,8 +52,7 @@ namespace OpenSim.Framework.Console
private const string LOGLEVEL_NONE = "(none)";
// Used to extract categories for colourization.
private Regex m_categoryRegex
= new Regex(
private Regex m_categoryRegex = new Regex(
@"^(?<Front>.*?)\[(?<Category>[^\]]+)\]:?(?<End>.*)", RegexOptions.Singleline | RegexOptions.Compiled);
private int m_cursorYPosition = -1;
@ -86,7 +85,6 @@ namespace OpenSim.Framework.Console
public LocalConsole(string defaultPrompt, IConfig startupConfig = null) : base(defaultPrompt)
{
if (startupConfig == null) return;
m_historyEnable = startupConfig.GetBoolean("ConsoleHistoryFileEnabled", false);
@ -181,39 +179,29 @@ namespace OpenSim.Framework.Console
/// </returns>
private int SetCursorTop(int top)
{
// From at least mono 2.4.2.3, window resizing can give mono an invalid row and column values. If we try
// to set a cursor row position with a currently invalid column, mono will throw an exception.
// Therefore, we need to make sure that the column position is valid first.
// mono seems to fail unless we do check both left and top ranges, even current
int left = System.Console.CursorLeft;
if (left < 0)
{
System.Console.CursorLeft = 0;
}
if (left <= 0)
left = 0;
else
{
int bufferWidth = System.Console.BufferWidth;
// On Mono 2.4.2.3 (and possibly above), the buffer value is sometimes erroneously zero (Mantis 4657)
if (bufferWidth > 0 && left >= bufferWidth)
System.Console.CursorLeft = bufferWidth - 1;
left = bufferWidth - 1;
}
if (top < 0)
{
if (top <= 0)
top = 0;
}
else
{
int bufferHeight = System.Console.BufferHeight;
// On Mono 2.4.2.3 (and possibly above), the buffer value is sometimes erroneously zero (Mantis 4657)
if (bufferHeight > 0 && top >= bufferHeight)
top = bufferHeight - 1;
}
System.Console.CursorTop = top;
System.Console.SetCursorPosition(left, top);
return top;
}
@ -230,41 +218,70 @@ namespace OpenSim.Framework.Console
/// </returns>
private int SetCursorLeft(int left)
{
// From at least mono 2.4.2.3, window resizing can give mono an invalid row and column values. If we try
// to set a cursor column position with a currently invalid row, mono will throw an exception.
// Therefore, we need to make sure that the row position is valid first.
int top = System.Console.CursorTop;
if (top < 0)
{
System.Console.CursorTop = 0;
}
if (top <= 0)
top = 0;
else
{
int bufferHeight = System.Console.BufferHeight;
// On Mono 2.4.2.3 (and possibly above), the buffer value is sometimes erroneously zero (Mantis 4657)
if (bufferHeight > 0 && top >= bufferHeight)
System.Console.CursorTop = bufferHeight - 1;
top = bufferHeight - 1;
}
if (left < 0)
{
if (left <= 0)
left = 0;
}
else
{
int bufferWidth = System.Console.BufferWidth;
// On Mono 2.4.2.3 (and possibly above), the buffer value is sometimes erroneously zero (Mantis 4657)
if (bufferWidth > 0 && left >= bufferWidth)
left = bufferWidth - 1;
}
System.Console.CursorLeft = left;
System.Console.SetCursorPosition(left, top);
return left;
}
private void SetCursorTopLeft(int top, int left)
{
if (top <= 0)
top = 0;
else
{
int bufferHeight = System.Console.BufferHeight;
if (bufferHeight > 0 && top >= bufferHeight)
top = bufferHeight - 1;
}
if (left <= 0)
left = 0;
else
{
int bufferWidth = System.Console.BufferWidth;
if (bufferWidth > 0 && left >= bufferWidth)
left = bufferWidth - 1;
}
System.Console.SetCursorPosition(left, top);
}
private int SetCursorZeroLeft(int top)
{
if (top <= 0)
{
System.Console.SetCursorPosition(0, 0);
return 0;
}
int bufferHeight = System.Console.BufferHeight;
if (bufferHeight > 0 && top >= bufferHeight)
{
top = bufferHeight - 1;
}
System.Console.SetCursorPosition(0, top);
return top;
}
private void Show()
{
lock (m_commandLine)
@ -274,6 +291,7 @@ namespace OpenSim.Framework.Console
int xc = prompt.Length + m_cursorXPosition;
int new_x = xc % System.Console.BufferWidth;
int new_y = m_cursorYPosition + xc / System.Console.BufferWidth;
int end_y = m_cursorYPosition + (m_commandLine.Length + prompt.Length) / System.Console.BufferWidth;
@ -281,21 +299,18 @@ namespace OpenSim.Framework.Console
{
m_cursorYPosition--;
new_y--;
SetCursorLeft(0);
SetCursorTop(System.Console.BufferHeight - 1);
SetCursorZeroLeft(System.Console.BufferHeight - 1);
System.Console.WriteLine(" ");
}
m_cursorYPosition = SetCursorTop(m_cursorYPosition);
SetCursorLeft(0);
m_cursorYPosition = SetCursorZeroLeft(m_cursorYPosition);
if (m_echo)
System.Console.Write("{0}{1}", prompt, m_commandLine);
else
System.Console.Write("{0}", prompt);
SetCursorTop(new_y);
SetCursorLeft(new_x);
SetCursorTopLeft(new_y, new_x);
}
}
@ -306,16 +321,15 @@ namespace OpenSim.Framework.Console
{
if (m_cursorYPosition != -1)
{
m_cursorYPosition = SetCursorTop(m_cursorYPosition);
System.Console.CursorLeft = 0;
m_cursorYPosition = SetCursorZeroLeft(m_cursorYPosition);
int count = m_commandLine.Length + prompt.Length;
char[] spaces = new char[count];
for(int i = 0; i < spaces.Length; i++)
spaces[i] = ' ';
System.Console.Write(spaces);
while (count-- > 0)
System.Console.Write(" ");
m_cursorYPosition = SetCursorTop(m_cursorYPosition);
SetCursorLeft(0);
m_cursorYPosition = SetCursorZeroLeft(m_cursorYPosition);
}
}
catch (Exception)
@ -387,8 +401,6 @@ namespace OpenSim.Framework.Console
WriteColorText(ConsoleColor.Yellow, outText);
else
System.Console.Write(outText);
System.Console.WriteLine();
}
public override void Output(string format)
@ -401,11 +413,10 @@ namespace OpenSim.Framework.Console
string level = null;
if(components != null && components.Length > 0)
{
if(components[0] == null || components[0] is ConsoleLevel)
ConsoleLevel cl = components[0] as ConsoleLevel;
if (cl != null)
{
if(components[0] is ConsoleLevel)
level = ((ConsoleLevel)components[0]).ToString();
level = cl.ToString();
if (components.Length > 1)
{
object[] tmp = new object[components.Length - 1];
@ -416,11 +427,8 @@ namespace OpenSim.Framework.Console
components = null;
}
}
string text;
if (components == null || components.Length == 0)
text = format;
else
text = String.Format(format, components);
string text = (components == null || components.Length == 0) ? format : String.Format(format, components);
FireOnOutput(text);
@ -429,24 +437,19 @@ namespace OpenSim.Framework.Console
if (m_cursorYPosition == -1)
{
WriteLocalText(text, level);
System.Console.WriteLine();
return;
}
m_cursorYPosition = SetCursorTop(m_cursorYPosition);
SetCursorLeft(0);
m_cursorYPosition = SetCursorZeroLeft(m_cursorYPosition);
int count = m_commandLine.Length + prompt.Length;
while (count-- > 0)
System.Console.Write(" ");
m_cursorYPosition = SetCursorTop(m_cursorYPosition);
SetCursorLeft(0);
int count = m_commandLine.Length + prompt.Length - text.Length;
WriteLocalText(text, level);
for (int i = 0; i < count; ++i)
System.Console.Write(" ");
System.Console.WriteLine();
m_cursorYPosition = System.Console.CursorTop;
Show();
}
}
@ -479,18 +482,22 @@ namespace OpenSim.Framework.Console
m_echo = e;
int historyLine = m_history.Count;
SetCursorLeft(0); // Needed for mono
System.Console.Write(" "); // Needed for mono
lock (m_commandLine)
{
SetCursorLeft(0); // Needed for mono
m_cursorYPosition = System.Console.CursorTop;
m_commandLine.Remove(0, m_commandLine.Length);
// mono is silly
if (m_cursorYPosition >= System.Console.BufferHeight)
m_cursorYPosition = System.Console.BufferHeight - 1;
m_commandLine.Clear();
}
while (true)
{
Show();
//Reduce collisions with internal read terminal information like cursor position on linux
//while(System.Console.KeyAvailable == false)
// Thread.Sleep(100);
ConsoleKeyInfo key = System.Console.ReadKey(true);
@ -526,8 +533,7 @@ namespace OpenSim.Framework.Console
m_commandLine.Remove(m_cursorXPosition-1, 1);
m_cursorXPosition--;
SetCursorLeft(0);
m_cursorYPosition = SetCursorTop(m_cursorYPosition);
m_cursorYPosition = SetCursorZeroLeft(m_cursorYPosition);
if (m_echo)
System.Console.Write("{0}{1} ", prompt, m_commandLine);
@ -541,8 +547,7 @@ namespace OpenSim.Framework.Console
m_commandLine.Remove(m_cursorXPosition, 1);
SetCursorLeft(0);
m_cursorYPosition = SetCursorTop(m_cursorYPosition);
m_cursorYPosition = SetCursorZeroLeft(m_cursorYPosition);
if (m_echo)
System.Console.Write("{0}{1} ", prompt, m_commandLine);
@ -571,15 +576,9 @@ namespace OpenSim.Framework.Console
break;
historyLine++;
LockOutput();
if (historyLine == m_history.Count)
{
m_commandLine.Remove(0, m_commandLine.Length);
}
else
{
m_commandLine.Remove(0, m_commandLine.Length);
m_commandLine.Remove(0, m_commandLine.Length);
if (historyLine != m_history.Count)
m_commandLine.Append(m_history[historyLine]);
}
m_cursorXPosition = m_commandLine.Length;
UnlockOutput();
break;

View file

@ -46,8 +46,8 @@ namespace OpenSim.Framework.Console
override protected void Append(LoggingEvent le)
{
if (m_console != null)
m_console.LockOutput();
//if (m_console != null)
// m_console.LockOutput();
string loggingMessage = RenderLoggingEvent(le);
@ -78,11 +78,13 @@ namespace OpenSim.Framework.Console
{
System.Console.WriteLine("Couldn't write out log message: {0}", e.ToString());
}
/*
finally
{
if (m_console != null)
m_console.UnlockOutput();
}
*/
}
}
}

View file

@ -200,11 +200,10 @@ namespace OpenSim.Framework.Console
string level = null;
if (components != null && components.Length > 0)
{
if (components[0] == null || components[0] is ConsoleLevel)
ConsoleLevel cl = components[0] as ConsoleLevel;
if (cl != null)
{
if (components[0] is ConsoleLevel)
level = ((ConsoleLevel)components[0]).ToString();
level = cl.ToString();
if (components.Length > 1)
{
object[] tmp = new object[components.Length - 1];
@ -215,12 +214,7 @@ namespace OpenSim.Framework.Console
components = null;
}
}
string text;
if (components == null || components.Length == 0)
text = format;
else
text = String.Format(format, components);
string text = (components == null || components.Length == 0) ? format : String.Format(format, components);
Output(text, level, false, false, false);
}

View file

@ -56,7 +56,17 @@ namespace OpenSim.Framework
public const float MinWaterHeight = 0;
public const float MaxWaterHeight = 8000f;
public const string DefaultTexture = "89556747-24cb-43ed-920b-47caed15465f";
public static readonly string DefaultTexture = "89556747-24cb-43ed-920b-47caed15465f"; //plywood
public static readonly UUID DefaultTextureID = new UUID(DefaultTexture);
public static readonly string DefaultScript = "2074003b-8d5f-40e5-8b20-581c1c50aedb"; // must be on default assets and cache
public static readonly UUID DefaultScriptID = new UUID(DefaultScript);
public static readonly string DefaultScriptText = "default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n}";
public static readonly byte[] DefaultScriptData = osUTF8.GetASCIIBytes(DefaultScriptText);
public static readonly string EmptyNotecard = "4b6a777d-7bcd-4fc4-b06f-929b21e32925";
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 m_MrOpenSimIDString = "11111111-1111-0000-0000-000100bba000";
public static readonly UUID m_MrOpenSimID = new UUID(m_MrOpenSimIDString);

View file

@ -45,7 +45,6 @@ namespace OpenSim.Framework
[SerializableAttribute]
[ComVisibleAttribute(false)]
[HostProtectionAttribute(SecurityAction.LinkDemand, Synchronization = true, ExternalThreading = true)]
public class Lazy<T>
{
T value;

View file

@ -139,7 +139,7 @@ namespace OpenSim.Framework.Monitoring
// There is no script frame time currently because we don't yet collect it
sb.Append("PktsIn PktOut PendDl PendUl UnackB TotlFt NetFt PhysFt OthrFt AgntFt ImgsFt\n");
sb.AppendFormat(
"{0,6:0} {1,6:0} {2,6:0} {3,6:0} {4,6:0} {5,6:0.0} {6,6:0.0} {7,6:0.0} {8,6:0.0} {9,6:0.0} {10,6:0.0}\n",
"{0,6:0} {1,6:0} {2,6:0} {3,6:0} {4,6:0} {5,6:0.00} {6,6:0.00} {7,6:0.00} {8,6:0.00} {9,6:0.00} {10,6:0.00}\n",
data[(int)StatsIndex.InPacketsPerSecond], data[(int)StatsIndex.OutPacketsPerSecond],
data[(int)StatsIndex.PendingDownloads], data[(int)StatsIndex.PendingUploads],
data[(int)StatsIndex.UnAckedBytes], data[(int)StatsIndex.FrameMS],

View file

@ -215,8 +215,6 @@ namespace OpenSim.Framework
AddinManager.AddinLoadError += on_addinloaderror_;
AddinManager.AddinLoaded += on_addinloaded_;
//clear_registry_(dir);
//suppress_console_output_(true);
AddinManager.Initialize(dir);
AddinManager.Registry.Update(null);
@ -239,41 +237,6 @@ namespace OpenSim.Framework
+ args.Exception.StackTrace);
}
private void clear_registry_(string dir)
{
// The Mono addin manager (in Mono.Addins.dll version 0.2.0.0)
// occasionally seems to corrupt its addin cache
// Hence, as a temporary solution we'll remove it before each startup
string customDir = Environment.GetEnvironmentVariable ("MONO_ADDINS_REGISTRY");
string v0 = "addin-db-000";
string v1 = "addin-db-001";
if (customDir != null && customDir != String.Empty)
{
v0 = Path.Combine(customDir, v0);
v1 = Path.Combine(customDir, v1);
}
try
{
if (Directory.Exists(v0))
Directory.Delete(v0, true);
if (Directory.Exists(v1))
Directory.Delete(v1, true);
}
catch (IOException)
{
// If multiple services are started simultaneously, they may
// each test whether the directory exists at the same time, and
// attempt to delete the directory at the same time. However,
// one of the services will likely succeed first, causing the
// second service to throw an IOException. We catch it here and
// continue on our merry way.
// Mike 2008.08.01, patch from Zaki
}
}
private static TextWriter prev_console_;
public void suppress_console_output_(bool save)
{

View file

@ -27,13 +27,13 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Reflection;
using System.Xml;
using System.Xml.Schema;
using System.Xml.Serialization;
using System.Runtime.CompilerServices;
using log4net;
using OpenMetaverse;
using OpenMetaverse.StructuredData;
@ -109,12 +109,12 @@ namespace OpenSim.Framework
private ProfileShape _profileShape;
private HollowShape _hollowShape;
// Sculpted
//extra parameters Sculpted
[XmlIgnore] private UUID _sculptTexture;
[XmlIgnore] private byte _sculptType;
[XmlIgnore] private byte[] _sculptData = Utils.EmptyBytes;
// Flexi
//extra parameters Flexi
[XmlIgnore] private int _flexiSoftness;
[XmlIgnore] private float _flexiTension;
[XmlIgnore] private float _flexiDrag;
@ -124,7 +124,7 @@ namespace OpenSim.Framework
[XmlIgnore] private float _flexiForceY;
[XmlIgnore] private float _flexiForceZ;
//Bright n sparkly
//extra parameters light
[XmlIgnore] private float _lightColorR;
[XmlIgnore] private float _lightColorG;
[XmlIgnore] private float _lightColorB;
@ -134,13 +134,13 @@ namespace OpenSim.Framework
[XmlIgnore] private float _lightFalloff;
[XmlIgnore] private float _lightIntensity = 1.0f;
// Light Projection Filter
//extra parameters Projection
[XmlIgnore] private UUID _projectionTextureID;
[XmlIgnore] private float _projectionFOV;
[XmlIgnore] private float _projectionFocus;
[XmlIgnore] private float _projectionAmb;
//extra parameters extramesh/flag
[XmlIgnore] private uint _meshFlags;
[XmlIgnore] private bool _flexiEntry;
@ -149,10 +149,19 @@ namespace OpenSim.Framework
[XmlIgnore] private bool _projectionEntry;
[XmlIgnore] private bool _meshFlagsEntry;
//extra parameters extramesh/flag
[XmlIgnore]
public Primitive.ReflectionProbe ReflectionProbe = null;
//extra parameters extramesh/flag
[XmlIgnore]
public Primitive.RenderMaterials RenderMaterials = null;
public bool MeshFlagEntry
{
get { return _meshFlagsEntry;}
}
public byte ProfileCurve
{
get { return (byte)((byte)HollowShape | (byte)ProfileShape); }
@ -993,24 +1002,19 @@ namespace OpenSim.Framework
// TODO: Separate scale out from the primitive shape data (after
// scaling is supported at the physics engine level)
byte[] scaleBytes = size.GetBytes();
for (int i = 0; i < scaleBytes.Length; i++)
hash = djb2(hash, scaleBytes[i]);
hash = djb2(hash, size.X);
hash = djb2(hash, size.Y);
hash = djb2(hash, size.Z);
// Include LOD in hash, accounting for endianness
hash = djb2(hash, lod);
byte[] lodBytes = new byte[4];
Buffer.BlockCopy(BitConverter.GetBytes(lod), 0, lodBytes, 0, 4);
if (!BitConverter.IsLittleEndian)
{
Array.Reverse(lodBytes, 0, 4);
}
for (int i = 0; i < lodBytes.Length; i++)
hash = djb2(hash, lodBytes[i]);
// include sculpt UUID
if (this.SculptEntry)
{
scaleBytes = this.SculptTexture.GetBytes();
byte[] scaleBytes = this.SculptTexture.GetBytes();
for (int i = 0; i < scaleBytes.Length; i++)
hash = djb2(hash, scaleBytes[i]);
}
@ -1023,18 +1027,27 @@ namespace OpenSim.Framework
private ulong djb2(ulong hash, byte c)
{
return ((hash << 5) + hash) + (ulong)c;
//return ((hash << 5) + hash) + (ulong)c;
return 33 * hash + (ulong)c;
}
private ulong djb2(ulong hash, ushort c)
{
hash = ((hash << 5) + hash) + (ulong)((byte)c);
return ((hash << 5) + hash) + (ulong)(c >> 8);
//hash = ((hash << 5) + hash) + (ulong)((byte)c);
//return ((hash << 5) + hash) + (ulong)(c >> 8);
return 33 * hash + c;
}
public byte[] ExtraParamsToBytes()
private ulong djb2(ulong hash, float c)
{
// m_log.DebugFormat("[EXTRAPARAMS]: Called ExtraParamsToBytes()");
//hash = ((hash << 5) + hash) + (ulong)((byte)c);
//return ((hash << 5) + hash) + (ulong)(c >> 8);
return 33 * hash + (ulong)c.GetHashCode();
}
public unsafe byte[] ExtraParamsToBytes()
{
//m_log.DebugFormat("[EXTRAPARAMS]: Called ExtraParamsToBytes()");
const byte FlexiEP = 0x10;
const byte LightEP = 0x20;
@ -1042,6 +1055,8 @@ namespace OpenSim.Framework
const byte ProjectionEP = 0x40;
//const byte MeshEP = 0x60;
const byte MeshFlagsEP = 0x70;
const byte MaterialsEP = 0x80;
const byte ReflectionProbeEP = 0x90;
int TotalBytesLength = 1; // ExtraParamsNum
@ -1075,92 +1090,129 @@ namespace OpenSim.Framework
ExtraParamsNum++;
TotalBytesLength += 4 + 2 + 4; // data
}
byte[] returnBytes = new byte[TotalBytesLength];
returnBytes[0] = (byte)ExtraParamsNum;
if(ExtraParamsNum == 0)
return returnBytes;
int i = 1;
if (_flexiEntry)
if (ReflectionProbe != null)
{
returnBytes[i] = FlexiEP; // 2 bytes id code
i += 2;
returnBytes[i] = 16; // 4 bytes size
i += 4;
// Softness is packed in the upper bits of tension and drag
returnBytes[i] = (byte)((_flexiSoftness & 2) << 6);
returnBytes[i + 1] = (byte)((_flexiSoftness & 1) << 7);
returnBytes[i++] |= (byte)((byte)(_flexiTension * 10.01f) & 0x7F);
returnBytes[i++] |= (byte)((byte)(_flexiDrag * 10.01f) & 0x7F);
returnBytes[i++] = (byte)((_flexiGravity + 10.0f) * 10.01f);
returnBytes[i++] = (byte)(_flexiWind * 10.01f);
Utils.FloatToBytes(_flexiForceX, returnBytes, i);
Utils.FloatToBytes(_flexiForceY, returnBytes, i + 4);
Utils.FloatToBytes(_flexiForceZ, returnBytes, i + 8);
i += 12;
ExtraParamsNum++;
TotalBytesLength += 9 + 2 + 4; // data
}
if (_lightEntry)
if (RenderMaterials != null)
{
returnBytes[i] = LightEP;
i += 2;
returnBytes[i] = 16;
i += 4;
// Alpha channel in color is intensity
Color4 tmpColor = new Color4(_lightColorR, _lightColorG, _lightColorB, _lightIntensity);
tmpColor.GetBytes().CopyTo(returnBytes, i);
Utils.FloatToBytes(_lightRadius, returnBytes, i + 4);
Utils.FloatToBytes(_lightCutoff, returnBytes, i + 8);
Utils.FloatToBytes(_lightFalloff, returnBytes, i + 12);
i += 16;
ExtraParamsNum++;
if (RenderMaterials.entries == null || RenderMaterials.entries.Length == 0)
TotalBytesLength++;
else
{
TotalBytesLength += 1 + 17 * RenderMaterials.entries.Length + 2 + 4; // data
}
}
if (_sculptEntry)
byte[] safeReturnBytes = new byte[TotalBytesLength];
if(TotalBytesLength == 1)
{
//if(_sculptType == 5)
// returnBytes[i] = MeshEP;
//else
returnBytes[i] = SculptEP;
i += 2;
returnBytes[i] = 17;
i += 4;
_sculptTexture.GetBytes().CopyTo(returnBytes, i);
i += 16;
returnBytes[i++] = _sculptType;
safeReturnBytes[0] = 0;
return safeReturnBytes;
}
if (_projectionEntry)
fixed(byte* breturnBytes = &safeReturnBytes[0])
{
returnBytes[i] = ProjectionEP;
i += 2;
returnBytes[i] = 28;
i += 4;
byte* returnBytes = breturnBytes;
_projectionTextureID.GetBytes().CopyTo(returnBytes, i);
Utils.FloatToBytes(_projectionFOV, returnBytes, i + 16);
Utils.FloatToBytes(_projectionFocus, returnBytes, i + 20);
Utils.FloatToBytes(_projectionAmb, returnBytes, i + 24);
i += 28;
*returnBytes++ = (byte)ExtraParamsNum;
if (_flexiEntry)
{
*returnBytes = FlexiEP; returnBytes += 2;// 2 bytes id code
*returnBytes = 16; returnBytes += 4;// 4 bytes size
// Softness is packed in the upper bits of tension and drag
*returnBytes++ = (byte)(((_flexiSoftness & 2) << 6) | ((byte)(_flexiTension * 10.01f) & 0x7F));
*returnBytes++ = (byte)(((_flexiSoftness & 1) << 7) | ((byte)(_flexiDrag * 10.01f) & 0x7F));
*returnBytes++ = (byte)((_flexiGravity + 10.0f) * 10.01f);
*returnBytes++ = (byte)(_flexiWind * 10.01f);
Utils.FloatToBytes(_flexiForceX, returnBytes); returnBytes += 4;
Utils.FloatToBytes(_flexiForceY, returnBytes); returnBytes += 4;
Utils.FloatToBytes(_flexiForceZ, returnBytes); returnBytes += 4;
}
if (_lightEntry)
{
*returnBytes = LightEP; returnBytes += 2;
*returnBytes = 16; returnBytes += 4;
// Alpha channel in color is intensity
*returnBytes++ = Utils.FloatZeroOneToByte(_lightColorR);
*returnBytes++ = Utils.FloatZeroOneToByte(_lightColorG);
*returnBytes++ = Utils.FloatZeroOneToByte(_lightColorB);
*returnBytes++ = Utils.FloatZeroOneToByte(_lightIntensity);
Utils.FloatToBytes(_lightRadius, returnBytes); returnBytes += 4;
Utils.FloatToBytes(_lightCutoff, returnBytes); returnBytes += 4;
Utils.FloatToBytes(_lightFalloff, returnBytes); returnBytes += 4;
}
if (_sculptEntry)
{
//if(_sculptType == 5)
// *returnBytes = MeshEP; returnBytes += 2;
//else
*returnBytes = SculptEP; returnBytes += 2;
*returnBytes = 17; returnBytes += 4;
_sculptTexture.ToBytes(returnBytes); returnBytes += 16;
*returnBytes++ = _sculptType;
}
if (_projectionEntry)
{
*returnBytes = ProjectionEP; returnBytes += 2;
*returnBytes = 28; returnBytes += 4;
_projectionTextureID.ToBytes(returnBytes); returnBytes += 16;
Utils.FloatToBytes(_projectionFOV, returnBytes); returnBytes += 4;
Utils.FloatToBytes(_projectionFocus, returnBytes); returnBytes += 4;
Utils.FloatToBytes(_projectionAmb, returnBytes); returnBytes += 4;
}
if (_meshFlagsEntry)
{
*returnBytes = MeshFlagsEP; returnBytes += 2;
*returnBytes = 4; returnBytes += 4;
Utils.UIntToBytes(_meshFlags, returnBytes); returnBytes += 4;
}
if (ReflectionProbe != null)
{
*returnBytes = ReflectionProbeEP; returnBytes += 2;
*returnBytes = 9; returnBytes += 4;
Utils.FloatToBytes(ReflectionProbe.Ambiance, returnBytes); returnBytes += 4;
Utils.FloatToBytes(ReflectionProbe.ClipDistance, returnBytes); returnBytes += 4;
*returnBytes++ = ReflectionProbe.Flags;
}
if (RenderMaterials != null && RenderMaterials.entries != null && RenderMaterials.entries.Length > 0)
{
*returnBytes = MaterialsEP; returnBytes += 2;
int len = 1 + 17 * RenderMaterials.entries.Length;
*returnBytes++ = (byte)len;
*returnBytes++ = (byte)(len >> 8);
*returnBytes++ = (byte)(len >> 16);
*returnBytes++ = (byte)(len >> 24);
*returnBytes++ = (byte)RenderMaterials.entries.Length;
for (int j = 0; j < RenderMaterials.entries.Length; ++j)
{
*returnBytes++ = RenderMaterials.entries[j].te_index;
RenderMaterials.entries[j].id.ToBytes(returnBytes); returnBytes += 16;
}
}
}
if (_meshFlagsEntry)
{
returnBytes[i] = MeshFlagsEP;
i += 2;
returnBytes[i] = 4;
i += 4;
Utils.UIntToBytes(_meshFlags, returnBytes, i);
}
return returnBytes;
return safeReturnBytes;
}
public void ReadInUpdateExtraParam(ushort type, bool inUse, byte[] data)
@ -1171,6 +1223,8 @@ namespace OpenSim.Framework
const ushort ProjectionEP = 0x40;
const ushort MeshEP = 0x60;
const ushort MeshFlagsEP = 0x70;
const ushort MaterialsEP = 0x80;
const ushort ReflectionProbeEP = 0x90;
switch (type)
{
@ -1217,6 +1271,22 @@ namespace OpenSim.Framework
}
ReadMeshFlagsData(data, 0);
break;
case ReflectionProbeEP:
if (!inUse)
{
ReflectionProbe = null;
return;
}
ReadReflectionProbe(data, 0);
break;
case MaterialsEP:
if (!inUse)
{
RenderMaterials = null;
return;
}
ReadRenderMaterials(data, 0, data.Length);
break;
}
}
@ -1230,6 +1300,8 @@ namespace OpenSim.Framework
_sculptEntry = false;
_projectionEntry = false;
_meshFlagsEntry = false;
RenderMaterials = null;
ReflectionProbe = null;
if (data.Length == 1)
return;
@ -1240,45 +1312,68 @@ namespace OpenSim.Framework
const byte ProjectionEP = 0x40;
const byte MeshEP = 0x60;
const byte MeshFlagsEP = 0x70;
const byte MaterialsEP = 0x80;
const byte ReflectionProbeEP = 0x90;
byte extraParamCount = data[0];
int i = 1;
for (int k = 0; k < extraParamCount; ++k)
{
byte epType = data[i];
i += 6;
switch (epType)
{
case FlexiEP:
i += 6;
ReadFlexiData(data, i);
i += 16;
break;
case LightEP:
i += 6;
ReadLightData(data, i);
i += 16;
break;
case MeshEP:
case SculptEP:
i += 6;
ReadSculptData(data, i);
i += 17;
break;
case ProjectionEP:
i += 6;
ReadProjectionData(data, i);
i += 28;
break;
case MeshFlagsEP:
i += 6;
ReadMeshFlagsData(data, i);
i += 4;
break;
case ReflectionProbeEP:
i += 6;
ReadReflectionProbe(data, i);
i += 9;
break;
case MaterialsEP:
i += 2;
if (data.Length - i >= 4)
{
int size = Utils.BytesToInt(data, i);
i += 4;
i += ReadRenderMaterials(data, i, size);
}
break;
}
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ReadSculptData(byte[] data, int pos)
{
if (data.Length-pos >= 17)
@ -1295,6 +1390,7 @@ namespace OpenSim.Framework
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ReadFlexiData(byte[] data, int pos)
{
if (data.Length-pos >= 16)
@ -1325,6 +1421,7 @@ namespace OpenSim.Framework
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ReadLightData(byte[] data, int pos)
{
if (data.Length - pos >= 16)
@ -1355,6 +1452,7 @@ namespace OpenSim.Framework
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ReadProjectionData(byte[] data, int pos)
{
if (data.Length - pos >= 28)
@ -1375,6 +1473,7 @@ namespace OpenSim.Framework
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ReadMeshFlagsData(byte[] data, int pos)
{
if (data.Length - pos >= 4)
@ -1389,10 +1488,50 @@ namespace OpenSim.Framework
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ReadReflectionProbe(byte[] data, int pos)
{
if (data.Length - pos >= 9)
{
ReflectionProbe = new Primitive.ReflectionProbe
{
Ambiance = Utils.Clamp(Utils.BytesToFloat(data, pos), 0, 1.0f),
ClipDistance = Utils.Clamp(Utils.BytesToFloat(data, pos + 4), 0, 1024f),
Flags = data[pos + 8]
};
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int ReadRenderMaterials(byte[] data, int pos, int size)
{
if (size > 17)
{
int count = data[pos];
++pos;
if (size >= 1 + 17 * count)
{
var entries = new Primitive.RenderMaterials.RenderMaterialEntry[count];
for (int i = 0; i < count; ++i)
{
entries[i].te_index = data[pos++];
entries[i].id = new UUID(data, pos);
pos += 16;
}
RenderMaterials = new Primitive.RenderMaterials
{
entries = entries
};
}
}
return size + 4;
}
/// <summary>
/// Creates a OpenMetaverse.Primitive and populates it with converted PrimitiveBaseShape values
/// </summary>
/// <returns></returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public Primitive ToOmvPrimitive()
{
// position and rotation defaults here since they are not available in PrimitiveBaseShape
@ -1536,11 +1675,13 @@ namespace OpenSim.Framework
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void WriteXml(XmlWriter writer)
{
writer.WriteRaw(ToXml());
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static MediaList FromXml(string rawXml)
{
MediaList ml = new MediaList();
@ -1590,6 +1731,7 @@ namespace OpenSim.Framework
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ReadXml(XmlReader reader)
{
if (reader.IsEmptyElement)

View file

@ -164,6 +164,7 @@ namespace OpenSim.Framework
new TypeMapping(AssetType.Link, InventoryType.Unknown, "application/vnd.ll.link", "link"),
new TypeMapping(AssetType.LinkFolder, InventoryType.Unknown, "application/vnd.ll.linkfolder", "linkfolder"),
new TypeMapping(AssetType.Mesh, InventoryType.Mesh, "application/vnd.ll.mesh", "llm"),
new TypeMapping(AssetType.Material, InventoryType.Material, "application/llsd+xml", "glftmat"),
// The next few items are about inventory folders
new TypeMapping(AssetType.Folder, FolderType.None, "application/vnd.ll.folder", "folder"),
@ -212,7 +213,8 @@ namespace OpenSim.Framework
{"gesture", AssetType.Gesture},
{"simstate", AssetType.Simstate},
{"mesh", AssetType.Mesh},
{"settings", AssetType.Settings}
{"settings", AssetType.Settings},
{"material", AssetType.Material}
};
private static Dictionary<string, FolderType> name2Inventory = new Dictionary<string, FolderType>()
{
@ -238,6 +240,7 @@ namespace OpenSim.Framework
{"myoutfits", FolderType.MyOutfits},
{"mesh", FolderType.Mesh},
{"settings", FolderType.Settings},
{"material", FolderType.Material},
{"suitcase", FolderType.Suitcase}
};

View file

@ -127,6 +127,7 @@ namespace OpenSim.Framework.Serialization
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.TextureTGA] = ASSET_EXTENSION_SEPARATOR + "texture.tga";
ASSET_TYPE_TO_EXTENSION[(sbyte)OpenSimAssetType.Material] = ASSET_EXTENSION_SEPARATOR + "material.xml";
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Settings] = ASSET_EXTENSION_SEPARATOR + "settings.bin";
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Material] = ASSET_EXTENSION_SEPARATOR + "prmat.dat";
EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "animation.bvh"] = (sbyte)AssetType.Animation;
EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "bodypart.txt"] = (sbyte)AssetType.Bodypart;
@ -149,6 +150,7 @@ namespace OpenSim.Framework.Serialization
EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "texture.tga"] = (sbyte)AssetType.TextureTGA;
EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "material.xml"] = (sbyte)OpenSimAssetType.Material;
EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "settings.bin"] = (sbyte)AssetType.Settings;
EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "prmat.dat"] = (sbyte)AssetType.Material;
}
public static string CreateOarLandDataPath(LandData ld)

View file

@ -2156,7 +2156,7 @@ namespace OpenSim.Framework.Servers.HttpServer
// We want this exception to halt the entire server since in current configurations we aren't too
// useful without inbound HTTP.
throw e;
throw;
}
m_requestsProcessedStat = new Stat(

View file

@ -37,7 +37,7 @@ namespace OpenSim.Framework
/// </summary>
public class TaskInventoryItem : ICloneable
{
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
/// <summary>
/// XXX This should really be factored out into some constants class.

View file

@ -213,6 +213,40 @@ namespace OpenSim.Framework
return Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
}
// next should be replaced using .net5 system numerics bitoperations log2
// this is just log2 + 1
private static byte[] nBitsLookup =
{
01, 10, 02, 11, 14, 22, 03, 30, 12, 15, 17, 19, 23, 26, 04, 31,
09, 13, 21, 29, 16, 18, 25, 08, 20, 28, 24, 07, 27, 06, 05, 32
};
public static int NumberBits(uint n)
{
n |= (n >> 1);
n |= (n >> 2);
n |= (n >> 4);
n |= (n >> 8);
n |= (n >> 16);
return nBitsLookup[(n * 0x07C4ACDDu) >> 27];
}
private static byte[] intLog2Lookup =
{
00, 09, 01, 10, 13, 21, 02, 29, 11, 14, 16, 18, 22, 25, 03, 30,
08, 12, 20, 28, 15, 17, 24, 07, 19, 27, 23, 06, 26, 05, 04, 31
};
public static int intLog2(uint n)
{
n |= (n >> 1);
n |= (n >> 2);
n |= (n >> 4);
n |= (n >> 8);
n |= (n >> 16);
return intLog2Lookup[(n * 0x07C4ACDDu) >> 27];
}
/// <summary>
/// Linear interpolates B<->C using percent A
/// </summary>
@ -1282,8 +1316,8 @@ namespace OpenSim.Framework
public static UUID ComputeSHA1UUID(byte[] src)
{
byte[] ret;
using (SHA1CryptoServiceProvider SHA1 = new SHA1CryptoServiceProvider())
ret = SHA1.ComputeHash(src);
using (SHA1 sha = SHA1.Create())
ret = sha.ComputeHash(src);
return new UUID(ret, 2);
}
@ -1346,6 +1380,12 @@ namespace OpenSim.Framework
return FieldToString(bytes, String.Empty);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static string FieldToASCIIString(byte[] bytes, int limit)
{
return CleanString(Encoding.ASCII.GetString(bytes, 0, limit < bytes.Length ? limit : bytes.Length));
}
/// <summary>
/// Convert a variable length field (byte array) to a string, with a
/// field name prepended to each line of the output
@ -2018,28 +2058,12 @@ namespace OpenSim.Framework
public static string CleanString(string input)
{
if (input.Length == 0)
return input;
int clip = input.Length;
// Test for ++ string terminator
int pos = input.IndexOf("\0");
if (pos != -1 && pos < clip)
clip = pos;
// Test for CR
pos = input.IndexOf("\r");
if (pos != -1 && pos < clip)
clip = pos;
// Test for LF
pos = input.IndexOf("\n");
if (pos != -1 && pos < clip)
clip = pos;
// Truncate string before first end-of-line character found
return input.Substring(0, clip);
for (int i = 0; i < input.Length; i++)
{
if (input[i] == '\0' || input[i] == '\r' || input[i] == '\n')
return input.Substring(0, i);
}
return input;
}
/// <summary>
@ -4365,12 +4389,11 @@ namespace OpenSim.Framework
using (ImageAttributes atrib = new ImageAttributes())
using (Graphics graphics = Graphics.FromImage(result))
{
atrib.SetWrapMode(System.Drawing.Drawing2D.WrapMode.TileFlipXY);
atrib.SetWrapMode(System.Drawing.Drawing2D.WrapMode.TileFlipXY);
graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
graphics.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.None;
graphics.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;
graphics.DrawImage(image, new Rectangle(0, 0, result.Width, result.Height),
0, 0, image.Width, image.Height, GraphicsUnit.Pixel, atrib);

View file

@ -993,7 +993,7 @@ namespace OpenSim.Framework
catch (Exception e)
{
m_log.InfoFormat("[FORMS]: Error creating {0} request to : {1}. Request: {2}", verb, requestUrl, e.Message);
throw e;
throw;
}
int sendlen = 0;
@ -1015,7 +1015,7 @@ namespace OpenSim.Framework
catch (Exception e)
{
m_log.InfoFormat("[FORMS]: Error sending {0} request to: {1}. {2}", verb,requestUrl, e.Message);
throw e;
throw;
}
}
@ -1036,7 +1036,7 @@ namespace OpenSim.Framework
catch (Exception e)
{
m_log.InfoFormat("[FORMS]: Error receiving response from {0}: {1}.", requestUrl, e.Message);
throw e;
throw;
}
int tickdiff = Util.EnvironmentTickCountSubtract(tickstart);
@ -1091,7 +1091,7 @@ namespace OpenSim.Framework
catch (Exception e)
{
m_log.InfoFormat("[FORMS]: Error creating POST request to {0}: {1}", requestUrl, e.Message);
throw e;
throw;
}
byte[] data = Util.UTF8NBGetbytes(obj);
@ -1110,7 +1110,7 @@ namespace OpenSim.Framework
catch (Exception e)
{
m_log.InfoFormat("[FORMS]: Error sending POST request to {0}: {1}", requestUrl, e.Message);
throw e;
throw;
}
string respstring = String.Empty;
@ -1129,7 +1129,7 @@ namespace OpenSim.Framework
catch (Exception e)
{
m_log.InfoFormat("[FORMS]: Error receiving response from {0}: {1}", requestUrl, e.Message);
throw e;
throw;
}
int tickdiff = Util.EnvironmentTickCountSubtract(tickstart);

View file

@ -185,11 +185,9 @@ namespace OpenSim.Region.ClientStack.Linden
m_enableFreeTestUpload = EconomyConfig.GetBoolean("AllowFreeTestUpload", m_enableFreeTestUpload);
m_ForceFreeTestUpload = EconomyConfig.GetBoolean("ForceFreeTestUpload", m_ForceFreeTestUpload);
string testcreator = EconomyConfig.GetString("TestAssetsCreatorID", "");
if (testcreator != "")
if (!string.IsNullOrEmpty(testcreator))
{
UUID id;
UUID.TryParse(testcreator, out id);
if (id != null)
if (UUID.TryParse(testcreator, out UUID id))
m_testAssetsCreatorID = id;
}
}
@ -198,19 +196,19 @@ namespace OpenSim.Region.ClientStack.Linden
if (CapsConfig != null)
{
string homeLocationUrl = CapsConfig.GetString("Cap_HomeLocation", "localhost");
if(homeLocationUrl == String.Empty)
if(homeLocationUrl.Length == 0)
m_AllowCapHomeLocation = false;
string GroupMemberDataUrl = CapsConfig.GetString("Cap_GroupMemberData", "localhost");
if(GroupMemberDataUrl == String.Empty)
if(GroupMemberDataUrl.Length == 0)
m_AllowCapGroupMemberData = false;
string LandResourcesUrl = CapsConfig.GetString("Cap_LandResources", "localhost");
if (LandResourcesUrl == String.Empty)
if (LandResourcesUrl.Length == 0)
m_AllowCapLandResources = false;
string AttachmentResourcesUrl = CapsConfig.GetString("Cap_AttachmentResources", "localhost");
if (AttachmentResourcesUrl == String.Empty)
if (AttachmentResourcesUrl.Length == 0)
m_AllowCapAttachmentResources = false;
}
}
@ -332,6 +330,10 @@ namespace OpenSim.Region.ClientStack.Linden
m_HostCapsObj.RegisterSimpleHandler("UpdateSettingsAgentInventory", oreq, true);
m_HostCapsObj.RegisterSimpleHandler("UpdateSettingsTaskInventory", oreq, false); // a object inv
oreq = new SimpleOSDMapHandler("POST", GetNewCapPath(), UpdateMaterialItemAsset);
m_HostCapsObj.RegisterSimpleHandler("UpdateMaterialAgentInventory", oreq, true);
m_HostCapsObj.RegisterSimpleHandler("UpdateMaterialTaskInventory", oreq, false); // a object inv
oreq = new SimpleOSDMapHandler("POST", GetNewCapPath(), UpdateGestureItemAsset);
m_HostCapsObj.RegisterSimpleHandler("UpdateGestureAgentInventory", oreq, true);
m_HostCapsObj.RegisterSimpleHandler("UpdateGestureTaskInventory", oreq, false);

View file

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

File diff suppressed because it is too large Load diff

View file

@ -26,16 +26,14 @@
*/
using System;
using System.Text;
using System.Runtime.CompilerServices;
using OpenSim.Framework;
using Nini.Config;
using OpenMetaverse;
namespace OpenSim.Region.ClientStack.LindenUDP
{
public sealed class LLUDPZeroEncoder
public class LLUDPZeroEncoder
{
private byte[] m_tmp = new byte[16];
private byte[] m_dest;
private int zerocount;
private int pos;
@ -86,10 +84,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe void AddZeros(int len)
{
zerocount += len;
while (zerocount > 255)
while (zerocount > 0xff)
{
m_dest[pos++] = 0x00;
m_dest[pos++] = 0xff;
@ -97,9 +96,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe int Finish()
{
if(zerocount > 0)
if (zerocount > 0)
{
m_dest[pos++] = 0x00;
m_dest[pos++] = (byte)zerocount;
@ -113,12 +113,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
if (src[i] == 0x00)
{
zerocount++;
if (zerocount == 0)
if (zerocount != 0xff)
zerocount++;
else
{
m_dest[pos++] = 0x00;
m_dest[pos++] = 0xff;
zerocount++;
zerocount = 1;
}
}
else
@ -141,12 +142,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
if (src[i] == 0x00)
{
zerocount++;
if (zerocount == 0)
if (zerocount != 0xff)
zerocount++;
else
{
m_dest[pos++] = 0x00;
m_dest[pos++] = 0xff;
zerocount++;
zerocount = 1;
}
}
else
@ -167,12 +169,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
if (v == 0x00)
{
zerocount++;
if (zerocount == 0)
if (zerocount != 0xff)
zerocount++;
else
{
m_dest[pos++] = 0x00;
m_dest[pos++] = 0xff;
zerocount++;
zerocount = 1;
}
}
else
@ -188,124 +191,149 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
}
public void AddInt16(short v)
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe void AddInt16(short v)
{
if (v == 0)
AddZeros(2);
else
{
Utils.Int16ToBytes(v, m_tmp, 0);
AddBytes(m_tmp, 2);
byte* b = stackalloc byte[2];
Utils.Int16ToBytes(v, b);
AddBytes(b, 2);
}
}
public void AddUInt16(ushort v)
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe void AddUInt16(ushort v)
{
if (v == 0)
AddZeros(2);
else
{
Utils.UInt16ToBytes(v, m_tmp, 0);
AddBytes(m_tmp, 2);
byte* b = stackalloc byte[2];
Utils.UInt16ToBytes(v, b);
AddBytes(b, 2);
}
}
public void AddInt(int v)
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe void AddInt(int v)
{
if (v == 0)
AddZeros(4);
else
{
Utils.IntToBytesSafepos(v, m_tmp, 0);
AddBytes(m_tmp, 4);
byte* b = stackalloc byte[4];
Utils.IntToBytes(v, b);
AddBytes(b, 4);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe void AddUInt(uint v)
{
if (v == 0)
AddZeros(4);
else
{
Utils.UIntToBytesSafepos(v, m_tmp, 0);
AddBytes(m_tmp, 4);
byte* b = stackalloc byte[4];
Utils.UIntToBytes(v, b);
AddBytes(b, 4);
}
}
public void AddFloatToUInt16(float v, float range)
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe void AddFloatToUInt16(float v, float range)
{
Utils.FloatToUInt16Bytes(v, range, m_tmp, 0);
AddBytes(m_tmp, 2);
byte* b = stackalloc byte[2];
Utils.FloatToUInt16Bytes(v, range, b);
AddBytes(b, 2);
}
public void AddFloat(float v)
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe void AddFloat(float v)
{
if (v == 0f)
AddZeros(4);
else
{
Utils.FloatToBytesSafepos(v, m_tmp, 0);
AddBytes(m_tmp, 4);
byte* b = stackalloc byte[4];
Utils.FloatToBytes(v, b);
AddBytes(b, 4);
}
}
public void AddInt64(long v)
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe void AddInt64(long v)
{
if (v == 0)
AddZeros(8);
else
{
Utils.Int64ToBytesSafepos(v, m_tmp, 0);
AddBytes(m_tmp, 8);
byte* b = stackalloc byte[8];
Utils.Int64ToBytes(v, b);
AddBytes(b, 8);
}
}
public void AddUInt64(ulong v)
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe void AddUInt64(ulong v)
{
if (v == 0)
AddZeros(8);
else
{
Utils.UInt64ToBytesSafepos(v, m_tmp, 0);
AddBytes(m_tmp, 8);
byte* b = stackalloc byte[8];
Utils.UInt64ToBytes(v, b);
AddBytes(b, 8);
}
}
public void AddVector3(Vector3 v)
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe void AddVector3(Vector3 v)
{
if (v.IsZero())
AddZeros(12);
else
{
v.ToBytes(m_tmp, 0);
AddBytes(m_tmp, 12);
byte* b = stackalloc byte[12];
v.ToBytes(b);
AddBytes(b, 12);
}
}
public void AddVector4(Vector4 v)
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe void AddVector4(Vector4 v)
{
if (v.IsZero())
AddZeros(16);
else
{
v.ToBytes(m_tmp, 0);
AddBytes(m_tmp, 16);
byte* b = stackalloc byte[16];
v.ToBytes(b);
AddBytes(b, 16);
}
}
public void AddNormQuat(Quaternion v)
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe void AddNormQuat(Quaternion v)
{
v.ToBytes(m_tmp, 0);
AddBytes(m_tmp, 12);
byte* b = stackalloc byte[12];
v.ToBytes(b);
AddBytes(b, 12);
}
public void AddUUID(UUID v)
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe void AddUUID(UUID v)
{
v.ToBytes(m_tmp, 0);
AddBytes(m_tmp, 16);
byte* b = stackalloc byte[16];
v.ToBytes(b);
AddBytes(b, 16);
}
// maxlen <= 255 and includes null termination byte
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe void AddShortString(string str, int maxlen)
{
if (String.IsNullOrEmpty(str))
@ -328,6 +356,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
// maxlen <= 255 and includes null termination byte, maxchars == max len of utf16 source
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe void AddShortString(string str, int maxchars, int maxlen)
{
if (String.IsNullOrEmpty(str))
@ -353,9 +382,380 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
// maxlen <= 254 because null termination byte
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe void AddShortLimitedUTF8(osUTF8 str)
{
if(str == null)
if (str == null)
{
AddZeros(1);
return;
}
int len = str.Length;
if (len == 0)
{
AddZeros(1);
return;
}
AddByte((byte)(len + 1)); // add null
AddBytes(str.GetArray(), len);
AddZeros(1);
}
}
public unsafe class LLUDPUnsafeZeroEncoder
{
private byte* m_destStart;
private int m_zerocount;
private byte* m_dest;
public LLUDPUnsafeZeroEncoder()
{
}
public LLUDPUnsafeZeroEncoder(byte* data)
{
m_destStart = data;
m_dest = data;
m_zerocount = 0;
}
public byte* Data
{
get
{
return m_destStart;
}
set
{
m_destStart = value;
m_dest = value;
}
}
public int ZeroCount
{
get
{
return m_zerocount;
}
set
{
m_zerocount = value;
}
}
public int Position
{
get
{
return (int)(m_dest - m_destStart);
}
set
{
m_dest = m_destStart + value;
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe void AddZeros(int len)
{
m_zerocount += len;
while (m_zerocount > 0xff)
{
*m_dest++ = 0x00;
*m_dest++ = 0xff;
m_zerocount -= 256;
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe int Finish()
{
if (m_zerocount > 0)
{
*m_dest++ = 0x00;
*m_dest++ = (byte)m_zerocount;
}
return (int)(m_dest - m_destStart);
}
public unsafe void AddBytes(byte[] src, int srclen)
{
for (int i = 0; i < srclen; ++i)
{
if (src[i] == 0x00)
{
if (m_zerocount != 0xff)
m_zerocount++;
else
{
*m_dest++ = 0x00;
*m_dest++ = 0xff;
m_zerocount = 1;
}
}
else
{
if (m_zerocount != 0)
{
*m_dest++ = 0x00;
*m_dest++ = (byte)m_zerocount;
m_zerocount = 0;
}
*m_dest++ = src[i];
}
}
}
public unsafe void AddBytes(byte* src, int srclen)
{
for (int i = 0; i < srclen; ++i)
{
if (src[i] == 0x00)
{
if (m_zerocount != 0xff)
m_zerocount++;
else
{
*m_dest++ = 0x00;
*m_dest++ = 0xff;
m_zerocount = 1;
}
}
else
{
if (m_zerocount != 0)
{
*m_dest++ = 0x00;
*m_dest++ = (byte)m_zerocount;
m_zerocount = 0;
}
*m_dest++ = src[i];
}
}
}
public unsafe void AddByte(byte v)
{
if (v == 0x00)
{
if (m_zerocount != 0xff)
m_zerocount++;
else
{
*m_dest++ = 0x00;
*m_dest++ = 0xff;
m_zerocount = 1;
}
}
else
{
if (m_zerocount != 0)
{
*m_dest++ = 0x00;
*m_dest++ = (byte)m_zerocount;
m_zerocount = 0;
}
*m_dest++ = v;
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void AddInt16(short v)
{
if (v == 0)
AddZeros(2);
else
{
byte* b = stackalloc byte[2];
Utils.Int16ToBytes(v, b);
AddBytes(b, 2);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void AddUInt16(ushort v)
{
if (v == 0)
AddZeros(2);
else
{
byte* b = stackalloc byte[2];
Utils.UInt16ToBytes(v, b);
AddBytes(b, 2);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void AddInt(int v)
{
if (v == 0)
AddZeros(4);
else
{
byte* b = stackalloc byte[4];
Utils.IntToBytes(v, b);
AddBytes(b, 4);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe void AddUInt(uint v)
{
if (v == 0)
AddZeros(4);
else
{
byte* b = stackalloc byte[4];
Utils.UIntToBytes(v, b);
AddBytes(b, 4);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void AddFloatToUInt16(float v, float range)
{
byte* b = stackalloc byte[2];
Utils.FloatToUInt16Bytes(v, range, b);
AddBytes(b, 2);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void AddFloat(float v)
{
if (v == 0f)
AddZeros(4);
else
{
byte* b = stackalloc byte[4];
Utils.FloatToBytes(v, b);
AddBytes(b, 4);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void AddInt64(long v)
{
if (v == 0)
AddZeros(8);
else
{
byte* b = stackalloc byte[8];
Utils.Int64ToBytes(v, b);
AddBytes(b, 8);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void AddUInt64(ulong v)
{
if (v == 0)
AddZeros(8);
else
{
byte* b = stackalloc byte[8];
Utils.UInt64ToBytes(v, b);
AddBytes(b, 8);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void AddVector3(Vector3 v)
{
if (v.IsZero())
AddZeros(12);
else
{
byte* b = stackalloc byte[12];
v.ToBytes(b);
AddBytes(b, 12);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void AddVector4(Vector4 v)
{
if (v.IsZero())
AddZeros(16);
else
{
byte* b = stackalloc byte[16];
v.ToBytes(b);
AddBytes(b, 16);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void AddNormQuat(Quaternion v)
{
byte* b = stackalloc byte[12];
v.ToBytes(b);
AddBytes(b, 12);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void AddUUID(UUID v)
{
byte* b = stackalloc byte[16];
v.ToBytes(b);
AddBytes(b, 16);
}
// maxlen <= 255 and includes null termination byte
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe void AddShortString(string str, int maxlen)
{
if (String.IsNullOrEmpty(str))
{
AddZeros(1);
return;
}
byte* data = stackalloc byte[maxlen];
int len = Util.osUTF8Getbytes(str, data, maxlen, true);
if (len == 0)
{
AddZeros(1);
return;
}
AddByte((byte)(len));
AddBytes(data, len);
}
// maxlen <= 255 and includes null termination byte, maxchars == max len of utf16 source
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe void AddShortString(string str, int maxchars, int maxlen)
{
if (String.IsNullOrEmpty(str))
{
AddZeros(1);
return;
}
if (str.Length > maxchars)
str = str.Substring(0, maxchars);
byte* data = stackalloc byte[maxlen];
int len = Util.osUTF8Getbytes(str, data, maxlen, true);
if (len == 0)
{
AddZeros(1);
return;
}
AddByte((byte)(len));
AddBytes(data, len);
}
// maxlen <= 254 because null termination byte
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe void AddShortLimitedUTF8(osUTF8 str)
{
if (str == null)
{
AddZeros(1);
return;

View file

@ -166,8 +166,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
// m_log.DebugFormat(
// "[TRANSACTIONS MANAGER] Called HandleItemCreationFromTransaction with item {0}", name);
AgentAssetTransactions transactions =
GetUserTransactions(remoteClient.AgentId);
AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId);
return transactions.RequestCreateInventoryItem(remoteClient, transactionID,
folderID, callbackID, description, name, invType, type,

View file

@ -477,24 +477,25 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
m_Scene.AssetService.Store(m_asset);
InventoryItemBase item = new InventoryItemBase();
item.Owner = ourClient.AgentId;
item.CreatorId = ourClient.AgentId.ToString();
item.ID = UUID.Random();
item.AssetID = m_asset.FullID;
item.Description = m_description;
item.Name = m_name;
item.AssetType = type;
item.InvType = invType;
item.Folder = InventFolder;
item.BasePermissions = (uint)(PermissionMask.All | PermissionMask.Export);
item.CurrentPermissions = item.BasePermissions;
item.GroupPermissions=0;
item.EveryOnePermissions=0;
item.NextPermissions = nextPerm;
item.Flags = (uint) wearableType;
item.CreationDate = Util.UnixTimeSinceEpoch();
InventoryItemBase item = new InventoryItemBase
{
Owner = ourClient.AgentId,
CreatorId = ourClient.AgentId.ToString(),
ID = UUID.Random(),
AssetID = m_asset.FullID,
Description = m_description,
Name = m_name,
AssetType = type,
InvType = invType,
Folder = InventFolder,
BasePermissions = (uint)(PermissionMask.All | PermissionMask.Export),
CurrentPermissions = (uint)(PermissionMask.All | PermissionMask.Export),
GroupPermissions =0,
EveryOnePermissions=0,
NextPermissions = nextPerm,
Flags = wearableType,
CreationDate = Util.UnixTimeSinceEpoch()
};
m_log.DebugFormat("[XFER]: Created item {0} with asset {1}",
item.ID, item.AssetID);

View file

@ -1656,7 +1656,6 @@ namespace OpenSim.Region.CoreModules.Asset
public void Get(string id, string ForeignAssetService, bool StoreOnLocalGrid, SimpleAssetRetrieved callBack)
{
return;
}
public bool[] AssetsExist(string[] ids)

View file

@ -1260,7 +1260,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
return null;
}
bool ItemIDNotZero = !itemID.IsZero();
bool ItemIDNotZero = itemID.IsNotZero();
if (ItemIDNotZero)
objatt = m_invAccessModule.RezObject(sp.ControllingClient,

View file

@ -1687,10 +1687,9 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
}
// flush cache
UserProfileCacheEntry uce = null;
lock(m_profilesCache)
{
if(m_profilesCache.TryGetValue(remoteClient.AgentId, out uce) && uce != null)
if(m_profilesCache.TryGetValue(remoteClient.AgentId, out UserProfileCacheEntry uce) && uce != null)
{
uce.props = null;
uce.ClientsWaitingProps = null;

View file

@ -2774,18 +2774,35 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
public virtual bool HandleIncomingSceneObject(SceneObjectGroup so, Vector3 newPosition)
{
if (so.OwnerID.IsZero())
{
m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: Denied object {0}({1}) entry into {2} because ownerID is zero",
so.Name, so.UUID, m_sceneName);
return false;
}
// If the user is banned, we won't let any of their objects
// enter. Period.
//
if (m_sceneRegionInfo.EstateSettings.IsBanned(so.OwnerID))
{
m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: Denied prim crossing of {0} {1} into {2} for banned avatar {3}",
so.Name, so.UUID, m_sceneName, so.OwnerID);
"[ENTITY TRANSFER MODULE]: Denied {0} {1} into {2} of banned owner {3}",
so.Name, so.UUID, m_sceneName, so.OwnerID);
return false;
}
if(so.IsAttachmentCheckFull())
{
if(m_scene.GetScenePresence(so.OwnerID) == null)
{
m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: Denied attachment {0}({1}) owner {2} not in region {3}",
so.Name, so.UUID, so.OwnerID, m_sceneName);
return false;
}
}
if (!newPosition.IsZero())
so.RootPart.GroupPosition = newPosition;

View file

@ -289,6 +289,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
};
bool success = connector.LoginAgentToGrid(source, agentCircuit, reg, finalDestination, false, out reason);
//logout = success & !isLocal; // flag for later logout from this grid; this is an HG TP
logout = success; // flag for later logout from this grid; this is an HG TP
if (success)
@ -647,6 +648,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
public override bool HandleIncomingSceneObject(SceneObjectGroup so, Vector3 newPosition)
{
UUID OwnerID = so.OwnerID;
if (OwnerID.IsZero())
{
m_log.DebugFormat(
"[HG TRANSFER MODULE]: Denied object {0}({1}) entry into {2} because ownerID is zero",
so.Name, so.UUID, m_sceneName);
return false;
}
if (m_sceneRegionInfo.EstateSettings.IsBanned(OwnerID))
{
m_log.DebugFormat(
@ -661,9 +670,25 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
return base.HandleIncomingSceneObject(so, newPosition);
// Equally, we can't use so.AttachedAvatar here.
if (OwnerID.IsZero() || m_scene.UserManagementModule.IsLocalGridUser(OwnerID))
if (m_scene.UserManagementModule.IsLocalGridUser(OwnerID))
return base.HandleIncomingSceneObject(so, newPosition);
if (m_scene.GetScenePresence(OwnerID) == null)
{
m_log.DebugFormat(
"[HG TRANSFER MODULE]: Denied attachment {0}({1}) owner {2} not in region {3}",
so.Name, so.UUID, OwnerID, m_sceneName);
return false;
}
if (!m_scene.AddSceneObject(so))
{
m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: Problem adding scene object {0} {1} into {2} ",
so.Name, so.UUID, m_sceneName);
return false;
}
// foreign user
AgentCircuitData aCircuit = m_scene.AuthenticateHandler.GetAgentCircuitData(OwnerID);
if (aCircuit != null)
@ -683,9 +708,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
() =>
{
string url = aCircuit.ServiceURLs["AssetServerURI"].ToString();
// m_log.DebugFormat(
// "[HG ENTITY TRANSFER MODULE]: Incoming attachment {0} for HG user {1} with asset service {2}",
// so.Name, so.AttachedAvatar, url);
//m_log.DebugFormat(
// "[HG ENTITY TRANSFER MODULE]: Incoming attachment {0} for HG user {1} with asset service {2}",
// so.Name, so.AttachedAvatar, url);
IDictionary<UUID, sbyte> ids = new Dictionary<UUID, sbyte>();
HGUuidGatherer uuidGatherer = new HGUuidGatherer(m_scene.AssetService, url, ids);
@ -696,9 +721,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
int tickStart = Util.EnvironmentTickCount();
uuidGatherer.GatherNext();
// m_log.DebugFormat(
// "[HG ENTITY TRANSFER]: Gathered attachment asset uuid {0} for object {1} for HG user {2} took {3} ms with asset service {4}",
// nextUuid, so.Name, so.OwnerID, Util.EnvironmentTickCountSubtract(tickStart), url);
//m_log.DebugFormat(
// "[HG ENTITY TRANSFER]: Gathered attachment asset uuid {0} for object {1} for HG user {2} took {3} ms with asset service {4}",
// nextUuid, so.Name, so.OwnerID, Util.EnvironmentTickCountSubtract(tickStart), url);
int ticksElapsed = Util.EnvironmentTickCountSubtract(tickStart);
@ -713,9 +738,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
}
}
// m_log.DebugFormat(
// "[HG ENTITY TRANSFER]: Fetching {0} assets for attachment {1} for HG user {2} with asset service {3}",
// ids.Count, so.Name, so.OwnerID, url);
//m_log.DebugFormat(
// "[HG ENTITY TRANSFER]: Fetching {0} assets for attachment {1} for HG user {2} with asset service {3}",
// ids.Count, so.Name, so.OwnerID, url);
foreach (UUID id in ids.Keys)
{
@ -742,9 +767,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
aCircuit = null;
uuidGatherer = null;
// m_log.DebugFormat(
// "[HG ENTITY TRANSFER MODULE]: Completed incoming attachment {0} for HG user {1} with asset server {2}",
// so.Name, so.OwnerID, url);
//m_log.DebugFormat(
// "[HG ENTITY TRANSFER MODULE]: Completed incoming attachment {0} for HG user {1} with asset server {2}",
// so.Name, so.OwnerID, url);
},
OwnerID.ToString());
}
@ -792,6 +817,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
foreach (SceneObjectGroup defso in deftatt)
{
if(defso.OwnerID.NotEqual(defsp.UUID))
{
m_log.ErrorFormat(
"[HG TRANSFER MODULE] attachment {0}({1} owner {2} does not match HG avatarID {3}",
defso.Name, defso.UUID, defso.OwnerID, defsp.UUID);
continue;
}
uuidGatherer.AddForInspection(defso);
while (!uuidGatherer.Complete)
{

View file

@ -521,7 +521,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
if (!m_OutboundPermission && !UserManagementModule.IsLocalGridUser(sp.UUID))
{
if (sog.OwnerID == sp.UUID)
if (sog.OwnerID.Equals(sp.UUID))
return true;
return false;
}

View file

@ -27,15 +27,10 @@
using System;
using System.Collections.Generic;
using System.Net;
using System.Xml;
using System.Globalization;
using System.Reflection;
using System.Text;
using System.Threading;
using OpenSim.Framework;
using OpenSim.Framework.Capabilities;
using OpenSim.Framework.Client;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Framework.Scenes.Serialization;
@ -161,7 +156,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
#endregion
private readonly byte[] DEFAULTSCRIPT = osUTF8.GetASCIIBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n}");
//private readonly byte[] DEFAULTSCRIPT = osUTF8.GetASCIIBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n}");
#region Inventory Access
/// <summary>
@ -213,29 +208,36 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
}
}
ScenePresence presence;
if (m_Scene.TryGetScenePresence(remoteClient.AgentId, out presence))
if (m_Scene.TryGetScenePresence(remoteClient.AgentId, out ScenePresence presence))
{
byte[] data = null;
uint everyonemask = 0;
uint groupmask = 0;
uint flags = 0;
if (invType == (sbyte)InventoryType.Landmark && presence != null)
{
string suffix = string.Empty, prefix = string.Empty;
string strdata = GenerateLandmark(presence, out prefix, out suffix);
data = Encoding.ASCII.GetBytes(strdata);
string strdata = GenerateLandmark(presence, out string prefix, out string suffix);
byte[] data = osUTF8.GetASCIIBytes(strdata);
name = prefix + name;
description += suffix;
groupmask = (uint)PermissionMask.AllAndExport;
everyonemask = (uint)(PermissionMask.AllAndExport & ~PermissionMask.Modify);
everyonemask = (uint)(PermissionMask.AllAndExport & ~PermissionMask.Modify);
AssetBase asset = m_Scene.CreateAsset(name, description, assetType, data, remoteClient.AgentId);
m_Scene.AssetService.Store(asset);
m_Scene.CreateNewInventoryItem(
remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID,
name, description, flags, callbackID, asset.FullID, asset.Type, invType,
(uint)PermissionMask.AllAndExport, (uint)PermissionMask.AllAndExport,
everyonemask, nextOwnerMask, groupmask,
creationDate, false); // Data from viewer
return;
}
if(assetType == (sbyte)AssetType.Settings)
switch (assetType)
{
flags = subType;
if (data == null)
case (sbyte)AssetType.Settings:
{
flags = subType;
IEnvironmentModule envModule = m_Scene.RequestModuleInterface<IEnvironmentModule>();
if(envModule == null)
return;
@ -254,25 +256,41 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
creationDate, false); // Data from viewer
return;
}
}
else if( assetType == (byte)AssetType.LSLText)
{
if(data == null)
data = DEFAULTSCRIPT;
}
else if( assetType == (byte)AssetType.Clothing ||
assetType == (byte)AssetType.Bodypart)
flags = subType;
case (sbyte)AssetType.LSLText:
{
m_Scene.CreateNewInventoryItem(
remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID,
name, description, flags, callbackID, Constants.DefaultScriptID, (sbyte)AssetType.LSLText, invType,
(uint)PermissionMask.AllAndExport, (uint)PermissionMask.AllAndExport,
everyonemask, nextOwnerMask, groupmask,
creationDate, false); // Data from viewer
return;
}
case (sbyte)AssetType.Notecard:
{
m_Scene.CreateNewInventoryItem(
remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID,
name, description, flags, callbackID, Constants.EmptyNotecardID, (sbyte)AssetType.Notecard, invType,
(uint)PermissionMask.AllAndExport, (uint)PermissionMask.AllAndExport,
everyonemask, nextOwnerMask, groupmask,
creationDate, false); // Data from viewer
return;
}
case (sbyte)AssetType.Clothing:
case (sbyte)AssetType.Bodypart:
flags = subType;
break;
default:
break;
}
AssetBase asset = m_Scene.CreateAsset(name, description, assetType, data, remoteClient.AgentId);
m_Scene.AssetService.Store(asset);
m_Scene.CreateNewInventoryItem(
remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID,
name, description, flags, callbackID, asset.FullID, asset.Type, invType,
(uint)PermissionMask.AllAndExport, // Base
(uint)PermissionMask.AllAndExport, // Current
everyonemask,
nextOwnerMask, groupmask, creationDate, false); // Data from viewer
name, description, flags, callbackID, UUID.Zero, assetType, invType,
(uint)PermissionMask.AllAndExport, (uint)PermissionMask.AllAndExport,
everyonemask, nextOwnerMask, groupmask,
creationDate, false); // Data from viewer
}
else
{
@ -287,7 +305,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
prefix = string.Empty;
suffix = string.Empty;
Vector3 pos = presence.AbsolutePosition;
return String.Format(Culture.FormatProvider, "Landmark version 2\nregion_id {0}\nlocal_pos {1} {2} {3}\nregion_handle {4}\n",
return String.Format(CultureInfo.InvariantCulture.NumberFormat, "Landmark version 2\nregion_id {0}\nlocal_pos {1} {2} {3}\nregion_handle {4}\n",
presence.Scene.RegionInfo.RegionID,
pos.X, pos.Y, pos.Z,
presence.RegionHandle);
@ -370,7 +388,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
}
case InventoryType.Settings:
{
if((item.CurrentPermissions & (uint)PermissionMask.Modify) == 0)
if ((item.CurrentPermissions & (uint)PermissionMask.Modify) == 0)
{
remoteClient.SendAgentAlertMessage("Insufficient permissions to edit setting", false);
return UUID.Zero;
@ -379,6 +397,17 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
remoteClient.SendAlertMessage("Setting updated");
break;
}
case InventoryType.Material:
{
if ((item.CurrentPermissions & (uint)PermissionMask.Modify) == 0)
{
remoteClient.SendAgentAlertMessage("Insufficient permissions to edit setting", false);
return UUID.Zero;
}
remoteClient.SendAlertMessage("Material updated");
break;
}
}
AssetBase asset =
@ -964,25 +993,18 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
byte bRayEndIsIntersection = (byte)(RayEndIsIntersection ? 1 : 0);
Vector3 pos;
bool single
= m_Scene.GetObjectsToRez(
bool single = m_Scene.GetObjectsToRez(
rezAsset.Data, attachment, out objlist, out veclist, out bbox, out offsetHeight);
pos = m_Scene.GetNewRezLocation(RayStart, RayEnd,
RayTargetID, Quaternion.Identity,
BypassRayCast, bRayEndIsIntersection, true,
bbox, false);
if (single)
{
pos = m_Scene.GetNewRezLocation(
RayStart, RayEnd, RayTargetID, Quaternion.Identity,
BypassRayCast, bRayEndIsIntersection, true, bbox, false);
pos.Z += offsetHeight;
}
else
{
pos = m_Scene.GetNewRezLocation(RayStart, RayEnd,
RayTargetID, Quaternion.Identity,
BypassRayCast, bRayEndIsIntersection, true,
bbox, false);
pos -= bbox / 2;
}
int primcount = 0;
if(attachment)
@ -1008,7 +1030,6 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
primcount += g.PrimCount;
}
if (!m_Scene.Permissions.CanRezObject(
primcount, remoteClient.AgentId, pos)
&& !attachment)
@ -1017,13 +1038,12 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
// have already removed the item from the folder
// if it's no copy.
// Put it back if it's not an attachment
//
if (item != null)
{
if (((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) && (!attachment))
remoteClient.SendBulkUpdateInventory(item);
}
return null;
}

View file

@ -709,29 +709,57 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
else
{
string location = response.Headers["Location"];
if (location == null)
{
Status = 499;//ClientErrorJoker;
ResponseBody = "HTTP redirect code but no location header";
RequestModule.GotCompletedRequest(this);
}
else if (!RequestModule.CheckAllowed(new Uri(location)))
{
Status = 499;//ClientErrorJoker;
ResponseBody = "URL from HTTP redirect blocked: " + location;
RequestModule.GotCompletedRequest(this);
}
else
{
Status = 0;
Url = location;
Redirects++;
ResponseBody = null;
if(Uri.TryCreate(location, UriKind.RelativeOrAbsolute, out Uri locationUri))
{
bool validredir = true;
if(!locationUri.IsAbsoluteUri)
{
string newloc = response.ResponseUri.Scheme +"://" + response.ResponseUri.DnsSafeHost + ":" +
response.ResponseUri.Port +"/" + location;
if (!Uri.TryCreate(newloc, UriKind.RelativeOrAbsolute, out locationUri))
{
Status = 499;//ClientErrorJoker;
ResponseBody = "HTTP redirect code but invalid location header";
RequestModule.GotCompletedRequest(this);
validredir = false;
}
location = newloc;
}
if(validredir)
{
if (!RequestModule.CheckAllowed(locationUri))
{
Status = 499;//ClientErrorJoker;
ResponseBody = "URL from HTTP redirect blocked: " + location;
RequestModule.GotCompletedRequest(this);
}
else
{
Status = 0;
Url = location;
Redirects++;
ResponseBody = null;
//m_log.DebugFormat("Redirecting to [{0}]", Url);
//m_log.DebugFormat("Redirecting to [{0}]", Url);
Process();
Process();
}
}
}
else
{
Status = 499;//ClientErrorJoker;
ResponseBody = "HTTP redirect code but invalid location header";
RequestModule.GotCompletedRequest(this);
}
}
}
}

View file

@ -49,9 +49,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Profile
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LocalUserProfilesServicesConnector")]
public class LocalUserProfilesServicesConnector : ISharedRegionModule
{
private static readonly ILog m_log =
LogManager.GetLogger(
MethodBase.GetCurrentMethod().DeclaringType);
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private Dictionary<UUID, Scene> regions = new Dictionary<UUID, Scene>();

View file

@ -43,9 +43,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LocalAuthorizationServicesConnector")]
public class LocalAuthorizationServicesConnector : INonSharedRegionModule, IAuthorizationService
{
private static readonly ILog m_log =
LogManager.GetLogger(
MethodBase.GetCurrentMethod().DeclaringType);
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private IAuthorizationService m_AuthorizationService;
private Scene m_Scene;
@ -106,7 +104,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization
if (!m_Enabled)
return;
m_AuthorizationService = new AuthorizationService(m_AuthorizationConfig, m_Scene);
m_AuthorizationService = new AuthorizationService(m_AuthorizationConfig, scene);
m_log.InfoFormat(
"[AUTHORIZATION CONNECTOR]: Enabled local authorization for region {0}",

View file

@ -152,7 +152,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
{
foreach (Scene s in m_Scenes)
{
if (s.RegionInfo.RegionID == RegionID)
if (s.RegionInfo.RegionID.Equals(RegionID))
return s;
}

View file

@ -1424,24 +1424,28 @@ namespace OpenSim.Region.CoreModules.World.Land
if (currentParcel == null)
continue;
LandData currentParcelLandData = currentParcel.LandData;
if (currentParcelLandData == null)
continue;
// types
if (currentParcel.LandData.OwnerID.Equals(remote_client.AgentId))
if (currentParcelLandData.OwnerID.Equals(remote_client.AgentId))
{
//Owner Flag
curByte = LandChannel.LAND_TYPE_OWNED_BY_REQUESTER;
}
else if (currentParcel.LandData.IsGroupOwned && remote_client.IsGroupMember(currentParcel.LandData.GroupID))
else if (currentParcelLandData.IsGroupOwned && remote_client.IsGroupMember(currentParcelLandData.GroupID))
{
curByte = LandChannel.LAND_TYPE_OWNED_BY_GROUP;
}
else if (currentParcel.LandData.SalePrice > 0 &&
(currentParcel.LandData.AuthBuyerID.IsZero() ||
currentParcel.LandData.AuthBuyerID.Equals(remote_client.AgentId)))
else if (currentParcelLandData.SalePrice > 0 &&
(currentParcelLandData.AuthBuyerID.IsZero() ||
currentParcelLandData.AuthBuyerID.Equals(remote_client.AgentId)))
{
//Sale type
curByte = LandChannel.LAND_TYPE_IS_FOR_SALE;
}
else if (currentParcel.LandData.OwnerID.IsZero())
else if (currentParcelLandData.OwnerID.IsZero())
{
//Public type
curByte = LandChannel.LAND_TYPE_PUBLIC; // this does nothing, its zero

View file

@ -216,7 +216,7 @@ namespace OpenSim.Region.CoreModules.World.Land
if (obj.IsSelected || obj.GetSittingAvatarsCount() > 0)
parcelCounts.Selected += partCount;
if (obj.OwnerID == landData.OwnerID)
if (obj.OwnerID.Equals(landData.OwnerID))
parcelCounts.Owner += partCount;
else if (!landData.GroupID.IsZero() && obj.GroupID.Equals(landData.GroupID))
parcelCounts.Group += partCount;

View file

@ -355,7 +355,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
return;
Predicate<SceneObjectGroup> searchPredicate
= so => so.OwnerID == ownerID && !so.IsAttachment;
= so => so.OwnerID.Equals(ownerID) && !so.IsAttachment;
OutputSogsToConsole(searchPredicate, showFull);
}
@ -762,7 +762,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
m_scene.ForEachSOG(delegate (SceneObjectGroup g)
{
if (g.OwnerID == match && !g.IsAttachment)
if (g.OwnerID.Equals(match) && !g.IsAttachment)
deletes.Add(g);
});

View file

@ -2060,7 +2060,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return false;
}
if(sog.OwnerID != sp.UUID && (perms & (uint)PermissionMask.Transfer) == 0)
if(sog.OwnerID.NotEqual(sp.UUID) && (perms & (uint)PermissionMask.Transfer) == 0)
return false;
return true;
}

View file

@ -1224,7 +1224,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
return ret;
ScenePresence presence = pups.Presence;
if (presence == null)
if (presence == null || presence.IsDeleted)
return ret;
float minz = presence.AbsolutePosition.Z;
@ -1235,9 +1235,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
if (minz > 1500f)
return ret;
int DrawDistance = (int)presence.DrawDistance;
DrawDistance = DrawDistance / Constants.TerrainPatchSize;
int DrawDistance = (int)presence.DrawDistance / Constants.TerrainPatchSize;
int testposX;
int testposY;
@ -1253,8 +1251,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain
testposX = (int)presence.AbsolutePosition.X / Constants.TerrainPatchSize;
testposY = (int)presence.AbsolutePosition.Y / Constants.TerrainPatchSize;
}
int limitX = (int)m_scene.RegionInfo.RegionSizeX / Constants.TerrainPatchSize;
int limitY = (int)m_scene.RegionInfo.RegionSizeY / Constants.TerrainPatchSize;
int limitX = pups.xsize;
int limitY = pups.ysize;
// Compute the area of patches within our draw distance
int startX = testposX - DrawDistance;
@ -1307,7 +1305,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
if (npatchs++ > 1024)
{
y = endY;
x = endX;
break;
}
}
}

View file

@ -203,14 +203,15 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
m_primMesher = RenderingLoader.LoadRenderer(renderers[0]);
}
viewWitdh = (int)m_scene.RegionInfo.RegionSizeX;
viewHeight = (int)m_scene.RegionInfo.RegionSizeY;
cameraPos = new Vector3(
(m_scene.RegionInfo.RegionSizeX) * 0.5f,
(m_scene.RegionInfo.RegionSizeY) * 0.5f,
viewWitdh * 0.5f,
viewHeight * 0.5f,
m_cameraHeight);
cameraDir = -Vector3.UnitZ;
viewWitdh = (int)m_scene.RegionInfo.RegionSizeX;
viewHeight = (int)m_scene.RegionInfo.RegionSizeY;
orto = true;
Bitmap tile = GenImage();
@ -341,9 +342,8 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
int bitWidth;
int bitHeight;
const double log2inv = 1.4426950408889634073599246810019;
bitWidth = (int)Math.Ceiling((Math.Log(terrain.Width) * log2inv));
bitHeight = (int)Math.Ceiling((Math.Log(terrain.Height) * log2inv));
bitWidth = Util.intLog2((uint)terrain.Width);
bitHeight = Util.intLog2((uint)terrain.Height);
if (bitWidth > 8) // more than 256 is very heavy :(
bitWidth = 8;

View file

@ -101,6 +101,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
protected bool m_exportPrintRegionName = false; // prints the region name exported map
protected bool m_localV1MapAssets = false; // keep V1 map assets only on local cache
private readonly object m_sceneLock = new object();
public WorldMapModule()
{
}
@ -146,7 +147,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
string[] configSections = new string[] { "Map", "Startup" };
if (Util.GetConfigVarFromSections<string>(
config, "WorldMapModule", configSections, "WorldMap") == "WorldMap")
config, "WorldMapModule", configSections, "WorldMap") == "WorldMap")
m_Enabled = true;
expireBlackListTime = (int)Util.GetConfigVarFromSections<int>(config, "BlacklistTimeout", configSections, 10 * 60);
@ -164,7 +165,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
if (!m_Enabled)
return;
lock (scene)
lock (m_sceneLock)
{
m_scene = scene;
m_regionHandle = scene.RegionInfo.RegionHandle;
@ -195,7 +196,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
if (!m_Enabled)
return;
lock (m_scene)
lock (m_sceneLock)
{
m_Enabled = false;
RemoveHandlers();
@ -1321,7 +1322,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
g.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
g.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.None;
g.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;
SolidBrush sea = new SolidBrush(Color.DarkBlue);
g.FillRectangle(sea, 0, 0, spanX, spanY);
@ -1421,8 +1422,10 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
public void HandleGenerateMapConsoleCommand(string module, string[] cmdparams)
{
Scene consoleScene = m_scene.ConsoleScene();
if(m_scene == null)
return;
Scene consoleScene = m_scene.ConsoleScene();
if (consoleScene != null && consoleScene != m_scene)
return;

View file

@ -30,18 +30,13 @@ using System.Collections.Generic;
using System.Collections;
using System.Reflection;
using System.Text;
using System.Threading;
using System.Timers;
using System.Xml;
using OpenMetaverse;
using OpenMetaverse.Packets;
using log4net;
using OpenSim.Framework;
using OpenSim.Framework.Serialization.External;
using OpenSim.Region.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes.Serialization;
using OpenSim.Services.Interfaces;
using PermissionMask = OpenSim.Framework.PermissionMask;
namespace OpenSim.Region.Framework.Scenes
@ -343,6 +338,17 @@ namespace OpenSim.Region.Framework.Scenes
avatar.ControllingClient.SendAlertMessage("Setting updated");
break;
}
case InventoryType.Material:
{
if ((item.CurrentPermissions & (uint)PermissionMask.Modify) == 0)
{
avatar.ControllingClient.SendAgentAlertMessage("Insufficient permissions to edit setting", false);
return UUID.Zero;
}
avatar.ControllingClient.SendAlertMessage("Material updated");
break;
}
}
AssetBase asset = CreateAsset(item.Name, item.Description, (sbyte)item.Type, data, avatarId);
@ -1199,25 +1205,26 @@ namespace OpenSim.Region.Framework.Scenes
uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate,
bool assetUpload)
{
InventoryItemBase item = new InventoryItemBase();
item.Owner = remoteClient.AgentId;
item.CreatorId = creatorID;
item.CreatorData = creatorData;
item.ID = UUID.Random();
item.AssetID = assetID;
item.Name = name;
item.Description = description;
item.Flags = flags;
item.AssetType = assetType;
item.InvType = invType;
item.Folder = folderID;
item.CurrentPermissions = currentMask;
item.NextPermissions = nextOwnerMask;
item.EveryOnePermissions = everyoneMask;
item.GroupPermissions = groupMask;
item.BasePermissions = baseMask;
item.CreationDate = creationDate;
InventoryItemBase item = new InventoryItemBase
{
Owner = remoteClient.AgentId,
CreatorId = creatorID,
CreatorData = creatorData,
ID = UUID.Random(),
AssetID = assetID,
Name = name,
Description = description,
Flags = flags,
AssetType = assetType,
InvType = invType,
Folder = folderID,
CurrentPermissions = currentMask,
NextPermissions = nextOwnerMask,
EveryOnePermissions = everyoneMask,
GroupPermissions = groupMask,
BasePermissions = baseMask,
CreationDate = creationDate
};
// special AnimationSet case
if (item.InvType == (int)CustomInventoryType.AnimationSet)
AnimationSet.enforceItemPermitions(item,true);
@ -1888,9 +1895,9 @@ namespace OpenSim.Region.Framework.Scenes
}
else // Updating existing item with new perms etc
{
// m_log.DebugFormat(
// "[PRIM INVENTORY]: Updating item {0} in {1} for UpdateTaskInventory()",
// currentItem.Name, part.Name);
//m_log.DebugFormat(
// "[PRIM INVENTORY]: Updating item {0} in {1} for UpdateTaskInventory()",
// currentItem.Name, part.Name);
if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId))
return;
@ -1903,12 +1910,12 @@ namespace OpenSim.Region.Framework.Scenes
AgentTransactionsModule.HandleTaskItemUpdateFromTransaction(
remoteClient, part, transactionID, currentItem);
// if ((InventoryType)itemInfo.InvType == InventoryType.Notecard)
// remoteClient.SendAgentAlertMessage("Notecard saved", false);
// else if ((InventoryType)itemInfo.InvType == InventoryType.LSL)
// remoteClient.SendAgentAlertMessage("Script saved", false);
// else
// remoteClient.SendAgentAlertMessage("Item saved", false);
//if ((InventoryType)itemInfo.InvType == InventoryType.Notecard)
// remoteClient.SendAgentAlertMessage("Notecard saved", false);
//else if ((InventoryType)itemInfo.InvType == InventoryType.LSL)
// remoteClient.SendAgentAlertMessage("Script saved", false);
//else
// remoteClient.SendAgentAlertMessage("Item saved", false);
}
// Base ALWAYS has move
@ -2043,9 +2050,9 @@ namespace OpenSim.Region.Framework.Scenes
// tell anyone watching that there is a new script in town
EventManager.TriggerNewScript(agentID, part, copyID);
// m_log.InfoFormat("[PRIMINVENTORY]: " +
// "Rezzed script {0} into prim local ID {1} for user {2}",
// item.inventoryName, localID, remoteClient.Name);
//m_log.InfoFormat("[PRIMINVENTORY]: " +
// "Rezzed script {0} into prim local ID {1} for user {2}",
// item.inventoryName, localID, remoteClient.Name);
part.ParentGroup.ResumeScripts();
@ -2078,10 +2085,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <returns>The part where the script was rezzed if successful. False otherwise.</returns>
public SceneObjectPart RezNewScript(UUID agentID, InventoryItemBase itemBase)
{
return RezNewScript(
agentID,
itemBase,
"default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n}");
return RezNewScript(agentID, itemBase, null);
}
/// <summary>
@ -2097,53 +2101,62 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectPart part = GetSceneObjectPart(itemBase.Folder);
if (part == null)
{
// m_log.DebugFormat(
// "[SCENE INVENTORY]: Could not find part with id {0} for {1} to rez new script",
// itemBase.Folder, agentID);
//m_log.DebugFormat(
// "[SCENE INVENTORY]: Could not find part with id {0} for {1} to rez new script",
// itemBase.Folder, agentID);
return null;
}
if (!Permissions.CanCreateObjectInventory(itemBase.InvType, part.UUID, agentID))
{
// m_log.DebugFormat(
// "[SCENE INVENTORY]: No permission to create new script in {0} for {1}", part.Name, agentID);
//m_log.DebugFormat(
// "[SCENE INVENTORY]: No permission to create new script in {0} for {1}", part.Name, agentID);
return null;
}
AssetBase asset
= CreateAsset(
itemBase.Name,
itemBase.Description,
(sbyte)itemBase.AssetType,
UUID assetID;
if (scriptText == null)
assetID = Constants.DefaultScriptID;
else
{
AssetBase asset = CreateAsset(
itemBase.Name, itemBase.Description,
(sbyte)AssetType.LSLText,
Encoding.ASCII.GetBytes(scriptText),
agentID);
AssetService.Store(asset);
AssetService.Store(asset);
assetID = asset.FullID;
}
TaskInventoryItem taskItem = new TaskInventoryItem();
taskItem.ResetIDs(itemBase.Folder);
taskItem.ParentID = itemBase.Folder;
taskItem.CreationDate = (uint)itemBase.CreationDate;
taskItem.Name = itemBase.Name;
taskItem.Description = itemBase.Description;
taskItem.Type = itemBase.AssetType;
taskItem.InvType = itemBase.InvType;
taskItem.OwnerID = itemBase.Owner;
taskItem.CreatorID = itemBase.CreatorIdAsUuid;
taskItem.BasePermissions = itemBase.BasePermissions;
taskItem.CurrentPermissions = itemBase.CurrentPermissions;
taskItem.EveryonePermissions = itemBase.EveryOnePermissions;
taskItem.GroupPermissions = itemBase.GroupPermissions;
taskItem.NextPermissions = itemBase.NextPermissions;
taskItem.GroupID = itemBase.GroupID;
taskItem.GroupPermissions = 0;
taskItem.Flags = itemBase.Flags;
taskItem.PermsGranter = UUID.Zero;
taskItem.PermsMask = 0;
taskItem.AssetID = asset.FullID;
TaskInventoryItem taskItem = new TaskInventoryItem
{
ItemID = UUID.Random(),
OldItemID = UUID.Zero,
ParentPartID = itemBase.Folder,
ParentID = itemBase.Folder,
CreationDate = (uint)itemBase.CreationDate,
Name = itemBase.Name,
Description = itemBase.Description,
Type = itemBase.AssetType,
InvType = itemBase.InvType,
OwnerID = itemBase.Owner,
CreatorID = itemBase.CreatorIdAsUuid,
BasePermissions = itemBase.BasePermissions,
CurrentPermissions = itemBase.CurrentPermissions,
EveryonePermissions = itemBase.EveryOnePermissions,
//GroupPermissions = itemBase.GroupPermissions,
GroupPermissions = 0,
NextPermissions = itemBase.NextPermissions,
GroupID = itemBase.GroupID,
Flags = itemBase.Flags,
PermsGranter = UUID.Zero,
PermsMask = 0,
AssetID = assetID
};
part.Inventory.AddInventoryItem(taskItem, false);
part.Inventory.CreateScriptInstance(taskItem, 0, false, DefaultScriptEngine, 1);

View file

@ -5642,44 +5642,65 @@ Environment.Exit(1);
// does a linear approximation of the height at this intermediate point.
public float GetGroundHeight(float x, float y)
{
int ix;
int iy;
float dx;
float dy;
// make position fit into array
if (x < 0)
x = 0;
if (x >= Heightmap.Width)
x = Heightmap.Width - 1;
{
ix = 0;
dx = 0;
}
else if (x < Heightmap.Width - 1)
{
ix = (int)x;
dx = x - ix;
}
else // out world use external height
{
ix = Heightmap.Width - 2;
dx = 0;
}
if (y < 0)
y = 0;
if (y >= Heightmap.Height)
y = Heightmap.Height - 1;
{
iy = 0;
dy = 0;
}
else if (y < Heightmap.Height - 1)
{
iy = (int)y;
dy = y - iy;
}
else
{
iy = Heightmap.Height - 2;
dy = 0;
}
Vector3 p0 = new Vector3(x, y, (float)Heightmap[(int)x, (int)y]);
Vector3 p1 = p0;
Vector3 p2 = p0;
float h1;
float h2;
float h0 = Heightmap[ix, iy]; // 0,0 vertice
p1.X += 1.0f;
if (p1.X < Heightmap.Width)
p1.Z = (float)Heightmap[(int)p1.X, (int)p1.Y];
p2.Y += 1.0f;
if (p2.Y < Heightmap.Height)
p2.Z = (float)Heightmap[(int)p2.X, (int)p2.Y];
Vector3 v0 = new Vector3(p1.X - p0.X, p1.Y - p0.Y, p1.Z - p0.Z);
Vector3 v1 = new Vector3(p2.X - p0.X, p2.Y - p0.Y, p2.Z - p0.Z);
v0.Normalize();
v1.Normalize();
Vector3 vsn = new Vector3(
(v0.Y * v1.Z) - (v0.Z * v1.Y),
(v0.Z * v1.X) - (v0.X * v1.Z),
(v0.X * v1.Y) - (v0.Y * v1.X)
);
vsn.Normalize();
float xdiff = x - (float)((int)x);
float ydiff = y - (float)((int)y);
return (((vsn.X * xdiff) + (vsn.Y * ydiff)) / (-1 * vsn.Z)) + p0.Z;
if (dy > dx)
{
++iy;
h2 = Heightmap[ix, iy]; // 0,1 vertice
h1 = (h2 - h0) * dy; // 0,1 vertice minus 0,0
++ix;
h2 = (Heightmap[ix, iy] - h2) * dx; // 1,1 vertice minus 0,1
}
else
{
++ix;
h2 = Heightmap[ix, iy]; // vertice 1,0
h1 = (h2 - h0) * dx; // 1,0 vertice minus 0,0
++iy;
h2 = (Heightmap[ix, iy] - h2) * dy; // 1,1 vertice minus 1,0
}
return h0 + h1 + h2;
}
private void CheckHeartbeat()

View file

@ -407,6 +407,14 @@ namespace OpenSim.Region.Framework.Scenes
if (part.Shape.ProjectionTextureUUID.IsNotZero())
GatheredUuids[part.Shape.ProjectionTextureUUID] = (sbyte)AssetType.Texture;
if(part.Shape.RenderMaterials != null && part.Shape.RenderMaterials.entries != null)
{
for(int j = 0; j < part.Shape.RenderMaterials.entries.Length; ++j)
{
if(part.Shape.RenderMaterials.entries[j].id.IsNotZero())
AddForInspection(part.Shape.RenderMaterials.entries[j].id, (sbyte)AssetType.Material);
}
}
UUID collisionSound = part.CollisionSound;
if (collisionSound.IsNotZero() && collisionSound.NotEqual(part.invalidCollisionSoundUUID))
GatheredUuids[collisionSound] = (sbyte)AssetType.Sound;
@ -581,33 +589,36 @@ namespace OpenSim.Region.Framework.Scenes
GatheredUuids[assetUuid] = assetType;
try
{
if ((sbyte)AssetType.Bodypart == assetType || (sbyte)AssetType.Clothing == assetType)
switch ((AssetType)assetType)
{
RecordWearableAssetUuids(assetBase);
}
else if ((sbyte)AssetType.Gesture == assetType)
{
RecordGestureAssetUuids(assetBase);
}
else if ((sbyte)AssetType.Notecard == assetType)
{
RecordNoteCardEmbeddedAssetUuids(assetBase);
}
else if ((sbyte)AssetType.LSLText == assetType)
{
RecordEmbeddedAssetDataUuids(assetBase);
}
else if ((sbyte)OpenSimAssetType.Material == assetType)
{
RecordMaterialAssetUuids(assetBase);
}
else if ((sbyte)AssetType.Object == assetType)
{
RecordSceneObjectAssetUuids(assetBase);
}
else if ((sbyte)AssetType.Settings == assetType)
{
RecordEmbeddedAssetDataUuids(assetBase); // BAD to do
case AssetType.Bodypart:
case AssetType.Clothing:
RecordWearableAssetUuids(assetBase);
break;
case AssetType.Gesture:
RecordGestureAssetUuids(assetBase);
break;
case AssetType.Notecard:
RecordNoteCardEmbeddedAssetUuids(assetBase);
break;
case AssetType.LSLText:
RecordEmbeddedAssetDataUuids(assetBase);
break;
case (AssetType)OpenSimAssetType.Material:
RecordMaterialAssetUuids(assetBase);
break;
case AssetType.Object:
RecordSceneObjectAssetUuids(assetBase);
break;
case AssetType.Settings:
RecordEmbeddedAssetDataUuids(assetBase); // BAD to do
break;
case AssetType.Material:
RecordEmbeddedAssetDataUuids(assetBase);
break;
default:
break;
}
}
catch (Exception e)
@ -645,7 +656,8 @@ namespace OpenSim.Region.Framework.Scenes
|| (sbyte)AssetType.LSLText == assetType
|| (sbyte)OpenSimAssetType.Material == assetType
|| (sbyte)AssetType.Object == assetType
|| (sbyte)AssetType.Settings == assetType)
|| (sbyte)AssetType.Settings == assetType
|| (sbyte)AssetType.Material == assetType)
{
AddForInspection(assetUuid);
}

View file

@ -1171,10 +1171,10 @@ namespace Nwc.XmlRpc
{
resp = (XmlRpcResponse)_deserializer.Deserialize(inputXml);
}
catch (Exception e)
catch
{
RequestResponse = inputXml;
throw e;
throw;
}
}
}

View file

@ -753,33 +753,44 @@ namespace OpenSim.Region.OptionalModules.Materials
return asset;
}
private byte[] CacheGet = null;
private object CacheGetLock = new object();
private double CacheGetTime = 0;
public void RenderMaterialsGetCap(IOSHttpRequest request, IOSHttpResponse response)
{
//OSDMap resp = new OSDMap();
//OSDArray allOsd = new OSDArray();
/*
// this violates all idea of caching and geting things only if needed, so disabled
int matsCount = 0;
lock (m_Materials)
lock(CacheGetLock)
{
foreach (KeyValuePair<UUID, FaceMaterial> kvp in m_Materials)
OSDArray allOsd = new OSDArray();
double now = Util.GetTimeStamp();
if(CacheGet == null || now - CacheGetTime > 30)
{
OSDMap matMap = new OSDMap();
matMap["ID"] = OSD.FromBinary(kvp.Key.GetBytes());
matMap["Material"] = kvp.Value.toOSD();
allOsd.Add(matMap);
matsCount++;
CacheGetTime = now;
lock (m_Materials)
{
foreach (KeyValuePair<UUID, FaceMaterial> kvp in m_Materials)
{
OSDMap matMap = new OSDMap
{
["ID"] = OSD.FromBinary(kvp.Key.GetBytes()),
["Material"] = kvp.Value.toOSD()
};
allOsd.Add(matMap);
}
}
OSDMap resp = new OSDMap
{
["Zipped"] = ZCompressOSD(allOsd, false)
};
CacheGet = OSDParser.SerializeLLSDXmlToBytes(resp);
}
response.RawBuffer = CacheGet ?? GetPutEmptyResponseBytes;
}
*/
//resp["Zipped"] = ZCompressOSD(allOsd, false);
//string tmp = OSDParser.SerializeLLSDXmlString(resp);
//response.RawBuffer = Encoding.UTF8.GetBytes(tmp);
response.RawBuffer = GetPutEmptyResponseBytes;
}
private static string ZippedOsdBytesToString(byte[] bytes)
{
try

View file

@ -28,7 +28,7 @@
using log4net;
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.InteropServices;
using OpenSim.Framework;
using OpenMetaverse;
@ -62,6 +62,15 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
public bool MouseLook;
}
[StructLayout(LayoutKind.Sequential, Pack = 16)]
public struct AABB2D
{
public float minx;
public float maxx;
public float miny;
public float maxy;
}
public struct ContactPoint
{
public Vector3 Position;
@ -158,7 +167,7 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
public abstract class PhysicsActor
{
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
//private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public delegate void RequestTerseUpdate();
public delegate void CollisionUpdate(EventArgs e);
@ -201,6 +210,8 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
cdata.bounce = 0;
}
public AABB2D _AABB2D;
public abstract bool Stopped { get; }
public abstract Vector3 Size { get; set; }
@ -222,7 +233,7 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
public abstract PrimitiveBaseShape Shape { set; }
uint m_baseLocalID;
public uint m_baseLocalID;
public virtual uint LocalID
{
set { m_baseLocalID = value; }
@ -258,38 +269,17 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
public virtual void RequestPhysicsterseUpdate()
{
// Make a temporary copy of the event to avoid possibility of
// a race condition if the last subscriber unsubscribes
// immediately after the null check and before the event is raised.
RequestTerseUpdate handler = OnRequestTerseUpdate;
if (handler != null)
{
handler();
}
OnRequestTerseUpdate?.Invoke();
}
public virtual void RaiseOutOfBounds(Vector3 pos)
{
// Make a temporary copy of the event to avoid possibility of
// a race condition if the last subscriber unsubscribes
// immediately after the null check and before the event is raised.
OutOfBounds handler = OnOutOfBounds;
if (handler != null)
{
handler(pos);
}
OnOutOfBounds?.Invoke(pos);
}
public virtual void SendCollisionUpdate(EventArgs e)
{
CollisionUpdate handler = OnCollisionUpdate;
// m_log.DebugFormat("[PHYSICS ACTOR]: Sending collision for {0}", LocalID);
if (handler != null)
handler(e);
OnCollisionUpdate?.Invoke(e);
}
public virtual void SetMaterial (int material) { }

View file

@ -27,10 +27,7 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using log4net;
using Nini.Config;
using System.Runtime.CompilerServices;
using OpenSim.Framework;
using OpenMetaverse;
@ -41,9 +38,6 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
public delegate void RaycastCallback(bool hitYN, Vector3 collisionPoint, uint localid, float distance, Vector3 normal);
public delegate void RayCallback(List<ContactResult> list);
public delegate void ProbeBoxCallback(List<ContactResult> list);
public delegate void ProbeSphereCallback(List<ContactResult> list);
public delegate void ProbePlaneCallback(List<ContactResult> list);
public delegate void SitAvatarCallback(int status, uint partID, Vector3 offset, Quaternion Orientation);
public delegate void JointMoved(PhysicsJoint joint);
@ -88,16 +82,14 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
public struct ContactResult
{
public Vector3 Pos;
public Vector3 Normal;
public float Depth;
public uint ConsumerID;
public Vector3 Normal;
}
public abstract class PhysicsScene
{
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
//private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
/// <summary>
/// A unique identifying string for this instance of the physics engine.

View file

@ -41,6 +41,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using OMV = OpenMetaverse;
@ -192,14 +193,14 @@ namespace OpenSim.Region.PhysicsModule.ubOde
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate int AABBTestFn(IntPtr o1, IntPtr o2, ref AABB aabb);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate int ColliderFn(IntPtr o1, IntPtr o2, int flags, out ContactGeom contact, int skip);
//[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
//internal delegate int ColliderFn(IntPtr o1, IntPtr o2, int flags, out ContactGeom contact, int skip);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate void GetAABBFn(IntPtr geom, out AABB aabb);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate ColliderFn GetColliderFnFn(int num);
//[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
//internal delegate ColliderFn GetColliderFnFn(int num);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate void GeomDtorFn(IntPtr o);
@ -246,6 +247,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
[StructLayout(LayoutKind.Sequential)]
//needed for Contact only, rest should use the class
internal struct ContactGeom
{
@ -259,6 +261,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
internal static readonly int unmanagedSizeOf = Marshal.SizeOf(typeof(ContactGeom));
}
/*
[StructLayout(LayoutKind.Sequential)]
internal struct GeomClass
{
@ -268,7 +271,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
internal AABBTestFn aabb_test;
internal GeomDtorFn dtor;
}
*/
[StructLayout(LayoutKind.Sequential)]
internal struct JointFeedback
@ -500,9 +503,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde
}
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyDisable"), SuppressUnmanagedCodeSecurity]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static extern void BodyDisable(IntPtr body);
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyEnable"), SuppressUnmanagedCodeSecurity]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static extern void BodyEnable(IntPtr body);
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetAutoDisableAngularThreshold"), SuppressUnmanagedCodeSecurity]
@ -525,10 +530,30 @@ namespace OpenSim.Region.PhysicsModule.ubOde
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetAngularVel"), SuppressUnmanagedCodeSecurity]
internal extern unsafe static Vector3* BodyGetAngularVelUnsafe(IntPtr body);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static Vector3 BodyGetAngularVel(IntPtr body)
{
unsafe { return *(BodyGetAngularVelUnsafe(body)); }
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static OMV.Vector3 BodyGetAngularVelOMV(IntPtr body)
{
unsafe
{
Vector3* vtmp = BodyGetAngularVelUnsafe(body);
return new OMV.Vector3(vtmp->X, vtmp->Y, vtmp->Z);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static OMV.Vector3 BodyGetAngularVelOMVforAvatar(IntPtr body)
{
unsafe
{
Vector3* vtmp = BodyGetAngularVelUnsafe(body);
return new OMV.Vector3(0, 0, (float)Math.Round(vtmp->Z, 3));
}
}
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetData"), SuppressUnmanagedCodeSecurity]
internal static extern IntPtr BodyGetData(IntPtr body);
@ -557,10 +582,20 @@ namespace OpenSim.Region.PhysicsModule.ubOde
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetLinearVel"), SuppressUnmanagedCodeSecurity]
internal extern unsafe static Vector3* BodyGetLinearVelUnsafe(IntPtr body);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static Vector3 BodyGetLinearVel(IntPtr body)
{
unsafe { return *(BodyGetLinearVelUnsafe(body)); }
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static OMV.Vector3 BodyGetLinearVelOMV(IntPtr body)
{
unsafe
{
Vector3* vtmp = BodyGetLinearVelUnsafe(body);
return new OMV.Vector3(vtmp->X, vtmp->Y, vtmp->Z);
}
}
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetMass"), SuppressUnmanagedCodeSecurity]
internal static extern void BodyGetMass(IntPtr body, out Mass mass);
@ -573,20 +608,40 @@ namespace OpenSim.Region.PhysicsModule.ubOde
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetPosition"), SuppressUnmanagedCodeSecurity]
internal extern unsafe static Vector3* BodyGetPositionUnsafe(IntPtr body);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static Vector3 BodyGetPosition(IntPtr body)
{
unsafe { return *(BodyGetPositionUnsafe(body)); }
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static OMV.Vector3 BodyGetPositionOMV(IntPtr body)
{
unsafe
{
Vector3* vtmp = BodyGetPositionUnsafe(body);
return new OMV.Vector3(vtmp->X, vtmp->Y, vtmp->Z);
}
}
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetPosRelPoint"), SuppressUnmanagedCodeSecurity]
internal static extern void BodyGetPosRelPoint(IntPtr body, dReal px, dReal py, dReal pz, out Vector3 result);
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetQuaternion"), SuppressUnmanagedCodeSecurity]
internal extern unsafe static Quaternion* BodyGetQuaternionUnsafe(IntPtr body);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static Quaternion BodyGetQuaternion(IntPtr body)
{
unsafe { return *(BodyGetQuaternionUnsafe(body)); }
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static OMV.Quaternion BodyGetQuaternionOMV(IntPtr body)
{
unsafe
{
Quaternion* q = BodyGetQuaternionUnsafe(body);
return new OMV.Quaternion(q->X, q->Y, q->Z, q->W);
}
}
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetRelPointPos"), SuppressUnmanagedCodeSecurity]
internal static extern void BodyGetRelPointPos(IntPtr body, dReal px, dReal py, dReal pz, out Vector3 result);
@ -618,69 +673,91 @@ namespace OpenSim.Region.PhysicsModule.ubOde
internal static extern IntPtr dBodyGetNextGeom(IntPtr Geom);
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyIsEnabled"), SuppressUnmanagedCodeSecurity]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static extern bool BodyIsEnabled(IntPtr body);
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetAngularVel"), SuppressUnmanagedCodeSecurity]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static extern void BodySetAngularVel(IntPtr body, dReal x, dReal y, dReal z);
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetAutoDisableAngularThreshold"), SuppressUnmanagedCodeSecurity]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static extern void BodySetAutoDisableAngularThreshold(IntPtr body, dReal angular_threshold);
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetAutoDisableDefaults"), SuppressUnmanagedCodeSecurity]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static extern void BodySetAutoDisableDefaults(IntPtr body);
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetAutoDisableFlag"), SuppressUnmanagedCodeSecurity]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static extern void BodySetAutoDisableFlag(IntPtr body, bool do_auto_disable);
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetAutoDisableLinearThreshold"), SuppressUnmanagedCodeSecurity]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static extern void BodySetAutoDisableLinearThreshold(IntPtr body, dReal linear_threshold);
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetAutoDisableSteps"), SuppressUnmanagedCodeSecurity]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static extern void BodySetAutoDisableSteps(IntPtr body, int steps);
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetAutoDisableTime"), SuppressUnmanagedCodeSecurity]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static extern void BodySetAutoDisableTime(IntPtr body, dReal time);
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetData"), SuppressUnmanagedCodeSecurity]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static extern void BodySetData(IntPtr body, IntPtr data);
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetFiniteRotationMode"), SuppressUnmanagedCodeSecurity]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static extern void BodySetFiniteRotationMode(IntPtr body, int mode);
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetFiniteRotationAxis"), SuppressUnmanagedCodeSecurity]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static extern void BodySetFiniteRotationAxis(IntPtr body, dReal x, dReal y, dReal z);
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetLinearDamping"), SuppressUnmanagedCodeSecurity]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static extern void BodySetLinearDamping(IntPtr body, dReal scale);
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetAngularDamping"), SuppressUnmanagedCodeSecurity]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static extern void BodySetAngularDamping(IntPtr body, dReal scale);
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetLinearDamping"), SuppressUnmanagedCodeSecurity]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static extern dReal BodyGetLinearDamping(IntPtr body);
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetAngularDamping"), SuppressUnmanagedCodeSecurity]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static extern dReal BodyGetAngularDamping(IntPtr body);
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetAngularDamping"), SuppressUnmanagedCodeSecurity]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static extern void BodySetDamping(IntPtr body, dReal linear_scale, dReal angular_scale);
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetAngularDampingThreshold"), SuppressUnmanagedCodeSecurity]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static extern void BodySetAngularDampingThreshold(IntPtr body, dReal threshold);
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetLinearDampingThreshold"), SuppressUnmanagedCodeSecurity]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static extern void BodySetLinearDampingThreshold(IntPtr body, dReal threshold);
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetLinearDampingThreshold"), SuppressUnmanagedCodeSecurity]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static extern dReal BodyGetLinearDampingThreshold(IntPtr body);
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetAngularDampingThreshold"), SuppressUnmanagedCodeSecurity]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static extern dReal BodyGetAngularDampingThreshold(IntPtr body);
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetForce"), SuppressUnmanagedCodeSecurity]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static extern void BodySetForce(IntPtr body, dReal x, dReal y, dReal z);
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetGravityMode"), SuppressUnmanagedCodeSecurity]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static extern void BodySetGravityMode(IntPtr body, bool mode);
/// <summary>
@ -692,33 +769,43 @@ namespace OpenSim.Region.PhysicsModule.ubOde
internal static extern void dBodySetGyroscopicMode(IntPtr body, int enabled);
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetLinearVel"), SuppressUnmanagedCodeSecurity]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static extern void BodySetLinearVel(IntPtr body, dReal x, dReal y, dReal z);
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetMass"), SuppressUnmanagedCodeSecurity]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static extern void BodySetMass(IntPtr body, ref Mass mass);
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetPosition"), SuppressUnmanagedCodeSecurity]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static extern void BodySetPosition(IntPtr body, dReal x, dReal y, dReal z);
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetQuaternion"), SuppressUnmanagedCodeSecurity]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static extern void BodySetQuaternion(IntPtr body, ref Quaternion q);
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetQuaternion"), SuppressUnmanagedCodeSecurity]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static extern void BodySetQuaternion(IntPtr body, ref dReal w);
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetRotation"), SuppressUnmanagedCodeSecurity]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static extern void BodySetRotation(IntPtr body, ref Matrix3 R);
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetRotation"), SuppressUnmanagedCodeSecurity]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static extern void BodySetRotation(IntPtr body, ref dReal M00);
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetTorque"), SuppressUnmanagedCodeSecurity]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static extern void BodySetTorque(IntPtr body, dReal x, dReal y, dReal z);
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyVectorFromWorld"), SuppressUnmanagedCodeSecurity]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static extern void BodyVectorFromWorld(IntPtr body, dReal px, dReal py, dReal pz, out Vector3 result);
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyVectorToWorld"), SuppressUnmanagedCodeSecurity]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static extern void BodyVectorToWorld(IntPtr body, dReal px, dReal py, dReal pz, out Vector3 result);
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBoxBox"), SuppressUnmanagedCodeSecurity]
@ -745,8 +832,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
internal static extern void CloseODE();
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCollide"), SuppressUnmanagedCodeSecurity]
internal static extern int Collide(IntPtr o1, IntPtr o2, int flags, [In, Out] ContactGeom[] contact, int skip);
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCollide"), SuppressUnmanagedCodeSecurity]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static extern int CollidePtr(IntPtr o1, IntPtr o2, int flags, IntPtr contactgeomarray, int skip);
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dConnectingJoint"), SuppressUnmanagedCodeSecurity]
@ -754,6 +840,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreateBox"), SuppressUnmanagedCodeSecurity]
internal static extern IntPtr CreateiBox(IntPtr space, dReal lx, dReal ly, dReal lz);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static IntPtr CreateBox(IntPtr space, dReal lx, dReal ly, dReal lz)
{
NTotalGeoms++;
@ -762,6 +849,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreateCapsule"), SuppressUnmanagedCodeSecurity]
internal static extern IntPtr CreateiCapsule(IntPtr space, dReal radius, dReal length);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static IntPtr CreateCapsule(IntPtr space, dReal radius, dReal length)
{
NTotalGeoms++;
@ -794,6 +882,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreateOSTerrain"), SuppressUnmanagedCodeSecurity]
internal static extern IntPtr CreateiOSTerrain(IntPtr space, IntPtr data, int bPlaceable);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static IntPtr CreateOSTerrain(IntPtr space, IntPtr data, int bPlaceable)
{
NTotalGeoms++;
@ -808,14 +897,15 @@ namespace OpenSim.Region.PhysicsModule.ubOde
return CreateiGeom(classnum);
}
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreateGeomClass"), SuppressUnmanagedCodeSecurity]
internal static extern int CreateGeomClass(ref GeomClass classptr);
//[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreateGeomClass"), SuppressUnmanagedCodeSecurity]
//internal static extern int CreateGeomClass(ref GeomClass classptr);
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreateGeomTransform"), SuppressUnmanagedCodeSecurity]
internal static extern IntPtr CreateGeomTransform(IntPtr space);
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreatePlane"), SuppressUnmanagedCodeSecurity]
internal static extern IntPtr CreateiPlane(IntPtr space, dReal a, dReal b, dReal c, dReal d);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static IntPtr CreatePlane(IntPtr space, dReal a, dReal b, dReal c, dReal d)
{
NTotalGeoms++;
@ -824,6 +914,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreateRay"), SuppressUnmanagedCodeSecurity]
internal static extern IntPtr CreateiRay(IntPtr space, dReal length);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static IntPtr CreateRay(IntPtr space, dReal length)
{
NTotalGeoms++;
@ -832,6 +923,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreateSphere"), SuppressUnmanagedCodeSecurity]
internal static extern IntPtr CreateiSphere(IntPtr space, dReal radius);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static IntPtr CreateSphere(IntPtr space, dReal radius)
{
NTotalGeoms++;
@ -841,6 +933,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreateTriMesh"), SuppressUnmanagedCodeSecurity]
internal static extern IntPtr CreateiTriMesh(IntPtr space, IntPtr data,
TriCallback callback, TriArrayCallback arrayCallback, TriRayCallback rayCallback);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static IntPtr CreateTriMesh(IntPtr space, IntPtr data,
TriCallback callback, TriArrayCallback arrayCallback, TriRayCallback rayCallback)
{
@ -919,6 +1012,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomDestroy"), SuppressUnmanagedCodeSecurity]
internal static extern void GeomiDestroy(IntPtr geom);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static void GeomDestroy(IntPtr geom)
{
NTotalGeoms--;
@ -955,6 +1049,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetOffsetPosition"), SuppressUnmanagedCodeSecurity]
internal extern unsafe static Vector3* GeomGetOffsetPositionUnsafe(IntPtr geom);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static Vector3 GeomGetOffsetPosition(IntPtr geom)
{
unsafe { return *(GeomGetOffsetPositionUnsafe(geom)); }
@ -962,6 +1057,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetOffsetRotation"), SuppressUnmanagedCodeSecurity]
internal extern unsafe static Matrix3* GeomGetOffsetRotationUnsafe(IntPtr geom);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static Matrix3 GeomGetOffsetRotation(IntPtr geom)
{
unsafe { return *(GeomGetOffsetRotationUnsafe(geom)); }
@ -969,22 +1065,27 @@ namespace OpenSim.Region.PhysicsModule.ubOde
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetPosition"), SuppressUnmanagedCodeSecurity]
internal extern unsafe static Vector3* GeomGetPositionUnsafe(IntPtr geom);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static Vector3 GeomGetPosition(IntPtr geom)
{
unsafe { return *(GeomGetPositionUnsafe(geom)); }
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static OMV.Vector3 GeomGetPositionOMV(IntPtr geom)
{
Vector3 vtmp = GeomGetPosition(geom);
return new OMV.Vector3(vtmp.X, vtmp.Y, vtmp.Z);
unsafe
{
Vector3* vtmp = GeomGetPositionUnsafe(geom);
return new OMV.Vector3(vtmp->X, vtmp->Y, vtmp->Z);
}
}
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetQuaternion"), SuppressUnmanagedCodeSecurity]
internal static extern void GeomCopyQuaternion(IntPtr geom, out Quaternion q);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static OMV.Quaternion GeomGetQuaternionOMV(IntPtr geom)
{
Quaternion qtmp;
GeomCopyQuaternion(geom, out qtmp);
GeomCopyQuaternion(geom, out Quaternion qtmp);
return new OMV.Quaternion(qtmp.X, qtmp.Y, qtmp.Z, qtmp.W);
}
@ -1132,24 +1233,30 @@ namespace OpenSim.Region.PhysicsModule.ubOde
internal static extern dReal GeomRayGetParams(IntPtr g, out int firstContact, out int backfaceCull);
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomRaySet"), SuppressUnmanagedCodeSecurity]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static extern void GeomRaySet(IntPtr ray, dReal px, dReal py, dReal pz, dReal dx, dReal dy, dReal dz);
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomRaySetClosestHit"), SuppressUnmanagedCodeSecurity]
internal static extern void GeomRaySetClosestHit(IntPtr ray, int closestHit);
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomRaySetLength"), SuppressUnmanagedCodeSecurity]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static extern void GeomRaySetLength(IntPtr ray, dReal length);
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomRaySetParams"), SuppressUnmanagedCodeSecurity]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static extern void GeomRaySetParams(IntPtr ray, int firstContact, int backfaceCull);
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetBody"), SuppressUnmanagedCodeSecurity]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static extern void GeomSetBody(IntPtr geom, IntPtr body);
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetCategoryBits"), SuppressUnmanagedCodeSecurity]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static extern void GeomSetCategoryBits(IntPtr geom, uint bits);
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetCollideBits"), SuppressUnmanagedCodeSecurity]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static extern void GeomSetCollideBits(IntPtr geom, uint bits);
[DllImport("ubode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetConvex"), SuppressUnmanagedCodeSecurity]

File diff suppressed because it is too large Load diff

View file

@ -440,7 +440,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
{
if (pbs.SculptEntry)
{
if (pbs.SculptTexture != null && !pbs.SculptTexture.IsZero())
if (pbs.SculptTexture.IsNotZero())
{
repData.assetID = pbs.SculptTexture;
repData.meshState = MeshState.needAsset;

File diff suppressed because it is too large Load diff

View file

@ -28,6 +28,7 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using OpenSim.Framework;
using OpenSim.Region.PhysicsModules.SharedBase;
@ -52,11 +53,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde
/// Scene that created this object.
/// </summary>
private readonly ODEScene m_scene;
private readonly SafeNativeMethods.ContactGeom[] m_contacts;
IntPtr ray; // the ray. we only need one for our lifetime
IntPtr Sphere;
IntPtr Box;
IntPtr Plane;
private int CollisionContactGeomsPerTest = 25;
private const int DefaultMaxCount = 25;
@ -70,21 +69,18 @@ namespace OpenSim.Region.PhysicsModule.ubOde
private readonly List<ContactResult> m_contactResults = new List<ContactResult>();
private RayFilterFlags CurrentRayFilter;
private int CurrentMaxCount;
ContactResult SharedCollisionResult = new ContactResult();
public ODERayCastRequestManager(ODEScene pScene)
{
m_scene = pScene;
m_contacts = pScene.m_contacts;
nearCallback = near;
ray = SafeNativeMethods.CreateRay(IntPtr.Zero, 1.0f);
SafeNativeMethods.GeomSetCategoryBits(ray, 0);
Box = SafeNativeMethods.CreateBox(IntPtr.Zero, 1.0f, 1.0f, 1.0f);
SafeNativeMethods.GeomSetCategoryBits(Box, 0);
Sphere = SafeNativeMethods.CreateSphere(IntPtr.Zero,1.0f);
SafeNativeMethods.GeomSetCategoryBits(Sphere, 0);
Plane = SafeNativeMethods.CreatePlane(IntPtr.Zero, 0f,0f,1f,1f);
SafeNativeMethods.GeomSetCategoryBits(Sphere, 0);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void QueueRequest(ODERayRequest req)
{
if (req.Count == 0)
@ -96,28 +92,21 @@ namespace OpenSim.Region.PhysicsModule.ubOde
/// <summary>
/// Process all queued raycast requests
/// </summary>
/// <returns>Time in MS the raycasts took to process.</returns>
public int ProcessQueuedRequests()
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ProcessQueuedRequests()
{
if (m_PendingRequests.Count <= 0)
return 0;
if (m_scene.ContactgeomsArray == IntPtr.Zero || ray == IntPtr.Zero)
// oops something got wrong or scene isn't ready still
{
m_PendingRequests.Clear();
return 0;
}
if (m_PendingRequests.Count == 0)
return ;
int time = Util.EnvironmentTickCount();
int closestHit;
int backfacecull;
CollisionCategories catflags;
while (m_PendingRequests.Dequeue(out ODERayRequest req))
{
if(req.length <= 0)
{
NoContacts(req);
continue;
}
IntPtr geom = IntPtr.Zero;
if (req.actor != null)
{
@ -137,70 +126,34 @@ namespace OpenSim.Region.PhysicsModule.ubOde
CurrentRayFilter = req.filter;
CurrentMaxCount = req.Count;
if (CurrentMaxCount > 25)
CurrentMaxCount = 25;
CollisionContactGeomsPerTest = req.Count & 0xffff;
closestHit = ((CurrentRayFilter & RayFilterFlags.ClosestHit) == 0 ? 0 : 1);
backfacecull = ((CurrentRayFilter & RayFilterFlags.BackFaceCull) == 0 ? 0 : 1);
if (req.callbackMethod is ProbeBoxCallback)
unchecked
{
if (CollisionContactGeomsPerTest > 80)
CollisionContactGeomsPerTest = 80;
SafeNativeMethods.GeomBoxSetLengths(Box, req.Normal.X, req.Normal.Y, req.Normal.Z);
SafeNativeMethods.GeomSetPosition(Box, req.Origin.X, req.Origin.Y, req.Origin.Z);
SafeNativeMethods.Quaternion qtmp;
qtmp.X = req.orientation.X;
qtmp.Y = req.orientation.Y;
qtmp.Z = req.orientation.Z;
qtmp.W = req.orientation.W;
SafeNativeMethods.GeomSetQuaternion(Box, ref qtmp);
}
else if (req.callbackMethod is ProbeSphereCallback)
{
if (CollisionContactGeomsPerTest > 80)
CollisionContactGeomsPerTest = 80;
SafeNativeMethods.GeomSphereSetRadius(Sphere, req.length);
SafeNativeMethods.GeomSetPosition(Sphere, req.Origin.X, req.Origin.Y, req.Origin.Z);
}
else if (req.callbackMethod is ProbePlaneCallback)
{
if (CollisionContactGeomsPerTest > 80)
CollisionContactGeomsPerTest = 80;
SafeNativeMethods.GeomPlaneSetParams(Plane, req.Normal.X, req.Normal.Y, req.Normal.Z, req.length);
CollisionContactGeomsPerTest = ((CurrentRayFilter & RayFilterFlags.ContactsUnImportant) != 0) ?
CurrentMaxCount | (int)SafeNativeMethods.CONTACTS_UNIMPORTANT : CurrentMaxCount;
}
int backfacecull = ((CurrentRayFilter & RayFilterFlags.BackFaceCull) == 0 ? 0 : 1);
SafeNativeMethods.GeomRaySetParams(ray, 0, backfacecull);
if (req.callbackMethod is RaycastCallback)
{
// if we only want one get only one per Collision pair saving memory
CurrentRayFilter |= RayFilterFlags.ClosestHit;
SafeNativeMethods.GeomRaySetClosestHit(ray, 1);
}
else
{
if (CollisionContactGeomsPerTest > 25)
CollisionContactGeomsPerTest = 25;
SafeNativeMethods.GeomRaySetLength(ray, req.length);
SafeNativeMethods.GeomRaySet(ray, req.Origin.X, req.Origin.Y, req.Origin.Z, req.Normal.X, req.Normal.Y, req.Normal.Z);
SafeNativeMethods.GeomRaySetParams(ray, 0, backfacecull);
if (req.callbackMethod is RaycastCallback)
{
// if we only want one get only one per Collision pair saving memory
CurrentRayFilter |= RayFilterFlags.ClosestHit;
SafeNativeMethods.GeomRaySetClosestHit(ray, 1);
}
else
SafeNativeMethods.GeomRaySetClosestHit(ray, closestHit);
int closestHit = ((CurrentRayFilter & RayFilterFlags.ClosestHit) == 0 ? 0 : 1);
SafeNativeMethods.GeomRaySetClosestHit(ray, closestHit);
}
if ((CurrentRayFilter & RayFilterFlags.ContactsUnImportant) != 0)
unchecked
{
CollisionContactGeomsPerTest |= (int)SafeNativeMethods.CONTACTS_UNIMPORTANT;
}
if (geom == IntPtr.Zero)
{
// translate ray filter to Collision flags
catflags = 0;
CollisionCategories catflags = 0;
if ((CurrentRayFilter & RayFilterFlags.volumedtc) != 0)
catflags |= CollisionCategories.VolumeDtc;
if ((CurrentRayFilter & RayFilterFlags.phantom) != 0)
@ -211,53 +164,18 @@ namespace OpenSim.Region.PhysicsModule.ubOde
catflags |= CollisionCategories.Geom;
if ((CurrentRayFilter & RayFilterFlags.land) != 0)
catflags |= CollisionCategories.Land;
if ((CurrentRayFilter & RayFilterFlags.water) != 0)
catflags |= CollisionCategories.Water;
if (catflags != 0)
{
if (req.callbackMethod is ProbeBoxCallback)
{
catflags |= CollisionCategories.Space;
SafeNativeMethods.GeomSetCollideBits(Box, (uint)catflags);
SafeNativeMethods.GeomSetCategoryBits(Box, (uint)catflags);
doProbe(req, Box);
}
else if (req.callbackMethod is ProbeSphereCallback)
{
catflags |= CollisionCategories.Space;
SafeNativeMethods.GeomSetCollideBits(Sphere, (uint)catflags);
SafeNativeMethods.GeomSetCategoryBits(Sphere, (uint)catflags);
doProbe(req, Sphere);
}
else if (req.callbackMethod is ProbePlaneCallback)
{
catflags |= CollisionCategories.Space;
SafeNativeMethods.GeomSetCollideBits(Plane, (uint)catflags);
SafeNativeMethods.GeomSetCategoryBits(Plane, (uint)catflags);
doPlane(req,IntPtr.Zero);
}
else
{
SafeNativeMethods.GeomSetCollideBits(ray, (uint)catflags);
doSpaceRay(req);
}
SafeNativeMethods.GeomSetCollideBits(ray, (uint)catflags);
doSpaceRay(req);
}
}
else
{
// if we select a geom don't use filters
if (req.callbackMethod is ProbePlaneCallback)
{
SafeNativeMethods.GeomSetCollideBits(Plane, (uint)CollisionCategories.All);
doPlane(req,geom);
}
else
{
SafeNativeMethods.GeomSetCollideBits(ray, (uint)CollisionCategories.All);
doGeomRay(req,geom);
}
SafeNativeMethods.GeomSetCollideBits(ray, (uint)CollisionCategories.All);
doGeomRay(req,geom);
}
if (Util.EnvironmentTickCountSubtract(time) > MaxTimePerCallMS)
@ -266,8 +184,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
lock (m_contactResults)
m_contactResults.Clear();
return Util.EnvironmentTickCountSubtract(time);
}
/// <summary>
/// Method that actually initiates the raycast with spaces
@ -275,6 +191,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
/// <param name="req"></param>
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private void NoContacts(ODERayRequest req)
{
if (req.callbackMethod is RaycastCallback)
@ -282,30 +199,77 @@ namespace OpenSim.Region.PhysicsModule.ubOde
((RaycastCallback)req.callbackMethod)(false, Vector3.Zero, 0, 0, Vector3.Zero);
return;
}
List<ContactResult> cresult = new List<ContactResult>();
if (req.callbackMethod is RayCallback)
((RayCallback)req.callbackMethod)(cresult);
else if (req.callbackMethod is ProbeBoxCallback)
((ProbeBoxCallback)req.callbackMethod)(cresult);
else if (req.callbackMethod is ProbeSphereCallback)
((ProbeSphereCallback)req.callbackMethod)(cresult);
((RayCallback)req.callbackMethod)(new List<ContactResult>());
}
private const RayFilterFlags FilterActiveSpace = RayFilterFlags.agent | RayFilterFlags.physical | RayFilterFlags.LSLPhantom;
// private const RayFilterFlags FilterStaticSpace = RayFilterFlags.water | RayFilterFlags.land | RayFilterFlags.nonphysical | RayFilterFlags.LSLPhanton;
private const RayFilterFlags FilterStaticSpace = RayFilterFlags.water | RayFilterFlags.nonphysical | RayFilterFlags.LSLPhantom;
private const RayFilterFlags FilterActiveSpace = RayFilterFlags.physical | RayFilterFlags.LSLPhantom;
private const RayFilterFlags FilterStaticSpace = RayFilterFlags.nonphysical | RayFilterFlags.LSLPhantom;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private void doSpaceRay(ODERayRequest req)
{
/*
float endx;
float endy;
if (req.Normal.X <= 0)
{
if (req.Origin.X <= 0)
{
NoContacts(req);
return;
}
endx = req.Origin.X - req.length;
if (endx < 0)
{
req.length += endx;
endx = 0;
}
}
else
{
if (req.Origin.X < 0)
{
req.length += req.Origin.X;
if (req.length <= 0)
{
NoContacts(req);
return;
}
req.Origin.X = 0;
}
endx = req.Origin.X + req.length;
if (endx < 0)
{
req.length += endx;
endx = 0;
}
}
*/
SafeNativeMethods.GeomRaySetLength(ray, req.length);
SafeNativeMethods.GeomRaySet(ray, req.Origin.X, req.Origin.Y, req.Origin.Z, req.Normal.X, req.Normal.Y, req.Normal.Z);
// Collide tests
if ((CurrentRayFilter & FilterActiveSpace) != 0)
{
SafeNativeMethods.SpaceCollide2(ray, m_scene.ActiveSpace, IntPtr.Zero, nearCallback);
SafeNativeMethods.SpaceCollide2(ray, m_scene.CharsSpace, IntPtr.Zero, nearCallback);
if ((CurrentRayFilter & RayFilterFlags.agent) != 0)
{
foreach(OdeCharacter chr in m_scene._charactersList)
{
if (m_contactResults.Count >= CurrentMaxCount)
break;
collideRayAvatar(chr);
}
}
if ((CurrentRayFilter & FilterStaticSpace) != 0 && (m_contactResults.Count < CurrentMaxCount))
SafeNativeMethods.SpaceCollide2(ray, m_scene.StaticSpace, IntPtr.Zero, nearCallback);
if ((CurrentRayFilter & RayFilterFlags.land) != 0 && (m_contactResults.Count < CurrentMaxCount))
{
// current ode land to ray collisions is very bad
@ -322,7 +286,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
}
}
SafeNativeMethods.SpaceCollide2(ray, m_scene.GroundSpace, IntPtr.Zero, nearCallback);
collideRayTerrain(m_scene.TerrainGeom);
}
if (req.callbackMethod is RaycastCallback)
@ -366,67 +330,16 @@ namespace OpenSim.Region.PhysicsModule.ubOde
}
}
private void doProbe(ODERayRequest req, IntPtr probe)
{
// Collide tests
if ((CurrentRayFilter & FilterActiveSpace) != 0)
{
SafeNativeMethods.SpaceCollide2(probe, m_scene.ActiveSpace, IntPtr.Zero, nearCallback);
SafeNativeMethods.SpaceCollide2(probe, m_scene.CharsSpace, IntPtr.Zero, nearCallback);
}
if ((CurrentRayFilter & FilterStaticSpace) != 0 && (m_contactResults.Count < CurrentMaxCount))
SafeNativeMethods.SpaceCollide2(probe, m_scene.StaticSpace, IntPtr.Zero, nearCallback);
if ((CurrentRayFilter & RayFilterFlags.land) != 0 && (m_contactResults.Count < CurrentMaxCount))
SafeNativeMethods.SpaceCollide2(probe, m_scene.GroundSpace, IntPtr.Zero, nearCallback);
List<ContactResult> cresult = new List<ContactResult>(m_contactResults.Count);
lock (m_PendingRequests)
{
cresult.AddRange(m_contactResults);
m_contactResults.Clear();
}
if (req.callbackMethod is ProbeBoxCallback)
((ProbeBoxCallback)req.callbackMethod)(cresult);
else if (req.callbackMethod is ProbeSphereCallback)
((ProbeSphereCallback)req.callbackMethod)(cresult);
}
private void doPlane(ODERayRequest req,IntPtr geom)
{
// Collide tests
if (geom == IntPtr.Zero)
{
if ((CurrentRayFilter & FilterActiveSpace) != 0)
{
SafeNativeMethods.SpaceCollide2(Plane, m_scene.ActiveSpace, IntPtr.Zero, nearCallback);
SafeNativeMethods.SpaceCollide2(Plane, m_scene.CharsSpace, IntPtr.Zero, nearCallback);
}
if ((CurrentRayFilter & FilterStaticSpace) != 0 && (m_contactResults.Count < CurrentMaxCount))
SafeNativeMethods.SpaceCollide2(Plane, m_scene.StaticSpace, IntPtr.Zero, nearCallback);
if ((CurrentRayFilter & RayFilterFlags.land) != 0 && (m_contactResults.Count < CurrentMaxCount))
SafeNativeMethods.SpaceCollide2(Plane, m_scene.GroundSpace, IntPtr.Zero, nearCallback);
}
else
{
SafeNativeMethods.SpaceCollide2(Plane, geom, IntPtr.Zero, nearCallback);
}
List<ContactResult> cresult = new List<ContactResult>(m_contactResults.Count);
lock (m_PendingRequests)
{
cresult.AddRange(m_contactResults);
m_contactResults.Clear();
}
((ProbePlaneCallback)req.callbackMethod)(cresult);
}
/// <summary>
/// Method that actually initiates the raycast with a geom
/// </summary>
/// <param name="req"></param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private void doGeomRay(ODERayRequest req, IntPtr geom)
{
SafeNativeMethods.GeomRaySetLength(ray, req.length);
SafeNativeMethods.GeomRaySet(ray, req.Origin.X, req.Origin.Y, req.Origin.Z, req.Normal.X, req.Normal.Y, req.Normal.Z);
// Collide test
SafeNativeMethods.SpaceCollide2(ray, geom, IntPtr.Zero, nearCallback); // still do this to have full AABB pre test
@ -472,24 +385,13 @@ namespace OpenSim.Region.PhysicsModule.ubOde
}
}
private bool GetCurContactGeom(int index, ref SafeNativeMethods.ContactGeom newcontactgeom)
{
IntPtr ContactgeomsArray = m_scene.ContactgeomsArray;
if (ContactgeomsArray == IntPtr.Zero || index >= CollisionContactGeomsPerTest)
return false;
IntPtr contactptr = new IntPtr(ContactgeomsArray.ToInt64() + (Int64)(index * SafeNativeMethods.ContactGeom.unmanagedSizeOf));
newcontactgeom = (SafeNativeMethods.ContactGeom)Marshal.PtrToStructure(contactptr, typeof(SafeNativeMethods.ContactGeom));
return true;
}
// This is the standard Near. g1 is the ray
private void near(IntPtr space, IntPtr g1, IntPtr g2)
private void near(IntPtr dummy, IntPtr g1, IntPtr g2)
{
if (g2 == IntPtr.Zero || g1 == g2)
if (g2 == IntPtr.Zero)
return;
if (m_contactResults.Count >= CurrentMaxCount)
if (m_contactResults.Count >= CurrentMaxCount)
return;
if (SafeNativeMethods.GeomIsSpace(g2))
@ -518,21 +420,13 @@ namespace OpenSim.Region.PhysicsModule.ubOde
if (count == 0)
return;
/*
uint cat1 = d.GeomGetCategoryBits(g1);
uint cat2 = d.GeomGetCategoryBits(g2);
uint col1 = d.GeomGetCollideBits(g1);
uint col2 = d.GeomGetCollideBits(g2);
*/
uint ID = 0;
PhysicsActor p2 = null;
m_scene.actor_name_map.TryGetValue(g2, out p2);
m_scene.actor_name_map.TryGetValue(g2, out PhysicsActor p2);
if (p2 == null)
return;
uint ID = 0;
switch (p2.PhysicsActorType)
{
case (int)ActorTypes.Prim:
@ -556,53 +450,26 @@ namespace OpenSim.Region.PhysicsModule.ubOde
ID = ((OdePrim)p2).LocalID;
break;
case (int)ActorTypes.Agent:
if ((CurrentRayFilter & RayFilterFlags.agent) == 0)
return;
else
ID = ((OdeCharacter)p2).LocalID;
break;
case (int)ActorTypes.Ground:
if ((CurrentRayFilter & RayFilterFlags.land) == 0)
return;
break;
case (int)ActorTypes.Water:
if ((CurrentRayFilter & RayFilterFlags.water) == 0)
return;
break;
default:
break;
return;
// break;
}
SafeNativeMethods.ContactGeom curcontact = new SafeNativeMethods.ContactGeom();
// closestHit for now only works for meshs, so must do it for others
if ((CurrentRayFilter & RayFilterFlags.ClosestHit) == 0)
{
// Loop all contacts, build results.
for (int i = 0; i < count; i++)
{
if (!GetCurContactGeom(i, ref curcontact))
break;
ContactResult collisionresult = new ContactResult();
collisionresult.ConsumerID = ID;
collisionresult.Pos.X = curcontact.pos.X;
collisionresult.Pos.Y = curcontact.pos.Y;
collisionresult.Pos.Z = curcontact.pos.Z;
collisionresult.Depth = curcontact.depth;
collisionresult.Normal.X = curcontact.normal.X;
collisionresult.Normal.Y = curcontact.normal.Y;
collisionresult.Normal.Z = curcontact.normal.Z;
lock (m_contactResults)
{
m_contactResults.Add(collisionresult);
m_contactResults.Add(new ContactResult
{
ConsumerID = ID,
Pos = new Vector3(m_contacts[i].pos.X, m_contacts[i].pos.Y, m_contacts[i].pos.Z),
Normal = new Vector3(m_contacts[i].normal.X, m_contacts[i].normal.Y, m_contacts[i].normal.Z),
Depth = m_contacts[i].depth
});
if (m_contactResults.Count >= CurrentMaxCount)
return;
}
@ -611,31 +478,162 @@ namespace OpenSim.Region.PhysicsModule.ubOde
else
{
// keep only closest contact
ContactResult collisionresult = new ContactResult();
collisionresult.ConsumerID = ID;
collisionresult.Depth = float.MaxValue;
SharedCollisionResult.ConsumerID = ID;
SharedCollisionResult.Depth = float.MaxValue;
for (int i = 0; i < count; i++)
{
if (!GetCurContactGeom(i, ref curcontact))
break;
if (curcontact.depth < collisionresult.Depth)
if (m_contacts[i].depth < SharedCollisionResult.Depth)
{
collisionresult.Pos.X = curcontact.pos.X;
collisionresult.Pos.Y = curcontact.pos.Y;
collisionresult.Pos.Z = curcontact.pos.Z;
collisionresult.Depth = curcontact.depth;
collisionresult.Normal.X = curcontact.normal.X;
collisionresult.Normal.Y = curcontact.normal.Y;
collisionresult.Normal.Z = curcontact.normal.Z;
SharedCollisionResult.Pos.X = m_contacts[i].pos.X;
SharedCollisionResult.Pos.Y = m_contacts[i].pos.Y;
SharedCollisionResult.Pos.Z = m_contacts[i].pos.Z;
SharedCollisionResult.Normal.X = m_contacts[i].normal.X;
SharedCollisionResult.Normal.Y = m_contacts[i].normal.Y;
SharedCollisionResult.Normal.Z = m_contacts[i].normal.Z;
SharedCollisionResult.Depth = m_contacts[i].depth;
}
}
if (collisionresult.Depth != float.MaxValue)
if (SharedCollisionResult.Depth != float.MaxValue)
{
lock (m_contactResults)
m_contactResults.Add(collisionresult);
m_contactResults.Add(SharedCollisionResult);
}
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private void collideRayAvatar(OdeCharacter chr)
{
if (chr.collider == IntPtr.Zero)
return;
int count = 0;
try
{
count = SafeNativeMethods.CollidePtr(ray, chr.collider, CollisionContactGeomsPerTest, m_scene.ContactgeomsArray, SafeNativeMethods.ContactGeom.unmanagedSizeOf);
if (count == 0)
return;
}
catch (Exception e)
{
m_log.WarnFormat("[PHYSICS Ray]: Unable to collide test an object: {0}", e.Message);
return;
}
// closestHit for now only works for meshs, so must do it for others
if ((CurrentRayFilter & RayFilterFlags.ClosestHit) == 0)
{
uint id = chr.LocalID;
// Loop all contacts, build results.
for (int i = 0; i < count; i++)
{
lock (m_contactResults)
{
m_contactResults.Add(new ContactResult
{
ConsumerID = id,
Pos = new Vector3(m_contacts[i].pos.X, m_contacts[i].pos.Y, m_contacts[i].pos.Z),
Normal = new Vector3(m_contacts[i].normal.X, m_contacts[i].normal.Y, m_contacts[i].normal.Z),
Depth = m_contacts[i].depth
});
if (m_contactResults.Count >= CurrentMaxCount)
return;
}
}
}
else
{
// keep only closest contact
SharedCollisionResult.ConsumerID = chr.LocalID;
SharedCollisionResult.Depth = float.MaxValue;
for (int i = 0; i < count; i++)
{
if (m_contacts[i].depth < SharedCollisionResult.Depth)
{
SharedCollisionResult.Pos.X = m_contacts[i].pos.X;
SharedCollisionResult.Pos.Y = m_contacts[i].pos.Y;
SharedCollisionResult.Pos.Z = m_contacts[i].pos.Z;
SharedCollisionResult.Normal.X = m_contacts[i].normal.X;
SharedCollisionResult.Normal.Y = m_contacts[i].normal.Y;
SharedCollisionResult.Normal.Z = m_contacts[i].normal.Z;
SharedCollisionResult.Depth = m_contacts[i].depth;
}
}
if (SharedCollisionResult.Depth != float.MaxValue)
{
lock (m_contactResults)
m_contactResults.Add(SharedCollisionResult);
}
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private void collideRayTerrain(IntPtr terrain)
{
if (terrain == IntPtr.Zero)
return;
int count = 0;
try
{
count = SafeNativeMethods.CollidePtr(ray, terrain, CollisionContactGeomsPerTest, m_scene.ContactgeomsArray, SafeNativeMethods.ContactGeom.unmanagedSizeOf);
if (count == 0)
return;
}
catch (Exception e)
{
m_log.WarnFormat("[PHYSICS Ray]: Unable to collide test an object: {0}", e.Message);
return;
}
// closestHit for now only works for meshs, so must do it for others
if ((CurrentRayFilter & RayFilterFlags.ClosestHit) == 0)
{
// Loop all contacts, build results.
for (int i = 0; i < count; i++)
{
lock (m_contactResults)
{
m_contactResults.Add(new ContactResult
{
ConsumerID = 0,
Pos = new Vector3(m_contacts[i].pos.X, m_contacts[i].pos.Y, m_contacts[i].pos.Z),
Normal = new Vector3(m_contacts[i].normal.X, m_contacts[i].normal.Y, m_contacts[i].normal.Z),
Depth = m_contacts[i].depth
});
if (m_contactResults.Count >= CurrentMaxCount)
return;
}
}
}
else
{
// keep only closest contact
SharedCollisionResult.ConsumerID = 0;
SharedCollisionResult.Depth = float.MaxValue;
for (int i = 0; i < count; i++)
{
if (m_contacts[i].depth < SharedCollisionResult.Depth)
{
SharedCollisionResult.Pos.X = m_contacts[i].pos.X;
SharedCollisionResult.Pos.Y = m_contacts[i].pos.Y;
SharedCollisionResult.Pos.Z = m_contacts[i].pos.Z;
SharedCollisionResult.Normal.X = m_contacts[i].normal.X;
SharedCollisionResult.Normal.Y = m_contacts[i].normal.Y;
SharedCollisionResult.Normal.Z = m_contacts[i].normal.Z;
SharedCollisionResult.Depth = m_contacts[i].depth;
}
}
if (SharedCollisionResult.Depth != float.MaxValue)
{
lock (m_contactResults)
m_contactResults.Add(SharedCollisionResult);
}
}
}
@ -650,33 +648,18 @@ namespace OpenSim.Region.PhysicsModule.ubOde
SafeNativeMethods.GeomDestroy(ray);
ray = IntPtr.Zero;
}
if (Box != IntPtr.Zero)
{
SafeNativeMethods.GeomDestroy(Box);
Box = IntPtr.Zero;
}
if (Sphere != IntPtr.Zero)
{
SafeNativeMethods.GeomDestroy(Sphere);
Sphere = IntPtr.Zero;
}
if (Plane != IntPtr.Zero)
{
SafeNativeMethods.GeomDestroy(Plane);
Plane = IntPtr.Zero;
}
}
}
public struct ODERayRequest
public class ODERayRequest
{
public PhysicsActor actor;
public Vector3 Origin;
public Vector3 Normal;
public object callbackMethod;
public PhysicsActor actor;
public int Count;
public float length;
public object callbackMethod;
public RayFilterFlags filter;
public Quaternion orientation;
}
}

File diff suppressed because it is too large Load diff

View file

@ -4431,11 +4431,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llCreateLink(LSL_Key target, LSL_Integer parent)
{
if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0
&& !m_automaticLinkPermission)
if (!m_automaticLinkPermission)
{
Error("llCreateLink", "PERMISSION_CHANGE_LINKS permission not set");
return;
if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0)
{
Error("llCreateLink", "PERMISSION_CHANGE_LINKS required");
return;
}
if (m_item.PermsGranter.NotEqual(m_host.ParentGroup.OwnerID))
{
Error("llCreateLink", "PERMISSION_CHANGE_LINKS not set by script owner");
return;
}
}
CreateLink(target, parent);
@ -4446,34 +4453,43 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (!UUID.TryParse(target, out UUID targetID) || targetID.IsZero())
return;
SceneObjectGroup hostgroup = m_host.ParentGroup;
if (hostgroup.AttachmentPoint != 0)
return; // Fail silently if attached
if ((hostgroup.RootPart.OwnerMask & (uint)PermissionMask.Modify) == 0)
return;
SceneObjectPart targetPart = World.GetSceneObjectPart(targetID);
if (targetPart == null)
return;
if (targetPart.ParentGroup.AttachmentPoint != 0)
return; // Fail silently if attached
SceneObjectGroup targetgrp = targetPart.ParentGroup;
if (targetPart.ParentGroup.RootPart.OwnerID.NotEqual(m_host.ParentGroup.RootPart.OwnerID))
if (targetgrp == null || targetgrp.OwnerID.NotEqual(hostgroup.OwnerID))
return;
if (targetgrp.AttachmentPoint != 0)
return; // Fail silently if attached
if ((targetgrp.RootPart.OwnerMask & (uint)PermissionMask.Modify) == 0)
return;
SceneObjectGroup parentPrim = null, childPrim = null;
if (parent != 0)
{
parentPrim = m_host.ParentGroup;
childPrim = targetPart.ParentGroup;
parentPrim = hostgroup;
childPrim = targetgrp;
}
else
{
parentPrim = targetPart.ParentGroup;
childPrim = m_host.ParentGroup;
parentPrim = targetgrp;
childPrim = hostgroup;
}
// Required for linking
childPrim.RootPart.ClearUpdateSchedule();
parentPrim.LinkToGroup(childPrim, true);
parentPrim.TriggerScriptChangedEvent(Changed.LINK);
parentPrim.RootPart.CreateSelected = false;
parentPrim.HasGroupChanged = true;
@ -4492,7 +4508,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llBreakLink(int linknum)
{
if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0
&& !m_automaticLinkPermission)
{
@ -4512,6 +4527,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (parentSOG.AttachmentPoint != 0)
return; // Fail silently if attached
if ((parentSOG.RootPart.OwnerMask & (uint)PermissionMask.Modify) == 0)
return;
SceneObjectPart childPrim = null;
switch (linknum)
@ -6338,9 +6357,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_String llGetDate()
{
DateTime date = DateTime.Now.ToUniversalTime();
string result = date.ToString("yyyy-MM-dd");
return result;
return DateTime.UtcNow.ToString("yyyy-MM-dd");
}
public LSL_Integer llEdgeOfWorld(LSL_Vector pos, LSL_Vector dir)
@ -10983,7 +11000,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_String llGetTimestamp()
{
return DateTime.Now.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ");
return DateTime.UtcNow.ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ");
}
public LSL_Integer llGetNumberOfPrims()
@ -14661,6 +14678,33 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ret.Add(new LSL_Integer(count));
break;
case ScriptBaseClass.OBJECT_ACCOUNT_LEVEL:
ret.Add(new LSL_Integer(1));
break;
case ScriptBaseClass.OBJECT_MATERIAL:
ret.Add(new LSL_Integer((int)Material.Flesh));
break;
case ScriptBaseClass.OBJECT_MASS:
ret.Add(new LSL_Float(av.GetMass()));
break;
case ScriptBaseClass.OBJECT_TEXT:
ret.Add(new LSL_String(""));
break;
case ScriptBaseClass.OBJECT_REZ_TIME:
ret.Add(new LSL_String(""));
break;
case ScriptBaseClass.OBJECT_LINK_NUMBER:
ret.Add(new LSL_Integer(0));
break;
case ScriptBaseClass.OBJECT_SCALE:
ret.Add(new LSL_Vector(av.Appearance.AvatarBoxSize));
break;
case ScriptBaseClass.OBJECT_TEXT_COLOR:
ret.Add(new LSL_Vector(0f, 0f, 0f));
break;
case ScriptBaseClass.OBJECT_TEXT_ALPHA:
ret.Add(new LSL_Float(1.0f));
break;
default:
// Invalid or unhandled constant.
ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL));
@ -14886,6 +14930,36 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
case ScriptBaseClass.OBJECT_ANIMATED_SLOTS_AVAILABLE:
ret.Add(new LSL_Integer(0));
break;
case ScriptBaseClass.OBJECT_ACCOUNT_LEVEL:
ret.Add(new LSL_Integer(1));
break;
case ScriptBaseClass.OBJECT_MATERIAL:
ret.Add(new LSL_Integer(m_host.Material));
break;
case ScriptBaseClass.OBJECT_MASS:
ret.Add(new LSL_Float(llGetMassMKS()));
break;
case ScriptBaseClass.OBJECT_TEXT:
ret.Add(new LSL_String(m_host.Text));
break;
case ScriptBaseClass.OBJECT_REZ_TIME:
ret.Add(new LSL_String(m_host.Rezzed.ToString("yyyy-MM-ddTHH:mm:ss.ffffffZ", CultureInfo.InvariantCulture)));
break;
case ScriptBaseClass.OBJECT_LINK_NUMBER:
ret.Add(new LSL_Integer(m_host.LinkNum));
break;
case ScriptBaseClass.OBJECT_SCALE:
ret.Add(new LSL_Vector(m_host.Scale));
break;
case ScriptBaseClass.OBJECT_TEXT_COLOR:
Color4 textColor = m_host.GetTextColor();
ret.Add(new LSL_Vector(textColor.R,
textColor.G,
textColor.B));
break;
case ScriptBaseClass.OBJECT_TEXT_ALPHA:
ret.Add(new LSL_Float(m_host.GetTextColor().A));
break;
default:
// Invalid or unhandled constant.
ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL));

View file

@ -670,6 +670,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
public const int OBJECT_SIT_COUNT = 38;
public const int OBJECT_ANIMATED_COUNT = 39;
public const int OBJECT_ANIMATED_SLOTS_AVAILABLE = 40;
public const int OBJECT_ACCOUNT_LEVEL = 41;
public const int OBJECT_MATERIAL = 42;
public const int OBJECT_MASS = 43;
public const int OBJECT_TEXT = 44;
public const int OBJECT_REZ_TIME = 45;
public const int OBJECT_LINK_NUMBER = 46;
public const int OBJECT_SCALE = 47;
public const int OBJECT_TEXT_COLOR = 48;
public const int OBJECT_TEXT_ALPHA = 49;
// Pathfinding types

View file

@ -939,8 +939,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
if (Engine.World.PipeEventsForScript(LocalID) ||
data.EventName == "control") // Don't freeze avies!
{
// m_log.DebugFormat("[Script] Delivered event {2} in state {3} to {0}.{1}",
// PrimName, ScriptName, data.EventName, State);
//m_log.DebugFormat("[Script] Delivered event {2} in state {3} to {0}.{1}",
// PrimName, ScriptName, data.EventName, State);
try
{

View file

@ -1864,11 +1864,11 @@ namespace OpenSim.Region.ScriptEngine.Shared
public static bool operator ==(key k1, key k2)
{
return k1.value == k2.value;
return k1.value.Equals(k2.value);
}
public static bool operator !=(key k1, key k2)
{
return k1.value != k2.value;
return !k1.value.Equals(k2.value);
}
#endregion

View file

@ -99,6 +99,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
= TaskInventoryHelpers.AddNotecard(
m_scene.AssetService, grp1.RootPart, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!");
grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS;
grp1Item.PermsGranter = ownerId;
SceneObjectGroup grp2 = SceneHelpers.CreateSceneObject(2, ownerId, "grp2-", 0x20);
grp2.AbsolutePosition = new Vector3(20, 20, 20);

View file

@ -104,7 +104,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine.Tests
m_scene.EventManager.OnChatFromWorld += OnChatFromWorld;
SceneObjectPart partWhereRezzed = m_scene.RezNewScript(userId, itemTemplate);
SceneObjectPart partWhereRezzed = m_scene.RezNewScript(userId, itemTemplate, Constants.DefaultScriptText);
m_chatEvent.WaitOne(60000);

View file

@ -149,10 +149,11 @@ namespace OpenSim.Region.ScriptEngine.Yengine
// "DetectParams" are returned by llDetected...() script functions
// for the currently active event, if any.
if(m_DetectParams != null)
var detectParams = m_DetectParams;
if (detectParams != null)
{
XmlElement detParArrayN = doc.CreateElement("", "DetectArray", "");
AppendXMLDetectArray(doc, detParArrayN, m_DetectParams);
AppendXMLDetectArray(doc, detParArrayN, detectParams);
scriptStateN.AppendChild(detParArrayN);
}
//m_RunOnePhase = "GetExecutionState F";
@ -231,11 +232,15 @@ namespace OpenSim.Region.ScriptEngine.Yengine
*/
private static void AppendXMLDetectArray(XmlDocument doc, XmlElement parent, DetectParams[] detect)
{
foreach(DetectParams d in detect)
try
{
XmlElement detectParamsN = GetXMLDetect(doc, d);
parent.AppendChild(detectParamsN);
foreach(DetectParams d in detect)
{
XmlElement detectParamsN = GetXMLDetect(doc, d);
parent.AppendChild(detectParamsN);
}
}
catch { }
}
private static XmlElement GetXMLDetect(XmlDocument doc, DetectParams d)

View file

@ -136,7 +136,8 @@ namespace OpenSim.Server.Handlers.Asset
result = ServerUtils.SerializeResult(xs, asset);
httpResponse.StatusCode = (int)HttpStatusCode.OK;
httpResponse.ContentType = SLUtil.SLAssetTypeToContentType(asset.Type);
//httpResponse.ContentType = SLUtil.SLAssetTypeToContentType(asset.Type);
httpResponse.ContentType = "text/xml";
}
else
{

View file

@ -61,7 +61,7 @@ namespace OpenSim.Server.Handlers.Freeswitch
string freeswitchService = serverConfig.GetString("LocalServiceModule",
String.Empty);
if (freeswitchService == String.Empty)
if (freeswitchService.Length == 0)
throw new Exception("No LocalServiceModule in config file");
Object[] args = new Object[] { config };

View file

@ -50,7 +50,7 @@ namespace OpenSim.Server.Handlers.Friends
string theService = serverConfig.GetString("LocalServiceModule",
String.Empty);
if (theService == String.Empty)
if (theService.Length == 0)
throw new Exception("No LocalServiceModule in config file");
Object[] args = new Object[] { config };

View file

@ -364,8 +364,8 @@ namespace OpenSim.Services.FSAssetService
string GetSHA256Hash(byte[] data)
{
byte[] hash;
using (SHA256CryptoServiceProvider SHA256 = new SHA256CryptoServiceProvider())
hash = SHA256.ComputeHash(data);
using (SHA256 sha = SHA256.Create())
hash = sha.ComputeHash(data);
return BitConverter.ToString(hash).Replace("-", String.Empty);
}

View file

@ -195,11 +195,9 @@ namespace OpenSim.Services.LLLoginService
string hgInvServicePlugin = m_LoginServerConfig.GetString("HGInventoryServicePlugin", string.Empty);
if (!string.IsNullOrWhiteSpace(hgInvServicePlugin))
{
// TODO: Remove HGInventoryServiceConstructorArg after 0.9 release
string hgInvServiceArg = m_LoginServerConfig.GetString("HGInventoryServiceConstructorArg", string.Empty);
if (!string.IsNullOrWhiteSpace(hgInvServiceArg))
{
m_log.Warn("[LLOGIN SERVICE]: You are using HGInventoryServiceConstructorArg, which is deprecated. See example file for correct syntax.");
hgInvServicePlugin = hgInvServiceArg + "@" + hgInvServicePlugin;
}
m_HGInventoryService = ServerUtils.LoadPlugin<IInventoryService>(hgInvServicePlugin, args);

View file

@ -148,7 +148,6 @@ namespace OpenSim.Services.MapImageService
}
catch (Exception e)
{
m_log.WarnFormat("[MAP IMAGE SERVICE]: Unable to save delete file {0}: {1}", fileName, e);
reason = e.Message;
return false;
@ -157,7 +156,6 @@ namespace OpenSim.Services.MapImageService
return UpdateMultiResolutionFiles(x, y, scopeID, out reason);
}
// When large varregions start up, they can send piles of new map tiles. This causes
// this multi-resolution routine to be called a zillion times an causes much CPU
// time to be spent creating multi-resolution tiles that will be replaced when
@ -361,22 +359,16 @@ namespace OpenSim.Services.MapImageService
ntiles++;
}
// Write the modified output
if (ntiles == 0)
File.Delete(outputFile);
else
try
{
try
{
File.Delete(outputFile);
if (ntiles > 0)
output.Save(outputFile, ImageFormat.Jpeg);
}
catch (Exception e)
{
m_log.WarnFormat("[MAP IMAGE SERVICE]: Oops on saving {0} {1}", outputFile, e);
}
} // Save also as png?
}
catch (Exception e)
{
m_log.WarnFormat("[MAP IMAGE SERVICE]: Oops on saving {0} {1}", outputFile, e);
}
output.Dispose();
return true;

View file

@ -315,6 +315,67 @@ namespace Prebuild.Core.Nodes
}
}
[OptionNode("EnableDefaultItems")]
private bool m_EnableDefaultItems = true;
public bool EnableDefaultItems
{
get
{
return m_EnableDefaultItems;
}
set
{
m_EnableDefaultItems = value;
}
}
[OptionNode("UseCommonOutputDirectory")]
private bool m_UseCommonOutputDirectory = false;
public bool UseCommonOutputDirectory
{
get
{
return m_UseCommonOutputDirectory;
}
set
{
m_UseCommonOutputDirectory = value;
}
}
[OptionNode("AppendTargetFrameworkToOutputPath")]
private bool m_AppendTargetFrameworkToOutputPath = true;
public bool AppendTargetFrameworkToOutputPath
{
get
{
return m_AppendTargetFrameworkToOutputPath;
}
set
{
m_AppendTargetFrameworkToOutputPath = value;
}
}
[OptionNode("AppendRuntimeIdentifierToOutputPath")]
private bool m_AppendRuntimeIdentifierToOutputPath = true;
public bool AppendRuntimeIdentifierToOutputPath
{
get
{
return m_AppendRuntimeIdentifierToOutputPath;
}
set
{
m_AppendRuntimeIdentifierToOutputPath = value;
}
}
[OptionNode("OutputPath")]
private string m_OutputPath = "bin/";

View file

@ -0,0 +1,151 @@
using System;
using System.IO;
using System.Text;
using Prebuild.Core.Attributes;
using Prebuild.Core.Interfaces;
using Prebuild.Core.Nodes;
using Prebuild.Core.Utilities;
using System.CodeDom.Compiler;
namespace Prebuild.Core.Targets
{
/// <summary>
///
/// </summary>
[Target("vs2017")]
public class VS2017Target : VSGenericTarget
{
#region Fields
string solutionVersion = "12.00";
string productVersion = "15.9.50";
string schemaVersion = "2.0";
string versionName = "Visual Studio 17";
string name = "vs2017";
VSVersion version = VSVersion.VS17;
#endregion
#region Properties
/// <summary>
/// Gets or sets the solution version.
/// </summary>
/// <value>The solution version.</value>
public override string SolutionVersion
{
get
{
return solutionVersion;
}
}
/// <summary>
/// Gets or sets the product version.
/// </summary>
/// <value>The product version.</value>
public override string ProductVersion
{
get
{
return productVersion;
}
}
/// <summary>
/// Gets or sets the schema version.
/// </summary>
/// <value>The schema version.</value>
public override string SchemaVersion
{
get
{
return schemaVersion;
}
}
/// <summary>
/// Gets or sets the name of the version.
/// </summary>
/// <value>The name of the version.</value>
public override string VersionName
{
get
{
return versionName;
}
}
/// <summary>
/// Gets or sets the version.
/// </summary>
/// <value>The version.</value>
public override VSVersion Version
{
get
{
return version;
}
}
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public override string Name
{
get
{
return name;
}
}
protected override string GetToolsVersionXml(FrameworkVersion frameworkVersion)
{
switch (frameworkVersion)
{
case FrameworkVersion.v4_8:
case FrameworkVersion.v4_7_2:
case FrameworkVersion.v4_7_1:
case FrameworkVersion.v4_7:
return "ToolsVersion=\"15.0\"";
case FrameworkVersion.v4_6_2:
case FrameworkVersion.v4_6_1:
case FrameworkVersion.v4_6:
return "ToolsVersion=\"14.0\"";
case FrameworkVersion.v4_5_2:
return "ToolsVersion=\"12.0\"";
case FrameworkVersion.v4_5_1:
case FrameworkVersion.v4_5:
case FrameworkVersion.v4_0:
case FrameworkVersion.v3_5:
return "ToolsVersion=\"4.0\"";
case FrameworkVersion.v3_0:
return "ToolsVersion=\"3.0\"";
default:
return "ToolsVersion=\"2.0\"";
}
}
public override string SolutionTag
{
get { return "# Visual Studio 17"; }
}
#endregion
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="VS2012Target"/> class.
/// </summary>
public VS2017Target()
: base()
{
}
#endregion
}
}

View file

@ -106,6 +106,10 @@ namespace Prebuild.Core.Targets
{
switch (frameworkVersion)
{
case FrameworkVersion.netstandard2_0:
case FrameworkVersion.net5_0:
case FrameworkVersion.net6_0:
case FrameworkVersion.net7_0:
case FrameworkVersion.v4_8:
case FrameworkVersion.v4_7_2:
return "ToolsVersion=\"16.0\"";

View file

@ -0,0 +1,157 @@
using System;
using System.IO;
using System.Text;
using Prebuild.Core.Attributes;
using Prebuild.Core.Interfaces;
using Prebuild.Core.Nodes;
using Prebuild.Core.Utilities;
using System.CodeDom.Compiler;
namespace Prebuild.Core.Targets
{
/// <summary>
///
/// </summary>
[Target("vs2022")]
public class VS2022Target : VSGenericTarget
{
#region Fields
string solutionVersion = "12.00";
string productVersion = "117.3.2";
string schemaVersion = "2.0";
string versionName = "Visual Studio Version 17";
string name = "vs2022";
VSVersion version = VSVersion.VS22;
#endregion
#region Properties
/// <summary>
/// Gets or sets the solution version.
/// </summary>
/// <value>The solution version.</value>
public override string SolutionVersion
{
get
{
return solutionVersion;
}
}
/// <summary>
/// Gets or sets the product version.
/// </summary>
/// <value>The product version.</value>
public override string ProductVersion
{
get
{
return productVersion;
}
}
/// <summary>
/// Gets or sets the schema version.
/// </summary>
/// <value>The schema version.</value>
public override string SchemaVersion
{
get
{
return schemaVersion;
}
}
/// <summary>
/// Gets or sets the name of the version.
/// </summary>
/// <value>The name of the version.</value>
public override string VersionName
{
get
{
return versionName;
}
}
/// <summary>
/// Gets or sets the version.
/// </summary>
/// <value>The version.</value>
public override VSVersion Version
{
get
{
return version;
}
}
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public override string Name
{
get
{
return name;
}
}
protected override string GetToolsVersionXml(FrameworkVersion frameworkVersion)
{
switch (frameworkVersion)
{
case FrameworkVersion.net5_0:
case FrameworkVersion.net6_0:
case FrameworkVersion.net7_0:
return "ToolsVersion=\"17.0\"";
case FrameworkVersion.netstandard2_0:
case FrameworkVersion.v4_8:
case FrameworkVersion.v4_7_2:
return "ToolsVersion=\"16.0\"";
case FrameworkVersion.v4_7_1:
case FrameworkVersion.v4_7:
return "ToolsVersion=\"15.0\"";
case FrameworkVersion.v4_6_2:
case FrameworkVersion.v4_6_1:
case FrameworkVersion.v4_6:
return "ToolsVersion=\"14.0\"";
case FrameworkVersion.v4_5_2:
return "ToolsVersion=\"12.0\"";
case FrameworkVersion.v4_5_1:
case FrameworkVersion.v4_5:
case FrameworkVersion.v4_0:
case FrameworkVersion.v3_5:
return "ToolsVersion=\"4.0\"";
case FrameworkVersion.v3_0:
return "ToolsVersion=\"3.0\"";
default:
return "ToolsVersion=\"2.0\"";
}
}
public override string SolutionTag
{
get { return "# Visual Studio 22"; }
}
#endregion
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="VS2012Target"/> class.
/// </summary>
public VS2022Target()
: base()
{
}
#endregion
}
}

View file

@ -317,7 +317,6 @@ namespace Prebuild.Core.Targets
}
#region Files
foreach (string filePath in project.Files)
{
@ -674,6 +673,9 @@ namespace Prebuild.Core.Targets
private void WriteProjectDotNet(SolutionNode solution, ProjectNode project, StreamWriter ps)
{
#region Project File
bool listFiles = false;
string prebuild = string.Empty;
string postbuild = string.Empty;
using (ps)
{
ps.WriteLine("<Project Sdk=\"Microsoft.NET.Sdk\">");
@ -681,12 +683,17 @@ namespace Prebuild.Core.Targets
ps.WriteLine(" <PropertyGroup>");
ps.WriteLine(" <TargetFramework>{0}</TargetFramework>", project.FrameworkVersion.ToString().Replace("_", "."));
ps.WriteLine(" <PreserveCompilationContext>false</PreserveCompilationContext>");
ps.WriteLine(" <OutputType>{0}</OutputType>", project.Type == ProjectType.Web ? ProjectType.Library.ToString() : project.Type.ToString());
ps.WriteLine(" <GenerateAssemblyInfo>false</GenerateAssemblyInfo>");
ps.WriteLine(" <RuntimeFrameworkVersion>5.0.0</RuntimeFrameworkVersion>");
if(project.FrameworkVersion == FrameworkVersion.netstandard2_0)
ps.WriteLine(" <RuntimeFrameworkVersion>5.0.0</RuntimeFrameworkVersion>");
ps.WriteLine(" <ImplicitUsings>disable</ImplicitUsings>");
ps.WriteLine(" <AssemblyName>{0}</AssemblyName>", project.AssemblyName);
ps.WriteLine(" <Deterministic>true</Deterministic>");
//ps.WriteLine(" <EnableDefaultCompileItems>false</EnableDefaultCompileItems>");
ps.WriteLine(" <ProduceReferenceAssembly>false</ProduceReferenceAssembly>");
ps.WriteLine(" <GenerateDependencyFile>false</GenerateDependencyFile>");
ps.WriteLine(" </PropertyGroup>");
ps.WriteLine();
@ -720,6 +727,16 @@ namespace Prebuild.Core.Targets
ps.WriteLine(" <FileAlignment>{0}</FileAlignment>", conf.Options["FileAlignment"]);
ps.WriteLine(" <Optimize>{0}</Optimize>", conf.Options["OptimizeCode"]);
ps.WriteLine(" <TieredCompilation>false</TieredCompilation>");
ps.WriteLine(" <UseCommonOutputDirectory>{0}</UseCommonOutputDirectory>", conf.Options["UseCommonOutputDirectory"].ToString());
ps.WriteLine(" <AppendTargetFrameworkToOutputPath>{0}</AppendTargetFrameworkToOutputPath>", conf.Options["AppendTargetFrameworkToOutputPath"].ToString());
ps.WriteLine(" <AppendRuntimeIdentifierToOutputPath>{0}</AppendRuntimeIdentifierToOutputPath>", conf.Options["AppendRuntimeIdentifierToOutputPath"].ToString());
if ((bool)conf.Options["EnableDefaultItems"] == false)
{
listFiles = true;
ps.WriteLine(" <EnableDefaultItems>false</EnableDefaultItems>");
}
if (project.Type != ProjectType.Web)
ps.WriteLine(" <OutputPath>{0}</OutputPath>",
Helper.EndPath(Helper.NormalizePath(conf.Options["OutputPath"].ToString())));
@ -734,6 +751,16 @@ namespace Prebuild.Core.Targets
ps.WriteLine(" <NoStdLib>{0}</NoStdLib>", conf.Options["NoStdLib"]);
ps.WriteLine(" <NoWarn>{0}</NoWarn>", conf.Options["SuppressWarnings"]);
ps.WriteLine(" <PlatformTarget>{0}</PlatformTarget>", conf.Platform);
if (conf.Options["PreBuildEvent"] != null && conf.Options["PreBuildEvent"].ToString().Length != 0)
{
prebuild = conf.Options["PreBuildEvent"].ToString();
}
if (conf.Options["PostBuildEvent"] != null && conf.Options["PostBuildEvent"].ToString().Length != 0)
{
postbuild = conf.Options["PostBuildEvent"].ToString();
}
ps.WriteLine(" </PropertyGroup>");
}
}
@ -762,6 +789,200 @@ namespace Prebuild.Core.Targets
// Output the ItemGroup for project.References
WriteProjectReferencesDotNet(solution, project, ps);
if (listFiles)
{
List<string> list = new List<string>();
ps.WriteLine(" <ItemGroup>");
foreach (string filePath in project.Files)
{
// Add the filePath with the destination as the key
// will use it later to form the copy parameters with Include lists
// for each destination
if (project.Files.GetBuildAction(filePath) == BuildAction.Copy)
continue;
// if (file == "Properties\\Bind.Designer.cs")
// {
// Console.WriteLine("Wait a minute!");
// Console.WriteLine(project.Files.GetSubType(file).ToString());
// }
SubType subType = project.Files.GetSubType(filePath);
// Visual Studio chokes on file names if forward slash is used as a path separator
// instead of backslash. So we must make sure that all file paths written to the
// project file use \ as a path separator.
string file = filePath.Replace(@"/", @"\");
if (subType != SubType.Code && subType != SubType.Settings && subType != SubType.Designer
&& subType != SubType.CodeBehind)
{
ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx");
ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(file));
ps.WriteLine(" <SubType>Designer</SubType>");
ps.WriteLine(" </EmbeddedResource>");
//
}
if (subType == SubType.Designer)
{
ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file);
string autogen_name = file.Substring(0, file.LastIndexOf('.')) + ".Designer.cs";
string dependent_name = filePath.Substring(0, file.LastIndexOf('.')) + ".cs";
// Check for a parent .cs file with the same name as this designer file
if (File.Exists(Helper.NormalizePath(dependent_name)))
{
ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(dependent_name));
}
else
{
ps.WriteLine(" <Generator>ResXFileCodeGenerator</Generator>");
ps.WriteLine(" <LastGenOutput>{0}</LastGenOutput>", Path.GetFileName(autogen_name));
ps.WriteLine(" <SubType>" + subType + "</SubType>");
}
ps.WriteLine(" </EmbeddedResource>");
if (File.Exists(Helper.NormalizePath(autogen_name)))
{
ps.WriteLine(" <Compile Include=\"{0}\">", autogen_name);
//ps.WriteLine(" <DesignTime>True</DesignTime>");
// If a parent .cs file exists, link this autogen file to it. Otherwise link
// to the designer file
if (File.Exists(dependent_name))
{
ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(dependent_name));
}
else
{
ps.WriteLine(" <AutoGen>True</AutoGen>");
ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(filePath));
}
ps.WriteLine(" </Compile>");
}
list.Add(autogen_name);
}
if (subType == SubType.Settings)
{
ps.Write(" <{0} ", project.Files.GetBuildAction(filePath));
ps.WriteLine("Include=\"{0}\">", file);
string fileName = Path.GetFileName(filePath);
if (project.Files.GetBuildAction(filePath) == BuildAction.None)
{
ps.WriteLine(" <Generator>SettingsSingleFileGenerator</Generator>");
ps.WriteLine(" <LastGenOutput>{0}</LastGenOutput>", fileName.Substring(0, fileName.LastIndexOf('.')) + ".Designer.cs");
}
else
{
ps.WriteLine(" <SubType>Code</SubType>");
ps.WriteLine(" <AutoGen>True</AutoGen>");
ps.WriteLine(" <DesignTimeSharedInput>True</DesignTimeSharedInput>");
string fileNameShort = fileName.Substring(0, fileName.LastIndexOf('.'));
string fileNameShorter = fileNameShort.Substring(0, fileNameShort.LastIndexOf('.'));
ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(fileNameShorter + ".settings"));
}
ps.WriteLine(" </{0}>", project.Files.GetBuildAction(filePath));
}
else if (subType != SubType.Designer)
{
string path = Helper.NormalizePath(file);
string path_lower = path.ToLower();
if (!list.Contains(filePath))
{
ps.Write(" <{0} ", project.Files.GetBuildAction(filePath));
int startPos = 0;
if (project.Files.GetPreservePath(filePath))
{
while ((@"./\").IndexOf(file.Substring(startPos, 1)) != -1)
startPos++;
}
else
{
startPos = file.LastIndexOf(Path.GetFileName(path));
}
// be sure to write out the path with backslashes so VS recognizes
// the file properly.
ps.WriteLine("Include=\"{0}\">", file);
int last_period_index = file.LastIndexOf('.');
string short_file_name = (last_period_index >= 0)
? file.Substring(0, last_period_index)
: file;
string extension = Path.GetExtension(path);
// make this upper case, so that when File.Exists tests for the
// existence of a designer file on a case-sensitive platform,
// it is correctly identified.
string designer_format = string.Format(".Designer{0}", extension);
if (path_lower.EndsWith(designer_format.ToLowerInvariant()))
{
int designer_index = path.IndexOf(designer_format);
string file_name = path.Substring(0, designer_index);
// There are two corrections to the next lines:
// 1. Fix the connection between a designer file and a form
// or usercontrol that don't have an associated resx file.
// 2. Connect settings files to associated designer files.
if (File.Exists(file_name + extension))
ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(file_name + extension));
else if (File.Exists(file_name + ".resx"))
ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(file_name + ".resx"));
else if (File.Exists(file_name + ".settings"))
{
ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(file_name + ".settings"));
ps.WriteLine(" <AutoGen>True</AutoGen>");
ps.WriteLine(" <DesignTimeSharedInput>True</DesignTimeSharedInput>");
}
}
else if (subType == SubType.CodeBehind)
{
ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(short_file_name));
}
if (project.Files.GetIsLink(filePath))
{
string alias = project.Files.GetLinkPath(filePath);
alias += file.Substring(startPos);
alias = Helper.NormalizePath(alias);
ps.WriteLine(" <Link>{0}</Link>", alias);
}
else if (project.Files.GetBuildAction(filePath) != BuildAction.None)
{
if (project.Files.GetBuildAction(filePath) != BuildAction.EmbeddedResource)
{
ps.WriteLine(" <SubType>{0}</SubType>", subType);
}
}
if (project.Files.GetCopyToOutput(filePath) != CopyToOutput.Never)
{
ps.WriteLine(" <CopyToOutputDirectory>{0}</CopyToOutputDirectory>", project.Files.GetCopyToOutput(filePath));
}
ps.WriteLine(" </{0}>", project.Files.GetBuildAction(filePath));
}
}
}
ps.WriteLine(" </ItemGroup>");
}
if (!string.IsNullOrEmpty(prebuild))
{
ps.WriteLine(" <Target Name=\"PreBuild\" BeforeTargets=\"PreBuildEvent\">");
ps.WriteLine(" <Exec Command = \"{0}\" />", prebuild);
ps.WriteLine(" </Target>");
}
if (!string.IsNullOrEmpty(postbuild))
{
ps.WriteLine(" <Target Name = \"PostBuild\" AfterTargets = \"PostBuildEvent\">");
ps.WriteLine(" <Exec Command = \"{0}\" />", postbuild);
ps.WriteLine(" </Target>");
}
ps.WriteLine("</Project>");
#endregion
@ -790,6 +1011,7 @@ namespace Prebuild.Core.Targets
foreach (ReferenceNode refr in otherReferences)
{
ps.Write(" <Reference");
//ps.Write(" Update=\"");
ps.Write(" Include=\"");
ps.Write(refr.Name);
ps.WriteLine("\" >");
@ -1166,6 +1388,9 @@ namespace Prebuild.Core.Targets
Helper.DeleteIfExists(projectFile);
Helper.DeleteIfExists(userFile);
string projectobj = Helper.MakeFilePath(project.FullPath,"obj");
Helper.DeleteFolderIfExists(projectobj);
}
private void CleanSolution(SolutionNode solution)

View file

@ -63,6 +63,7 @@ namespace Prebuild.Core.Targets
/// </summary>
VS15,
VS17,
VS19
VS19,
VS22
}
}

View file

@ -232,6 +232,27 @@ namespace Prebuild.Core.Utilities
return true;
}
public static bool DeleteFolderIfExists(string file)
{
string resFile = null;
try
{
resFile = ResolvePath(file);
}
catch (ArgumentException)
{
return false;
}
if (!Directory.Exists(resFile))
{
return false;
}
Directory.Delete(resFile, true);
return true;
}
static readonly char seperator = Path.DirectorySeparatorChar;
// This little gem was taken from the NeL source, thanks guys!

View file

@ -187,8 +187,8 @@
<xs:all>
<xs:element name="CompilerDefines" type="xs:string" minOccurs="0" />
<xs:element name="OptimizeCode" type="xs:boolean" minOccurs="0" />
<xs:element name="Prefer32Bit" type="xs:boolean" minOccurs="0" />
<xs:element name="CheckUnderflowOverflow" type="xs:boolean" minOccurs="0" />
<xs:element name="Prefer32Bit" type="xs:boolean" minOccurs="0" />
<xs:element name="CheckUnderflowOverflow" type="xs:boolean" minOccurs="0" />
<xs:element name="AllowUnsafe" type="xs:boolean" minOccurs="0" />
<xs:element name="PreBuildEvent" type="xs:string" minOccurs="0" />
<xs:element name="PostBuildEvent" type="xs:string" minOccurs="0" />
@ -214,6 +214,10 @@
</xs:element>
<xs:element name="WarningsAsErrors" type="xs:boolean" minOccurs="0" />
<xs:element name="SuppressWarnings" type="xs:string" minOccurs="0" />
<xs:element name="UseCommonOutputDirectory" type="xs:boolean" minOccurs="0" />
<xs:element name="AppendTargetFrameworkToOutputPath" type="xs:boolean" minOccurs="0" />
<xs:element name="AppendRuntimeIdentifierToOutputPath" type="xs:boolean" minOccurs="0" />
<xs:element name="EnableDefaultItems" type="xs:boolean" minOccurs="0" />
<xs:element name="OutputPath" type="xs:string" minOccurs="0" />
<xs:element name="GenerateDocumentation" type="xs:boolean" minOccurs="0" />
<xs:element name="XmlDocFile" type="xs:string" minOccurs="0" />

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -1,8 +1,8 @@
<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="osx" cpu="x86" dll="BulletSim" target="lib32/libBulletSim.dylib" />
<dllmap os="osx" cpu="x86-64,ia64" dll="BulletSim" target="lib32/libBulletSim.dylib" />
<dllmap os="osx" cpu="x86" dll="BulletSim" target="lib64/libBulletSim.dylib" />
<dllmap os="osx" cpu="x86-64,ia64" 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,ia64" dll="BulletSim" target="lib64/libBulletSim.so" />
<dllmap os="!windows,osx" cpu="armv8" dll="BulletSim" target="lib64/libBulletSim-aarch64.so" />

Binary file not shown.

View file

@ -1,4 +1,4 @@
4b833b57-d52b-5503-85a4-76754ac3b8ff
3547fa45-79ff-dc5f-a2ba-b9ffb56abefe
<llsd><map><key>llsd-lsl-syntax-version</key><integer>2</integer>
<key>controls</key>
<map>
@ -1419,6 +1419,10 @@
<key>type</key><string>string</string>
<key>value</key><string>00000000-0000-0000-0000-000000000000</string>
</map>
<key>OBJECT_ACCOUNT_LEVEL</key><map>
<key>type</key><string>integer</string>
<key>value</key><string>41</string>
</map>
<key>OBJECT_ANIMATED_COUNT</key><map>
<key>type</key><string>integer</string>
<key>value</key><string>39</string>
@ -1475,6 +1479,18 @@
<key>type</key><string>integer</string>
<key>value</key><string>27</string>
</map>
<key>OBJECT_LINK_NUMBER</key><map>
<key>type</key><string>integer</string>
<key>value</key><string>46</string>
</map>
<key>OBJECT_MASS</key><map>
<key>type</key><string>integer</string>
<key>value</key><string>43</string>
</map>
<key>OBJECT_MATERIAL</key><map>
<key>type</key><string>integer</string>
<key>value</key><string>42</string>
</map>
<key>OBJECT_NAME</key><map>
<key>type</key><string>integer</string>
<key>value</key><string>1</string>
@ -1519,6 +1535,10 @@
<key>type</key><string>integer</string>
<key>value</key><string>24</string>
</map>
<key>OBJECT_REZ_TIME</key><map>
<key>type</key><string>integer</string>
<key>value</key><string>45</string>
</map>
<key>OBJECT_REZZER_KEY</key><map>
<key>type</key><string>integer</string>
<key>value</key><string>32</string>
@ -1535,6 +1555,10 @@
<key>type</key><string>integer</string>
<key>value</key><string>9</string>
</map>
<key>OBJECT_SCALE</key><map>
<key>type</key><string>integer</string>
<key>value</key><string>47</string>
</map>
<key>OBJECT_SCRIPT_MEMORY</key><map>
<key>type</key><string>integer</string>
<key>value</key><string>11</string>
@ -1567,6 +1591,18 @@
<key>type</key><string>integer</string>
<key>value</key><string>23</string>
</map>
<key>OBJECT_TEXT</key><map>
<key>type</key><string>integer</string>
<key>value</key><string>44</string>
</map>
<key>OBJECT_TEXT_ALPHA</key><map>
<key>type</key><string>integer</string>
<key>value</key><string>49</string>
</map>
<key>OBJECT_TEXT_COLOR</key><map>
<key>type</key><string>integer</string>
<key>value</key><string>48</string>
</map>
<key>OBJECT_TOTAL_INVENTORY_COUNT</key><map>
<key>type</key><string>integer</string>
<key>value</key><string>31</string>
@ -2343,6 +2379,10 @@
<key>type</key><string>integer</string>
<key>value</key><string>6</string>
</map>
<key>PRIM_PROJECTOR</key><map>
<key>type</key><string>integer</string>
<key>value</key><string>42</string>
</map>
<key>PRIM_ROT_LOCAL</key><map>
<key>type</key><string>integer</string>
<key>value</key><string>29</string>
@ -6382,7 +6422,6 @@
<key>arguments</key><array>
<map><key>agentId</key><map><key>type</key><string>key</string></map></map>
<map><key>notecard</key><map><key>type</key><string>string</string></map></map>
<map><key>includeHuds</key><map><key>type</key><string>integer</string></map></map>
</array>
</map>
<key>osAgentSaveAppearance</key>
@ -6391,6 +6430,7 @@
<key>arguments</key><array>
<map><key>agentId</key><map><key>type</key><string>key</string></map></map>
<map><key>notecard</key><map><key>type</key><string>string</string></map></map>
<map><key>includeHuds</key><map><key>type</key><string>integer</string></map></map>
</array>
</map>
<key>osAngleBetween</key>
@ -6407,6 +6447,7 @@
<key>arguments</key><array>
<map><key>a</key><map><key>type</key><string>float</string></map></map>
<map><key>b</key><map><key>type</key><string>float</string></map></map>
<map><key>margin</key><map><key>type</key><string>float</string></map></map>
</array>
</map>
<key>osApproxEquals</key>
@ -6415,7 +6456,6 @@
<key>arguments</key><array>
<map><key>a</key><map><key>type</key><string>float</string></map></map>
<map><key>b</key><map><key>type</key><string>float</string></map></map>
<map><key>margin</key><map><key>type</key><string>float</string></map></map>
</array>
</map>
<key>osApproxEquals</key>
@ -7134,15 +7174,15 @@
<key>osKickAvatar</key>
<map>
<key>arguments</key><array>
<map><key>agentId</key><map><key>type</key><string>key</string></map></map>
<map><key>FirstName</key><map><key>type</key><string>string</string></map></map>
<map><key>SurName</key><map><key>type</key><string>string</string></map></map>
<map><key>alert</key><map><key>type</key><string>string</string></map></map>
</array>
</map>
<key>osKickAvatar</key>
<map>
<key>arguments</key><array>
<map><key>FirstName</key><map><key>type</key><string>string</string></map></map>
<map><key>SurName</key><map><key>type</key><string>string</string></map></map>
<map><key>agentId</key><map><key>type</key><string>key</string></map></map>
<map><key>alert</key><map><key>type</key><string>string</string></map></map>
</array>
</map>
@ -7211,6 +7251,13 @@
</array>
</map>
<key>osMakeNotecard</key>
<map>
<key>arguments</key><array>
<map><key>notecardName</key><map><key>type</key><string>string</string></map></map>
<map><key>contents</key><map><key>type</key><string>string</string></map></map>
</array>
</map>
<key>osMakeNotecard</key>
<map>
<key>arguments</key><array>
<map><key>notecardName</key><map><key>type</key><string>string</string></map></map>
@ -7375,7 +7422,6 @@
<map>
<key>arguments</key><array>
<map><key>npc</key><map><key>type</key><string>key</string></map></map>
<map><key>channel</key><map><key>type</key><string>integer</string></map></map>
<map><key>message</key><map><key>type</key><string>string</string></map></map>
</array>
</map>
@ -7383,6 +7429,7 @@
<map>
<key>arguments</key><array>
<map><key>npc</key><map><key>type</key><string>key</string></map></map>
<map><key>channel</key><map><key>type</key><string>integer</string></map></map>
<map><key>message</key><map><key>type</key><string>string</string></map></map>
</array>
</map>
@ -7472,7 +7519,6 @@
<key>return</key><string>key</string>
<key>arguments</key><array>
<map><key>notecard</key><map><key>type</key><string>string</string></map></map>
<map><key>includeHuds</key><map><key>type</key><string>integer</string></map></map>
</array>
</map>
<key>osOwnerSaveAppearance</key>
@ -7480,6 +7526,7 @@
<key>return</key><string>key</string>
<key>arguments</key><array>
<map><key>notecard</key><map><key>type</key><string>string</string></map></map>
<map><key>includeHuds</key><map><key>type</key><string>integer</string></map></map>
</array>
</map>
<key>osParcelJoin</key>
@ -7558,7 +7605,6 @@
<key>return</key><string>integer</string>
<key>arguments</key><array>
<map><key>seconds</key><map><key>type</key><string>float</string></map></map>
<map><key>msg</key><map><key>type</key><string>string</string></map></map>
</array>
</map>
<key>osRegionRestart</key>
@ -7566,6 +7612,7 @@
<key>return</key><string>integer</string>
<key>arguments</key><array>
<map><key>seconds</key><map><key>type</key><string>float</string></map></map>
<map><key>msg</key><map><key>type</key><string>string</string></map></map>
</array>
</map>
<key>osReplaceAgentEnvironment</key>
@ -7838,6 +7885,16 @@
</array>
</map>
<key>osSetProjectionParams</key>
<map>
<key>arguments</key><array>
<map><key>projection</key><map><key>type</key><string>integer</string></map></map>
<map><key>texture</key><map><key>type</key><string>key</string></map></map>
<map><key>fov</key><map><key>type</key><string>float</string></map></map>
<map><key>focus</key><map><key>type</key><string>float</string></map></map>
<map><key>amb</key><map><key>type</key><string>float</string></map></map>
</array>
</map>
<key>osSetProjectionParams</key>
<map>
<key>arguments</key><array>
<map><key>prim</key><map><key>type</key><string>key</string></map></map>
@ -7859,16 +7916,6 @@
<map><key>amb</key><map><key>type</key><string>float</string></map></map>
</array>
</map>
<key>osSetProjectionParams</key>
<map>
<key>arguments</key><array>
<map><key>projection</key><map><key>type</key><string>integer</string></map></map>
<map><key>texture</key><map><key>type</key><string>key</string></map></map>
<map><key>fov</key><map><key>type</key><string>float</string></map></map>
<map><key>focus</key><map><key>type</key><string>float</string></map></map>
<map><key>amb</key><map><key>type</key><string>float</string></map></map>
</array>
</map>
<key>osSetRegionSunSettings</key>
<map>
<key>arguments</key><array>
@ -7994,21 +8041,10 @@
<key>arguments</key><array>
<map><key>src</key><map><key>type</key><string>string</string></map></map>
<map><key>value</key><map><key>type</key><string>string</string></map></map>
<map><key>start</key><map><key>type</key><string>integer</string></map></map>
<map><key>count</key><map><key>type</key><string>integer</string></map></map>
<map><key>ignorecase</key><map><key>type</key><string>integer</string></map></map>
</array>
</map>
<key>osStringIndexOf</key>
<map>
<key>return</key><string>integer</string>
<key>arguments</key><array>
<map><key>src</key><map><key>type</key><string>string</string></map></map>
<map><key>value</key><map><key>type</key><string>string</string></map></map>
<map><key>ignorecase</key><map><key>type</key><string>integer</string></map></map>
</array>
</map>
<key>osStringLastIndexOf</key>
<map>
<key>return</key><string>integer</string>
<key>arguments</key><array>
@ -8028,6 +8064,17 @@
<map><key>ignorecase</key><map><key>type</key><string>integer</string></map></map>
</array>
</map>
<key>osStringLastIndexOf</key>
<map>
<key>return</key><string>integer</string>
<key>arguments</key><array>
<map><key>src</key><map><key>type</key><string>string</string></map></map>
<map><key>value</key><map><key>type</key><string>string</string></map></map>
<map><key>start</key><map><key>type</key><string>integer</string></map></map>
<map><key>count</key><map><key>type</key><string>integer</string></map></map>
<map><key>ignorecase</key><map><key>type</key><string>integer</string></map></map>
</array>
</map>
<key>osStringRemove</key>
<map>
<key>return</key><string>string</string>
@ -8090,6 +8137,7 @@
<map>
<key>arguments</key><array>
<map><key>agent</key><map><key>type</key><string>string</string></map></map>
<map><key>regionName</key><map><key>type</key><string>string</string></map></map>
<map><key>position</key><map><key>type</key><string>vector</string></map></map>
<map><key>lookat</key><map><key>type</key><string>vector</string></map></map>
</array>
@ -8108,7 +8156,6 @@
<map>
<key>arguments</key><array>
<map><key>agent</key><map><key>type</key><string>string</string></map></map>
<map><key>regionName</key><map><key>type</key><string>string</string></map></map>
<map><key>position</key><map><key>type</key><string>vector</string></map></map>
<map><key>lookat</key><map><key>type</key><string>vector</string></map></map>
</array>
@ -8124,13 +8171,6 @@
</array>
</map>
<key>osTeleportOwner</key>
<map>
<key>arguments</key><array>
<map><key>position</key><map><key>type</key><string>vector</string></map></map>
<map><key>lookat</key><map><key>type</key><string>vector</string></map></map>
</array>
</map>
<key>osTeleportOwner</key>
<map>
<key>arguments</key><array>
<map><key>regionName</key><map><key>type</key><string>string</string></map></map>
@ -8147,6 +8187,13 @@
<map><key>lookat</key><map><key>type</key><string>vector</string></map></map>
</array>
</map>
<key>osTeleportOwner</key>
<map>
<key>arguments</key><array>
<map><key>position</key><map><key>type</key><string>vector</string></map></map>
<map><key>lookat</key><map><key>type</key><string>vector</string></map></map>
</array>
</map>
<key>osTerrainFlush</key>
<map>
<key>arguments</key><undef/>

View file

@ -7,73 +7,50 @@
<Key Name="file" Value="MyAssetSet/MyAssetSet.xml"/>
</Section>
<Section Name="Animations AssetSet">
<Key Name="file" Value="AnimationsAssetSet/index.xml"/>
</Section>
<!---->
<Section Name="BodyParts AssetSet">
<Key Name="file" Value="BodyPartsAssetSet/BodyPartsAssetSet.xml"/>
</Section>
<!---->
<!---->
<Section Name="Clothing AssetSet">
<Key Name="file" Value="ClothingAssetSet/ClothingAssetSet.xml"/>
</Section>
<!---->
<!---->
<Section Name="Gestures AssetSet">
<Key Name="file" Value="GesturesAssetSet/GesturesAssetSet.xml"/>
</Section>
<!---->
<!---->
<Section Name="Landmarks AssetSet">
<Key Name="file" Value="LandmarksAssetSet/LandmarksAssetSet.xml"/>
</Section>
<!---->
<!---->
<Section Name="Notecards AssetSet">
<Key Name="file" Value="NotecardsAssetSet/NotecardsAssetSet.xml"/>
</Section>
<!---->
<!---->
<Section Name="Objects AssetSet">
<Key Name="file" Value="ObjectsAssetSet/ObjectsAssetSet.xml"/>
</Section>
<!---->
<!---->
<Section Name="Photos AssetSet">
<Key Name="file" Value="PhotosAssetSet/PhotosAssetSet.xml"/>
</Section>
<!---->
<!---->
<Section Name="Scripts AssetSet">
<Key Name="file" Value="ScriptsAssetSet/ScriptsAssetSet.xml"/>
</Section>
<!---->
<!---->
<Section Name="Sounds AssetSet">
<Key Name="file" Value="SoundsAssetSet/SoundsAssetSet.xml"/>
</Section>
<!---->
<!---->
<Section Name="Collision Sounds AssetSet">
<Key Name="file" Value="CollisionSoundsAssetSet/CollisionSoundsAssetSet.xml"/>
</Section>
<!---->
<!---->
<Section Name="Textures AssetSet">
<Key Name="file" Value="TexturesAssetSet/TexturesAssetSet.xml"/>
</Section>
@ -81,5 +58,5 @@
<Section Name="Settings AssetSet">
<Key Name="file" Value="SettingsAssetSet/SettingsAssetSet.xml"/>
</Section>
<!---->
</Nini>

Binary file not shown.

View file

@ -1,14 +1,14 @@
<Nini>
<Section Name="EmptyNotecard">
<Key Name="assetID" Value="4b6a777d-7bcd-4fc4-b06f-929b21e32925" />
<Key Name="name" Value="EmptyNotecard" />
<Key Name="assetType" Value="7" />
<Key Name="fileName" Value="EmptyNotecard.dat" />
</Section>
<Section Name="Welcome notecard">
<Key Name="assetID" Value="00000000-0000-2222-3333-000000000001" />
<Key Name="name" Value="WelcomeNote" />
<Key Name="assetType" Value="7" />
<Key Name="fileName" Value="welcomeNote.txt" />
</Section>
<Section Name="Example notecard">
<Key Name="assetID" Value="8d1ada50-b9c7-11dc-95ff-0800200c9a66" />
<Key Name="name" Value="WelcomeNote" />
<Key Name="assetType" Value="7" />
<Key Name="fileName" Value="exampleNote.txt" />
</Section>
<Key Name="fileName" Value="welcomeNote.dat" />
</Section>
</Nini>

View file

@ -1 +0,0 @@
This is a test, this is only a test. Had this been an actual emergency, I would have sent the LoLKat after you :-P......

Binary file not shown.

View file

@ -90,6 +90,13 @@
<Key Name="assetType" Value="10" />
<Key Name="fileName" Value="DefaultSay.lsl" />
</Section>
<Section Name="DefaultScript">
<Key Name="assetID" Value="2074003b-8d5f-40e5-8b20-581c1c50aedb" />
<Key Name="name" Value="DefaultScript" />
<Key Name="assetType" Value="10" />
<Key Name="fileName" Value="DefaultScript.lsl" />
</Section>
<Section Name="DefaultSayAndTouch">
<Key Name="assetID" Value="9267e689-4f37-4ce5-b2c2-455ee2e1ab12" />

Some files were not shown because too many files have changed in this diff Show more