Difference between revisions of "Property Element"

1,874 bytes added ,  13:16, 21 December 2023
no edit summary
imported>JRoush
Tag: Manual revert
 
(17 intermediate revisions by 4 users not shown)
Line 1: Line 1:
Property Elements are a subgroup of the elements in the [[:Category: Oblivion XML|Oblivion XML]] schema, always found as children of [[Object Element]]s.  They define the properties of their parent element - position on the screen, color, texture, etc.  In this sense they are similar to traditional xml [[traits]].   
== Overview ==
 
Property Elements are a subgroup of the elements in the [[:Category: Oblivion XML|Oblivion XML]] schema, always found as children of [[Object Element]]s.  They define the properties of their parent element - position on the screen, color, texture, etc.  In this sense they are similar to traditional xml [http://www.w3schools.com/xml/xml_attributes.asp attributes].
 
A '''Note''' on the name - Bethesda apparently referred to these elements as "Traits" internally.  Likewise, they are called "traits" in the OBSE documentation and several script functions.  This makes sense given their purpose - in XML "trait" is often used synonymously with "attribute".  However, strictly speaking the subjects of this article are ''elements''For the purposes of this wiki, the name "Property Element" was chosen to be clear and unambiguous.   


There are two basic data types for properties - numeric and string.  A number of Oblivion-specific XML entities are defined for commonly used constants of both types.  Particularly useful are the numeric entities "&true;" (numeric value 2) and "&false;" (1), used to with boolean properties like Visible or Targetable.
There are two basic data types for properties - numeric and string.  A number of Oblivion-specific XML entities are defined for commonly used constants of both types.  Particularly useful are the numeric entities "&true;" (numeric value 2) and "&false;" (1), used to with boolean properties like Visible or Targetable.


Property elements may contain literal values, or a "formula" expressed as a set of [[Operator Element]]s (but not both).  The Oblivion parser evaluates each property element every frame to obtain the ''value'' of the property (see the operator element page for a description on how they are evaluated). If an object element contains more than one property element of the same type, the last one defined will take precedence.  If it contains no property elements for an applicable property, the default value is used (usually zero or the empty string).
Property elements may contain literal values.  However, the real power of Oblivion's XML is that properties can instead have "formulas" expressed using [[Operator Element]]s.  
 
If an object element contains more than one property of the same type, the last one defined will take precedence.  If it contains no property elements for an applicable property, the default value is used (usually zero or the empty string).
 
A property (and its operators) is only updated when one of the source properties changes. Either by the engine itself or through scripting. When the property has been updated and the value is different from last time it will continue to update any properties that use it (can be called "derived properties"). This may then repeat itself for each subsequent derived property. A Golden Rule is that nothing gets updated as long as nothing is changed, in that sense there are no 'frames' for the UI.


== General ==
== General ==
Properties which any object element of any type might define.
Properties which any object element of any type might define.
*'''ID''' (Numeric) Specifies which part of the internal menu "class" the element corresponds to, for the purposes of updating and accepting player input.  For example, the game treats whatever element has an ID of 3  in the Recharge menu as the exit button, regardless of the type, name, or any other property of the element - if it can be clicked on, then doing so will close the menu.  Likewise, the element with ID 2 in the Enchantment Settings menu is treated as the effect icon and will have its filename property updated by the game (even if it shouldn't have one).  Valid ID values depend on the menu class, but generally range 1-20.  Giving an element an ID not recognized for that menu will have no effect, while changing an existing ID will prevent the element from updating or accepting input.
*'''ID''' (Numeric) Specifies which part of the internal menu "class" the element corresponds to, for the purposes of updating and accepting player input.  For example, the game treats whatever element has an ID of 3  in the Recharge menu as the exit button, regardless of the type, name, or any other property of the element - if it can be clicked on, then doing so will close the menu.  Likewise, the element with ID 2 in the Enchantment Settings menu is treated as the effect icon and will have its filename property updated by the game (even if it shouldn't have one).  Valid ID values depend on the menu class, but generally range 1-20.  Giving an element an ID not recognized for that menu will have no effect, while changing an existing ID will prevent the element from updating or accepting input.
*'''Childcount''' (Numeric) Set automatically by the engine to the number of children the element has.


*'''User#''' (type flexible) Element types beginning in "user" are not in general part of the Oblivion XML schema.  They may, however, be recognized by specific menu classes and set to specific values.  For example, in most contexts an element of type User4 would be parsed and then ignored.  The internal class of the Spellmaking menu, though, will look for a User4 property element that is a child of the root [[Object Element#Menu|Menu element]], and update its value to the current magicka cost.
*'''User#''' (type flexible) Element types beginning in "user" are not in general part of the Oblivion XML schema.  They may, however, be recognized by specific menu classes and set to specific values.  For example, in most contexts an element of type User4 would be parsed and then ignored.  The internal class of the Spellmaking menu, though, will look for a User4 property element that is a child of the root [[Object Element#Menu|Menu element]], and update its value to the current magicka cost.
Line 15: Line 25:
*'''X,Y''' (Numeric) The coordinates (in pixels) of the upper-left hand corner of an element.  These coordinates can be absolute or relative to the position of the parent element (see Locus).  For text elements, this marks the "root" position (see Justify).
*'''X,Y''' (Numeric) The coordinates (in pixels) of the upper-left hand corner of an element.  These coordinates can be absolute or relative to the position of the parent element (see Locus).  For text elements, this marks the "root" position (see Justify).
*'''Height, Width''' (Numeric) The height and width (in pixels) of the element.  For text elements, the width and height are set by the game engine automatically depending on the font and text contents.
*'''Height, Width''' (Numeric) The height and width (in pixels) of the element.  For text elements, the width and height are set by the game engine automatically depending on the font and text contents.
*'''Locus''' (Numeric: Boolean) If true then the coordinates coordinates of all the element's children are taken relative to the element position.  If false, then the coordinates of all the elements children are taken as absolute, from the upper-left hand corner of the screen.
*'''Locus''' (Numeric: Boolean) If true then the coordinates of all the element's children are taken relative to the element position.  If false, then the coordinates of all the elements children are taken as absolute, from the upper-left hand corner of the screen.


== Rendered ==
== Rendered ==
Line 21: Line 31:
*'''Visible''' (Numeric: Boolean) If true, the element is visible, and if false the element is hidden.  Hiding an element will reveal the elements under it (parents or siblings with lower Depth).  Hidden elements cannot be clicked or moused over, but can still be activated from scripts using OBSE's [[ClickMenuButton]] function.
*'''Visible''' (Numeric: Boolean) If true, the element is visible, and if false the element is hidden.  Hiding an element will reveal the elements under it (parents or siblings with lower Depth).  Hidden elements cannot be clicked or moused over, but can still be activated from scripts using OBSE's [[ClickMenuButton]] function.
*'''Alpha''' (Numeric)  Value between 0 and 255 that determines transparency of element.  An alpha of 255 is normal, but the lower the alpha the the more transparent. At alpha of 0 the element is completely transparent - although it can still respond to mouse clicks, etc.
*'''Alpha''' (Numeric)  Value between 0 and 255 that determines transparency of element.  An alpha of 255 is normal, but the lower the alpha the the more transparent. At alpha of 0 the element is completely transparent - although it can still respond to mouse clicks, etc.
*'''Depth''' (Numeric) Determines precedence for overlapping elements - those with a higher Depth will be drawn on top.  Not that by default, an element always has higher depth than its parent.  
*'''Depth''' (Numeric) Determines precedence for overlapping elements - those with a higher Depth will be drawn on top.  Note that by default, an element always has higher depth than its parent.  
*'''Clips''' (Numeric: Boolean)  ''Purpose Unknown.''
*'''Clips''' (Numeric: Boolean)  If the element's (relative) position is outside of its parent element's dimensions it will be hidden. Only works if the parent element's <clipwindow> property is true.


== Mouse Targetable ==
== Mouse Targetable ==
Line 36: Line 46:
*'''Zoom''' (Numeric) Specifies the zoom percentage of the image. Setting it to 0 will result in a hidden image and can be larger than 100 to magnify the source texture. When using a value of -1 the image will be resized to fit the width and height of the element (and therefore not cropped).
*'''Zoom''' (Numeric) Specifies the zoom percentage of the image. Setting it to 0 will result in a hidden image and can be larger than 100 to magnify the source texture. When using a value of -1 the image will be resized to fit the width and height of the element (and therefore not cropped).
*'''FileWidth, FileHeight''' (Numeric) Set automatically by the game engine to the actual width in pixels of the loaded texture, after zoom has been applied.  For zoom = -1, these values are set to zero.
*'''FileWidth, FileHeight''' (Numeric) Set automatically by the game engine to the actual width in pixels of the loaded texture, after zoom has been applied.  For zoom = -1, these values are set to zero.
*'''CropX,CropY''' (Numeric) Specify the point on the texture, in pixels, that will be placed at the upper left hand corner of the image element.  Because the texture is cropped to fit inside the image element, this essentially cuts CropX pixels off of the left of the image and CropY off of the bottom.  '''Note:'''  CropX/CropY are calculated ''after'' the zoom property has been applied, so the point (5,10) in the original image would be (10,20) after a 200% zoom.
*'''Tile''' (Numeric: Boolean)  If the width or height of the image element is larger than the dimensions of the texture this property will extend the image displayed by stacking (or pasting) two or more of the textures together into one single image. It does not appear to account for any alpha channel the texture may have, only the raw dimensions are used to determine if and where the textures are connected. This can cause problems with lower resolutions as many of the Menus80 textures have an alpha channel to hide the excess content.
*'''CropX,CropY''' (Numeric) Specify the point on the texture, in pixels, that will be placed at the upper left hand corner of the image element.  Because the texture is cropped to fit inside the image element, this essentially cuts CropX pixels off of the left of the image and CropY off of the top.  '''Note:'''  CropX/CropY are calculated ''after'' the zoom property has been applied, so the point (5,10) in the original image would be (10,20) after a 200% zoom.


Examples using all_small_icons.dds (a 384x32 texture containing twelve 32x32 icons in a horizontal row)
Examples using all_small_icons.dds (a 384x32 texture containing twelve 32x32 icons in a horizontal row)
Line 59: Line 70:
Properties specific to the [[Object Element#Text|Text Element]]
Properties specific to the [[Object Element#Text|Text Element]]
*'''String''' (String) The text to be displayed.
*'''String''' (String) The text to be displayed.
*'''Red, Green, Blue''' (Numeric) Specifies the color of the text. Values are from 0 to 255 - the greater the value, the more of that color. Example: "red 0, green 0, blue 0" results in a black color, and "red 255, green 0, blue 0" results in a red color. Any combination can be made.
*'''Red, Green, Blue''' (Numeric) Specifies the color of the text. Values are from 0 to 255 - the greater the value, the more of that color. Default values are "red 117, green 59, blue 33". Example: "red 0, green 0, blue 0" results in a black color, and "red 255, green 0, blue 0" results in a red color. Any combination can be made.
*'''Font''' (Numeric) Specifies the font for the text element. Values are from 1 to 5, associated with the Oblivion.ini fonts. When missing or with an invalid number the game will default it to 1.
*'''Font''' (Numeric) Specifies the font for the text element. Values are from 1 to 5, associated with the Oblivion.ini fonts. When missing or with an invalid number the game will default it to 1.
*'''Justify''' (Numeric) Specifies where the text begins relative to the element's X coordinate. Options are "&left;", "&center;" and "&right;":
*'''Justify''' (Numeric) Specifies where the text begins relative to the element's X coordinate. Options are "&left;" (1), "&center;" (2) and "&right;" (4):
  <text>  
  <text>  
     <string> Hello World </string>
     <string> Hello World </string>
Line 81: Line 92:
           Hello World
           Hello World
*'''Wrapwidth''' (Numeric) the maximum width, in pixels, of the element.  If the text is long enough to extend past this width, it is split into multiple lines.  This is the only way to control the size of a text element - the width and height properties set by the game engine to whatever the final dimensions of the element end up being.
*'''Wrapwidth''' (Numeric) the maximum width, in pixels, of the element.  If the text is long enough to extend past this width, it is split into multiple lines.  This is the only way to control the size of a text element - the width and height properties set by the game engine to whatever the final dimensions of the element end up being.
*'''Wraplines''' (Numeric) the maximum number of lines displayed.
*'''IsHTML''' (Numeric) If value is greater than zero, the String Property is [[Book Formatting|parsed as HTML]] before being displayed.  ''Note'': This only works if the String property is set by script or the game engine, as HTML-formatted text written directly in the *.xml file is not handled correctly.
*'''IsHTML''' (Numeric) If value is greater than zero, the String Property is [[Book Formatting|parsed as HTML]] before being displayed.  ''Note'': This only works if the String property is set by script or the game engine, as HTML-formatted text written directly in the *.xml file is not handled correctly.
*'''PageNum''' (Numeric) In Oblivion, html-formatted text may be broken into pages using the &lt;hr&gt; tag.  This property specifies which 'page' of text is actually displayed, with zero meaning the first page, 1 meaning the second page, and so on.
*'''PageNum''' (Numeric) In Oblivion, html-formatted text may be broken into pages using the &lt;hr&gt; tag.  This property specifies which 'page' of text is actually displayed, with zero meaning the first page, 1 meaning the second page, and so on.
*'''PageCount''' (Numeric) Set automatically by the engine to the number of HTML 'pages' in the String Property.
*'''PageCount''' (Numeric) Set automatically by the engine to the number of HTML 'pages' in the String Property.  This value is zero if the String property isn't being parsed as HTML.


== Menu ==
== Menu ==
Anonymous user