When TaskInventory value is synced across, each receiver will also call
Inventory.ForceInventoryPersistence, so that PSA will see HasInventoryChanged set to true and do proper persistence backup. Also, added ScheduleSyncUpdate in UpdateInventoryItem, so that the new TaskInventory item will be propagated to all actors.dsg
parent
d28c857232
commit
7c542be833
|
@ -4603,6 +4603,14 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
//UpdateSOPProperty(part, m_propertiesSyncInfo[property]);
|
//UpdateSOPProperty(part, m_propertiesSyncInfo[property]);
|
||||||
SetSOPPropertyValue(part, property);
|
SetSOPPropertyValue(part, property);
|
||||||
propertiesUpdated.Add(property);
|
propertiesUpdated.Add(property);
|
||||||
|
|
||||||
|
if (property == SceneObjectPartSyncProperties.TaskInventory)
|
||||||
|
{
|
||||||
|
//Mark the inventory as has changed, for proper backup
|
||||||
|
part.Inventory.ForceInventoryPersistence();
|
||||||
|
}
|
||||||
|
|
||||||
|
part.ParentGroup.HasGroupChanged = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
|
|
@ -233,5 +233,8 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
/// A <see cref="Dictionary`2"/>
|
/// A <see cref="Dictionary`2"/>
|
||||||
/// </returns>
|
/// </returns>
|
||||||
Dictionary<UUID, string> GetScriptStates();
|
Dictionary<UUID, string> GetScriptStates();
|
||||||
|
|
||||||
|
//DSG
|
||||||
|
bool UpdateInventoryItemBySync(TaskInventoryItem item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -327,7 +327,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
//Scene does permission checking, asset creation and storing, then informs Script Engine to
|
//Scene does permission checking, asset creation and storing, then informs Script Engine to
|
||||||
//update the script.
|
//update the script.
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//Only should be called when this is the cached Scene of script engine
|
//Only should be called when this is the local Scene of script engine
|
||||||
public ArrayList OnUpdateScript(UUID avatarID, UUID itemID, UUID primID, bool isScriptRunning, UUID newAssetID)
|
public ArrayList OnUpdateScript(UUID avatarID, UUID itemID, UUID primID, bool isScriptRunning, UUID newAssetID)
|
||||||
{
|
{
|
||||||
ArrayList errors = new ArrayList();
|
ArrayList errors = new ArrayList();
|
||||||
|
@ -353,7 +353,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
// Update item with new asset
|
// Update item with new asset
|
||||||
item.AssetID = newAssetID;
|
item.AssetID = newAssetID;
|
||||||
group.UpdateInventoryItem(item);
|
group.UpdateInventoryItemBySync(item);
|
||||||
m_log.Debug("UpdateInventoryItem on object "+group.UUID);
|
m_log.Debug("UpdateInventoryItem on object "+group.UUID);
|
||||||
|
|
||||||
if (isScriptRunning)
|
if (isScriptRunning)
|
||||||
|
@ -419,9 +419,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return new ArrayList();
|
return new ArrayList();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update item with new asset
|
// Update item with new asset.
|
||||||
|
// The actor that initiate the UpdateScript event should also send out
|
||||||
|
// a sync message for the updated task inventory. In case that sync message is
|
||||||
|
// not here year, we retrieve and update the task item -- w/o marking that
|
||||||
|
// the taskinventory is modified here, so that when the sync message is here,
|
||||||
|
// the actor and timestamp info will be copied.
|
||||||
item.AssetID = newAssetID;
|
item.AssetID = newAssetID;
|
||||||
group.UpdateInventoryItem(item);
|
group.UpdateInventoryItemBySync(item);
|
||||||
m_log.Debug("UpdateInventoryItem on object "+group.UUID);
|
m_log.Debug("UpdateInventoryItem on object "+group.UUID);
|
||||||
|
|
||||||
if (isScriptRunning)
|
if (isScriptRunning)
|
||||||
|
|
|
@ -398,5 +398,33 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
parts[i].Inventory.SuspendScripts();
|
parts[i].Inventory.SuspendScripts();
|
||||||
}
|
}
|
||||||
#endregion REGION SYNC
|
#endregion REGION SYNC
|
||||||
|
|
||||||
|
#region DSG SYNC
|
||||||
|
/// <summary>
|
||||||
|
/// Update an existing inventory item.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="item">The updated item. An item with the same id must already exist
|
||||||
|
/// in this prim's inventory</param>
|
||||||
|
/// <returns>false if the item did not exist, true if the update occurred succesfully</returns>
|
||||||
|
public bool UpdateInventoryItemBySync(TaskInventoryItem item)
|
||||||
|
{
|
||||||
|
SceneObjectPart part = GetChildPart(item.ParentPartID);
|
||||||
|
if (part != null)
|
||||||
|
{
|
||||||
|
part.Inventory.UpdateInventoryItemBySync(item);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat(
|
||||||
|
"[PRIM INVENTORY]: " +
|
||||||
|
"Couldn't find prim ID {0} to update item {1}, {2}",
|
||||||
|
item.ParentPartID, item.Name, item.ItemID);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -727,6 +727,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
HasInventoryChanged = true;
|
HasInventoryChanged = true;
|
||||||
m_part.ParentGroup.HasGroupChanged = true;
|
m_part.ParentGroup.HasGroupChanged = true;
|
||||||
|
|
||||||
|
//DSG
|
||||||
|
m_part.ScheduleSyncUpdate(new List<SceneObjectPartSyncProperties>(){SceneObjectPartSyncProperties.TaskInventory});
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1182,6 +1185,68 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion REGION SYNC
|
#endregion REGION SYNC
|
||||||
|
|
||||||
|
#region DSG SYNC
|
||||||
|
/// <summary>
|
||||||
|
/// Update an existing inventory item.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="item">The updated item. An item with the same id must already exist
|
||||||
|
/// in this prim's inventory.</param>
|
||||||
|
/// <returns>false if the item did not exist, true if the update occurred successfully</returns>
|
||||||
|
public bool UpdateInventoryItemBySync(TaskInventoryItem item)
|
||||||
|
{
|
||||||
|
return UpdateInventoryItemBySync(item, true, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Similar to UpdateInventoryItem except that ScheduleSyncUpdate is not triggered
|
||||||
|
private bool UpdateInventoryItemBySync(TaskInventoryItem item, bool fireScriptEvents, bool considerChanged)
|
||||||
|
{
|
||||||
|
TaskInventoryItem it = GetInventoryItem(item.ItemID);
|
||||||
|
if (it != null)
|
||||||
|
{
|
||||||
|
// m_log.DebugFormat("[PRIM INVENTORY]: Updating item {0} in {1}", item.Name, m_part.Name);
|
||||||
|
|
||||||
|
item.ParentID = m_part.UUID;
|
||||||
|
item.ParentPartID = m_part.UUID;
|
||||||
|
|
||||||
|
// If group permissions have been set on, check that the groupID is up to date in case it has
|
||||||
|
// changed since permissions were last set.
|
||||||
|
if (item.GroupPermissions != (uint)PermissionMask.None)
|
||||||
|
item.GroupID = m_part.GroupID;
|
||||||
|
|
||||||
|
if (item.AssetID == UUID.Zero)
|
||||||
|
item.AssetID = it.AssetID;
|
||||||
|
|
||||||
|
lock (m_items)
|
||||||
|
{
|
||||||
|
m_items[item.ItemID] = item;
|
||||||
|
m_inventorySerial++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fireScriptEvents)
|
||||||
|
m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
|
||||||
|
|
||||||
|
if (considerChanged)
|
||||||
|
{
|
||||||
|
HasInventoryChanged = true;
|
||||||
|
m_part.ParentGroup.HasGroupChanged = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat(
|
||||||
|
"[PRIM INVENTORY]: " +
|
||||||
|
"Tried to retrieve item ID {0} from prim {1}, {2} at {3} in {4} but the item does not exist in this inventory",
|
||||||
|
item.ItemID, m_part.Name, m_part.UUID,
|
||||||
|
m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion DSG SYNC
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue