C.O.F.F.E.E. Filter

Introduction

With the upcoming Cinema 4D R20, C.O.F.F.E.E. scripting language will be removed from Cinema 4D.

The C.O.F.F.E.E. Filter plugin is supposed to help locate scenes, which are making use of C.O.F.F.E.E. in any way, and furthermore to provide easy access to the involved C.O.F.F.E.E. code.

C.O.F.F.E.E. Filter plugin will not convert or port existing C.O.F.F.E.E. code to Python (or anything else). It just provides means to locate scenes containing C.O.F.F.E.E. and an easy way to get to the code inside of the scene.

C.O.F.F.E.E. Filter can and will not erase files.
C.O.F.F.E.E. Filter will not overwrite files.

General Workflow within Cinema 4D

General Workflow
The general workflow consists of two main steps:

  1. Importing scene files
    • Optionally filtering and selecting the results of the import
  2. Clicking an entity’s icon in order to open the scene an see the C.O.F.F.E.E. code in Attribute Manager

Where to Find the Plugin
C.O.F.F.E.E Filter can be found in the Plugins menu:

Main Dialog
The main dialog looks like so:

Menus

File

Open File

Import a single .c4d scene file.

Open folder

Import all .c4d scene files that are in a selected directory.

Open one level of subfolders

Import all .c4d scene files that are in a given directory and one level below. This option is meant for people with a project folder, which then contains sub-directories for different projects, but who do not want to scan any backup sub-directories possibly contained in the actual project directories..

Open all subfolders

Import all .c4d scene files that are in a given directory (including all sub-directories).

It’s also possible to drag files or folders from Explorer or Finder onto this dialog in order to get them imported.

Example of a directory tree and the differences between all three options:

Open current Document

Import the currently active scene. The document needs a name, so it either got loaded or needs to be saved at least one time.

Open all opened Document

Import all open scenes. The documents need to have names, so either got loaded or need to be saved at least one time.

Content Browser

Import all items from your personal content preset library to the dialog.

While we use this plugin internally to scan our own content libraries, these are excluded in the published version. This was not done to hide anything, but to reduce the results to those relevant for a user. The content libraries delivered with R20 will not contain any C.O.F.F.E.E. scene.
Search COFFEE plugins

Import COFFEE plugins from current Cinema 4D instance located in theses directories:

  • Cinema 4D plugins folder in program installation folder
  • Cinema 4D plugins folder in user’s home
  • Path(s) defined in C4D_PLUGINS_DIR environment variable

Edit

Remove

Remove entries from result list according to the option chosen (see below). It will not delete any files.

COFFEE found

Remove results which contain at least one C.O.F.F.E.E. element. These are usually scene files which need action in order to work properly in R20.

No COFFEE

Remove results which do not contain any C.O.F.F.E.E. elements.

Preset

Remove results from a Content Browser library scan.

Plugin

Remove results from Plugin scan.

Filtering Results

In order to get a quick overview of the results of an import operation, one can easily hide certain groups of files.

COFFEE found

Yellow – Display results which contain at least one C.O.F.F.E.E. element, most likely results which need action in order to work properly in R20.

No COFFEE

Green – Display results which contain no C.O.F.F.E.E. elements at all, probably candidates to be removed from the result list.

Accessing C.O.F.F.E.E. code
After one or multiple scene files have been imported, they are displayed in the result list, as shown below.

Click on the icon allow you to directly access to the C.O.F.F.E.E. elements.

Refresh

Refresh the status of a file. For example after removing a C.O.F.F.E.E. node.

If this file is currently open in Cinema 4D, the plugin will use this document and not the one from disk.
Open

Open the given scene file in Cinema 4D.

View in Explorer/Finder

Open the given scene in Windows Explorer or Finder on macOS.

Remove

Remove the file from the result list. The file will not be deleted, just removed from the list.

List of C.O.F.F.E.E. usage

Clicking an icon will open the file if needed and the C.O.F.F.E.E element specific C.O.F.F.E.E. element will be selected so it is shown in the Attribute Manager.

If a C.O.F.F.E.E. node is within an Xpresso tag and this node is within a locked xgroup only the group is displayed. Locked nodes/xgroups will not expose code.

General Workflow on Command Line

The general workflow from command line is pretty much the same as the one described above.

Basically one sets a file/folder to scan and it will write the result list with C.O.F.F.E.E. elements to a file.

In contrast to the UI command of this plugin, the command line can be used with version of Cinema 4D down to R16.

