"mesh-table" container (interior version)

From TrainzOnline
Jump to: navigation, search

The "mesh-table" container is a top-level config.txt file entry used by various Content Types. Refer to the "mesh-table" Container documentation for the standard tags - this document only describes the extensions available within the mesh table when it is used in a cab interior asset.

Most of the entries in a mesh-table for an interior will be cab controls. A cab control has a single value associated with it, which could be an input (e.g. a lever position) or an output (a dial or gauge position).

Contents

Standard Mesh Names

There are a number of standard mesh names that the trainz default cab script uses for it's controls. For a Diesel or Electric cab (either unscripted, or scripted and inheriting from the DefaultLocomotiveCabin class), the following are the default mesh names:

  • speedo_needle -- speedometer
  • speedo_needle2 -- speedometer
  • bplocomain_needle -- loco main reservoir pressure gauge
  • bptrainbrakecylinder_needle -- locomotive brake cylinder pressure gauge
  • bptrainbrakecylinder_needle2 -- locomotive brake cylinder pressure gauge
  • no3pipe_needle -- brake pressure gauge (currently loco brake cylinder -- but maybe intended for something else?)
  • bptrainbrakecylinder2_needle -- brake pressure gauge (source unknown)
  • bptrainbrakepipe_needle -- train brake pipe pressure gauge
  • bptrainbrakepipe_needle2 -- train brake pipe pressure gauge
  • bploco_equaliser -- brake equaliser pressure gauge
  • flow_needle -- brake flow rate gauge
  • ampmeter_needle -- traction ammeter gauge
  • ampmeter2_needle -- traction ammeter gauge
  • throttle_lever -- throttle lever control
  • reverser_lever -- reverser lever control
  • trainbrake_lever -- self-lapping train brake control
  • trainbrakelap_lever -- non self-lapping train brake control
  • independantbrake_lever -- locomotive independent brake control. Note the typo in the control name.
  • dynamicbrake_lever -- dynamic brake control
  • wheelslip_light -- wheelslip indicator
  • horn -- horn control
  • light_switch -- light control
  • pantograph_lever -- pantograph control
  • throttle_brake_lever -- combined throttle/self-lapping brake lever

For a Steam cab (either unscripted, or scripted and inheriting from the DefaultSteamCabin class), these default mesh names are available:

  • speedo_needle -- speedometer
  • bplocomain_needle -- loco main reservoir pressure gauge
  • bptrainbrakecylinder_needle -- locomotive brake cylinder pressure gauge
  • no3pipe_needle -- brake pressure gauge (currently loco brake cylinder -- but maybe intended for something else?)
  • bptrainbrakecylinder2_needle -- brake pressure gauge (source unknown)
  • bptrainbrakepipe_needle -- train brake pipe pressure gauge
  • bploco_equaliser -- brake equaliser pressure gauge
  • flow_needle -- brake flow rate gauge
  • trainbrake_lever -- self-lapping train brake control
  • trainbrakelap_lever -- non self-lapping train brake control
  • independantbrake_lever -- locomotive independent brake control. Note the typo in the control name.
  • horn -- horn control
  • light_switch -- light control
  • waterglass_left -- boiler water level
  • waterglass_right -- boiler water level
  • firebox -- the interior of the firebox (to show fire temperature)
  • boiler_needle -- boiler pressure
  • boiler_needle1 -- boiler pressure
  • steam_chest_needle -- steam chest pressure
  • regulator -- regulator (throttle) control
  • reverser -- cutoff (reverser) control
  • water_injector_0 -- primary water injector control
  • water_injector_1 -- secondary water injector control
  • blower -- steam blower control
  • fire_plates -- the firebox door
  • sanding_lever -- locomotive sander control
  • blowdown_lever -- blowdown control (releases water out of the boiler)


Supported Tags

Each mesh subcontainer supports the following tags. Each tag is shown here with its default value. Standard tags inherited from the normal mesh table are omitted for brevity.

tooltip-text ""
tooltip-token ""
tooltip-mesh ""
limits 0,1
angles 0,0
kind ""
collision-parent ""
mousemode ""
mousespeed 1
notches 
invert 0
notchheight 
onlight ""
value 0.0
font "swiss"
fontsize 12
fontcolor 1.0,1.0,1.0
fade-time 0.5

angles

Type: Decimal Pair
Desc: Specifies the minimum and maximum extents of movement for a control or needle. For control types that rotate, these values are in radians[[1]]. In the case of a speedometer, this would define the amount of angular movement of the needle - a speedometer running from horizontal left to horizontal right may use -1.57 to 1.57, for example. If the cab control needs to move the other way, put the higher number first.

collision-parent

Type: String
Desc: A mesh of kind collision-proxy must specify a collision-parent - the mesh it is a collision proxy for. This is the name of another control in the mesh-table.

fade-time

Type: Float
Desc: The time, in seconds, for a "light" control to fully switch on or off. Default is 0.5 seconds.

font

Type: String
Desc: Font name to use for the readout of a digital control.
Options are:
  • swiss (Default option. Renders with arial in PC builds.)
  • times_new_roman
  • verdana
  • century_gothic
  • cordia
  • courier
  • helvetica
  • arial
  • comic_sans
  • sans_serif
  • impact
  • console
  • tohoma (renders using the Tahoma font on PC builds.)
  • garamond
These roughly correspond with Windows font names. Beware - not all fonts are available on all platforms, and where a font is not available, a different font may be substituted.

fontcolor

Type: Decimal Triplet
Desc: RGB font color for the readout of a digital control. Colors are specified within the range 0.0 to 1.0, with 0.0 being black and 1.0 being full intensity. Default is 1.0,1.0,1.0 - white.

fontsize

Type: Decimal
Desc: Font size for the readout of a digital control. Default is 12.

invert

Type: Boolean
Desc: Invert mouse movement for this control. If the control moves the wrong way compared to the mouse, change this setting.

kind

Type: Selection
Desc: The type of control this mesh table element represents.
Options are:
  • animated-lever
Operates like a standard lever, only uses a named animation instead of the angles tag for movement.
  • animated-dial
Operates like a standard needle, only uses a named animation to represent the gauge readout instead of the angles tag.
  • collision-proxy
This element type defines a volume within the cab where the mouse pointer will be considered to be over the cab control. Generally used in conjunction with an animated-lever. Name of the animated lever is defined in the tag collision-parent.
  • digital-dial-spd
Digital readout for a speedometer, and using speed units.
  • digital-dial-prs
Digital readout for a pressure gauge, using pressure units.
  • firebox
The animated firebox in a steam locomotive.
  • lever
A standard lever, often used for throttle and brake controls. Requires the user to click hold and move the mouse to move the lever between it's notches. This control will stay at any notch position when let go.
  • light
A light glow / overlay - this mesh is hidden when the light is off and shown when the light is on.
  • needle
An analogue gauge needle. Can be used to implement many different types of gauges.
  • pulllever
Like a lever, only sprung to return to it's initial position when the user lets go of the control. Useful for horns.
  • pullrope
Like a pulllever, only with linear (not rotational) movement.
  • switch
This control requires only a single click to move between it's two endpoints. It is better suited than a lever to small switches and buttons.
  • button
Similar to switch but requires the mouse be held down to keep the control active. I.e., press and hold the mouse button to push the control down, release the mouse and the control will return to the off position.

limits

Type: Decimal Pair
Desc: Specifies the minimum and maximum values for a cab control or needle at it's two endpoints of movement. In the case of a speedometer, this would be the range of speeds it can display - 0m/s to 50m/s, for example.

mousemode

Type: String
Desc: If set to "exact", will require the mouse to be positioned over the geometry of the control precisely to activate it. Otherwise a bounding volume is used. This is useful for large controls which would otherwise block access to smaller controls.

mousespeed

Type: Float
Desc: Controls the mouse speed and push/pull direction for controls. Do not use zero.
Examples of use:
  • mousespeed -1 Inverts mouse direction.
  • mousespeed 2 Doubles mouse speed in default direction.
  • mousespeed -0.5 Inverts mouse direction and halves the speed.

notches

Type: Decimal List
Desc: Specifies the positions of the notches for this control. Notches are discrete positions within the movement of the control where the lever can be stopped. If a lever does not have notches, it can be positioned at any location. There are two common uses for notches. Firstly, they can be used to define a control which has a number of discrete positions which mean specific things (e.g. a brake valve). Secondly, they are used to define pre-set discrete values that a control can provide (e.g. a throttle lever). A typical US diesel 8 notch throttle would have something like "notches 0.0,0.125,0.25,0.375,0.5,0.625,0.75,0.875,1.0", specifying nine positions (for 'off' and notches 1 thru 8).

notchheight

Type: Integer List
Desc: Specifies the importance of the notches for this control. This affects how the graphical overlay draws each notch. This is useful for a combined brake and throttle controller, or any other control where you want to mark a specific position relative to the others. This should have the same number of values as the 'notches' list.
Three styles are available:
  • '1' configures this bar to be a standard length and width bar.
  • '2' configures this bar to be shorter in length, and is often used for intermediate positions.
  • '3' configures this bar to be standard length, but thicker in width. This is often used for marking a specific position.

onlight

Type: String
Desc: Specify the name of a light kind mesh which is enabled when this switch/lever is in the on position, and disabled when it is in the off position. The mesh name must be in the mesh-table. See the example below.

radius

Type: Decimal
Desc: Specifies the distance for the 2D notch overlay.

tooltip-mesh

Type: String
Desc: Specifies the name of a mesh-table entry for a mesh to show when the control is moused over. The mesh will be faded in/out over a short period.

tooltip-text

Type: String
Desc: OBSOLETE: DO NOT USE. This text will be used in the tooltip that appears when the mouse cursor hovers over a cab control.

tooltip-token

Type: String
Desc: The name of a string table entry. The contents of the named string table entry will be displayed as a tooltip that appears when the mouse cursor hovers over a cab control. If a token is used then it must appear as a tag in the "String-table" container.

value

Type: Decimal
Desc: Specifies the initial value for this control. For a lever or other input device, this will specify the initial position of the control before the user moves it.


Cab Interior Mesh-Table Example

