Objects

From OpenMW Wiki
Revision as of 10:44, 11 August 2011 by Zini (talk | contribs) (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...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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

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