Merge branch 'master' into careminster-presence-refactor
This was rather conflicted. Please test linking.avinationmerge
commit
fc8d2be632
|
@ -89,7 +89,6 @@ namespace OpenSim.Data.MSSQL
|
||||||
Dictionary<UUID, SceneObjectGroup> objects = new Dictionary<UUID, SceneObjectGroup>();
|
Dictionary<UUID, SceneObjectGroup> objects = new Dictionary<UUID, SceneObjectGroup>();
|
||||||
SceneObjectGroup grp = null;
|
SceneObjectGroup grp = null;
|
||||||
|
|
||||||
|
|
||||||
string sql = "SELECT *, " +
|
string sql = "SELECT *, " +
|
||||||
"sort = CASE WHEN prims.UUID = prims.SceneGroupID THEN 0 ELSE 1 END " +
|
"sort = CASE WHEN prims.UUID = prims.SceneGroupID THEN 0 ELSE 1 END " +
|
||||||
"FROM prims " +
|
"FROM prims " +
|
||||||
|
@ -232,7 +231,7 @@ namespace OpenSim.Data.MSSQL
|
||||||
/// <param name="regionUUID"></param>
|
/// <param name="regionUUID"></param>
|
||||||
public void StoreObject(SceneObjectGroup obj, UUID regionUUID)
|
public void StoreObject(SceneObjectGroup obj, UUID regionUUID)
|
||||||
{
|
{
|
||||||
_Log.InfoFormat("[MSSQL]: Adding/Changing SceneObjectGroup: {0} to region: {1}, object has {2} prims.", obj.UUID, regionUUID, obj.Children.Count);
|
_Log.DebugFormat("[MSSQL]: Adding/Changing SceneObjectGroup: {0} to region: {1}, object has {2} prims.", obj.UUID, regionUUID, obj.Children.Count);
|
||||||
|
|
||||||
using (SqlConnection conn = new SqlConnection(m_connectionString))
|
using (SqlConnection conn = new SqlConnection(m_connectionString))
|
||||||
{
|
{
|
||||||
|
@ -291,7 +290,6 @@ namespace OpenSim.Data.MSSQL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -239,6 +239,7 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
ExecuteNonQuery(cmd);
|
ExecuteNonQuery(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd.Dispose();
|
cmd.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -427,7 +427,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence))
|
if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence))
|
||||||
{
|
{
|
||||||
if (!m_scene.Permissions.CanRezObject(
|
if (!m_scene.Permissions.CanRezObject(
|
||||||
part.ParentGroup.Children.Count, remoteClient.AgentId, presence.AbsolutePosition))
|
part.ParentGroup.PrimCount, remoteClient.AgentId, presence.AbsolutePosition))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
presence.Appearance.DetachAttachment(itemID);
|
presence.Appearance.DetachAttachment(itemID);
|
||||||
|
|
|
@ -549,7 +549,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_Scene.Permissions.CanRezObject(
|
if (!m_Scene.Permissions.CanRezObject(
|
||||||
group.Children.Count, remoteClient.AgentId, pos)
|
group.PrimCount, remoteClient.AgentId, pos)
|
||||||
&& !attachment)
|
&& !attachment)
|
||||||
{
|
{
|
||||||
// The client operates in no fail mode. It will
|
// The client operates in no fail mode. It will
|
||||||
|
@ -629,7 +629,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
rootPart.Name = item.Name;
|
rootPart.Name = item.Name;
|
||||||
rootPart.Description = item.Description;
|
rootPart.Description = item.Description;
|
||||||
|
|
||||||
List<SceneObjectPart> partList = new List<SceneObjectPart>(group.Children.Values);
|
List<SceneObjectPart> partList = null;
|
||||||
|
lock (group.Children)
|
||||||
|
partList = new List<SceneObjectPart>(group.Children.Values);
|
||||||
|
|
||||||
group.SetGroup(remoteClient.ActiveGroupId, remoteClient);
|
group.SetGroup(remoteClient.ActiveGroupId, remoteClient);
|
||||||
if ((rootPart.OwnerID != item.Owner) || (item.CurrentPermissions & 16) != 0)
|
if ((rootPart.OwnerID != item.Owner) || (item.CurrentPermissions & 16) != 0)
|
||||||
|
|
|
@ -243,6 +243,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
// to the same scene (when this is possible).
|
// to the same scene (when this is possible).
|
||||||
sceneObject.ResetIDs();
|
sceneObject.ResetIDs();
|
||||||
|
|
||||||
|
lock (sceneObject.Children)
|
||||||
|
{
|
||||||
foreach (SceneObjectPart part in sceneObject.Children.Values)
|
foreach (SceneObjectPart part in sceneObject.Children.Values)
|
||||||
{
|
{
|
||||||
if (!ResolveUserUuid(part.CreatorID))
|
if (!ResolveUserUuid(part.CreatorID))
|
||||||
|
@ -264,8 +266,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
part.TaskInventory.LockItemsForRead(true);
|
part.TaskInventory.LockItemsForRead(true);
|
||||||
TaskInventoryDictionary inv = part.TaskInventory;
|
TaskInventoryDictionary inv = part.TaskInventory;
|
||||||
foreach (KeyValuePair<UUID, TaskInventoryItem> kvp in inv)
|
foreach (KeyValuePair<UUID, TaskInventoryItem> kvp in inv)
|
||||||
{
|
|
||||||
if (!ResolveUserUuid(kvp.Value.OwnerID))
|
|
||||||
{
|
{
|
||||||
if (!ResolveUserUuid(kvp.Value.OwnerID))
|
if (!ResolveUserUuid(kvp.Value.OwnerID))
|
||||||
{
|
{
|
||||||
|
@ -276,9 +276,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
kvp.Value.CreatorID = m_scene.RegionInfo.EstateSettings.EstateOwner;
|
kvp.Value.CreatorID = m_scene.RegionInfo.EstateSettings.EstateOwner;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
part.TaskInventory.LockItemsForRead(false);
|
part.TaskInventory.LockItemsForRead(false);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (m_scene.AddRestoredSceneObject(sceneObject, true, false))
|
if (m_scene.AddRestoredSceneObject(sceneObject, true, false))
|
||||||
{
|
{
|
||||||
|
|
|
@ -128,7 +128,10 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
|
||||||
group.SetOwnerId(remoteClient.AgentId);
|
group.SetOwnerId(remoteClient.AgentId);
|
||||||
group.SetRootPartOwner(part, remoteClient.AgentId, remoteClient.ActiveGroupId);
|
group.SetRootPartOwner(part, remoteClient.AgentId, remoteClient.ActiveGroupId);
|
||||||
|
|
||||||
List<SceneObjectPart> partList = new List<SceneObjectPart>(group.Children.Values);
|
List<SceneObjectPart> partList = null;
|
||||||
|
|
||||||
|
lock (group.Children)
|
||||||
|
partList = new List<SceneObjectPart>(group.Children.Values);
|
||||||
|
|
||||||
if (m_scene.Permissions.PropagatePermissions())
|
if (m_scene.Permissions.PropagatePermissions())
|
||||||
{
|
{
|
||||||
|
|
|
@ -227,7 +227,10 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||||
{
|
{
|
||||||
SceneObjectGroup mapdot = (SceneObjectGroup)obj;
|
SceneObjectGroup mapdot = (SceneObjectGroup)obj;
|
||||||
Color mapdotspot = Color.Gray; // Default color when prim color is white
|
Color mapdotspot = Color.Gray; // Default color when prim color is white
|
||||||
|
|
||||||
// Loop over prim in group
|
// Loop over prim in group
|
||||||
|
lock (mapdot.Children)
|
||||||
|
{
|
||||||
foreach (SceneObjectPart part in mapdot.Children.Values)
|
foreach (SceneObjectPart part in mapdot.Children.Values)
|
||||||
{
|
{
|
||||||
if (part == null)
|
if (part == null)
|
||||||
|
@ -498,6 +501,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||||
//}
|
//}
|
||||||
} // Object is within 256m Z of terrain
|
} // Object is within 256m Z of terrain
|
||||||
} // object is at least a meter wide
|
} // object is at least a meter wide
|
||||||
|
} // mapdot.Children lock
|
||||||
} // loop over group children
|
} // loop over group children
|
||||||
} // entitybase is sceneobject group
|
} // entitybase is sceneobject group
|
||||||
} // foreach loop over entities
|
} // foreach loop over entities
|
||||||
|
|
|
@ -29,6 +29,7 @@ using System.Collections.Generic;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
|
||||||
namespace OpenSim.Region.Framework.Interfaces
|
namespace OpenSim.Region.Framework.Interfaces
|
||||||
{
|
{
|
||||||
|
@ -156,6 +157,17 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
/// </returns>
|
/// </returns>
|
||||||
IList<TaskInventoryItem> GetInventoryItems(string name);
|
IList<TaskInventoryItem> GetInventoryItems(string name);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get the scene object referenced by an inventory item.
|
||||||
|
/// </summary>
|
||||||
|
///
|
||||||
|
/// This is returned in a 'rez ready' state. That is, name, description, permissions and other details have
|
||||||
|
/// been adjusted to reflect the part and item from which it originates.
|
||||||
|
///
|
||||||
|
/// <param name="item"></param>
|
||||||
|
/// <returns>The scene object. Null if the scene object asset couldn't be found</returns>
|
||||||
|
SceneObjectGroup GetRezReadySceneObject(TaskInventoryItem item);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Update an existing inventory item.
|
/// Update an existing inventory item.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -2022,61 +2022,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (null == item)
|
if (null == item)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
UUID ownerID = item.OwnerID;
|
SceneObjectGroup group = sourcePart.Inventory.GetRezReadySceneObject(item);
|
||||||
AssetBase rezAsset = AssetService.Get(item.AssetID.ToString());
|
|
||||||
|
|
||||||
if (null == rezAsset)
|
if (null == group)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
string xmlData = Utils.BytesToString(rezAsset.Data);
|
if (!Permissions.CanRezObject(group.PrimCount, item.OwnerID, pos))
|
||||||
SceneObjectGroup group = SceneObjectSerializer.FromOriginalXmlFormat(xmlData);
|
|
||||||
|
|
||||||
if (!Permissions.CanRezObject(group.Children.Count, ownerID, pos))
|
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
group.ResetIDs();
|
|
||||||
|
|
||||||
SceneObjectPart rootPart = group.GetChildPart(group.UUID);
|
|
||||||
|
|
||||||
// Since renaming the item in the inventory does not affect the name stored
|
|
||||||
// in the serialization, transfer the correct name from the inventory to the
|
|
||||||
// object itself before we rez.
|
|
||||||
rootPart.Name = item.Name;
|
|
||||||
rootPart.Description = item.Description;
|
|
||||||
|
|
||||||
List<SceneObjectPart> partList = new List<SceneObjectPart>(group.Children.Values);
|
|
||||||
|
|
||||||
group.SetGroup(sourcePart.GroupID, null);
|
|
||||||
|
|
||||||
if ((rootPart.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0)
|
|
||||||
{
|
|
||||||
if (Permissions.PropagatePermissions())
|
|
||||||
{
|
|
||||||
foreach (SceneObjectPart part in partList)
|
|
||||||
{
|
|
||||||
part.EveryoneMask = item.EveryonePermissions;
|
|
||||||
part.NextOwnerMask = item.NextPermissions;
|
|
||||||
}
|
|
||||||
|
|
||||||
group.ApplyNextOwnerPermissions();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (SceneObjectPart part in partList)
|
|
||||||
{
|
|
||||||
if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0)
|
|
||||||
{
|
|
||||||
part.LastOwnerID = part.OwnerID;
|
|
||||||
part.OwnerID = item.OwnerID;
|
|
||||||
part.Inventory.ChangeInventoryOwner(item.OwnerID);
|
|
||||||
}
|
|
||||||
|
|
||||||
part.EveryoneMask = item.EveryonePermissions;
|
|
||||||
part.NextOwnerMask = item.NextPermissions;
|
|
||||||
}
|
|
||||||
|
|
||||||
rootPart.TrimPermissions();
|
|
||||||
|
|
||||||
if (!Permissions.BypassPermissions())
|
if (!Permissions.BypassPermissions())
|
||||||
{
|
{
|
||||||
if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
|
if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
|
||||||
|
@ -2091,7 +2044,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
group.ScheduleGroupForFullUpdate();
|
group.ScheduleGroupForFullUpdate();
|
||||||
|
|
||||||
return rootPart.ParentGroup;
|
return group;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual bool returnObjects(SceneObjectGroup[] returnobjects, UUID AgentId)
|
public virtual bool returnObjects(SceneObjectGroup[] returnobjects, UUID AgentId)
|
||||||
|
@ -2151,9 +2104,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
sog.SetGroup(groupID, remoteClient);
|
sog.SetGroup(groupID, remoteClient);
|
||||||
sog.ScheduleGroupForFullUpdate();
|
sog.ScheduleGroupForFullUpdate();
|
||||||
|
|
||||||
|
lock (sog.Children)
|
||||||
|
{
|
||||||
foreach (SceneObjectPart child in sog.Children.Values)
|
foreach (SceneObjectPart child in sog.Children.Values)
|
||||||
child.Inventory.ChangeInventoryOwner(ownerID);
|
child.Inventory.ChangeInventoryOwner(ownerID);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!Permissions.CanEditObject(sog.UUID, remoteClient.AgentId))
|
if (!Permissions.CanEditObject(sog.UUID, remoteClient.AgentId))
|
||||||
|
@ -2162,16 +2118,18 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (sog.GroupID != groupID)
|
if (sog.GroupID != groupID)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
lock (sog.Children)
|
||||||
|
{
|
||||||
foreach (SceneObjectPart child in sog.Children.Values)
|
foreach (SceneObjectPart child in sog.Children.Values)
|
||||||
{
|
{
|
||||||
child.LastOwnerID = child.OwnerID;
|
child.LastOwnerID = child.OwnerID;
|
||||||
child.Inventory.ChangeInventoryOwner(groupID);
|
child.Inventory.ChangeInventoryOwner(groupID);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
sog.SetOwnerId(groupID);
|
sog.SetOwnerId(groupID);
|
||||||
sog.ApplyNextOwnerPermissions();
|
sog.ApplyNextOwnerPermissions();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (uint localID in localIDs)
|
foreach (uint localID in localIDs)
|
||||||
|
|
|
@ -161,7 +161,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// We also need to check the children of this prim as they
|
// We also need to check the children of this prim as they
|
||||||
// can be selected as well and send property information
|
// can be selected as well and send property information
|
||||||
bool foundPrim = false;
|
bool foundPrim = false;
|
||||||
foreach (KeyValuePair<UUID, SceneObjectPart> child in ((SceneObjectGroup) ent).Children)
|
|
||||||
|
SceneObjectGroup sog = ent as SceneObjectGroup;
|
||||||
|
|
||||||
|
lock (sog.Children)
|
||||||
|
{
|
||||||
|
foreach (KeyValuePair<UUID, SceneObjectPart> child in (sog.Children))
|
||||||
{
|
{
|
||||||
if (child.Value.LocalId == primLocalID)
|
if (child.Value.LocalId == primLocalID)
|
||||||
{
|
{
|
||||||
|
@ -170,7 +175,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (foundPrim) break;
|
}
|
||||||
|
|
||||||
|
if (foundPrim)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1790,8 +1790,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
if (group.RootPart == null)
|
if (group.RootPart == null)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[SCENE]: Found a SceneObjectGroup with m_rootPart == null and {0} children",
|
m_log.ErrorFormat(
|
||||||
group.Children == null ? 0 : group.Children.Count);
|
"[SCENE]: Found a SceneObjectGroup with m_rootPart == null and {0} children",
|
||||||
|
group.Children == null ? 0 : group.PrimCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
AddRestoredSceneObject(group, true, true);
|
AddRestoredSceneObject(group, true, true);
|
||||||
|
@ -2130,6 +2131,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
group.RemoveScriptInstances(true);
|
group.RemoveScriptInstances(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lock (group.Children)
|
||||||
|
{
|
||||||
foreach (SceneObjectPart part in group.Children.Values)
|
foreach (SceneObjectPart part in group.Children.Values)
|
||||||
{
|
{
|
||||||
if (part.IsJoint() && ((part.Flags & PrimFlags.Physics) != 0))
|
if (part.IsJoint() && ((part.Flags & PrimFlags.Physics) != 0))
|
||||||
|
@ -2142,6 +2145,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
part.PhysActor = null;
|
part.PhysActor = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// if (rootPart.PhysActor != null)
|
// if (rootPart.PhysActor != null)
|
||||||
// {
|
// {
|
||||||
// PhysicsScene.RemovePrim(rootPart.PhysActor);
|
// PhysicsScene.RemovePrim(rootPart.PhysActor);
|
||||||
|
@ -2498,15 +2503,17 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
// Force allocation of new LocalId
|
// Force allocation of new LocalId
|
||||||
//
|
//
|
||||||
|
lock (sceneObject.Children)
|
||||||
|
{
|
||||||
foreach (SceneObjectPart p in sceneObject.Children.Values)
|
foreach (SceneObjectPart p in sceneObject.Children.Values)
|
||||||
p.LocalId = 0;
|
p.LocalId = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (sceneObject.IsAttachmentCheckFull()) // Attachment
|
if (sceneObject.IsAttachmentCheckFull()) // Attachment
|
||||||
{
|
{
|
||||||
sceneObject.RootPart.AddFlag(PrimFlags.TemporaryOnRez);
|
sceneObject.RootPart.AddFlag(PrimFlags.TemporaryOnRez);
|
||||||
sceneObject.RootPart.AddFlag(PrimFlags.Phantom);
|
sceneObject.RootPart.AddFlag(PrimFlags.Phantom);
|
||||||
|
|
||||||
|
|
||||||
// Don't sent a full update here because this will cause full updates to be sent twice for
|
// Don't sent a full update here because this will cause full updates to be sent twice for
|
||||||
// attachments on region crossings, resulting in viewer glitches.
|
// attachments on region crossings, resulting in viewer glitches.
|
||||||
AddRestoredSceneObject(sceneObject, false, false, false);
|
AddRestoredSceneObject(sceneObject, false, false, false);
|
||||||
|
@ -2519,7 +2526,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
if (sp != null)
|
if (sp != null)
|
||||||
{
|
{
|
||||||
|
|
||||||
SceneObjectGroup grp = sceneObject;
|
SceneObjectGroup grp = sceneObject;
|
||||||
|
|
||||||
m_log.DebugFormat(
|
m_log.DebugFormat(
|
||||||
|
|
|
@ -384,6 +384,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// "[SCENE GRAPH]: Adding object {0} {1} to region {2}",
|
// "[SCENE GRAPH]: Adding object {0} {1} to region {2}",
|
||||||
// sceneObject.Name, sceneObject.UUID, m_parentScene.RegionInfo.RegionName);
|
// sceneObject.Name, sceneObject.UUID, m_parentScene.RegionInfo.RegionName);
|
||||||
|
|
||||||
|
lock (sceneObject.Children)
|
||||||
|
{
|
||||||
if (m_parentScene.m_clampPrimSize)
|
if (m_parentScene.m_clampPrimSize)
|
||||||
{
|
{
|
||||||
foreach (SceneObjectPart part in sceneObject.Children.Values)
|
foreach (SceneObjectPart part in sceneObject.Children.Values)
|
||||||
|
@ -410,7 +412,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
m_numPrim += sceneObject.Children.Count;
|
m_numPrim += sceneObject.Children.Count;
|
||||||
|
|
||||||
if (attachToBackup)
|
if (attachToBackup)
|
||||||
{
|
|
||||||
sceneObject.AttachToBackup();
|
sceneObject.AttachToBackup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -448,10 +449,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
if (!resultOfObjectLinked)
|
if (!resultOfObjectLinked)
|
||||||
{
|
{
|
||||||
m_numPrim -= ((SceneObjectGroup) Entities[uuid]).Children.Count;
|
m_numPrim -= grp.PrimCount;
|
||||||
|
|
||||||
if ((grp.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics)
|
if ((grp.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics)
|
||||||
RemovePhysicalPrim(grp.Children.Count);
|
RemovePhysicalPrim(grp.PrimCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (OnObjectRemove != null)
|
if (OnObjectRemove != null)
|
||||||
|
@ -965,9 +966,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
lock (SceneObjectGroupsByFullID)
|
lock (SceneObjectGroupsByFullID)
|
||||||
{
|
{
|
||||||
if (SceneObjectGroupsByFullID.TryGetValue(fullID, out sog))
|
if (SceneObjectGroupsByFullID.TryGetValue(fullID, out sog))
|
||||||
|
{
|
||||||
|
lock (sog.Children)
|
||||||
{
|
{
|
||||||
if (sog.Children.ContainsKey(fullID))
|
if (sog.Children.ContainsKey(fullID))
|
||||||
return sog;
|
return sog;
|
||||||
|
}
|
||||||
|
|
||||||
SceneObjectGroupsByFullID.Remove(fullID);
|
SceneObjectGroupsByFullID.Remove(fullID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1678,7 +1683,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
if (part != null)
|
if (part != null)
|
||||||
{
|
{
|
||||||
if (part.ParentGroup.Children.Count != 1) // Skip single
|
if (part.ParentGroup.PrimCount != 1) // Skip single
|
||||||
{
|
{
|
||||||
if (part.LinkNum < 2) // Root
|
if (part.LinkNum < 2) // Root
|
||||||
rootParts.Add(part);
|
rootParts.Add(part);
|
||||||
|
@ -1717,8 +1722,15 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// However, editing linked parts and unlinking may be different
|
// However, editing linked parts and unlinking may be different
|
||||||
//
|
//
|
||||||
SceneObjectGroup group = root.ParentGroup;
|
SceneObjectGroup group = root.ParentGroup;
|
||||||
List<SceneObjectPart> newSet = new List<SceneObjectPart>(group.Children.Values);
|
|
||||||
int numChildren = group.Children.Count;
|
List<SceneObjectPart> newSet = null;
|
||||||
|
int numChildren = -1;
|
||||||
|
|
||||||
|
lock (group.Children)
|
||||||
|
{
|
||||||
|
newSet = new List<SceneObjectPart>(group.Children.Values);
|
||||||
|
numChildren = group.PrimCount;
|
||||||
|
}
|
||||||
|
|
||||||
// If there are prims left in a link set, but the root is
|
// If there are prims left in a link set, but the root is
|
||||||
// slated for unlink, we need to do this
|
// slated for unlink, we need to do this
|
||||||
|
@ -1808,7 +1820,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
if (ent is SceneObjectGroup)
|
if (ent is SceneObjectGroup)
|
||||||
{
|
{
|
||||||
foreach (KeyValuePair<UUID, SceneObjectPart> subent in ((SceneObjectGroup)ent).Children)
|
SceneObjectGroup sog = ent as SceneObjectGroup;
|
||||||
|
|
||||||
|
lock (sog.Children)
|
||||||
|
{
|
||||||
|
foreach (KeyValuePair<UUID, SceneObjectPart> subent in sog.Children)
|
||||||
{
|
{
|
||||||
if (subent.Value.LocalId == localID)
|
if (subent.Value.LocalId == localID)
|
||||||
{
|
{
|
||||||
|
@ -1818,6 +1834,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//Protip: In my day, we didn't call them searchable objects, we called them limited point-to-point joints
|
//Protip: In my day, we didn't call them searchable objects, we called them limited point-to-point joints
|
||||||
//aka ObjectFlags.JointWheel = IncludeInSearch
|
//aka ObjectFlags.JointWheel = IncludeInSearch
|
||||||
|
@ -1878,7 +1895,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
SceneObjectGroup original = GetGroupByPrim(originalPrimID);
|
SceneObjectGroup original = GetGroupByPrim(originalPrimID);
|
||||||
if (original != null)
|
if (original != null)
|
||||||
{
|
{
|
||||||
if (m_parentScene.Permissions.CanDuplicateObject(original.Children.Count, original.UUID, AgentID, original.AbsolutePosition))
|
if (m_parentScene.Permissions.CanDuplicateObject(
|
||||||
|
original.PrimCount, original.UUID, AgentID, original.AbsolutePosition))
|
||||||
{
|
{
|
||||||
SceneObjectGroup copy = original.Copy(true);
|
SceneObjectGroup copy = original.Copy(true);
|
||||||
copy.AbsolutePosition = copy.AbsolutePosition + offset;
|
copy.AbsolutePosition = copy.AbsolutePosition + offset;
|
||||||
|
|
|
@ -360,7 +360,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int PrimCount
|
public int PrimCount
|
||||||
{
|
{
|
||||||
get { return m_parts.Count; }
|
get { lock (m_parts) { return m_parts.Count; } }
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Quaternion m_rotation = Quaternion.Identity;
|
protected Quaternion m_rotation = Quaternion.Identity;
|
||||||
|
@ -398,6 +398,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
/// <value>
|
/// <value>
|
||||||
/// The parts of this scene object group. You must lock this property before using it.
|
/// The parts of this scene object group. You must lock this property before using it.
|
||||||
|
/// If you want to know the number of children, consider using the PrimCount property instead
|
||||||
/// </value>
|
/// </value>
|
||||||
public Dictionary<UUID, SceneObjectPart> Children
|
public Dictionary<UUID, SceneObjectPart> Children
|
||||||
{
|
{
|
||||||
|
@ -521,7 +522,16 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
public override UUID UUID
|
public override UUID UUID
|
||||||
{
|
{
|
||||||
get { return m_rootPart.UUID; }
|
get { return m_rootPart.UUID; }
|
||||||
set { m_rootPart.UUID = value; }
|
set
|
||||||
|
{
|
||||||
|
m_rootPart.UUID = value;
|
||||||
|
|
||||||
|
lock (m_parts)
|
||||||
|
{
|
||||||
|
m_parts.Remove(m_rootPart.UUID);
|
||||||
|
m_parts.Add(m_rootPart.UUID, m_rootPart);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public UUID OwnerID
|
public UUID OwnerID
|
||||||
|
@ -742,7 +752,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (m_rootPart.LocalId == 0)
|
if (m_rootPart.LocalId == 0)
|
||||||
m_rootPart.LocalId = m_scene.AllocateLocalId();
|
m_rootPart.LocalId = m_scene.AllocateLocalId();
|
||||||
|
|
||||||
// No need to lock here since the object isn't yet in a scene
|
lock (m_parts)
|
||||||
|
{
|
||||||
foreach (SceneObjectPart part in m_parts.Values)
|
foreach (SceneObjectPart part in m_parts.Values)
|
||||||
{
|
{
|
||||||
if (Object.ReferenceEquals(part, m_rootPart))
|
if (Object.ReferenceEquals(part, m_rootPart))
|
||||||
|
@ -758,6 +769,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
part.ParentID = m_rootPart.LocalId;
|
part.ParentID = m_rootPart.LocalId;
|
||||||
//m_log.DebugFormat("[SCENE]: Given local id {0} to part {1}, linknum {2}, parent {3} {4}", part.LocalId, part.UUID, part.LinkNum, part.ParentID, part.ParentUUID);
|
//m_log.DebugFormat("[SCENE]: Given local id {0} to part {1}, linknum {2}, parent {3} {4}", part.LocalId, part.UUID, part.LinkNum, part.ParentID, part.ParentUUID);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ApplyPhysics(m_scene.m_physicalPrim);
|
ApplyPhysics(m_scene.m_physicalPrim);
|
||||||
|
|
||||||
|
@ -1238,10 +1250,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
m_rootPart.AttachedAvatar = agentID;
|
m_rootPart.AttachedAvatar = agentID;
|
||||||
|
|
||||||
//Anakin Lohner bug #3839
|
//Anakin Lohner bug #3839
|
||||||
|
lock (m_parts)
|
||||||
|
{
|
||||||
foreach (SceneObjectPart p in m_parts.Values)
|
foreach (SceneObjectPart p in m_parts.Values)
|
||||||
{
|
{
|
||||||
p.AttachedAvatar = agentID;
|
p.AttachedAvatar = agentID;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (m_rootPart.PhysActor != null)
|
if (m_rootPart.PhysActor != null)
|
||||||
{
|
{
|
||||||
|
@ -1308,11 +1323,15 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
AbsolutePosition = detachedpos;
|
AbsolutePosition = detachedpos;
|
||||||
m_rootPart.AttachedAvatar = UUID.Zero;
|
m_rootPart.AttachedAvatar = UUID.Zero;
|
||||||
|
|
||||||
//Anakin Lohner bug #3839
|
//Anakin Lohner bug #3839
|
||||||
|
lock (m_parts)
|
||||||
|
{
|
||||||
foreach (SceneObjectPart p in m_parts.Values)
|
foreach (SceneObjectPart p in m_parts.Values)
|
||||||
{
|
{
|
||||||
p.AttachedAvatar = UUID.Zero;
|
p.AttachedAvatar = UUID.Zero;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_rootPart.SetParentLocalId(0);
|
m_rootPart.SetParentLocalId(0);
|
||||||
SetAttachmentPoint((byte)0);
|
SetAttachmentPoint((byte)0);
|
||||||
|
@ -1337,11 +1356,15 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
|
|
||||||
m_rootPart.AttachedAvatar = UUID.Zero;
|
m_rootPart.AttachedAvatar = UUID.Zero;
|
||||||
|
|
||||||
//Anakin Lohner bug #3839
|
//Anakin Lohner bug #3839
|
||||||
|
lock (m_parts)
|
||||||
|
{
|
||||||
foreach (SceneObjectPart p in m_parts.Values)
|
foreach (SceneObjectPart p in m_parts.Values)
|
||||||
{
|
{
|
||||||
p.AttachedAvatar = UUID.Zero;
|
p.AttachedAvatar = UUID.Zero;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_rootPart.SetParentLocalId(0);
|
m_rootPart.SetParentLocalId(0);
|
||||||
//m_rootPart.SetAttachmentPoint((byte)0);
|
//m_rootPart.SetAttachmentPoint((byte)0);
|
||||||
|
@ -1406,8 +1429,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
part.ParentID = 0;
|
part.ParentID = 0;
|
||||||
part.LinkNum = 0;
|
part.LinkNum = 0;
|
||||||
|
|
||||||
// No locking required since the SOG should not be in the scene yet - one can't change root parts after
|
lock (m_parts)
|
||||||
// the scene object has been attached to the scene
|
|
||||||
m_parts.Add(m_rootPart.UUID, m_rootPart);
|
m_parts.Add(m_rootPart.UUID, m_rootPart);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1928,14 +1950,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Copy the given part as the root part of this scene object.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="part"></param>
|
/// <param name="part"></param>
|
||||||
/// <param name="cAgentID"></param>
|
/// <param name="cAgentID"></param>
|
||||||
/// <param name="cGroupID"></param>
|
/// <param name="cGroupID"></param>
|
||||||
public void CopyRootPart(SceneObjectPart part, UUID cAgentID, UUID cGroupID, bool userExposed)
|
public void CopyRootPart(SceneObjectPart part, UUID cAgentID, UUID cGroupID, bool userExposed)
|
||||||
{
|
{
|
||||||
SetRootPart(part.Copy(m_scene.AllocateLocalId(), OwnerID, GroupID, m_parts.Count, userExposed));
|
SetRootPart(part.Copy(m_scene.AllocateLocalId(), OwnerID, GroupID, 0, userExposed));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ScriptSetPhysicsStatus(bool UsePhysics)
|
public void ScriptSetPhysicsStatus(bool UsePhysics)
|
||||||
|
@ -2234,8 +2256,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void ResetIDs()
|
public void ResetIDs()
|
||||||
{
|
{
|
||||||
// As this is only ever called for prims which are not currently part of the scene (and hence
|
lock (m_parts)
|
||||||
// not accessible by clients), there should be no need to lock
|
{
|
||||||
List<SceneObjectPart> partsList = new List<SceneObjectPart>(m_parts.Values);
|
List<SceneObjectPart> partsList = new List<SceneObjectPart>(m_parts.Values);
|
||||||
m_parts.Clear();
|
m_parts.Clear();
|
||||||
foreach (SceneObjectPart part in partsList)
|
foreach (SceneObjectPart part in partsList)
|
||||||
|
@ -2244,6 +2266,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
m_parts.Add(part.UUID, part);
|
m_parts.Add(part.UUID, part);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
@ -2479,10 +2502,15 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
public SceneObjectPart GetChildPart(UUID primID)
|
public SceneObjectPart GetChildPart(UUID primID)
|
||||||
{
|
{
|
||||||
SceneObjectPart childPart = null;
|
SceneObjectPart childPart = null;
|
||||||
|
|
||||||
|
lock (m_parts)
|
||||||
|
{
|
||||||
if (m_parts.ContainsKey(primID))
|
if (m_parts.ContainsKey(primID))
|
||||||
{
|
{
|
||||||
childPart = m_parts[primID];
|
childPart = m_parts[primID];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return childPart;
|
return childPart;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2519,8 +2547,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public bool HasChildPrim(UUID primID)
|
public bool HasChildPrim(UUID primID)
|
||||||
{
|
{
|
||||||
if (m_parts.ContainsKey(primID))
|
lock (m_parts)
|
||||||
{
|
{
|
||||||
|
if (m_parts.ContainsKey(primID))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3131,10 +3160,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public void UpdatePermissions(UUID AgentID, byte field, uint localID,
|
public void UpdatePermissions(UUID AgentID, byte field, uint localID,
|
||||||
uint mask, byte addRemTF)
|
uint mask, byte addRemTF)
|
||||||
|
{
|
||||||
|
lock (m_parts)
|
||||||
{
|
{
|
||||||
foreach (SceneObjectPart part in m_parts.Values)
|
foreach (SceneObjectPart part in m_parts.Values)
|
||||||
part.UpdatePermissions(AgentID, field, localID, mask,
|
part.UpdatePermissions(AgentID, field, localID, mask, addRemTF);
|
||||||
addRemTF);
|
}
|
||||||
|
|
||||||
HasGroupChanged = true;
|
HasGroupChanged = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,7 @@ using log4net;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
using OpenSim.Region.Framework.Scenes.Scripting;
|
using OpenSim.Region.Framework.Scenes.Scripting;
|
||||||
|
using OpenSim.Region.Framework.Scenes.Serialization;
|
||||||
|
|
||||||
namespace OpenSim.Region.Framework.Scenes
|
namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
|
@ -722,6 +723,71 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SceneObjectGroup GetRezReadySceneObject(TaskInventoryItem item)
|
||||||
|
{
|
||||||
|
UUID ownerID = item.OwnerID;
|
||||||
|
AssetBase rezAsset = m_part.ParentGroup.Scene.AssetService.Get(item.AssetID.ToString());
|
||||||
|
|
||||||
|
if (null == rezAsset)
|
||||||
|
{
|
||||||
|
m_log.WarnFormat(
|
||||||
|
"[PRIM INVENTORY]: Could not find asset {0} for inventory item {1} in {2}",
|
||||||
|
item.AssetID, item.Name, m_part.Name);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
string xmlData = Utils.BytesToString(rezAsset.Data);
|
||||||
|
SceneObjectGroup group = SceneObjectSerializer.FromOriginalXmlFormat(xmlData);
|
||||||
|
|
||||||
|
group.ResetIDs();
|
||||||
|
|
||||||
|
SceneObjectPart rootPart = group.GetChildPart(group.UUID);
|
||||||
|
|
||||||
|
// Since renaming the item in the inventory does not affect the name stored
|
||||||
|
// in the serialization, transfer the correct name from the inventory to the
|
||||||
|
// object itself before we rez.
|
||||||
|
rootPart.Name = item.Name;
|
||||||
|
rootPart.Description = item.Description;
|
||||||
|
|
||||||
|
List<SceneObjectPart> partList = null;
|
||||||
|
|
||||||
|
lock (group.Children)
|
||||||
|
partList = new List<SceneObjectPart>(group.Children.Values);
|
||||||
|
|
||||||
|
group.SetGroup(m_part.GroupID, null);
|
||||||
|
|
||||||
|
if ((rootPart.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0)
|
||||||
|
{
|
||||||
|
if (m_part.ParentGroup.Scene.Permissions.PropagatePermissions())
|
||||||
|
{
|
||||||
|
foreach (SceneObjectPart part in partList)
|
||||||
|
{
|
||||||
|
part.EveryoneMask = item.EveryonePermissions;
|
||||||
|
part.NextOwnerMask = item.NextPermissions;
|
||||||
|
}
|
||||||
|
|
||||||
|
group.ApplyNextOwnerPermissions();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (SceneObjectPart part in partList)
|
||||||
|
{
|
||||||
|
if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0)
|
||||||
|
{
|
||||||
|
part.LastOwnerID = part.OwnerID;
|
||||||
|
part.OwnerID = item.OwnerID;
|
||||||
|
part.Inventory.ChangeInventoryOwner(item.OwnerID);
|
||||||
|
}
|
||||||
|
|
||||||
|
part.EveryoneMask = item.EveryonePermissions;
|
||||||
|
part.NextOwnerMask = item.NextPermissions;
|
||||||
|
}
|
||||||
|
|
||||||
|
rootPart.TrimPermissions();
|
||||||
|
|
||||||
|
return group;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Update an existing inventory item.
|
/// Update an existing inventory item.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -1197,6 +1263,5 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
Items.LockItemsForRead(false);
|
Items.LockItemsForRead(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -121,6 +121,8 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
|
||||||
continue;
|
continue;
|
||||||
temp = (SceneObjectGroup) currObj;
|
temp = (SceneObjectGroup) currObj;
|
||||||
|
|
||||||
|
lock (temp.Children)
|
||||||
|
{
|
||||||
if (m_CMEntityHash.ContainsKey(temp.UUID))
|
if (m_CMEntityHash.ContainsKey(temp.UUID))
|
||||||
{
|
{
|
||||||
foreach (SceneObjectPart part in temp.Children.Values)
|
foreach (SceneObjectPart part in temp.Children.Values)
|
||||||
|
@ -133,6 +135,7 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
|
||||||
missingList.Add(part);
|
missingList.Add(part);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return missingList;
|
return missingList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
|
@ -167,10 +167,13 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
|
||||||
public void RemoveOrUpdateDeletedEntity(SceneObjectGroup group)
|
public void RemoveOrUpdateDeletedEntity(SceneObjectGroup group)
|
||||||
{
|
{
|
||||||
// Deal with new parts not revisioned that have been deleted.
|
// Deal with new parts not revisioned that have been deleted.
|
||||||
|
lock (group.Children)
|
||||||
|
{
|
||||||
foreach (SceneObjectPart part in group.Children.Values)
|
foreach (SceneObjectPart part in group.Children.Values)
|
||||||
if (m_MetaEntityCollection.Auras.ContainsKey(part.UUID))
|
if (m_MetaEntityCollection.Auras.ContainsKey(part.UUID))
|
||||||
m_MetaEntityCollection.RemoveNewlyCreatedEntityAura(part.UUID);
|
m_MetaEntityCollection.RemoveNewlyCreatedEntityAura(part.UUID);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Retrieves the latest revision of a region in xml form,
|
/// Retrieves the latest revision of a region in xml form,
|
||||||
|
@ -207,8 +210,13 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
|
||||||
{
|
{
|
||||||
temp = SceneObjectSerializer.FromXml2Format(xml);
|
temp = SceneObjectSerializer.FromXml2Format(xml);
|
||||||
temp.SetScene(scene);
|
temp.SetScene(scene);
|
||||||
|
|
||||||
|
lock (temp.Children)
|
||||||
|
{
|
||||||
foreach (SceneObjectPart part in temp.Children.Values)
|
foreach (SceneObjectPart part in temp.Children.Values)
|
||||||
part.RegionHandle = scene.RegionInfo.RegionHandle;
|
part.RegionHandle = scene.RegionInfo.RegionHandle;
|
||||||
|
}
|
||||||
|
|
||||||
ReplacementList.Add(temp.UUID, (EntityBase)temp);
|
ReplacementList.Add(temp.UUID, (EntityBase)temp);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -338,6 +346,9 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
|
||||||
System.Collections.ArrayList auraList = new System.Collections.ArrayList();
|
System.Collections.ArrayList auraList = new System.Collections.ArrayList();
|
||||||
if (group == null)
|
if (group == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
lock (group.Children)
|
||||||
|
{
|
||||||
foreach (SceneObjectPart part in group.Children.Values)
|
foreach (SceneObjectPart part in group.Children.Values)
|
||||||
{
|
{
|
||||||
if (m_MetaEntityCollection.Auras.ContainsKey(part.UUID))
|
if (m_MetaEntityCollection.Auras.ContainsKey(part.UUID))
|
||||||
|
@ -347,6 +358,8 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
|
||||||
auraList.Add((AuraMetaEntity)m_MetaEntityCollection.Auras[part.UUID]);
|
auraList.Add((AuraMetaEntity)m_MetaEntityCollection.Auras[part.UUID]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return auraList;
|
return auraList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -186,10 +186,13 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
|
||||||
((ContentManagementEntity)m_model.MetaEntityCollection.Entities[group.UUID]).SendFullDiffUpdateToAll();
|
((ContentManagementEntity)m_model.MetaEntityCollection.Entities[group.UUID]).SendFullDiffUpdateToAll();
|
||||||
|
|
||||||
// Deal with new parts not revisioned that have been deleted.
|
// Deal with new parts not revisioned that have been deleted.
|
||||||
|
lock (group.Children)
|
||||||
|
{
|
||||||
foreach (SceneObjectPart part in group.Children.Values)
|
foreach (SceneObjectPart part in group.Children.Values)
|
||||||
if (m_model.MetaEntityCollection.Auras.ContainsKey(part.UUID))
|
if (m_model.MetaEntityCollection.Auras.ContainsKey(part.UUID))
|
||||||
((AuraMetaEntity)m_model.MetaEntityCollection.Auras[part.UUID]).HideFromAll();
|
((AuraMetaEntity)m_model.MetaEntityCollection.Auras[part.UUID]).HideFromAll();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void SendMetaEntitiesToNewClient(IClientAPI client)
|
public void SendMetaEntitiesToNewClient(IClientAPI client)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
|
@ -131,6 +131,8 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
|
||||||
DiffersFromSceneGroup = false;
|
DiffersFromSceneGroup = false;
|
||||||
// if group is not contained in scene's list
|
// if group is not contained in scene's list
|
||||||
if (!ContainsKey(sceneEntityList, m_UnchangedEntity.UUID))
|
if (!ContainsKey(sceneEntityList, m_UnchangedEntity.UUID))
|
||||||
|
{
|
||||||
|
lock (m_UnchangedEntity.Children)
|
||||||
{
|
{
|
||||||
foreach (SceneObjectPart part in m_UnchangedEntity.Children.Values)
|
foreach (SceneObjectPart part in m_UnchangedEntity.Children.Values)
|
||||||
{
|
{
|
||||||
|
@ -157,6 +159,7 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
|
||||||
}
|
}
|
||||||
// otherwise, scene will not contain the part. note: a group can not remove a part without changing group id
|
// otherwise, scene will not contain the part. note: a group can not remove a part without changing group id
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// a deleted part has no where to point a beam particle system,
|
// a deleted part has no where to point a beam particle system,
|
||||||
// if a metapart had a particle system (maybe it represented a moved part) remove it
|
// if a metapart had a particle system (maybe it represented a moved part) remove it
|
||||||
|
@ -180,8 +183,10 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool HasChildPrim(UUID uuid)
|
public bool HasChildPrim(UUID uuid)
|
||||||
{
|
{
|
||||||
|
lock (m_UnchangedEntity.Children)
|
||||||
if (m_UnchangedEntity.Children.ContainsKey(uuid))
|
if (m_UnchangedEntity.Children.ContainsKey(uuid))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,10 +194,14 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
|
||||||
/// Check if the revisioned scene object group that this CMEntity is based off of contains a child with the given LocalId.
|
/// Check if the revisioned scene object group that this CMEntity is based off of contains a child with the given LocalId.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool HasChildPrim(uint localID)
|
public bool HasChildPrim(uint localID)
|
||||||
|
{
|
||||||
|
lock (m_UnchangedEntity.Children)
|
||||||
{
|
{
|
||||||
foreach (SceneObjectPart part in m_UnchangedEntity.Children.Values)
|
foreach (SceneObjectPart part in m_UnchangedEntity.Children.Values)
|
||||||
if (part.LocalId == localID)
|
if (part.LocalId == localID)
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,6 +237,8 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
|
||||||
// Use "UnchangedEntity" to do comparisons because its text, transparency, and other attributes will be just as the user
|
// Use "UnchangedEntity" to do comparisons because its text, transparency, and other attributes will be just as the user
|
||||||
// had originally saved.
|
// had originally saved.
|
||||||
// m_Entity will NOT necessarily be the same entity as the user had saved.
|
// m_Entity will NOT necessarily be the same entity as the user had saved.
|
||||||
|
lock (m_UnchangedEntity.Children)
|
||||||
|
{
|
||||||
foreach (SceneObjectPart UnchangedPart in m_UnchangedEntity.Children.Values)
|
foreach (SceneObjectPart UnchangedPart in m_UnchangedEntity.Children.Values)
|
||||||
{
|
{
|
||||||
//This is the part that we use to show changes.
|
//This is the part that we use to show changes.
|
||||||
|
@ -309,6 +320,8 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
|
||||||
DiffersFromSceneGroup = true;
|
DiffersFromSceneGroup = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -150,6 +150,9 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
|
||||||
{
|
{
|
||||||
//make new uuids
|
//make new uuids
|
||||||
Dictionary<UUID, SceneObjectPart> parts = new Dictionary<UUID, SceneObjectPart>();
|
Dictionary<UUID, SceneObjectPart> parts = new Dictionary<UUID, SceneObjectPart>();
|
||||||
|
|
||||||
|
lock (m_Entity.Children)
|
||||||
|
{
|
||||||
foreach (SceneObjectPart part in m_Entity.Children.Values)
|
foreach (SceneObjectPart part in m_Entity.Children.Values)
|
||||||
{
|
{
|
||||||
part.ResetIDs(part.LinkNum);
|
part.ResetIDs(part.LinkNum);
|
||||||
|
@ -160,6 +163,7 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
|
||||||
m_Entity.RootPart.PhysActor = null;
|
m_Entity.RootPart.PhysActor = null;
|
||||||
m_Entity.Children = parts;
|
m_Entity.Children = parts;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion Protected Methods
|
#endregion Protected Methods
|
||||||
|
|
||||||
|
@ -173,14 +177,19 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
|
||||||
//This deletes the group without removing from any databases.
|
//This deletes the group without removing from any databases.
|
||||||
//This is important because we are not IN any database.
|
//This is important because we are not IN any database.
|
||||||
//m_Entity.FakeDeleteGroup();
|
//m_Entity.FakeDeleteGroup();
|
||||||
|
lock (m_Entity.Children)
|
||||||
|
{
|
||||||
foreach (SceneObjectPart part in m_Entity.Children.Values)
|
foreach (SceneObjectPart part in m_Entity.Children.Values)
|
||||||
client.SendKillObject(m_Entity.RegionHandle, part.LocalId);
|
client.SendKillObject(m_Entity.RegionHandle, part.LocalId);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sends a kill object message to all clients, effectively "hiding" the metaentity even though it's still on the server.
|
/// Sends a kill object message to all clients, effectively "hiding" the metaentity even though it's still on the server.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual void HideFromAll()
|
public virtual void HideFromAll()
|
||||||
|
{
|
||||||
|
lock (m_Entity.Children)
|
||||||
{
|
{
|
||||||
foreach (SceneObjectPart part in m_Entity.Children.Values)
|
foreach (SceneObjectPart part in m_Entity.Children.Values)
|
||||||
{
|
{
|
||||||
|
@ -190,6 +199,7 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void SendFullUpdate(IClientAPI client)
|
public void SendFullUpdate(IClientAPI client)
|
||||||
{
|
{
|
||||||
|
|
|
@ -185,15 +185,20 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
SceneObjectPart my = GetSOP();
|
SceneObjectPart my = GetSOP();
|
||||||
|
IObject[] rets = null;
|
||||||
|
|
||||||
|
lock (my.ParentGroup.Children)
|
||||||
|
{
|
||||||
int total = my.ParentGroup.Children.Count;
|
int total = my.ParentGroup.Children.Count;
|
||||||
|
|
||||||
IObject[] rets = new IObject[total];
|
rets = new IObject[total];
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
foreach (KeyValuePair<UUID, SceneObjectPart> pair in my.ParentGroup.Children)
|
foreach (KeyValuePair<UUID, SceneObjectPart> pair in my.ParentGroup.Children)
|
||||||
{
|
{
|
||||||
rets[i++] = new SOPObject(m_rootScene, pair.Value.LocalId, m_security);
|
rets[i++] = new SOPObject(m_rootScene, pair.Value.LocalId, m_security);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return rets;
|
return rets;
|
||||||
}
|
}
|
||||||
|
|
|
@ -293,7 +293,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
case ScriptBaseClass.LINK_SET:
|
case ScriptBaseClass.LINK_SET:
|
||||||
if (m_host.ParentGroup != null)
|
if (m_host.ParentGroup != null)
|
||||||
|
{
|
||||||
|
lock (m_host.ParentGroup.Children)
|
||||||
return new List<SceneObjectPart>(m_host.ParentGroup.Children.Values);
|
return new List<SceneObjectPart>(m_host.ParentGroup.Children.Values);
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
case ScriptBaseClass.LINK_ROOT:
|
case ScriptBaseClass.LINK_ROOT:
|
||||||
|
@ -308,7 +311,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
case ScriptBaseClass.LINK_ALL_OTHERS:
|
case ScriptBaseClass.LINK_ALL_OTHERS:
|
||||||
if (m_host.ParentGroup == null)
|
if (m_host.ParentGroup == null)
|
||||||
return new List<SceneObjectPart>();
|
return new List<SceneObjectPart>();
|
||||||
|
|
||||||
|
lock (m_host.ParentGroup.Children)
|
||||||
ret = new List<SceneObjectPart>(m_host.ParentGroup.Children.Values);
|
ret = new List<SceneObjectPart>(m_host.ParentGroup.Children.Values);
|
||||||
|
|
||||||
if (ret.Contains(m_host))
|
if (ret.Contains(m_host))
|
||||||
ret.Remove(m_host);
|
ret.Remove(m_host);
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -316,7 +322,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
case ScriptBaseClass.LINK_ALL_CHILDREN:
|
case ScriptBaseClass.LINK_ALL_CHILDREN:
|
||||||
if (m_host.ParentGroup == null)
|
if (m_host.ParentGroup == null)
|
||||||
return new List<SceneObjectPart>();
|
return new List<SceneObjectPart>();
|
||||||
|
|
||||||
|
lock (m_host.ParentGroup.Children)
|
||||||
ret = new List<SceneObjectPart>(m_host.ParentGroup.Children.Values);
|
ret = new List<SceneObjectPart>(m_host.ParentGroup.Children.Values);
|
||||||
|
|
||||||
if (ret.Contains(m_host.ParentGroup.RootPart))
|
if (ret.Contains(m_host.ParentGroup.RootPart))
|
||||||
ret.Remove(m_host.ParentGroup.RootPart);
|
ret.Remove(m_host.ParentGroup.RootPart);
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -1272,6 +1281,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
if (group == null)
|
if (group == null)
|
||||||
return;
|
return;
|
||||||
bool allow = true;
|
bool allow = true;
|
||||||
|
|
||||||
|
lock (group.Children)
|
||||||
|
{
|
||||||
foreach (SceneObjectPart part in group.Children.Values)
|
foreach (SceneObjectPart part in group.Children.Values)
|
||||||
{
|
{
|
||||||
if (part.Scale.X > World.m_maxPhys || part.Scale.Y > World.m_maxPhys || part.Scale.Z > World.m_maxPhys)
|
if (part.Scale.X > World.m_maxPhys || part.Scale.Y > World.m_maxPhys || part.Scale.Z > World.m_maxPhys)
|
||||||
|
@ -1280,6 +1292,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!allow)
|
if (!allow)
|
||||||
return;
|
return;
|
||||||
|
@ -3757,7 +3770,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
if (m_host.ParentGroup.Children.Count > 1)
|
if (m_host.ParentGroup.PrimCount > 1)
|
||||||
{
|
{
|
||||||
return m_host.LinkNum;
|
return m_host.LinkNum;
|
||||||
}
|
}
|
||||||
|
@ -3878,6 +3891,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
case ScriptBaseClass.LINK_ALL_OTHERS:
|
case ScriptBaseClass.LINK_ALL_OTHERS:
|
||||||
case ScriptBaseClass.LINK_ALL_CHILDREN:
|
case ScriptBaseClass.LINK_ALL_CHILDREN:
|
||||||
case ScriptBaseClass.LINK_THIS:
|
case ScriptBaseClass.LINK_THIS:
|
||||||
|
lock (parentPrim.Children)
|
||||||
|
{
|
||||||
foreach (SceneObjectPart part in parentPrim.Children.Values)
|
foreach (SceneObjectPart part in parentPrim.Children.Values)
|
||||||
{
|
{
|
||||||
if (part.UUID != m_host.UUID)
|
if (part.UUID != m_host.UUID)
|
||||||
|
@ -3887,6 +3902,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
childPrim = parentPrim.GetLinkNumPart(linknum);
|
childPrim = parentPrim.GetLinkNumPart(linknum);
|
||||||
if (childPrim.UUID == m_host.UUID)
|
if (childPrim.UUID == m_host.UUID)
|
||||||
|
@ -3962,27 +3978,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
if (parentPrim.RootPart.AttachmentPoint != 0)
|
if (parentPrim.RootPart.AttachmentPoint != 0)
|
||||||
return; // Fail silently if attached
|
return; // Fail silently if attached
|
||||||
|
|
||||||
|
lock (parentPrim.Children)
|
||||||
|
{
|
||||||
List<SceneObjectPart> parts = new List<SceneObjectPart>(parentPrim.Children.Values);
|
List<SceneObjectPart> parts = new List<SceneObjectPart>(parentPrim.Children.Values);
|
||||||
parts.Remove(parentPrim.RootPart);
|
parts.Remove(parentPrim.RootPart);
|
||||||
if (parts.Count > 0)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
parts[0].ParentGroup.areUpdatesSuspended = true;
|
|
||||||
foreach (SceneObjectPart part in parts)
|
foreach (SceneObjectPart part in parts)
|
||||||
{
|
{
|
||||||
parentPrim.DelinkFromGroup(part.LocalId, true);
|
parentPrim.DelinkFromGroup(part.LocalId, true);
|
||||||
parentPrim.TriggerScriptChangedEvent(Changed.LINK);
|
parentPrim.TriggerScriptChangedEvent(Changed.LINK);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
parts[0].ParentGroup.areUpdatesSuspended = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
parentPrim.HasGroupChanged = true;
|
parentPrim.HasGroupChanged = true;
|
||||||
parentPrim.ScheduleGroupForFullUpdate();
|
parentPrim.ScheduleGroupForFullUpdate();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public LSL_String llGetLinkKey(int linknum)
|
public LSL_String llGetLinkKey(int linknum)
|
||||||
{
|
{
|
||||||
|
@ -4545,7 +4554,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
partItemID = item.ItemID;
|
partItemID = item.ItemID;
|
||||||
int linkNumber = m_host.LinkNum;
|
int linkNumber = m_host.LinkNum;
|
||||||
if (m_host.ParentGroup.Children.Count == 1)
|
if (m_host.ParentGroup.PrimCount == 1)
|
||||||
linkNumber = 0;
|
linkNumber = 0;
|
||||||
|
|
||||||
object[] resobj = new object[]
|
object[] resobj = new object[]
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
<<<<<<< HEAD:OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
|
@ -505,3 +506,507 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
=======
|
||||||
|
/*
|
||||||
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the OpenSimulator Project nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Runtime.Remoting.Lifetime;
|
||||||
|
using OpenMetaverse;
|
||||||
|
using Nini.Config;
|
||||||
|
using OpenSim;
|
||||||
|
using OpenSim.Framework;
|
||||||
|
using OpenSim.Region.CoreModules.World.LightShare;
|
||||||
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
using OpenSim.Region.ScriptEngine.Shared;
|
||||||
|
using OpenSim.Region.ScriptEngine.Shared.Api.Plugins;
|
||||||
|
using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
|
||||||
|
using OpenSim.Region.ScriptEngine.Interfaces;
|
||||||
|
using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces;
|
||||||
|
|
||||||
|
using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat;
|
||||||
|
using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
|
||||||
|
using LSL_Key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
|
||||||
|
using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list;
|
||||||
|
using LSL_Rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion;
|
||||||
|
using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
|
||||||
|
using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
|
||||||
|
|
||||||
|
namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
|
{
|
||||||
|
[Serializable]
|
||||||
|
public class LS_Api : MarshalByRefObject, ILS_Api, IScriptApi
|
||||||
|
{
|
||||||
|
internal IScriptEngine m_ScriptEngine;
|
||||||
|
internal SceneObjectPart m_host;
|
||||||
|
internal uint m_localID;
|
||||||
|
internal UUID m_itemID;
|
||||||
|
internal bool m_LSFunctionsEnabled = false;
|
||||||
|
internal IScriptModuleComms m_comms = null;
|
||||||
|
|
||||||
|
public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID)
|
||||||
|
{
|
||||||
|
m_ScriptEngine = ScriptEngine;
|
||||||
|
m_host = host;
|
||||||
|
m_localID = localID;
|
||||||
|
m_itemID = itemID;
|
||||||
|
|
||||||
|
if (m_ScriptEngine.Config.GetBoolean("AllowLightShareFunctions", false))
|
||||||
|
m_LSFunctionsEnabled = true;
|
||||||
|
|
||||||
|
m_comms = m_ScriptEngine.World.RequestModuleInterface<IScriptModuleComms>();
|
||||||
|
if (m_comms == null)
|
||||||
|
m_LSFunctionsEnabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Object InitializeLifetimeService()
|
||||||
|
{
|
||||||
|
ILease lease = (ILease)base.InitializeLifetimeService();
|
||||||
|
|
||||||
|
if (lease.CurrentState == LeaseState.Initial)
|
||||||
|
{
|
||||||
|
lease.InitialLeaseTime = TimeSpan.FromMinutes(0);
|
||||||
|
// lease.RenewOnCallTime = TimeSpan.FromSeconds(10.0);
|
||||||
|
// lease.SponsorshipTimeout = TimeSpan.FromMinutes(1.0);
|
||||||
|
}
|
||||||
|
return lease;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Scene World
|
||||||
|
{
|
||||||
|
get { return m_ScriptEngine.World; }
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
//Dumps an error message on the debug console.
|
||||||
|
//
|
||||||
|
|
||||||
|
internal void LSShoutError(string message)
|
||||||
|
{
|
||||||
|
if (message.Length > 1023)
|
||||||
|
message = message.Substring(0, 1023);
|
||||||
|
|
||||||
|
World.SimChat(Utils.StringToBytes(message),
|
||||||
|
ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.ParentGroup.RootPart.AbsolutePosition, m_host.Name, m_host.UUID, true);
|
||||||
|
|
||||||
|
IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
|
||||||
|
wComm.DeliverMessage(ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.Name, m_host.UUID, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get the current Windlight scene
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>List of windlight parameters</returns>
|
||||||
|
public LSL_List lsGetWindlightScene(LSL_List rules)
|
||||||
|
{
|
||||||
|
if (!m_LSFunctionsEnabled)
|
||||||
|
{
|
||||||
|
LSShoutError("LightShare functions are not enabled.");
|
||||||
|
return new LSL_List();
|
||||||
|
}
|
||||||
|
m_host.AddScriptLPS(1);
|
||||||
|
RegionLightShareData wl = m_host.ParentGroup.Scene.RegionInfo.WindlightSettings;
|
||||||
|
|
||||||
|
LSL_List values = new LSL_List();
|
||||||
|
int idx = 0;
|
||||||
|
while (idx < rules.Length)
|
||||||
|
{
|
||||||
|
uint rule = (uint)rules.GetLSLIntegerItem(idx);
|
||||||
|
LSL_List toadd = new LSL_List();
|
||||||
|
|
||||||
|
switch (rule)
|
||||||
|
{
|
||||||
|
case (int)ScriptBaseClass.WL_AMBIENT:
|
||||||
|
toadd.Add(new LSL_Rotation(wl.ambient.X, wl.ambient.Y, wl.ambient.Z, wl.ambient.W));
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_BIG_WAVE_DIRECTION:
|
||||||
|
toadd.Add(new LSL_Vector(wl.bigWaveDirection.X, wl.bigWaveDirection.Y, 0.0f));
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_BLUE_DENSITY:
|
||||||
|
toadd.Add(new LSL_Rotation(wl.blueDensity.X, wl.blueDensity.Y, wl.blueDensity.Z, wl.blueDensity.W));
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_BLUR_MULTIPLIER:
|
||||||
|
toadd.Add(new LSL_Float(wl.blurMultiplier));
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_CLOUD_COLOR:
|
||||||
|
toadd.Add(new LSL_Rotation(wl.cloudColor.X, wl.cloudColor.Y, wl.cloudColor.Z, wl.cloudColor.W));
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_CLOUD_COVERAGE:
|
||||||
|
toadd.Add(new LSL_Float(wl.cloudCoverage));
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_CLOUD_DETAIL_XY_DENSITY:
|
||||||
|
toadd.Add(new LSL_Vector(wl.cloudDetailXYDensity.X, wl.cloudDetailXYDensity.Y, wl.cloudDetailXYDensity.Z));
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_CLOUD_SCALE:
|
||||||
|
toadd.Add(new LSL_Float(wl.cloudScale));
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X:
|
||||||
|
toadd.Add(new LSL_Float(wl.cloudScrollX));
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X_LOCK:
|
||||||
|
toadd.Add(new LSL_Integer(wl.cloudScrollXLock ? 1 : 0));
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y:
|
||||||
|
toadd.Add(new LSL_Float(wl.cloudScrollY));
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y_LOCK:
|
||||||
|
toadd.Add(new LSL_Integer(wl.cloudScrollYLock ? 1 : 0));
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_CLOUD_XY_DENSITY:
|
||||||
|
toadd.Add(new LSL_Vector(wl.cloudXYDensity.X, wl.cloudXYDensity.Y, wl.cloudXYDensity.Z));
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_DENSITY_MULTIPLIER:
|
||||||
|
toadd.Add(new LSL_Float(wl.densityMultiplier));
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_DISTANCE_MULTIPLIER:
|
||||||
|
toadd.Add(new LSL_Float(wl.distanceMultiplier));
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_DRAW_CLASSIC_CLOUDS:
|
||||||
|
toadd.Add(new LSL_Integer(wl.drawClassicClouds ? 1 : 0));
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_EAST_ANGLE:
|
||||||
|
toadd.Add(new LSL_Float(wl.eastAngle));
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_FRESNEL_OFFSET:
|
||||||
|
toadd.Add(new LSL_Float(wl.fresnelOffset));
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_FRESNEL_SCALE:
|
||||||
|
toadd.Add(new LSL_Float(wl.fresnelScale));
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_HAZE_DENSITY:
|
||||||
|
toadd.Add(new LSL_Float(wl.hazeDensity));
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_HAZE_HORIZON:
|
||||||
|
toadd.Add(new LSL_Float(wl.hazeHorizon));
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_HORIZON:
|
||||||
|
toadd.Add(new LSL_Rotation(wl.horizon.X, wl.horizon.Y, wl.horizon.Z, wl.horizon.W));
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_LITTLE_WAVE_DIRECTION:
|
||||||
|
toadd.Add(new LSL_Vector(wl.littleWaveDirection.X, wl.littleWaveDirection.Y, 0.0f));
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_MAX_ALTITUDE:
|
||||||
|
toadd.Add(new LSL_Integer(wl.maxAltitude));
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_NORMAL_MAP_TEXTURE:
|
||||||
|
toadd.Add(new LSL_Key(wl.normalMapTexture.ToString()));
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_REFLECTION_WAVELET_SCALE:
|
||||||
|
toadd.Add(new LSL_Vector(wl.reflectionWaveletScale.X, wl.reflectionWaveletScale.Y, wl.reflectionWaveletScale.Z));
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_REFRACT_SCALE_ABOVE:
|
||||||
|
toadd.Add(new LSL_Float(wl.refractScaleAbove));
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_REFRACT_SCALE_BELOW:
|
||||||
|
toadd.Add(new LSL_Float(wl.refractScaleBelow));
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_SCENE_GAMMA:
|
||||||
|
toadd.Add(new LSL_Float(wl.sceneGamma));
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_STAR_BRIGHTNESS:
|
||||||
|
toadd.Add(new LSL_Float(wl.starBrightness));
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_SUN_GLOW_FOCUS:
|
||||||
|
toadd.Add(new LSL_Float(wl.sunGlowFocus));
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_SUN_GLOW_SIZE:
|
||||||
|
toadd.Add(new LSL_Float(wl.sunGlowSize));
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_SUN_MOON_COLOR:
|
||||||
|
toadd.Add(new LSL_Rotation(wl.sunMoonColor.X, wl.sunMoonColor.Y, wl.sunMoonColor.Z, wl.sunMoonColor.W));
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_UNDERWATER_FOG_MODIFIER:
|
||||||
|
toadd.Add(new LSL_Float(wl.underwaterFogModifier));
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_WATER_COLOR:
|
||||||
|
toadd.Add(new LSL_Vector(wl.waterColor.X, wl.waterColor.Y, wl.waterColor.Z));
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_WATER_FOG_DENSITY_EXPONENT:
|
||||||
|
toadd.Add(new LSL_Float(wl.waterFogDensityExponent));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (toadd.Length > 0)
|
||||||
|
{
|
||||||
|
values.Add(rule);
|
||||||
|
values.Add(toadd.Data[0]);
|
||||||
|
}
|
||||||
|
idx++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return values;
|
||||||
|
}
|
||||||
|
|
||||||
|
private RegionLightShareData getWindlightProfileFromRules(LSL_List rules)
|
||||||
|
{
|
||||||
|
RegionLightShareData wl = (RegionLightShareData)m_host.ParentGroup.Scene.RegionInfo.WindlightSettings.Clone();
|
||||||
|
|
||||||
|
// LSL_List values = new LSL_List();
|
||||||
|
int idx = 0;
|
||||||
|
while (idx < rules.Length)
|
||||||
|
{
|
||||||
|
uint rule = (uint)rules.GetLSLIntegerItem(idx);
|
||||||
|
LSL_Types.Quaternion iQ;
|
||||||
|
LSL_Types.Vector3 iV;
|
||||||
|
switch (rule)
|
||||||
|
{
|
||||||
|
case (int)ScriptBaseClass.WL_SUN_MOON_POSITION:
|
||||||
|
idx++;
|
||||||
|
wl.sunMoonPosition = (float)rules.GetLSLFloatItem(idx);
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_AMBIENT:
|
||||||
|
idx++;
|
||||||
|
iQ = rules.GetQuaternionItem(idx);
|
||||||
|
wl.ambient = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_BIG_WAVE_DIRECTION:
|
||||||
|
idx++;
|
||||||
|
iV = rules.GetVector3Item(idx);
|
||||||
|
wl.bigWaveDirection = new Vector2((float)iV.x, (float)iV.y);
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_BLUE_DENSITY:
|
||||||
|
idx++;
|
||||||
|
iQ = rules.GetQuaternionItem(idx);
|
||||||
|
wl.blueDensity = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_BLUR_MULTIPLIER:
|
||||||
|
idx++;
|
||||||
|
wl.blurMultiplier = (float)rules.GetLSLFloatItem(idx);
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_CLOUD_COLOR:
|
||||||
|
idx++;
|
||||||
|
iQ = rules.GetQuaternionItem(idx);
|
||||||
|
wl.cloudColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_CLOUD_COVERAGE:
|
||||||
|
idx++;
|
||||||
|
wl.cloudCoverage = (float)rules.GetLSLFloatItem(idx);
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_CLOUD_DETAIL_XY_DENSITY:
|
||||||
|
idx++;
|
||||||
|
iV = rules.GetVector3Item(idx);
|
||||||
|
wl.cloudDetailXYDensity = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_CLOUD_SCALE:
|
||||||
|
idx++;
|
||||||
|
wl.cloudScale = (float)rules.GetLSLFloatItem(idx);
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X:
|
||||||
|
idx++;
|
||||||
|
wl.cloudScrollX = (float)rules.GetLSLFloatItem(idx);
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X_LOCK:
|
||||||
|
idx++;
|
||||||
|
wl.cloudScrollXLock = rules.GetLSLIntegerItem(idx).value == 1 ? true : false;
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y:
|
||||||
|
idx++;
|
||||||
|
wl.cloudScrollY = (float)rules.GetLSLFloatItem(idx);
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y_LOCK:
|
||||||
|
idx++;
|
||||||
|
wl.cloudScrollYLock = rules.GetLSLIntegerItem(idx).value == 1 ? true : false;
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_CLOUD_XY_DENSITY:
|
||||||
|
idx++;
|
||||||
|
iV = rules.GetVector3Item(idx);
|
||||||
|
wl.cloudXYDensity = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_DENSITY_MULTIPLIER:
|
||||||
|
idx++;
|
||||||
|
wl.densityMultiplier = (float)rules.GetLSLFloatItem(idx);
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_DISTANCE_MULTIPLIER:
|
||||||
|
idx++;
|
||||||
|
wl.distanceMultiplier = (float)rules.GetLSLFloatItem(idx);
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_DRAW_CLASSIC_CLOUDS:
|
||||||
|
idx++;
|
||||||
|
wl.drawClassicClouds = rules.GetLSLIntegerItem(idx).value == 1 ? true : false;
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_EAST_ANGLE:
|
||||||
|
idx++;
|
||||||
|
wl.eastAngle = (float)rules.GetLSLFloatItem(idx);
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_FRESNEL_OFFSET:
|
||||||
|
idx++;
|
||||||
|
wl.fresnelOffset = (float)rules.GetLSLFloatItem(idx);
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_FRESNEL_SCALE:
|
||||||
|
idx++;
|
||||||
|
wl.fresnelScale = (float)rules.GetLSLFloatItem(idx);
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_HAZE_DENSITY:
|
||||||
|
idx++;
|
||||||
|
wl.hazeDensity = (float)rules.GetLSLFloatItem(idx);
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_HAZE_HORIZON:
|
||||||
|
idx++;
|
||||||
|
wl.hazeHorizon = (float)rules.GetLSLFloatItem(idx);
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_HORIZON:
|
||||||
|
idx++;
|
||||||
|
iQ = rules.GetQuaternionItem(idx);
|
||||||
|
wl.horizon = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_LITTLE_WAVE_DIRECTION:
|
||||||
|
idx++;
|
||||||
|
iV = rules.GetVector3Item(idx);
|
||||||
|
wl.littleWaveDirection = new Vector2((float)iV.x, (float)iV.y);
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_MAX_ALTITUDE:
|
||||||
|
idx++;
|
||||||
|
wl.maxAltitude = (ushort)rules.GetLSLIntegerItem(idx).value;
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_NORMAL_MAP_TEXTURE:
|
||||||
|
idx++;
|
||||||
|
wl.normalMapTexture = new UUID(rules.GetLSLStringItem(idx).m_string);
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_REFLECTION_WAVELET_SCALE:
|
||||||
|
idx++;
|
||||||
|
iV = rules.GetVector3Item(idx);
|
||||||
|
wl.reflectionWaveletScale = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_REFRACT_SCALE_ABOVE:
|
||||||
|
idx++;
|
||||||
|
wl.refractScaleAbove = (float)rules.GetLSLFloatItem(idx);
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_REFRACT_SCALE_BELOW:
|
||||||
|
idx++;
|
||||||
|
wl.refractScaleBelow = (float)rules.GetLSLFloatItem(idx);
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_SCENE_GAMMA:
|
||||||
|
idx++;
|
||||||
|
wl.sceneGamma = (float)rules.GetLSLFloatItem(idx);
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_STAR_BRIGHTNESS:
|
||||||
|
idx++;
|
||||||
|
wl.starBrightness = (float)rules.GetLSLFloatItem(idx);
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_SUN_GLOW_FOCUS:
|
||||||
|
idx++;
|
||||||
|
wl.sunGlowFocus = (float)rules.GetLSLFloatItem(idx);
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_SUN_GLOW_SIZE:
|
||||||
|
idx++;
|
||||||
|
wl.sunGlowSize = (float)rules.GetLSLFloatItem(idx);
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_SUN_MOON_COLOR:
|
||||||
|
idx++;
|
||||||
|
iQ = rules.GetQuaternionItem(idx);
|
||||||
|
wl.sunMoonColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_UNDERWATER_FOG_MODIFIER:
|
||||||
|
idx++;
|
||||||
|
wl.underwaterFogModifier = (float)rules.GetLSLFloatItem(idx);
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_WATER_COLOR:
|
||||||
|
idx++;
|
||||||
|
iV = rules.GetVector3Item(idx);
|
||||||
|
wl.waterColor = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
|
||||||
|
break;
|
||||||
|
case (int)ScriptBaseClass.WL_WATER_FOG_DENSITY_EXPONENT:
|
||||||
|
idx++;
|
||||||
|
wl.waterFogDensityExponent = (float)rules.GetLSLFloatItem(idx);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
idx++;
|
||||||
|
}
|
||||||
|
return wl;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Set the current Windlight scene
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="rules"></param>
|
||||||
|
/// <returns>success: true or false</returns>
|
||||||
|
public int lsSetWindlightScene(LSL_List rules)
|
||||||
|
{
|
||||||
|
if (!m_LSFunctionsEnabled)
|
||||||
|
{
|
||||||
|
LSShoutError("LightShare functions are not enabled.");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200)
|
||||||
|
{
|
||||||
|
LSShoutError("lsSetWindlightScene can only be used by estate managers or owners.");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
int success = 0;
|
||||||
|
m_host.AddScriptLPS(1);
|
||||||
|
if (LightShareModule.EnableWindlight)
|
||||||
|
{
|
||||||
|
RegionLightShareData wl = getWindlightProfileFromRules(rules);
|
||||||
|
m_host.ParentGroup.Scene.StoreWindlightProfile(wl);
|
||||||
|
success = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LSShoutError("Windlight module is disabled");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Set the current Windlight scene to a target avatar
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="rules"></param>
|
||||||
|
/// <returns>success: true or false</returns>
|
||||||
|
public int lsSetWindlightSceneTargeted(LSL_List rules, LSL_Key target)
|
||||||
|
{
|
||||||
|
if (!m_LSFunctionsEnabled)
|
||||||
|
{
|
||||||
|
LSShoutError("LightShare functions are not enabled.");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200)
|
||||||
|
{
|
||||||
|
LSShoutError("lsSetWindlightSceneTargeted can only be used by estate managers or owners.");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
int success = 0;
|
||||||
|
m_host.AddScriptLPS(1);
|
||||||
|
if (LightShareModule.EnableWindlight)
|
||||||
|
{
|
||||||
|
RegionLightShareData wl = getWindlightProfileFromRules(rules);
|
||||||
|
World.EventManager.TriggerOnSendNewWindlightProfileTargeted(wl, new UUID(target.m_string));
|
||||||
|
success = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LSShoutError("Windlight module is disabled");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
>>>>>>> master:OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
|
||||||
|
|
|
@ -209,6 +209,8 @@ namespace OpenSim.Region.ScriptEngine.Shared
|
||||||
else
|
else
|
||||||
Type = 0x02; // Passive
|
Type = 0x02; // Passive
|
||||||
|
|
||||||
|
lock (part.ParentGroup.Children)
|
||||||
|
{
|
||||||
foreach (SceneObjectPart p in part.ParentGroup.Children.Values)
|
foreach (SceneObjectPart p in part.ParentGroup.Children.Values)
|
||||||
{
|
{
|
||||||
if (p.Inventory.ContainsScripts())
|
if (p.Inventory.ContainsScripts())
|
||||||
|
@ -217,6 +219,7 @@ namespace OpenSim.Region.ScriptEngine.Shared
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Position = new LSL_Types.Vector3(part.AbsolutePosition.X,
|
Position = new LSL_Types.Vector3(part.AbsolutePosition.X,
|
||||||
part.AbsolutePosition.Y,
|
part.AbsolutePosition.Y,
|
||||||
|
|
Loading…
Reference in New Issue