COFFEE (Cinema 4D)
   HOME

TheInfoList



OR:

COFFEE (often written as "C.O.F.F.E.E") was a
computer A computer is a machine that can be programmed to Execution (computing), carry out sequences of arithmetic or logical operations (computation) automatically. Modern digital electronic computers can perform generic sets of operations known as C ...
scripting language A scripting language or script language is a programming language that is used to manipulate, customize, and automate the facilities of an existing system. Scripting languages are usually interpreted at runtime rather than compiled. A scripting ...
that forms part of
CINEMA 4D Cinema 4D is a 3D software suite developed by the German company Maxon. Overview As of R21, only one version of Cinema 4D is available. It replaces all previous variants, including BodyPaint 3D, and includes all features of the past 'Studio' ...
, a proprietary 3D graphics application. Although presented as an
acronym An acronym is a word or name formed from the initial components of a longer name or phrase. Acronyms are usually formed from the initial letters of words, as in ''NATO'' (''North Atlantic Treaty Organization''), but sometimes use syllables, as ...
the letters of the word COFFEE allegedly stand for ''Cinema Object-oriented Fery Fast Environment Enhancer'', it is primarily a comic reference to
Java Java (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's List ...
, 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 Memory management is a form of resource management applied to computer memory. The essential requirement of memory management is to provide ways to dynamically allocate portions of memory to programs at their request, and free it for reuse when ...
on the user's behalf, where C does not; * The language interpreter does not require programs to be
compiled In computing, a compiler is a computer program that translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primarily used for programs that ...
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 In the industrial design field of human–computer interaction, a user interface (UI) is the space where interactions between humans and machines occur. The goal of this interaction is to allow effective operation and control of the machine f ...
and extensions for reading and writing new file formats and creating texture
shaders In computer graphics, a shader is a computer program that calculates the appropriate levels of light, darkness, and color during the Rendering (computer graphics), rendering of a 3D scene - a process known as ''shading''. Shaders have evolved ...
. 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 A bracket is either of two tall fore- or back-facing punctuation marks commonly used to isolate a segment of text or data from its surroundings. Typically deployed in symmetric pairs, an individual bracket may be identified as a 'left' or 'r ...
'' language and so it would look familiar to any previous user of C/C++, Java,
Perl Perl is a family of two high-level, general-purpose, interpreted, dynamic programming languages. "Perl" refers to Perl 5, but from 2000 to 2019 it also referred to its redesigned "sister language", Perl 6, before the latter's name was offici ...
or anything along those lines. The function and object class definitions are closely modelled after those of C++. However, COFFEE is
dynamically typed In computer programming, a type system is a logical system comprising a set of rules that assigns a property called a type to every "term" (a word, phrase, or other set of symbols). Usually the terms are various constructs of a computer progra ...
, and so variables are defined with a simple ''var'' keyword without any reference to their type. Unlike similar scripting languages such as
Squirrel Squirrels are members of the family Sciuridae, a family that includes small or medium-size rodents. The squirrel family includes tree squirrels, ground squirrels (including chipmunks and prairie dogs, among others), and flying squirrels. Squ ...
and
JavaScript JavaScript (), often abbreviated as JS, is a programming language that is one of the core technologies of the World Wide Web, alongside HTML and CSS. As of 2022, 98% of Website, websites use JavaScript on the Client (computing), client side ...
, 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 Waste collection is a part of the process of waste management. It is the transfer of solid waste from the point of use and disposal to the point of treatment or landfill. Waste collection also includes the curbside collection of recyclable m ...
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 Trigonometry () is a branch of mathematics that studies relationships between side lengths and angles of triangles. The field emerged in the Hellenistic world during the 3rd century BC from applications of geometry to astronomical studies. T ...
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 An application programming interface (API) is a way for two or more computer programs to communicate with each other. It is a type of software interface, offering a service to other pieces of software. A document or standard that describes how t ...
(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

{{Reflist


External links


Maxon website
- the makers of CINEMA 4D and COFFEE. Scripting languages