Commands and other aspects of modo use datatypes to represent different kinds of values. In the SDK, these are wrapped in an Value interface. When scripting, the datatypes are referenced by name. Datatypes include conversion to and from strings, and both "nice" (with units) and raw (without units) parsers. These datatypes define what kinds of values can be used in a particular context, and include integers, distances, colors, character strings and so on.
The following are some common simple datatypes.
Integers are simple non-fractional numbers, positive and negative. These are commonly used for on/off switches and choices.
Floats are double-precision floating-point numbers, which for scripting means they have can be fractional, like 3.1415. Due to rounding and general imprecision, these are generally accurate to about seven significant figures when converting to and from strings.
Booleans have only two states, on and off'. This is represented as an integer value of 1 or 0, and can generally be treated as integers. There isn't a unit mode, but text hints are provided for on, off, yes, no, true and false.
Percents are floats with a percent sign attached. The raw value is 1/100th of the units value: 0.1 is equal to 10%. There is also a global preference to allow you to always work with percentages as floats without units, in which case there is no difference between the two modes.
Distances are floats with distance units attached, such as meters and feet. When used in "raw" mode (ie: without square braces), they represent meters.
Angles are floats with angular units. When used with commands as strings, these are always in degrees. Raw mode omits the degree symbol. When scripting, it is possible to force angles to be treated as radians. When used from SDK, the float representing the angle is in radians.
Axis represents X, Y and Z axes. Similar to booleans, this is represented as an integer value of 1, 2 or 3. There is no units mode, but text hints are available for x, y and z.
UV Coordinates are single floats representing part of a UV coordinate. There are no modes that support units.
Times are used to represent durations. In raw mode they are floats representing seconds. When used with units, the time unit system preference is used to determine how the value is represented, but this can be overridden depending on the formatting of the string. If a colon (:) is present, timecode is assumed and more colons are searched for, such as 01:00:05:16. If a plus (+) is found, film footage plus frames is assumed in the form of 12+8. If there is an "s", such as 2.3s, then the time is interpreted as seconds. An "f" can be used to interpret as frames, like 10f. Except for seconds, these interpretations are based on the current frame rate and time unit system; seconds are completely independent of the system settings and are preferred for scripting and for plug-in development.
Colors in raw mode are three floats. When used with units, they can be three floats, three integers, three percents or three HTML-style hexadecimal numbers, depending on the current color system. Integer values are clipped to 0 the range of 255. In the SDK, colors and all other array types are tread as a Value Array.
Light Intensity describes the amount of illumination thrown off by a light. The raw units are in terms of radiance, or W/srm2 (Watts per steradian per square meter). Unit mode can use either this radiance representation or photometric luminance units of cd/m2 (candela per square meter).
Memory is used to describe storage capacity in memory or on disk, and is represented by a float. The raw mode is an integer representing the number of bytes. The unit mode will display kilobytes, megabytes and gigabytes. The standard conversion is used, with 1024 bytes to a kilobyte, 1024 kilobytes to a megabyte and 1024 megabytes to a gigabyte.
Pixels are simple integers used to represent positions and sizes in screen coordinates. The unit mode has the word pixels added after the integer.
Strings are simple character strings. There is no special mode with units.
File paths are identical to strings, but they indicate that this is a path to a file or directory on disk. There is no special mode with units.
Simple Datatype Examples
The table below lists the names of the various datatypes and example values for the raw modes and when using units.
There is also a special class of complex datatypes. These start with an ampersand (&), such as &item or &attribute. Each has its own specific format, often an index, name or path to a specific element. For example, &item types use the item reference, which is described as a hexadecimal number such as 0x10000001. The &attribute type describes the path to a form or control, such as formHash/controlIndex or 75478769354:sheet/1. These datatypes are often used by the various selection commands. They are also referred to as pointer datatypes, as they often resolve to pointers to objects.
The common datatypes are defined in the value header using macros like these:
#define LXsTYPE_FLOAT "float" #define LXsTYPE_DISTANCE "distance"