3ds Max C++ API Reference
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
maxtypes.h File Reference
#include "maxheap.h"
#include "WindowsDefines.h"
#include <Geom/maxcolors.h>
#include <cstdint>

Classes

class  Class_ID
 
class  Interface_ID
 

Macros

#define TIME_TICKSPERSEC   4800
 Number of ticks in a second.
 
#define TIME_PosInfinity   TimeValue(0x7fffffff)
 Returns a time value that represents positive infinity.
 
#define TIME_NegInfinity   TimeValue(0x80000000)
 Returns a time value that represents negative infinity.
 

Typedefs

using ulong = unsigned long
 
using uchar = unsigned char
 
using UBYTE = uchar
 
using UWORD = unsigned short
 
using MtlID = UWORD
 
using TimeValue = int
 
using SClass_ID = ulong
 

Enumerations

enum  IOResult : int { IO_OK = 0 , IO_END = 1 , IO_ERROR = 2 , IO_INTERRUPT = 3 }
 
enum  ChunkType { NEW_CHUNK = 0 , CONTAINER_CHUNK = 1 , DATA_CHUNK = 2 }
 
enum  FileIOType { IOTYPE_MAX = 0 , IOTYPE_MATLIB = 1 , IOTYPE_RENDER_PRESETS = 2 }
 

Functions

constexpr float TicksToSec (TimeValue ticks)
 Converts from ticks to seconds.
 
constexpr TimeValue SecToTicks (double secs)
 Converts from seconds to ticks.
 
constexpr TimeValue TicksSecToTime (TimeValue ticks, double secs)
 Converts a number of seconds plus a number of ticks to a TimeValue.
 
constexpr void TimeToTicksSec (TimeValue time, TimeValue &ticks, TimeValue &secs)
 Converts a TimeValue to a number of seconds plus a number of ticks.
 

Macro Definition Documentation

◆ TIME_TICKSPERSEC

#define TIME_TICKSPERSEC   4800

Number of ticks in a second.

◆ TIME_PosInfinity

#define TIME_PosInfinity   TimeValue(0x7fffffff)

Returns a time value that represents positive infinity.

◆ TIME_NegInfinity

#define TIME_NegInfinity   TimeValue(0x80000000)

Returns a time value that represents negative infinity.

Typedef Documentation

◆ ulong

using ulong = unsigned long

◆ uchar

using uchar = unsigned char

◆ UBYTE

using UBYTE = uchar

◆ UWORD

using UWORD = unsigned short

◆ MtlID

using MtlID = UWORD

◆ TimeValue

using TimeValue = int

◆ SClass_ID

using SClass_ID = ulong

Enumeration Type Documentation

◆ ChunkType

enum ChunkType
Enumerator
NEW_CHUNK 
CONTAINER_CHUNK 
DATA_CHUNK 
219{
220 NEW_CHUNK = 0,
221 CONTAINER_CHUNK = 1,
222 DATA_CHUNK = 2
223};
@ CONTAINER_CHUNK
Definition: maxtypes.h:221
@ NEW_CHUNK
Definition: maxtypes.h:220
@ DATA_CHUNK
Definition: maxtypes.h:222

◆ FileIOType

enum FileIOType
Enumerator
IOTYPE_MAX 

File IO concerns a scene file (.max, .viz).

IOTYPE_MATLIB 

File IO concerns a material library file (.mat).

IOTYPE_RENDER_PRESETS 

File IO concerns a render preset file (.rps).

228{
230 IOTYPE_MAX = 0,
232 IOTYPE_MATLIB = 1,
235};
@ IOTYPE_RENDER_PRESETS
File IO concerns a render preset file (.rps).
Definition: maxtypes.h:234
@ IOTYPE_MATLIB
File IO concerns a material library file (.mat).
Definition: maxtypes.h:232
@ IOTYPE_MAX
File IO concerns a scene file (.max, .viz).
Definition: maxtypes.h:230

Function Documentation

◆ TicksToSec()

constexpr float TicksToSec ( TimeValue  ticks)
constexpr

Converts from ticks to seconds.

35{ return ticks / static_cast<float>(TIME_TICKSPERSEC); }
#define TIME_TICKSPERSEC
Number of ticks in a second.
Definition: maxtypes.h:33

◆ SecToTicks()

constexpr TimeValue SecToTicks ( double  secs)
constexpr

Converts from seconds to ticks.

38{
39 // Using static_cast will round down the result of the multiplication which is not always what we want
40 // Since the function is constexpr, we can't use any math function such as std::round (not before C++23)
41 // Trick used : 3.2 + 0.5 = 3.8 and static_cast<TimeValue>(3.8) = 3 or 3.7 + 0.5 = 4.2 and static_cast<TimeValue>(4.2) = 4.0
42 double result = secs * TIME_TICKSPERSEC;
43 result += 0.5;
44 return static_cast<TimeValue>(result);
45}
int TimeValue
Definition: maxtypes.h:31

◆ TicksSecToTime()

constexpr TimeValue TicksSecToTime ( TimeValue  ticks,
double  secs 
)
constexpr

Converts a number of seconds plus a number of ticks to a TimeValue.

47{ return ticks + SecToTicks(secs); }
constexpr TimeValue SecToTicks(double secs)
Converts from seconds to ticks.
Definition: maxtypes.h:37

◆ TimeToTicksSec()

constexpr void TimeToTicksSec ( TimeValue  time,
TimeValue ticks,
TimeValue secs 
)
constexpr

Converts a TimeValue to a number of seconds plus a number of ticks.


50{
51 ticks = time % TIME_TICKSPERSEC;
52 secs = time / TIME_TICKSPERSEC;
53}