<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://osimdev.org/wiki/index.php?action=history&amp;feed=atom&amp;title=OpenSimulator_Internals%2FWalkthroughs%2FAvatar_Derezzes_Object</id>
	<title>OpenSimulator Internals/Walkthroughs/Avatar Derezzes Object - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://osimdev.org/wiki/index.php?action=history&amp;feed=atom&amp;title=OpenSimulator_Internals%2FWalkthroughs%2FAvatar_Derezzes_Object"/>
	<link rel="alternate" type="text/html" href="http://osimdev.org/wiki/index.php?title=OpenSimulator_Internals/Walkthroughs/Avatar_Derezzes_Object&amp;action=history"/>
	<updated>2026-08-04T15:36:57Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.3</generator>
	<entry>
		<id>http://osimdev.org/wiki/index.php?title=OpenSimulator_Internals/Walkthroughs/Avatar_Derezzes_Object&amp;diff=104&amp;oldid=prev</id>
		<title>Jwbshaw: first</title>
		<link rel="alternate" type="text/html" href="http://osimdev.org/wiki/index.php?title=OpenSimulator_Internals/Walkthroughs/Avatar_Derezzes_Object&amp;diff=104&amp;oldid=prev"/>
		<updated>2026-07-07T22:40:07Z</updated>

		<summary type="html">&lt;p&gt;first&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= OpenSimulator Internals/Walkthroughs/Avatar Derezzes Object =&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