Command Line Options

All command line options need to be enclosed with double quotes.
Option Description
-COFFEEFilter This argument needs to be the first one.
Scan file/folder specified directly next to this parameter: -COFFEEFilter ‘FILE_OR_FOLDER_PATH’
Import options (only one possible)
-Folder
-OneLevel
-SubFolder
If path to process is a file this option is ignored.
-Folder (default behavior): Process only the content of the folder, same as described for File Menu => Open Folder
-OneLevel: Process folder and one level of sub-folders, same as described for File Menu => Open one level of subfolder
-SubFolder: Process folder and all sub-folders, same as described for File Menu => Open all subfolders
-CheckPlugins Process plugins folder, same as File Menu => Search COFFEE plugins
-OnlySceneWithCoffee Only scenes with C.O.F.F.E.E. will be in result list.
-Output Write result list to a file, specified directly next to this parameter -Output ‘FILEPATH’
The output format depends on the -Json option.
If the file can’t be written for any reason, results are printed to the console.
-OverwriteOutput Allow to overwrite the result list file. If this option is not set and the result list file can not be written, results are printed to the console.
-Json The result list will be in JSON format.

Example 1

Check all files from {your path}/CS Cluster/ (including its first level of sub-folders) and plugins folders, write the result list to {your path}/result.txt and allow to overwrite this resulting text file (in case the operation is run more than once).

“CINEMA 4D.exe” “-COFFEEFilter ‘{your path}/CS Cluster/’ -SubFolder -Output ‘{your path}/result.txt’ -OverwriteOutput -CheckPlugins”

Example 1 Output

Write result list to: {your path}/CS Cluster\result.txt

Each line of the result list file contains the following: FILE, C.O.F.F.E.E. Element Count

{your path}\\scenes\\02_to_translate\\COFFEE\\CS Cluster\\CS Cluster\\CS Cluster.c4d, 5<br>
{c4d installation path}\\Cinema 4D R19\\plugins\\Commentator\\commentator.cob, 1<br>
{c4d installation path}\\Cinema 4D R19\\plugins\\cinema4dsdk\\res\\scene\\stairs.c4d, 0

Example 2

Check all files from {your path}/CS Cluster/ (including its first level of sub-folders) and plugins folders, write the result list to {your path}/CS Cluster/result.json and allow to overwrite this resulting text file (in case the operation is run more than once).

CommandLine.exe “-COFFEEFilter ‘{your path}/CS Cluster/’ -SubFolder -Output ‘{your path}/CS Cluster/result.json’ -Json -OverwriteOutput -CheckPlugins”

Example 2 Output

Write result list in JSON file format to: {your path}/CS Cluster/result.json

[
    {
        "path": "{your path}\\CS Cluster\\CS Cluster.c4d",
        "coffee": [
            "CS-Cluster->XPresso->XGroup::C.O.F.F.E.E.->C.O.F.F.E.E.",
            "CS-Cluster->XPresso->XGroup::C.O.F.F.E.E.->C.O.F.F.E.E.",
            "CS-Cluster->XPresso->XGroup::Framestart->Framestart",
            "CS-Cluster->XPresso->XGroup::RIGHT Instance Maker->RIGHT Instance Maker",
            "CS-Cluster->XPresso->XGroup::LEFT Instance Maker->LEFT Instance Maker"
        ]
    },
    {
        "path": "{c4d installation path}\\plugins\\Commentator\\commentator.cob",
        "coffee": [
            "commentator.cob"
        ]
    },
    {
        "path": "{c4d installation path}\\plugins\\cinema4dsdk\\res\\scene\\stairs.c4d",
        "coffee": []
    },
]

Limitations

  1. Content Browser scanning is not available through command line.
  2. Xpresso presets can not be scanned. If you need to check them, create an Xpresso tag and drag all your presets into it, save the scene, then run the plugin.
  3. While loading some files a message dialog may open for example in case of missing assets from Substance module. The plugin will hang until an user interaction. There is no way for the plugin to bypass theses messages.

Installation

Unzip the downloaded archive to Cinema 4D’s default plugin folder.

Requirements

For use as a Command inside of Cinema 4D user interface, Cinema 4D R19 (Windows or Mac) is required.
For use on the command line (batch mode), Cinema 4D R16 (Windows or Mac) is required.

Download

  coffeefilter_1.0.0.zip (357.7 KiB)

Please rate this

Leave a Reply

Your email address will not be published. Required fields are marked *