Merge branch 'master' into careminster-presence-refactor

avinationmerge
Melanie 2010-06-09 16:48:37 +01:00
commit 6b2d2413f7
17 changed files with 147 additions and 123 deletions

View File

@ -51,7 +51,7 @@ namespace OpenSim.Data
public int inventoryNextPermissions; public int inventoryNextPermissions;
public int inventoryCurrentPermissions; public int inventoryCurrentPermissions;
public int invType; public int invType;
public UUID creatorID; public string creatorID;
public int inventoryBasePermissions; public int inventoryBasePermissions;
public int inventoryEveryOnePermissions; public int inventoryEveryOnePermissions;
public int salePrice; public int salePrice;

View File

@ -73,5 +73,5 @@ ALTER TABLE assets ADD COLUMN asset_flags INTEGER NOT NULL DEFAULT 0;
:VERSION 8 :VERSION 8
ALTER TABLE assets ADD COLUMN CreatorID varchar(36) NOT NULL DEFAULT ''; ALTER TABLE assets ADD COLUMN CreatorID varchar(128) NOT NULL DEFAULT '';

View File

@ -91,3 +91,11 @@ update inventoryitems set creatorID = '00000000-0000-0000-0000-000000000000' whe
alter table inventoryitems modify column creatorID varchar(36) not NULL default '00000000-0000-0000-0000-000000000000'; alter table inventoryitems modify column creatorID varchar(36) not NULL default '00000000-0000-0000-0000-000000000000';
COMMIT; COMMIT;
:VERSION 5 # ------------
BEGIN;
alter table inventoryitems modify column creatorID varchar(128) not NULL default '00000000-0000-0000-0000-000000000000';
COMMIT;

View File

@ -1,38 +0,0 @@
BEGIN TRANSACTION;
CREATE TABLE inventoryfolders(
folderName varchar(255),
type integer,
version integer,
folderID varchar(255) primary key,
agentID varchar(255) not null default '00000000-0000-0000-0000-000000000000',
parentFolderID varchar(255) not null default '00000000-0000-0000-0000-000000000000');
CREATE TABLE inventoryitems(
assetID varchar(255),
assetType integer,
inventoryName varchar(255),
inventoryDescription varchar(255),
inventoryNextPermissions integer,
inventoryCurrentPermissions integer,
invType integer,
creatorID varchar(255),
inventoryBasePermissions integer,
inventoryEveryOnePermissions integer,
salePrice integer default 99,
saleType integer default 0,
creationDate integer default 2000,
groupID varchar(255) default '00000000-0000-0000-0000-000000000000',
groupOwned integer default 0,
flags integer default 0,
inventoryID varchar(255) primary key,
parentFolderID varchar(255) not null default '00000000-0000-0000-0000-000000000000',
avatarID varchar(255) not null default '00000000-0000-0000-0000-000000000000',
inventoryGroupPermissions integer not null default 0);
create index inventoryfolders_agentid on inventoryfolders(agentID);
create index inventoryfolders_parentid on inventoryfolders(parentFolderID);
create index inventoryitems_parentfolderid on inventoryitems(parentFolderID);
create index inventoryitems_avatarid on inventoryitems(avatarID);
COMMIT;

View File

@ -1,8 +0,0 @@
ATTACH 'inventoryStore.db' AS old;
BEGIN TRANSACTION;
INSERT INTO inventoryfolders (folderName, type, version, folderID, agentID, parentFolderID) SELECT `name` AS folderName, `type` AS type, `version` AS version, `UUID` AS folderID, `agentID` AS agentID, `parentID` AS parentFolderID from old.inventoryfolders;
INSERT INTO inventoryitems (assetID, assetType, inventoryName, inventoryDescription, inventoryNextPermissions, inventoryCurrentPermissions, invType, creatorID, inventoryBasePermissions, inventoryEveryOnePermissions, salePrice, saleType, creationDate, groupID, groupOwned, flags, inventoryID, parentFolderID, avatarID, inventoryGroupPermissions) SELECT `assetID`, `assetType` AS assetType, `inventoryName` AS inventoryName, `inventoryDescription` AS inventoryDescription, `inventoryNextPermissions` AS inventoryNextPermissions, `inventoryCurrentPermissions` AS inventoryCurrentPermissions, `invType` AS invType, `creatorsID` AS creatorID, `inventoryBasePermissions` AS inventoryBasePermissions, `inventoryEveryOnePermissions` AS inventoryEveryOnePermissions, `salePrice` AS salePrice, `saleType` AS saleType, `creationDate` AS creationDate, `groupID` AS groupID, `groupOwned` AS groupOwned, `flags` AS flags, `UUID` AS inventoryID, `parentFolderID` AS parentFolderID, `avatarID` AS avatarID, `inventoryGroupPermissions` AS inventoryGroupPermissions FROM old.inventoryitems;
COMMIT;

