units.h File Reference
 
 
 
units.h File Reference

This reference page is linked to from the following overview topics: Units of Measurement, Time Functions, MAXScript Global Variables.


#include "maxheap.h"
#include "strclass.h"
#include "maxtypes.h"

Classes

struct   DispInfo
  This is the display information structure. More...

Defines

#define  UNITS_INCHES   0
#define  UNITS_FEET   1
#define  UNITS_MILES   2
#define  UNITS_MILLIMETERS   3
#define  UNITS_CENTIMETERS   4
#define  UNITS_METERS   5
#define  UNITS_KILOMETERS   6
#define  MAX_UNIT_TYPES   7
#define  UNITDISP_GENERIC   0
#define  UNITDISP_METRIC   1
#define  UNITDISP_US   2
#define  UNITDISP_CUSTOM   3
#define  MAX_UNITDISP_TYPES   4
#define  UNIT_METRIC_DISP_MM   0
#define  UNIT_METRIC_DISP_CM   1
#define  UNIT_METRIC_DISP_M   2
#define  UNIT_METRIC_DISP_KM   3
#define  MAX_METRIC_DISP_TYPES   4
#define  UNIT_US_DISP_FRAC_IN   0
#define  UNIT_US_DISP_DEC_IN   1
#define  UNIT_US_DISP_FRAC_FT   2
#define  UNIT_US_DISP_DEC_FT   3
#define  UNIT_US_DISP_FT_FRAC_IN   4
#define  UNIT_US_DISP_FT_DEC_IN   5
#define  MAX_US_DISP_TYPES   6
#define  UNIT_FRAC_1_1   0
#define  UNIT_FRAC_1_2   1
#define  UNIT_FRAC_1_4   2
#define  UNIT_FRAC_1_8   3
#define  UNIT_FRAC_1_10   4
#define  UNIT_FRAC_1_16   5
#define  UNIT_FRAC_1_32   6
#define  UNIT_FRAC_1_64   7
#define  UNIT_FRAC_1_100   8
#define  MAX_FRAC_TYPES   9
#define  UNIT_DESIG_MM   0
#define  UNIT_DESIG_CM   1
#define  UNIT_DESIG_M   2
#define  UNIT_DESIG_KM   3
#define  UNIT_DESIG_IN   4
#define  UNIT_DESIG_FT   5
#define  UNIT_DESIG_CUSTOM   6
#define  UNIT_DESIG_TYPES   7
#define  US_UNIT_DEFAULT_FEET   0
#define  US_UNIT_DEFAULT_INCHES   1

Enumerations

enum   TimeDisp { DISPTIME_FRAMES, DISPTIME_SMPTE, DISPTIME_FRAMETICKS, DISPTIME_TIMETICKS }

Functions

CoreExport double  GetMasterScale (int type)
CoreExport double  GetRelativeScale (int fromType, float fromScale, int toType, float toScale)
  Computes a scaling factor for going from given System Units to others.
CoreExport void  GetMasterUnitInfo (int *type, float *scale)
CoreExport int  SetMasterUnitInfo (int type, float scale)
CoreExport void  GetUnitDisplayInfo (DispInfo *info)
CoreExport int  SetUnitDisplayInfo (DispInfo *info)
CoreExport int  GetUnitDisplayType ()
CoreExport int  SetUnitDisplayType (int type)
CoreExport BOOL  IsValidUnitCharacter (int ch)
CoreExport void  SetUSDefaultUnit (int type)
CoreExport int  GetUSDefaultUnit ()
CoreExport const MCHAR *  GetFirstUnitName ()
CoreExport const MCHAR *  GetNextUnitName ()
CoreExport const MCHAR *  GetFirstMetricDisp ()
CoreExport const MCHAR *  GetNextMetricDisp ()
CoreExport const MCHAR *  GetFirstUSDisp ()
CoreExport const MCHAR *  GetNextUSDisp ()
CoreExport const MCHAR *  GetFirstFraction ()
CoreExport const MCHAR *  GetNextFraction ()
CoreExport const MCHAR *  FormatUniverseValue (float value)
CoreExport float  DecodeUniverseValue (const MCHAR *string, BOOL *valid=NULL)
CoreExport void  TimeToString (TimeValue t, MSTR &string)
CoreExport BOOL  StringToTime (MSTR string, TimeValue &t)
CoreExport int  GetFrameRate ()
CoreExport void  SetFrameRate (int rate)
CoreExport int  GetTicksPerFrame ()
CoreExport void  SetTicksPerFrame (int ticks)
CoreExport TimeDisp  GetTimeDisplayMode ()
CoreExport void  SetTimeDisplayMode (TimeDisp m)
CoreExport int  LegalFrameRate (int r)
CoreExport void  RegisterDistanceDefault (const MCHAR *section, const MCHAR *key, float inchesDefault, float metersDefault)
CoreExport void  RestoreDistanceDefault (const MCHAR *section, const MCHAR *key, float inchesDefault, float metersDefault)
CoreExport float  GetDistanceDefault (const MCHAR *section, const MCHAR *key)
CoreExport void  SetDistanceDefault (const MCHAR *section, const MCHAR *key, float value)

Define Documentation