The following is an example of a mesh-table which implements a number of cab controls

mesh-table
{
  default
  {
    mesh                                "interior.im"
    auto-create                         1
  }
  
  wheelslip_light
  {
    kind                                "light"
    mesh                                "wheelslip_light.im"
    auto-create                         0
  }
  
  bptrainbrakepipe_needle2
  {
    kind                                "digital-dial-prs"
    mesh                                "brakeneedle.im"
    att                                 "a.brakepipe2"
    limits                              0,55
    font                                "arial"
    fontsize                            0.007
    fontcolor                           80,240,120
    auto-create                         1
  }
  
  speedo_needle2
  {
    kind                                "digital-dial-spd"
    mesh                                "brakeneedle.im"
    att                                 "a.digispeedo"
    limits                              0,55
    font                                "arial"
    fontsize                            0.01
    fontcolor                           0,0,0
    auto-create                         1
  }
  
  throttle_lever
  {
    kind                                "lever"
    mesh                                "throttle.im"
    att                                 "a.throttle"
    limits                              0,8
    angles                              0,1.69
    notches                             0,0.125,0.25,0.375,0.5,0.625,0.75,0.875,1
    notchheight                         1,2,2,2,2,2,2,2,1
    radius                              0.35
    mousespeed                          -1
    auto-create                         1
  }
  
  dynamicbrake_lever
  {
    kind                                "lever"
    mesh                                "dynamic_handle.im"
    att                                 "a.dynamic"
    limits                              0,2
    angles                              0,-1.69
    notches                             0,1
    notchheight                         0.1,1
    mousespeed                          -1
    radius                              0.35
    auto-create                         1
  }
  
  trainbrakelap_lever
  {
    kind                                "lever"
    auto-create                         1
    mesh                                "trainbrake_handle.im"
    att                                 "a.trainbrake_handle"
    limits                              0,4
    angles                              0,-2
    notches                             0,0.25,0.5,0.75,1
    notchheight                         2,2,2,2,2
    mousespeed                          1
  }
  
  independantbrake_lever
  {
    kind                                "lever"
    mesh                                "indy_handle.im"
    att                                 "a.ind"
    limits                              0,32
    angles                              0.94,0
    notches                             0,0.5,1
    notchheight                         1,1,1
    radius                              0.35
    mousespeed                          1
    auto-create                         1
  }
  
  flow_needle
  {
    kind                                "needle"
    mesh                                "flowneedle.im"
    att                                 "a.bpflow"
    limits                              0,1050
    auto-create                         1
  }
  
  bplocomain_needle
  {
    kind                                "needle"
    mesh                                "brakeneedlered.im"
    att                                 "a.mainres"
    limits                              0,1240
    auto-create                         1
  }
  
  bploco_equaliser
  {
    kind                                "needle"
    mesh                                "brakeneedle.im"
    att                                 "a.eqres"
    limits                              0,1240
    auto-create                         1
  }
  
  bptrainbrakecylinder_needle
  {
    kind                                "needle"
    mesh                                "brakeneedlered.im"
    att                                 "a.brakecyl"
    limits                              -50,1390
    auto-create                         1
  }
  
  bptrainbrakepipe_needle
  {
    kind                                "needle"
    mesh                                "brakeneedle.im"
    att                                 "a.brakepipe"
    limits                              0,1240
    auto-create                         1
  }
  
  speedo_needle
  {
    kind                                "needle"
    mesh                                "speedo_pointer.im"
    att                                 "a.speedo"
    limits                              0,43
    auto-create                         1
  }
  
  ampmeter_needle
  {
    kind                                "needle"
    mesh                                "needleamps.im"
    att                                 "a.ampmeter"
    limits                              0,1700
    angles                              0,3.02058
    auto-create                         1
  }
  
  reverser_lever
  {
    kind                                "lever"
    mesh                                "reverser_handle.im"
    att                                 "a.throttle01"
    limits                              0,2
    angles                              -0.55,0.55
    notches                             0,0.5,1
    notchheight                         1,1,1
    mousespeed                          -1
    auto-create                         1
  }
  
  light_switch
  {
    kind                                "lever"
    att                                 "a.hdlt"
    mesh                                "hdltswtch.im"
    limits                              0,1
    angles                              0,2
    notches                             0,1
    notchheight                         0.1,0.1
    mousespeed                          -1
    auto-create                         1
  }
  
  horn
  {
    kind                                "pulllever"
    mesh                                "horn.im"
    att                                 "a.horn"
    auto-create                         1
    angles                              0,-0.55
    limits                              0,1
    mousespeed                          -1
    radius                              -0.02
    notches                             0,1
    notchheight                         0,0
  }

  pantograph_lever
  {
    kind                                "lever"
    mesh                                "pantograph_lever.im"
    att                                 "a.pantograph_lever"
    limits                              0,3
    angles                              1.4,0
    notches                             0,0.5,0.75,1.0
    notchheight                         0,0,1,1
    mousespeed                          -1
    onlight                             "line_power"
  }
  
  line_power
  {
    kind                                "light"
    mesh                                "line_power.im"
    att                                 "a.line_power"
  }
}
Personal tools