View File

@ -1,5 +0,0 @@
BEGIN;
ALTER TABLE assets ADD COLUMN asset_flags INTEGER NOT NULL DEFAULT 0;
COMMIT;

View File

@ -55,7 +55,7 @@ CREATE TABLE assets(
Local, Local,
Temporary, Temporary,
asset_flags INTEGER NOT NULL DEFAULT 0, asset_flags INTEGER NOT NULL DEFAULT 0,
CreatorID varchar(36) default '', CreatorID varchar(128) default '',
Data); Data);
INSERT INTO assets(UUID,Name,Description,Type,Local,Temporary,Data) INSERT INTO assets(UUID,Name,Description,Type,Local,Temporary,Data)
@ -64,3 +64,4 @@ DROP TABLE assets_backup;
COMMIT; COMMIT;

View File

@ -0,0 +1,51 @@
:VERSION 1
BEGIN TRANSACTION;
CREATE TABLE inventoryfolders(
folderName varchar(64),
type integer,
version integer,
folderID varchar(36) primary key,
agentID varchar(36) not null default '00000000-0000-0000-0000-000000000000',
parentFolderID varchar(36) not null default '00000000-0000-0000-0000-000000000000');
CREATE TABLE inventoryitems(
assetID varchar(36),
assetType integer,
inventoryName varchar(64),
inventoryDescription varchar(128),
inventoryNextPermissions integer,
inventoryCurrentPermissions integer,
invType integer,
creatorID varchar(128),
inventoryBasePermissions integer,
inventoryEveryOnePermissions integer,
salePrice integer default 99,
saleType integer default 0,
creationDate integer default 2000,
groupID varchar(36) default '00000000-0000-0000-0000-000000000000',
groupOwned integer default 0,
flags integer default 0,
inventoryID varchar(36) primary key,
parentFolderID varchar(36) not null default '00000000-0000-0000-0000-000000000000',
avatarID varchar(36) not null default '00000000-0000-0000-0000-000000000000',
inventoryGroupPermissions integer not null default 0);
create index inventoryfolders_agentid on inventoryfolders(agentID);
create index inventoryfolders_parentid on inventoryfolders(parentFolderID);
create index inventoryitems_parentfolderid on inventoryitems(parentFolderID);
create index inventoryitems_avatarid on inventoryitems(avatarID);
COMMIT;
:VERSION 2
ATTACH 'inventoryStore.db' AS old;
BEGIN TRANSACTION;
INSERT INTO inventoryfolders (folderName, type, version, folderID, agentID, parentFolderID) SELECT `name` AS folderName, `type` AS type, `version` AS version, `UUID` AS folderID, `agentID` AS agentID, `parentID` AS parentFolderID from old.inventoryfolders;
INSERT INTO inventoryitems (assetID, assetType, inventoryName, inventoryDescription, inventoryNextPermissions, inventoryCurrentPermissions, invType, creatorID, inventoryBasePermissions, inventoryEveryOnePermissions, salePrice, saleType, creationDate, groupID, groupOwned, flags, inventoryID, parentFolderID, avatarID, inventoryGroupPermissions) SELECT `assetID`, `assetType` AS assetType, `inventoryName` AS inventoryName, `inventoryDescription` AS inventoryDescription, `inventoryNextPermissions` AS inventoryNextPermissions, `inventoryCurrentPermissions` AS inventoryCurrentPermissions, `invType` AS invType, `creatorsID` AS creatorID, `inventoryBasePermissions` AS inventoryBasePermissions, `inventoryEveryOnePermissions` AS inventoryEveryOnePermissions, `salePrice` AS salePrice, `saleType` AS saleType, `creationDate` AS creationDate, `groupID` AS groupID, `groupOwned` AS groupOwned, `flags` AS flags, `UUID` AS inventoryID, `parentFolderID` AS parentFolderID, `avatarID` AS avatarID, `inventoryGroupPermissions` AS inventoryGroupPermissions FROM old.inventoryitems;
COMMIT;

View File

