COFFEE (Cinema 4D)
COFFEE (often written as "C.O.F.F.E.E") was a computer scripting language that forms part of CINEMA 4D, a proprietary 3D graphics application. Although presented as an acronym the letters of the word COFFEE allegedly stand for Cinema Object-oriented Fery Fast Environment Enhancer,[1] it is primarily a comic reference to Java, a considerably more famous computer language.
COFFEE has been discontinued with Release 20 of Cinema 4D in 2018.
Purpose
Like most scripting languages, COFFEE is used to extend or modify the functionality of the host software. This technique is preferable to writing a so-called plug-in module using a traditional language such as C for a number of reasons, among them:
- The scripting language implicitly handles memory management on the user's behalf, where C does not;
- The language interpreter does not require programs to be compiled as a separate step before they can be used;
- A purpose-built scripting language can be tailored so that it lends itself to its intended usage. For example, COFFEE has built-in mathematical functions that are necessary for 3D graphics programming.
There are several different aspects of CINEMA 4D's operation that can be customised using COFFEE scripts, notably additions to the user interface and extensions for reading and writing new file formats and creating texture shaders. Almost all the main functionality of the application can be accessed from a COFFEE program, and so customised features can look and behave much like those supplied as standard.
Syntax and language features
COFFEE is a fairly typical curly bracket language and so it would look familiar to any previous user of C/C++, Java, Perl or anything along those lines. The function and object class definitions are closely modelled after those of C++. However, COFFEE is dynamically typed, and so variables are defined with a simple var keyword without any reference to their type. Unlike similar scripting languages such as Squirrel and JavaScript, COFFEE does not use a function keyword to introduce functions, nor does it require a return type or "void" return like C/C++ - the function definition simply begins with the function name.
COFFEE's memory management is handled entirely by a garbage collection process; essentially this means that it looks after itself, and the programmer seldom needs to worry about it. However, it is possible to control the process explicitly when necessary.
3D graphics programming makes extensive use of certain mathematical techniques, notably trigonometry and vector arithmetic. COFFEE is well equipped in this area, with a good set of mathematical functions and a built-in vector datatype.
Interface with CINEMA 4D
Since COFFEE is used to extend CINEMA 4D, it clearly needs to make use of the host program's features to some extent. Through the application programming interface (API) it is possible to locate 3D objects created by the user and access their internal data structures. For example, a new object can be created or an existing one modified or distorted from a script. Since a major purpose of COFFEE is to allow new file formats to be used, the Cinema API provides features useful for the task; a file input/output class is available and this allows individual items of binary data (such as integers and floating point numbers) to be read and written.
References
- Sterner, Mikael. "What means C.O.F.F.E.E. ? - Plugin Cafe Forums". www.plugincafe.com. Retrieved 14 July 2019.
External links
- Maxon website - the makers of CINEMA 4D and COFFEE.