Feature Proposals/Dynamic Attributes in Scene Objects

From OpenSimulator

Revision as of 02:58, 22 January 2013 by Orenh (Talk | contribs)

Jump to: navigation, search

Contents

Date

Jan. 2, 2013

Status (draft, in progress, done or abandoned)

Patch submitted.

Proposers

Originally implemented by JustinCC in 2010.

Being revived by Oren Hurvitz.

Introduction

This is a proposal to add a way of attaching arbitrary data to any Scene Object. The feature has actually already been implemented by JustinCC, but it was never pushed to the master branch. I would like to move this feature into master, and fill in any missing functionality (e.g., serialization).

Proposal

Here's Justin's original message about this feature (from http://lists.berlios.de/pipermail/opensim-dev/2010-August/009166.html):


Hi folks. As I mentioned last week, I have now pushed a dynamic-attributes branch to the Git repository. This is work that I was experimenting with while doing media-on-a-prim.

Essentially, this allows region modules to store and retrieve data on SceneObjectParts and PrimitiveBaseShapes without adding new attributes to those core classes.

Both SOP and PBS have an OSDMap property (which for various reasons is wrappered by OpenSim.Framework.DAMap). Modules can insert any class derived from libopenmetaverse's OSD class in this map (this includes OSDMap, OSDString, OSDInteger, etc. See the StructuredData.cs file in libopenmetavere's OpenMetaverse.StructuredData/ directory for more details.

Persistence is achieved by [de]serializing this map to xml and storing it in a DynAttrs column in the database. Persistence is implemented for sqlite, mysql and mssql.

There is a small region module in OpenSim.Region.CoreModules/Framework/DynamicAttributes/DAExampleModule.cs that demonstrates this. Every time an object is moved in the scene, it adds 1 to SOP.DynamicAttributes["moves"] and tells all users in the region how many times the object has moved. If the server is restarted, the number of moves is restored on restart.

It didn't take much code to achieve this. However, as discussed previously, there is some awkardness in using OSD in this way. Any feedback on this or other aspects of dynamic attributes is appreciated.

This branch is a 'technology preview' at most and should not be relied upon in production in any way whatsoever.

General
About This Wiki