@ -3426,7 +3426,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
CoarseLocationUpdatePacket loc = (CoarseLocationUpdatePacket)PacketPool.Instance.GetPacket(PacketType.CoarseLocationUpdate); CoarseLocationUpdatePacket loc = (CoarseLocationUpdatePacket)PacketPool.Instance.GetPacket(PacketType.CoarseLocationUpdate);
loc.Header.Reliable = false; loc.Header.Reliable = false;
// Each packet can only hold around 62 avatar positions and the client clears the mini-map each time // Each packet can only hold around 60 avatar positions and the client clears the mini-map each time
// a CoarseLocationUpdate packet is received. Oh well. // a CoarseLocationUpdate packet is received. Oh well.
int total = Math.Min(CoarseLocations.Count, 60); int total = Math.Min(CoarseLocations.Count, 60);

View File

@ -869,9 +869,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true); CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true);
// m_scene.SendKillObject(m_localId);
agent.Scene.NotifyMyCoarseLocationChange();
// the user may change their profile information in other region, // the user may change their profile information in other region,
// so the userinfo in UserProfileCache is not reliable any more, delete it // so the userinfo in UserProfileCache is not reliable any more, delete it
// REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE! // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE!

View File

@ -95,6 +95,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
try try
{ {
asset1.ID = url + "/" + asset.ID; asset1.ID = url + "/" + asset.ID;
UUID temp = UUID.Zero;
// TODO: if the creator is local, stick this grid's URL in front
//if (UUID.TryParse(asset.Metadata.CreatorID, out temp))
// asset1.Metadata.CreatorID = ??? + "/" + asset.Metadata.CreatorID;
} }
catch catch
{ {

View File

@ -362,6 +362,7 @@ namespace OpenSim.Region.Framework.Scenes
private int m_update_backup = 200; private int m_update_backup = 200;
private int m_update_terrain = 50; private int m_update_terrain = 50;
private int m_update_land = 1; private int m_update_land = 1;
private int m_update_coarse_locations = 50;
private int frameMS; private int frameMS;
private int physicsMS2; private int physicsMS2;
@ -1445,6 +1446,18 @@ namespace OpenSim.Region.Framework.Scenes
if (m_frame % m_update_objects == 0) if (m_frame % m_update_objects == 0)
m_sceneGraph.UpdateObjectGroups(); m_sceneGraph.UpdateObjectGroups();
if (m_frame % m_update_coarse_locations == 0)
{
List<Vector3> coarseLocations;
List<UUID> avatarUUIDs;
SceneGraph.GetCoarseLocations(out coarseLocations, out avatarUUIDs, 60);
// Send coarse locations to clients
ForEachScenePresence(delegate(ScenePresence presence)
{
presence.SendCoarseLocations(coarseLocations, avatarUUIDs);
});
}
int tmpPhysicsMS2 = Util.EnvironmentTickCount(); int tmpPhysicsMS2 = Util.EnvironmentTickCount();
if ((m_frame % m_update_physics == 0) && m_physics_enabled) if ((m_frame % m_update_physics == 0) && m_physics_enabled)
m_sceneGraph.UpdatePreparePhysics(); m_sceneGraph.UpdatePreparePhysics();
@ -3329,9 +3342,6 @@ namespace OpenSim.Region.Framework.Scenes
catch (NullReferenceException) { } catch (NullReferenceException) { }
}); });
ForEachScenePresence(
delegate(ScenePresence presence) { presence.CoarseLocationChange(); });
IAgentAssetTransactions agentTransactions = this.RequestModuleInterface<IAgentAssetTransactions>(); IAgentAssetTransactions agentTransactions = this.RequestModuleInterface<IAgentAssetTransactions>();
if (agentTransactions != null) if (agentTransactions != null)
{ {
@ -3383,14 +3393,6 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
/// <summary>
/// Inform all other ScenePresences on this Scene that someone else has changed position on the minimap.
/// </summary>
public void NotifyMyCoarseLocationChange()
{
ForEachScenePresence(delegate(ScenePresence presence) { presence.CoarseLocationChange(); });
}
#endregion #endregion
#region Entities #region Entities

View File

@ -211,6 +211,43 @@ namespace OpenSim.Region.Framework.Scenes
}); });
} }
public void GetCoarseLocations(out List<Vector3> coarseLocations, out List<UUID> avatarUUIDs, uint maxLocations)
{
coarseLocations = new List<Vector3>();
avatarUUIDs = new List<UUID>();
List<ScenePresence> presences = GetScenePresences();
for (int i = 0; i < Math.Min(presences.Count, maxLocations); ++i)
{
ScenePresence sp = presences[i];
// If this presence is a child agent, we don't want its coarse locations
if (sp.IsChildAgent)
return;
if (sp.ParentID != 0)
{
// sitting avatar
SceneObjectPart sop = m_parentScene.GetSceneObjectPart(sp.ParentID);
if (sop != null)
{
coarseLocations.Add(sop.AbsolutePosition + sp.AbsolutePosition);
avatarUUIDs.Add(sp.UUID);
}
else
{
// we can't find the parent.. ! arg!
coarseLocations.Add(sp.AbsolutePosition);
avatarUUIDs.Add(sp.UUID);
}
}
else
{
coarseLocations.Add(sp.AbsolutePosition);
avatarUUIDs.Add(sp.UUID);
}
}
}
#endregion #endregion
#region Entity Methods #region Entity Methods

View File

@ -66,7 +66,7 @@ namespace OpenSim.Region.Framework.Scenes
public ScriptControlled eventControls; public ScriptControlled eventControls;
} }
public delegate void SendCourseLocationsMethod(UUID scene, ScenePresence presence); public delegate void SendCourseLocationsMethod(UUID scene, ScenePresence presence, List<Vector3> coarseLocations, List<UUID> avatarUUIDs);
public class ScenePresence : EntityBase, ISceneEntity public class ScenePresence : EntityBase, ISceneEntity
{ {
@ -178,8 +178,6 @@ namespace OpenSim.Region.Framework.Scenes
public string JID = String.Empty; public string JID = String.Empty;
// Agent moves with a PID controller causing a force to be exerted.
private bool m_newCoarseLocations = true;
private float m_health = 100f; private float m_health = 100f;
// Default AV Height // Default AV Height
@ -2548,12 +2546,6 @@ Console.WriteLine("Scripted Sit ofset {0}", m_pos);
if (m_newCoarseLocations)
{
SendCoarseLocations();
m_newCoarseLocations = false;
}
if (m_isChildAgent == false) if (m_isChildAgent == false)
{ {
// PhysicsActor actor = m_physicsActor; // PhysicsActor actor = m_physicsActor;
@ -2630,12 +2622,12 @@ Console.WriteLine("Scripted Sit ofset {0}", m_pos);
m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
} }
public void SendCoarseLocations() public void SendCoarseLocations(List<Vector3> coarseLocations, List<UUID> avatarUUIDs)
{ {
SendCourseLocationsMethod d = m_sendCourseLocationsMethod; SendCourseLocationsMethod d = m_sendCourseLocationsMethod;
if (d != null) if (d != null)
{ {
d.Invoke(m_scene.RegionInfo.originRegionID, this); d.Invoke(m_scene.RegionInfo.originRegionID, this, coarseLocations, avatarUUIDs);
} }
} }
@ -2645,50 +2637,13 @@ Console.WriteLine("Scripted Sit ofset {0}", m_pos);
m_sendCourseLocationsMethod = d; m_sendCourseLocationsMethod = d;
} }
public void SendCoarseLocationsDefault(UUID sceneId, ScenePresence p) public void SendCoarseLocationsDefault(UUID sceneId, ScenePresence p, List<Vector3> coarseLocations, List<UUID> avatarUUIDs)
{ {
m_perfMonMS = Util.EnvironmentTickCount(); m_perfMonMS = Util.EnvironmentTickCount();
m_controllingClient.SendCoarseLocationUpdate(avatarUUIDs, coarseLocations);
List<Vector3> CoarseLocations = new List<Vector3>();
List<UUID> AvatarUUIDs = new List<UUID>();
m_scene.ForEachScenePresence(delegate(ScenePresence sp)
{
if (sp.IsChildAgent)
return;
if (sp.ParentID != 0)
{
// sitting avatar
SceneObjectPart sop = m_scene.GetSceneObjectPart(sp.ParentID);
if (sop != null)
{
CoarseLocations.Add(sop.AbsolutePosition + sp.m_pos);
AvatarUUIDs.Add(sp.UUID);
}
else
{
// we can't find the parent.. ! arg!
CoarseLocations.Add(sp.m_pos);
AvatarUUIDs.Add(sp.UUID);
}
}
else
{
CoarseLocations.Add(sp.m_pos);
AvatarUUIDs.Add(sp.UUID);
}
});
m_controllingClient.SendCoarseLocationUpdate(AvatarUUIDs, CoarseLocations);
m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
} }
public void CoarseLocationChange()
{
m_newCoarseLocations = true;
}
/// <summary> /// <summary>
/// Tell other client about this avatar (The client previously didn't know or had outdated details about this avatar) /// Tell other client about this avatar (The client previously didn't know or had outdated details about this avatar)
/// </summary> /// </summary>
@ -2923,7 +2878,6 @@ Console.WriteLine("Scripted Sit ofset {0}", m_pos);
{ {
posLastSignificantMove = AbsolutePosition; posLastSignificantMove = AbsolutePosition;
m_scene.EventManager.TriggerSignificantClientMovement(m_controllingClient); m_scene.EventManager.TriggerSignificantClientMovement(m_controllingClient);
m_scene.NotifyMyCoarseLocationChange();
} }
// Minimum Draw distance is 64 meters, the Radius of the draw distance sphere is 32m // Minimum Draw distance is 64 meters, the Radius of the draw distance sphere is 32m