Traces what happens in code, connectors, and database when an avatar takes an object from the world into inventory (derez), or deletes it. Uses the box-with-notecard from [[OpenSimulator Internals/Walkthroughs/Avatar Rezzes Box]] as the concrete example.&lt;br /&gt;
&lt;br /&gt;
This is a concrete instance of [[OpenSimulator Internals/Walkthroughs/Avatar Acquires Inventory]]. Read that page for the full code path.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Case 1: Take (own object, no-copy) ==&lt;br /&gt;
&lt;br /&gt;
Avatar right-clicks the box and selects Take.&lt;br /&gt;
&lt;br /&gt;
=== 1. Viewer Sends DeRezObject ===&lt;br /&gt;
&lt;br /&gt;
# Viewer sends DeRezObject packet with action=Take, objectLocalID=box local ID.&lt;br /&gt;
# Scene.DeRezObjects() validates permissions (CanTakeObject).&lt;br /&gt;
# Calls IInventoryAccessModule.CopyToInventory(DeRezAction.Take, folderID, [boxSOG], client, false).&lt;br /&gt;
&lt;br /&gt;
=== 2. Object Serialised ===&lt;br /&gt;
&lt;br /&gt;
BasicInventoryAccessModule.CopyBundleToInventory():&lt;br /&gt;
# Serialises box SOG to XML: SceneObjectSerializer.ToOriginalXmlFormat().&lt;br /&gt;
#* XML includes: prim data, shape, permissions, position, rotation, task inventory (the notecard reference is embedded in the XML as a primitems-equivalent block).&lt;br /&gt;
# Creates asset: AssetService.Store() -- new UUID, AssetType.Object, data = XML bytes.&lt;br /&gt;
# CreateItemForObject(Take): determines folder (original FromFolderID if owner taking back own item).&lt;br /&gt;
# AddPermissions(): same-owner path, preserves current permissions.&lt;br /&gt;
# Scene.AddInventoryItem(): InventoryService.AddItem() -- writes inventoryitems row.&lt;br /&gt;
# Sends SendInventoryItemCreateUpdate() to client.&lt;br /&gt;
&lt;br /&gt;
; DB writes:&lt;br /&gt;
* assets -- INSERT: new object XML asset UUID&lt;br /&gt;
* inventoryitems -- INSERT: new item in Object folder (or original folder)&lt;br /&gt;
&lt;br /&gt;
=== 3. Object Removed from Scene ===&lt;br /&gt;
&lt;br /&gt;
DoPostRezWhenFromItem():&lt;br /&gt;
* Box was no-copy: InventoryService.DeleteItems() -- removes original inventoryitems row.&lt;br /&gt;
&lt;br /&gt;
Scene.DeleteSceneObject(boxSOG, false):&lt;br /&gt;
* RemoveScriptInstances() -- no-op (no scripts).&lt;br /&gt;
* Removes physics actor.&lt;br /&gt;
* UnlinkSceneObject() -- removes from scene graph.&lt;br /&gt;
* SimulationDataService.RemoveObject(boxUUID, regionID).&lt;br /&gt;
&lt;br /&gt;
; DB writes:&lt;br /&gt;
* inventoryitems -- DELETE: original no-copy item&lt;br /&gt;
* prims -- DELETE: box prim row&lt;br /&gt;
* primshapes -- DELETE: box shape row&lt;br /&gt;
* primitems -- DELETE: notecard task inventory row&lt;br /&gt;
&lt;br /&gt;
=== 4. DB State After ===&lt;br /&gt;
&lt;br /&gt;
Region database:&lt;br /&gt;
* prims: box row gone.&lt;br /&gt;
* primshapes: box shape row gone.&lt;br /&gt;
* primitems: notecard task inventory row gone.&lt;br /&gt;
&lt;br /&gt;
Robust database:&lt;br /&gt;
* assets: new object XML asset (contains the notecard reference inside the serialised XML).&lt;br /&gt;
* inventoryitems: new item pointing to the new asset UUID.&lt;br /&gt;
* The notecard asset itself remains in assets table -- assets are never deleted on take.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Case 2: Take Copy (copyable object) ==&lt;br /&gt;
&lt;br /&gt;
Avatar right-clicks and selects Take Copy.&lt;br /&gt;
&lt;br /&gt;
Same serialise-and-store process as above, but:&lt;br /&gt;
* DoPostRezWhenFromItem() does NOT delete the original inventory item (item has Copy permission).&lt;br /&gt;
* Scene.DeRezObjects() does NOT call DeleteSceneObject() -- object stays in world.&lt;br /&gt;
&lt;br /&gt;
; DB writes:&lt;br /&gt;
* assets -- INSERT: new object XML asset&lt;br /&gt;
* inventoryitems -- INSERT: new item in Object folder&lt;br /&gt;
&lt;br /&gt;
Region DB unchanged. The box stays in the world.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Case 3: Delete (move to Trash) ==&lt;br /&gt;
&lt;br /&gt;
Avatar right-clicks and selects Delete.&lt;br /&gt;
&lt;br /&gt;
Calls CopyToInventory(DeRezAction.Delete):&lt;br /&gt;
* Destination folder: Trash (FolderType.Trash) if own object, Lost and Found if another&amp;#039;s.&lt;br /&gt;
* Same serialise-and-store process.&lt;br /&gt;
* Scene.DeleteSceneObject() removes from scene and region DB.&lt;br /&gt;
&lt;br /&gt;
; DB writes:&lt;br /&gt;
* assets -- INSERT: serialised object XML&lt;br /&gt;
* inventoryitems -- INSERT: item in Trash&lt;br /&gt;
* prims/primshapes/primitems -- DELETE&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Key DB Tables Affected ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Table !! Take (no-copy) !! Take Copy !! Delete&lt;br /&gt;
|-&lt;br /&gt;
| assets || INSERT (new) || INSERT (new) || INSERT (new)&lt;br /&gt;
|-&lt;br /&gt;
| inventoryitems || INSERT new + DELETE old || INSERT new only || INSERT (Trash)&lt;br /&gt;
|-&lt;br /&gt;
| prims || DELETE || unchanged || DELETE&lt;br /&gt;
|-&lt;br /&gt;
| primshapes || DELETE || unchanged || DELETE&lt;br /&gt;
|-&lt;br /&gt;
| primitems || DELETE || unchanged || DELETE&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note: asset rows are never deleted from the assets table by any of these operations. Assets accumulate. Cleanup is a separate administrative operation outside normal simulator operation.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== What Happens to the Notecard Inside ==&lt;br /&gt;
&lt;br /&gt;
The notecard was task inventory of the box (a primitems row). When the box is taken or deleted:&lt;br /&gt;
&lt;br /&gt;
* The primitems row is deleted from the region DB.&lt;br /&gt;
* The notecard asset (text content) remains in the assets table -- it is referenced by assetID in the serialised object XML.&lt;br /&gt;
* When the box is later rezzed from inventory, the XML is deserialised and the notecard reappears as task inventory -- it is re-fetched from assets by assetID.&lt;br /&gt;
&lt;br /&gt;
The notecard is not duplicated into the avatar&amp;#039;s personal inventory (inventoryitems). It stays embedded in the object asset.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[OpenSimulator Internals/Walkthroughs]]&lt;br /&gt;
* [[OpenSimulator Internals/Walkthroughs/Avatar Acquires Inventory]]&lt;br /&gt;
* [[OpenSimulator Internals/Walkthroughs/Avatar Rezzes Box]]&lt;br /&gt;
* [[OpenSimulator Internals/Walkthroughs/Avatar Rezzes Inventory]]&lt;br /&gt;
* [[OpenSimulator Internals/Walkthroughs/Garbage Collection]]&lt;br /&gt;
* [[OpenSimulator Internals/Code Map/InventoryAccessModule]]&lt;br /&gt;
* [[OpenSimulator Internals/Databases]]&lt;/div&gt;</summary>
		<author><name>Jwbshaw</name></author>
	</entry>
</feed>