Objects: Difference between revisions

From OpenMW Wiki
Jump to navigation Jump to search
(Created page with "The mutable part of the world model is made up from objects (called references in the original MW terminology). An object can either be located in a cell or in a container (which...")
 
Line 6: Line 6:


==OGRE handle==
==OGRE handle==
Once an object enters an active cell, a OGRE handle is assigned to it and stored in the LiveCellRef. Through the OGRE handle the object can be unambiguously identified. The OGRE handle becomes invalid when the object leaves the active cells or the cell it is in becomes inactive.
Note that objects in containers don't get OGRE handles.


==Unified Object Access==
==Unified Object Access==

Revision as of 10:47, 11 August 2011

The mutable part of the world model is made up from objects (called references in the original MW terminology). An object can either be located in a cell or in a container (which is also located in a cell).

Each cell and each container keeps a separate list for each record type that can be referenced. Each list is made up from a sequence of ESMS::LiveCellRef objects (specialized for the respective record type). Please note that the LiveCellRef only contains the persistent state plus an OGRE handle. State only valid while the object is in an active cell is stored elsewhere.

There is no polymorphism used here, which is a design flaw that originated at a very early development stage and could not be fixed anymore without a total rewrite, once everyone agreed that it was a flaw. Various workarounds are in place now.

OGRE handle

Once an object enters an active cell, a OGRE handle is assigned to it and stored in the LiveCellRef. Through the OGRE handle the object can be unambiguously identified. The OGRE handle becomes invalid when the object leaves the active cells or the cell it is in becomes inactive.

Note that objects in containers don't get OGRE handles.

Unified Object Access

Unified access to objects is possible through the MWWorld::Ptr class. There are several ways to obtain a Ptr:

  • directly from an object in a cell or a container
  • via the record ID (all referencable records have string IDs), if there is only on object of this record
  • via the OGRE handle, while the object is in an active cell.

Player