Difference between revisions of "Object Element"

1,344 bytes added ,  13:16, 21 December 2023
no edit summary
imported>JRoush
Tag: Manual revert
 
(20 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== Introduction ==
== Overview ==
=== What is XML? ===
Object Elements are a subgroup of the elements in the [[:Category: Oblivion XML|Oblivion XML]] schemaEvery visible part of a menu - the background and images, the buttons, the text - is an object element.
XML stands for [http://en.wikipedia.org/wiki/XML eXtensible Markup Language], a generic syntax used to encode data in a series of parent-child relationshipsAn XML document contains a hierarchical list of ''elements'', each of which is described by a set of ''traits''.  In Oblivion, XML is used to encode various customizable properties of the user interface.  Every button, box, piece of text, and colorful widget in a menu (or the HUD) is an element in that menu's XML file, where it is described by traits such as position, color, and graphical texture.


=== General Syntax ===
Object Elements are usually given a name to identify them using the [[XML Attribute|Name]] attribute, e.g. the image element that holds a menu's background texture might be:
XML markup syntax is largely based on HTML. An XML element is defined by an pair of opening and closing ''tags'' - matching angle brackets "<>" enclosing the type of the element. For example, the following xml code defines a text element:
  <image name="background_texture"> </image>
<text> </text>
[[Operator Element|Operator Elements]] and [[:Category:UI Functions (OBSE)|OBSE menu functions]] generally refer to Objects by their name.
Note that the closing tag is denoted by slash.  Anything in between an element's tags is considered to be a child of that element.  For example, the following defines an image element which has a child text element:
  <image> <text> </text> </image>
If an element has no children, like the first example above, then the opening/closing tag syntax can be abbreviated to:
<text />
Element traits are written as name/value pairs in the opening tag:
<image traitname="traitvalue"> </image>
Comments can be added to the code by enclosing them with "&lt;!--"  and "--&gt;":
&lt;!-- this is a comment --&gt;
To learn more about XML syntax, read the [http://www.w3.org/XML/ complete specification] or one of the tutorials provided by the World Wide Web Consortium.


== Oblivion XML Schema ==
Object Elements should not contain literal text or numbers.  Instead, they should have a series of [[Property Element]]s as children, which in turn will contain the various parameters that describe the object.  For example, the <text> element that holds the title of a menu might be defined like this:
=== Traits ===
<text name="title_text">  &lt;!-- [[#Text|Text]] element, [[XML Attribute|Name]] attribute is 'title_text' --&gt;
   
  <x> 100 </x>  &lt;!-- position determined by <[[Property Element#Sizeable|x]]> & <[[Property Element#Sizeable|y]]> Property elements --&gt;
=== Elements ===
  <y> 150 </y> 
  &lt;font> 2 &lt;/font>  &lt;!-- text font determined by <[[Property Element#Text|font]]> Property element--&gt;
  <string>      &lt;!-- actual text determined by <[[Property Element#Text|string]]> Property element --&gt;
    This is the Actual Title
  </string>   
</text>
 
Below is a listing of common Object Elements, and the groups of Properties each can make use of.
 
== Image ==
Defines a rectangular region with an associated [[Portal:Texturing|texture]].  Every visible aspect of the menus and HUD, except for text, is an <image> element.
 
'''Property Elements'''
*[[Property Element#General|General]]
*[[Property Element#Sizeable|Sizeable]]
*[[Property Element#Rendered|Rendered]]
*[[Property Element#Mouse Targetable|Mouse Targetable]]
*[[Property Element#Textured|Textured]]
 
== Rect ==
Defines a rectangular region (similar to an Image element), but without any visible effects. Even so, a <Rect> element may have a [[Property Element#Rendered|Visible]] property, which if set to false will hide the <Rect> element and all of its children.
 
'''Property Elements'''
*[[Property Element#General|General]]
*[[Property Element#Sizeable|Sizeable]]
*[[Property Element#Mouse Targetable|Mouse Targetable]]
 
== Text ==
Self explanatory.  Note, however, that the width and height property elements have no effect on the size of the text - this is determined solely by the font property.
 
'''Property Elements'''
*[[Property Element#General|General]]
*[[Property Element#Sizeable|Sizeable]]
*[[Property Element#Rendered|Rendered]]
*[[Property Element#Text|Text]]
 
== Menu ==
Menu elements are a bit special.  The root element of a every menu file must be of this type, and no other <menu> elements are parsed, no matter where they appear in the file.
 
'''Property Elements'''
*[[Property Element#General|General]]
*[[Property Element#Menu|Menu]]
 
[[Category:Oblivion XML]]
Anonymous user