Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Open Simulator Technical Help
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
OpenSimulator Internals/Walkthroughs/Avatar Derezzes Object
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
= OpenSimulator Internals/Walkthroughs/Avatar Derezzes Object = == Overview == 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. This is a concrete instance of [[OpenSimulator Internals/Walkthroughs/Avatar Acquires Inventory]]. Read that page for the full code path. ---- == Case 1: Take (own object, no-copy) == Avatar right-clicks the box and selects Take. === 1. Viewer Sends DeRezObject === # Viewer sends DeRezObject packet with action=Take, objectLocalID=box local ID. # Scene.DeRezObjects() validates permissions (CanTakeObject). # Calls IInventoryAccessModule.CopyToInventory(DeRezAction.Take, folderID, [boxSOG], client, false). === 2. Object Serialised === BasicInventoryAccessModule.CopyBundleToInventory(): # Serialises box SOG to XML: SceneObjectSerializer.ToOriginalXmlFormat(). #* XML includes: prim data, shape, permissions, position, rotation, task inventory (the notecard reference is embedded in the XML as a primitems-equivalent block). # Creates asset: AssetService.Store() -- new UUID, AssetType.Object, data = XML bytes. # CreateItemForObject(Take): determines folder (original FromFolderID if owner taking back own item). # AddPermissions(): same-owner path, preserves current permissions. # Scene.AddInventoryItem(): InventoryService.AddItem() -- writes inventoryitems row. # Sends SendInventoryItemCreateUpdate() to client. ; DB writes: * assets -- INSERT: new object XML asset UUID * inventoryitems -- INSERT: new item in Object folder (or original folder) === 3. Object Removed from Scene === DoPostRezWhenFromItem(): * Box was no-copy: InventoryService.DeleteItems() -- removes original inventoryitems row. Scene.DeleteSceneObject(boxSOG, false): * RemoveScriptInstances() -- no-op (no scripts). * Removes physics actor. * UnlinkSceneObject() -- removes from scene graph. * SimulationDataService.RemoveObject(boxUUID, regionID). ; DB writes: * inventoryitems -- DELETE: original no-copy item * prims -- DELETE: box prim row * primshapes -- DELETE: box shape row * primitems -- DELETE: notecard task inventory row === 4. DB State After === Region database: * prims: box row gone. * primshapes: box shape row gone. * primitems: notecard task inventory row gone. Robust database: * assets: new object XML asset (contains the notecard reference inside the serialised XML). * inventoryitems: new item pointing to the new asset UUID. * The notecard asset itself remains in assets table -- assets are never deleted on take. ---- == Case 2: Take Copy (copyable object) == Avatar right-clicks and selects Take Copy. Same serialise-and-store process as above, but: * DoPostRezWhenFromItem() does NOT delete the original inventory item (item has Copy permission). * Scene.DeRezObjects() does NOT call DeleteSceneObject() -- object stays in world. ; DB writes: * assets -- INSERT: new object XML asset * inventoryitems -- INSERT: new item in Object folder Region DB unchanged. The box stays in the world. ---- == Case 3: Delete (move to Trash) == Avatar right-clicks and selects Delete. Calls CopyToInventory(DeRezAction.Delete): * Destination folder: Trash (FolderType.Trash) if own object, Lost and Found if another's. * Same serialise-and-store process. * Scene.DeleteSceneObject() removes from scene and region DB. ; DB writes: * assets -- INSERT: serialised object XML * inventoryitems -- INSERT: item in Trash * prims/primshapes/primitems -- DELETE ---- == Key DB Tables Affected == {| class="wikitable" ! Table !! Take (no-copy) !! Take Copy !! Delete |- | assets || INSERT (new) || INSERT (new) || INSERT (new) |- | inventoryitems || INSERT new + DELETE old || INSERT new only || INSERT (Trash) |- | prims || DELETE || unchanged || DELETE |- | primshapes || DELETE || unchanged || DELETE |- | primitems || DELETE || unchanged || DELETE |} 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. ---- == What Happens to the Notecard Inside == The notecard was task inventory of the box (a primitems row). When the box is taken or deleted: * The primitems row is deleted from the region DB. * The notecard asset (text content) remains in the assets table -- it is referenced by assetID in the serialised object XML. * 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. The notecard is not duplicated into the avatar's personal inventory (inventoryitems). It stays embedded in the object asset. ---- == See Also == * [[OpenSimulator Internals/Walkthroughs]] * [[OpenSimulator Internals/Walkthroughs/Avatar Acquires Inventory]] * [[OpenSimulator Internals/Walkthroughs/Avatar Rezzes Box]] * [[OpenSimulator Internals/Walkthroughs/Avatar Rezzes Inventory]] * [[OpenSimulator Internals/Walkthroughs/Garbage Collection]] * [[OpenSimulator Internals/Code Map/InventoryAccessModule]] * [[OpenSimulator Internals/Databases]]
Summary:
Please note that all contributions to Open Simulator Technical Help may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Open Simulator Technical Help:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
OpenSimulator Internals/Walkthroughs/Avatar Derezzes Object
Add topic