About
Primitive data types are the building blocks for data stored within Cinema 4D. These data types are typically based on the standard data types of C++ and are available in a 32 and 64 bit version.
- Note
- To perform mathematical operations using these data types use the build-in functions, see Mathematical Functions Manual (Classic).
- Warning
- An overview over MAXON API primitive data types can be found here: Basic Data Types.
Float filletRadius = 20.0;
Int32 filletSubidivision = 5;
if (hyperFile == nullptr)
hyperFile->WriteBool(doFillet);
hyperFile->WriteFloat(filletRadius);
hyperFile->WriteInt32(filletSubidivision);
hyperFile->Close();
PyCompilerFlags const char * filename
Definition: ast.h:15
maxon::Url MaxonConvert(const Filename &fn, MAXONCONVERTMODE convertMode)
@ NONE
No check if file exists under case-sensitive drives.
Definition: ge_autoptr.h:37
Definition: lib_description.h:330
Definition: c4d_gedata.h:83
Bool GetBool(void) const
Definition: c4d_gedata.h:421
Int32 GetInt32(void) const
Definition: c4d_gedata.h:427
Float GetFloat(void) const
Definition: c4d_gedata.h:439
maxon::Bool Bool
Definition: ge_sys_math.h:55
maxon::Int32 Int32
Definition: ge_sys_math.h:60
maxon::Float Float
Definition: ge_sys_math.h:66
@ ANY
Show an error dialog for any error.
#define MAXON_SOURCE_LOCATION
Definition: memoryallocationbase.h:67
@ PRIM_CUBE_DOFILLET
Definition: ocube.h:13
@ PRIM_CUBE_FRAD
Definition: ocube.h:11
@ PRIM_CUBE_SUBF
Definition: ocube.h:12
Bool
Boolean values are used for logical operations:
Access
Bool variables can be created on demand or can be obtained from other entities.
Access Bool values stored in a BaseContainer:
See also BaseContainer Manual.
Access Bool values stored in a GeData object (GeData type is DA_LONG):
See also GeData Manual.
{
else
}
void SetInt32(Int32 v)
Definition: c4d_gedata.h:573
Int32 GetType(void) const
Definition: c4d_gedata.h:407
@ DA_LONG
Int32.
Definition: c4d_gedata.h:40
#define ApplicationOutput(formatString,...)
Definition: debugdiagnostics.h:210
Disc I/O
A Bool value can be stored in a BaseFile or a HyperFile:
See also BaseFile Manual on Bool and HyperFile Manual on Bool.
Char
A character variable contains a single symbol and is typically the smallest piece of memory.
- Char: Signed 8 bit character, defined as
char
.
- UChar: Unsigned 8 bit character, defined as
unsigned char
.
- Utf16Char: Defined as
UInt16
.
- Utf32Char: Defined as
UInt32
.
const String string {
"foobar" };
PyObject * string
Definition: asdl.h:6
Definition: c4d_string.h:39
Char * GetCStringCopy(STRINGENCODING type=STRINGENCODING::XBIT) const
maxon::Char Char
Definition: ge_sys_math.h:56
void DeleteMem(T *&p)
Definition: defaultallocator.h:257
Disc I/O
A character can be stored in a BaseFile or HyperFile:
- Note
- To read and write Utf16Char and Utf32Char use BaseFile::ReadBytes() and BaseFile::WriteBytes().
See also BaseFile Manual on Char and HyperFile Manual on Char.
Integer
Integer variables contain whole numbers. Both signed and unsigned variations are available, both in 16, 32 and 64 bit.
- Int16: Defined as
short int
.
- UInt16: Defined as
unsigned short int
.
- Int32: Defined as
signed int
.
- UInt32: Defined as
unsigned int
.
- Int64: Defined as
signed long long
.
- UInt64: Defined as
unsigned long long
.
- Int: Defined as
Int64
.
- UInt: Defined as
UInt64
.
- Note
- If larger integer numbers are needed the class maxon::BigInteger can be used.
Access
Integer values can be created by casting them from float values. To do this safely these macros should be used:
- Warning
- Never try to cast an integer pointer into a float pointer or vice versa.
static String IntToString(Int32 v)
Definition: c4d_string.h:495
void Py_ssize_t * pos
Definition: dictobject.h:50
maxon::Float32 Float32
Definition: ge_sys_math.h:68
Int32 SAFEINT32(Float32 x)
Definition: apibasemath.h:266
unsigned long Py_ssize_t width
Definition: pycore_traceback.h:88
Integer variables can be obtained from other entities.
Access integer values stored in a BaseContainer:
See also BaseContainer Manual.
Access Int32 or Int64 values stored in a GeData object (GeData type is DA_LONG or DA_LLONG):
See also GeData Manual.
String objects can be parsed to get the numeric value represented by the string:
See also String Manual (Classic).
const String bottles =
"99 bottles of beer on the wall";
Int32 ToInt32(Bool *error) const
Definition: c4d_string.h:598
String Left(Int count) const
Definition: c4d_string.h:411
Convert
To display them in the GUI, integer numbers also can be converted to String objects:
See also String Manual (Classic).
if (selection == nullptr)
const Int32 selCount = selection->GetCount();
const char * doc
Definition: pyerrors.h:226
Disc I/O
An integer value can be stored in a BaseFile or a HyperFile:
See also BaseFile Manual on Integer and HyperFile Manual on Integer.
Float
Floating point numbers present rational numbers with limited precision. Variations are available in 32 and 64 bit.
Access
Floating point variables can be obtained from other entities.
Access float values stored in a BaseContainer:
See also BaseContainer Manual.
Access float values stored in a GeData object (GeData type is DA_REAL):
See also GeData Manual.
Of course it is also possible to cast integer types into float values. Just be aware of the limited precision of different float formats.
- Warning
- Never try to cast an integer pointer into a float pointer or vice versa.
String objects can be parsed to get the numeric value represented by the string:
Compare
Since floating point values are only stored with limited precision they cannot represent every value perfectly. This is especially critical when it is needed to compare two floating point values:
PyObject * x
Definition: bytesobject.h:38
Bool CompareFloatTolerant(Float32 a, Float32 b)
Convert
To display them in the GUI, floating point numbers also can be converted to String objects:
PyObject * value
Definition: abstract.h:715
static String FloatToString(Float32 v, Int32 vvk=-1, Int32 nnk=-3)
Definition: c4d_string.h:529
Disc I/O
A floating point value can be stored in a BaseFile or a HyperFile:
See also BaseFile Manual on Float and HyperFile Manual on Float.
Further Reading