View File

@ -614,7 +614,9 @@ namespace OpenSim.Region.RegionCombinerModule
presence.SetSendCourseLocationMethod(SendCourseLocationUpdates); presence.SetSendCourseLocationMethod(SendCourseLocationUpdates);
} }
private void SendCourseLocationUpdates(UUID sceneId, ScenePresence presence) // This delegate was refactored for non-combined regions.
// This combined region version will not use the pre-compiled lists of locations and ids
private void SendCourseLocationUpdates(UUID sceneId, ScenePresence presence, List<Vector3> coarseLocations, List<UUID> avatarUUIDs)
{ {
RegionConnections connectiondata = null; RegionConnections connectiondata = null;
lock (m_regions) lock (m_regions)

View File

@ -125,6 +125,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
private ScriptCompileQueue m_CompileQueue = new ScriptCompileQueue(); private ScriptCompileQueue m_CompileQueue = new ScriptCompileQueue();
IWorkItemResult m_CurrentCompile = null; IWorkItemResult m_CurrentCompile = null;
private Dictionary<UUID, int> m_CompileDict = new Dictionary<UUID, int>();
private void lockScriptsForRead(bool locked) private void lockScriptsForRead(bool locked)
{ {
@ -560,6 +561,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
else else
{ {
m_CompileQueue.Enqueue(parms); m_CompileQueue.Enqueue(parms);
lock (m_CompileDict)
{
m_CompileDict[itemID] = 0;
}
if (m_CurrentCompile == null) if (m_CurrentCompile == null)
{ {
@ -622,6 +627,13 @@ namespace OpenSim.Region.ScriptEngine.XEngine
bool postOnRez = (bool)p[4]; bool postOnRez = (bool)p[4];
StateSource stateSource = (StateSource)p[5]; StateSource stateSource = (StateSource)p[5];
lock(m_CompileDict)
{
if (!m_CompileDict.ContainsKey(itemID))
return false;
m_CompileDict.Remove(itemID);
}
// Get the asset ID of the script, so we can check if we // Get the asset ID of the script, so we can check if we
// already have it. // already have it.
@ -868,6 +880,13 @@ namespace OpenSim.Region.ScriptEngine.XEngine
public void OnRemoveScript(uint localID, UUID itemID) public void OnRemoveScript(uint localID, UUID itemID)
{ {
// If it's not yet been compiled, make sure we don't try
lock (m_CompileDict)
{
if (m_CompileDict.ContainsKey(itemID))
m_CompileDict.Remove(itemID);
}
lockScriptsForRead(true); lockScriptsForRead(true);
// Do we even have it? // Do we even have it?
if (!m_Scripts.ContainsKey(itemID)) if (!m_Scripts.ContainsKey(itemID))

View File

@ -460,7 +460,7 @@ namespace OpenSim.Services.InventoryService
newItem.ID = item.inventoryID; newItem.ID = item.inventoryID;
newItem.InvType = item.invType; newItem.InvType = item.invType;
newItem.Folder = item.parentFolderID; newItem.Folder = item.parentFolderID;
newItem.CreatorId = item.creatorID.ToString(); newItem.CreatorId = item.creatorID;
newItem.Description = item.inventoryDescription; newItem.Description = item.inventoryDescription;
newItem.NextPermissions = (uint)item.inventoryNextPermissions; newItem.NextPermissions = (uint)item.inventoryNextPermissions;
newItem.CurrentPermissions = (uint)item.inventoryCurrentPermissions; newItem.CurrentPermissions = (uint)item.inventoryCurrentPermissions;
@ -491,7 +491,7 @@ namespace OpenSim.Services.InventoryService
newItem.inventoryID = item.ID; newItem.inventoryID = item.ID;
newItem.invType = item.InvType; newItem.invType = item.InvType;
newItem.parentFolderID = item.Folder; newItem.parentFolderID = item.Folder;
newItem.creatorID = item.CreatorIdAsUuid; newItem.creatorID = item.CreatorId;
newItem.inventoryDescription = item.Description; newItem.inventoryDescription = item.Description;
newItem.inventoryNextPermissions = (int)item.NextPermissions; newItem.inventoryNextPermissions = (int)item.NextPermissions;
newItem.inventoryCurrentPermissions = (int)item.CurrentPermissions; newItem.inventoryCurrentPermissions = (int)item.CurrentPermissions;