#define UNITS_INCHES   0
#define UNITS_FEET   1
#define UNITS_MILES   2
#define UNITS_MILLIMETERS   3
#define UNITS_CENTIMETERS   4
#define UNITS_METERS   5
#define UNITS_KILOMETERS   6
#define MAX_UNIT_TYPES   7
#define UNITDISP_GENERIC   0
#define UNITDISP_METRIC   1
#define UNITDISP_US   2
#define UNITDISP_CUSTOM   3
#define MAX_UNITDISP_TYPES   4
#define UNIT_METRIC_DISP_MM   0
#define UNIT_METRIC_DISP_CM   1
#define UNIT_METRIC_DISP_M   2
#define UNIT_METRIC_DISP_KM   3
#define MAX_METRIC_DISP_TYPES   4
#define UNIT_US_DISP_FRAC_IN   0
#define UNIT_US_DISP_DEC_IN   1
#define UNIT_US_DISP_FRAC_FT   2
#define UNIT_US_DISP_DEC_FT   3
#define UNIT_US_DISP_FT_FRAC_IN   4
#define UNIT_US_DISP_FT_DEC_IN   5
#define MAX_US_DISP_TYPES   6
#define UNIT_FRAC_1_1   0
#define UNIT_FRAC_1_2   1
#define UNIT_FRAC_1_4   2
#define UNIT_FRAC_1_8   3
#define UNIT_FRAC_1_10   4
#define UNIT_FRAC_1_16   5
#define UNIT_FRAC_1_32   6
#define UNIT_FRAC_1_64   7
#define UNIT_FRAC_1_100   8
#define MAX_FRAC_TYPES   9
#define UNIT_DESIG_MM   0
#define UNIT_DESIG_CM   1
#define UNIT_DESIG_M   2
#define UNIT_DESIG_KM   3
#define UNIT_DESIG_IN   4
#define UNIT_DESIG_FT   5
#define UNIT_DESIG_CUSTOM   6
#define UNIT_DESIG_TYPES   7
#define US_UNIT_DEFAULT_FEET   0
#define US_UNIT_DEFAULT_INCHES   1

Enumeration Type Documentation


Function Documentation

CoreExport double GetMasterScale ( int  type )
CoreExport double GetRelativeScale ( int  fromType,
float  fromScale,
int  toType,
float  toScale 
)

Computes a scaling factor for going from given System Units to others.

Parameters:
[in] fromType - type of System Units from which we start (a value going from UNITS_INCHES to UNITS_KILOMETERS).
[in] fromScale - scale of System Units from which we start.
[in] toType - type of System Units into which we want to rescale (a value going from UNITS_INCHES to UNITS_KILOMETERS).
[in] toScale - scale of System Units into which we want to rescale.
Returns:
- The scale factor that is needed to scale from given System Units to others.
CoreExport void GetMasterUnitInfo ( int *  type,
float *  scale 
)
CoreExport int SetMasterUnitInfo ( int  type,
float  scale 
)
CoreExport void GetUnitDisplayInfo ( DispInfo info )
CoreExport int SetUnitDisplayInfo ( DispInfo info )
CoreExport int GetUnitDisplayType ( )
CoreExport int SetUnitDisplayType ( int  type )
CoreExport BOOL IsValidUnitCharacter ( int  ch )
CoreExport void SetUSDefaultUnit ( int  type )
CoreExport int GetUSDefaultUnit ( )
CoreExport const MCHAR* GetFirstUnitName ( )
CoreExport const MCHAR* GetNextUnitName ( )
CoreExport const MCHAR* GetFirstMetricDisp ( )
CoreExport const MCHAR* GetNextMetricDisp ( )
CoreExport const MCHAR* GetFirstUSDisp ( )
CoreExport const MCHAR* GetNextUSDisp ( )
CoreExport const MCHAR* GetFirstFraction ( )
CoreExport const MCHAR* GetNextFraction ( )
CoreExport const MCHAR* FormatUniverseValue ( float  value )
CoreExport float DecodeUniverseValue ( const MCHAR *  string,
BOOL *  valid = NULL 
)
CoreExport void TimeToString ( TimeValue  t,
MSTR string 
)
CoreExport BOOL StringToTime ( MSTR  string,
TimeValue t 
)
CoreExport int GetFrameRate ( )
CoreExport void SetFrameRate ( int  rate )
CoreExport int GetTicksPerFrame ( )
CoreExport void SetTicksPerFrame ( int  ticks )
CoreExport TimeDisp GetTimeDisplayMode ( )
CoreExport void SetTimeDisplayMode ( TimeDisp  m )
CoreExport int LegalFrameRate ( int  r )
CoreExport void RegisterDistanceDefault ( const MCHAR *  section,
const MCHAR *  key,
float  inchesDefault,
float  metersDefault 
)
CoreExport void RestoreDistanceDefault ( const MCHAR *  section,
const MCHAR *  key,
float  inchesDefault,
float  metersDefault 
)
CoreExport float GetDistanceDefault ( const MCHAR *  section,
const MCHAR *  key 
)
CoreExport void SetDistanceDefault ( const MCHAR *  section,
const MCHAR *  key,
float  value 
)