Skip to main content

Jumpstart Cinema 4D plugin development

Project description

GitHub license Python Package Upload Python Package

bootstrap4c4d

Simplify your Cinema 4D plugin development process by generating all the necessary c-headers, strings and resources automatically.

Table of contents

  1. Description
  2. Installation
  3. Usage
  4. Examples
  5. Plugins
  6. To do

Description

With bootstrap4c4d you can automate a lot of the back and fore generally associated with writing Cinema 4D plugins. No need to write all those pesky header, string and resource files by hand. Just define them in your plugin.py file and automagically build your plugin.h, plugin.res, plugin.str and plugin.pyp file.

In the following excerpt you can see a very basic setup for a REAL value called STRENGTH which willbe displayed as PERCENT. This is wrappend in a GROUP with the name SETTINGS which is itself wrapped in a CONTAINER that represents the plugin:

#----begin_resource_section----
from bootstrap4c4d import Container, Assignment, Group, Description

strength = Description({
    "id": "STRENGTH",
    "key": "REAL",
    "value": [
        Assignment("UNIT", "PERCENT")
    ],
    "locales": {
        "strings_us": "Strength"
    }
})

settings_group = Group("SETTINGS", {
    "value": [
        strength
    ],
    "locales": {
        "strings_us": "Settings"
    }
})

root = Container("Tmyplugin", {
    "value": [
        Assignment("NAME", "Tmyplugin"),
        Assignment("INCLUDE", "Tbase"),
        Assignment("INCLUDE", "Texpression"),
        settings_group
    ],
    "locales": {
        "strings_us": "My awesome plugin"
    }
})
#----end_resource_section----

#----begin_id_section----
# IDs will be automatically injected
STRENGTH = strength.GetId()
#----end_id_section----

[...]

Building this will result in the following generated files:

tmyplugin.res

CONTAINER Tmyplugin
{
    NAME Tmyplugin;
    INCLUDE Tbase;
    INCLUDE Texpression;
    GROUP SETTINGS
    {
        REAL STRENGTH
        {
            UNIT PERCENT;
        }
    }
}

tmyplugin.h

#ifndef _Oatom_H_
#define _Oatom_H_

enum
{
    Tmyplugin = 72636982,
    SETTINGS = 59543963,
    STRENGTH = 34087515,
};

#endif

tmyplugin.str

STRINGTABLE Tmyplugin
{
    Tmyplugin "My awesome plugin";
    SETTINGS "Base Settings";
    STRENGTH "Strength";
}

tmyplugin.pyp

STRENGTH = 34087515

[...]

Installation

First you need to get the path to c4dpy. On macOS this will be something like this:

/Applications/Maxon Cinema 4D R23/c4dpy.app/Contents/MacOS/c4dpy

For further information about c4dpy please refer to the official documentation.

Next you need to download pip

$ curl https://bootstrap4c4d.pypa.io/get-pip.py -o /path/to/some/directory/get-pip.py

For installing pip you need to make sure to use the path to c4dpy instead of your system's python installation

$ "/Applications/Maxon Cinema 4D R23/c4dpy.app/Contents/MacOS/c4dpy" /path/to/some/directory/get-pip.py

Now you are ready to install bootstrap4c4d via pip

$ "/Applications/Maxon Cinema 4D R23/c4dpy.app/Contents/MacOS/c4dpy" -m pip install bootstrap4c4d-beesperester

Usage

Display available cli arguments:

$ "/Applications/Maxon Cinema 4D R23/c4dpy.app/Contents/MacOS/c4dpy" -m bootstrap4c4d -h

Build

Build an existing python plugin which has already been set up with bootstrap4c4d:

$ "/Applications/Maxon Cinema 4D R23/c4dpy.app/Contents/MacOS/c4dpy" -m bootstrap4c4d build /path/to/your/plugin.py

Create

Create a new tag / object plugin with bootstrap4c4d:

$ "/Applications/Maxon Cinema 4D R23/c4dpy.app/Contents/MacOS/c4dpy" -m bootstrap4c4d create YOUR_PLUGIN_NAME tag /path/to/your/plugin_directory

Examples

Check out tmyplugin.py for a simple working example.

You will notice two types of comments which describe specific parts of your plugin setup.

This will be where you setup the layout of your plugin, this will be omitted in the final output.

#----begin_resource_section----
...
#----end_resource_section----

This will be where you define your plugin IDs, the static IDs will be injected as integers during the build process:

#----begin_id_section----
...
#----end_id_section----

Using bootstrap4c4d like so will build the plugin:

$ "/Applications/Maxon Cinema 4D R23/c4dpy.app/Contents/MacOS/c4dpy" -m bootstrap4c4d build tmyplugin.py

This will result in the following files beeing created:

tmyplugin.pyp # the actual plugin file
res/description/tmyplugin.h # the header file with the IDs
res/description/tmyplugin.res # the layout
res/strings_us/description/tmyplugin.str # the localized strings

Plugins

Plugins build with bootstrap4c4d:

  1. cinema4d-jiggle

To do

  • Rewrite build process in a functional way
  • Add create functionality to cli / io
  • Publish package to pypi

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bootstrap4c4d-beesperester-2.1.0.tar.gz (17.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bootstrap4c4d_beesperester-2.1.0-py3-none-any.whl (19.8 kB view details)

Uploaded Python 3

File details

Details for the file bootstrap4c4d-beesperester-2.1.0.tar.gz.

File metadata

  • Download URL: bootstrap4c4d-beesperester-2.1.0.tar.gz
  • Upload date:
  • Size: 17.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.53.0 CPython/3.9.0

File hashes

Hashes for bootstrap4c4d-beesperester-2.1.0.tar.gz
Algorithm Hash digest
SHA256 494d1b0cd185d45f6e6701579485ac0700853fec8d4556c690f9a44fea09bd71
MD5 2ce0cabbabc5e0615782dd06bc93120b
BLAKE2b-256 58725d2c1208d3bcdb3d3249802f1124a66a6398a4c8f737d0fc9d0928e9427e

See more details on using hashes here.

File details

Details for the file bootstrap4c4d_beesperester-2.1.0-py3-none-any.whl.

File metadata

  • Download URL: bootstrap4c4d_beesperester-2.1.0-py3-none-any.whl
  • Upload date:
  • Size: 19.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.53.0 CPython/3.9.0

File hashes

Hashes for bootstrap4c4d_beesperester-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c0fe02960f03b932cdf9648f452e8a086bbf92f187e4bed14cc14aeeb5c1d5f0
MD5 bb6a667c00fbeae30f4f1c2da99d5618
BLAKE2b-256 977304c4541452d042e6ef2ad05277bfda7f92729599bae917a9fa24ddd936e2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page