Skip to content

alivirgo/Major-AI-Skills / plugins/mas-3d-games/skills/cinema-4d

cinema-4d

Verified

Script Cinema 4D scenes with c4dpy and the Maxon API, wire MoGraph/Fields systems, and debug Redshift GPU renders, AOVs, and headless Commandline farm jobs agents routinely miss.

FileKindSize
SKILL.mdskill md9.1 KB
gemini.mdmarkdown3.1 KB
gpt.mdmarkdown4.5 KB
---
title: "Maxon Cinema 4D AI Skill Guide (GPT & Codex)"
description: "Operational skill for GPT/Codex to author c4dpy batch scripts, Commandline farm wrappers, MoGraph setup generators, and Redshift preflight validators with build pinning and zero invented credentials."
category: "3D Motion Graphics & Visual Effects"
tags: ["cinema-4d", "c4dpy", "mograph", "redshift", "commandline", "gpt-codex", "ci-render"]
---

# Maxon Cinema 4D AI Skill Guide (GPT & Codex)

## Overview & Engine Architecture

GPT/Codex acts as a **C4D Pipeline TD**: emit **parameterized `c4dpy` modules**, **Commandline wrappers**, **MoGraph scaffolding scripts**, and **preflight validators** (missing textures, camera present, Redshift renderer assigned). Never assume a GUI Script Manager context.

```
┌─────────────────────────────────────────────────────────────┐
│                 C4D automation stack                        │
│  c4dpy job.py → LoadDocument → mutate OM → Save/Export      │
│  Commandline -render -frame -oimage (farm)                  │
│  CI: version print + exit 1 on LoadDocument failure         │
└─────────────────────────────────────────────────────────────┘
```

---

## Operational Capabilities & Agent Directives

1. **Scaffold argparse-style argv** after the script path: scene, frames, output dir, camera name.
2. **Idempotent MoGraph**: find Cloner/Effector by name before `InsertObject`.
3. **Always `KillDocument`** in `finally` / after export.
4. **Farm wrapper**: print C4D version first; require absolute paths passed by the scheduler—do not hardcode machine-local drives unless the user provided them.
5. **Redshift gate**: script that lists texture paths and fails if any `os.path.exists` is false.
6. **No secrets**: refuse to invent Maxon license servers, Team Render passwords, or registry tweaks—ask for existing ops docs.

---

## Production Python: missing-texture preflight

```python
"""Fail CI if any Bitmap shader path is missing on disk.
Run: c4dpy preflight_textures.py scene.c4d
"""
from __future__ import annotations

import os
import sys

import c4d
from c4d import documents


def iter_bitmaps(doc: c4d.documents.BaseDocument):
    mat = doc.GetFirstMaterial()
    while mat:
        # Walk shader tree lightly — extend for studio shader conventions
        shader = mat[c4d.MATERIAL_COLOR_SHADER]
        if shader and shader.CheckType(c4d.Xbitmap):
            yield mat.GetName(), shader[c4d.BITMAPSHADER_FILENAME]
        mat = mat.GetNext()


def main(scene_path: str) -> None:
    doc = documents.LoadDocument(scene_path, c4d.SCENEFILTER_MATERIALS)
    if doc is None:
        print("C4D_PIPELINE_FAIL load", scene_path, file=sys.stderr)
        sys.exit(1)
    missing = []
    for mat_name, path in iter_bitmaps(doc):
        if path and not os.path.isfile(path):
            missing.append(f"{mat_name}: {path}")
    documents.KillDocument(doc)
    if missing:
        print("\n".join(missing))
        sys.exit(1)
    print("texture preflight OK")


if __name__ == "__main__":
    main(sys.argv[1] if len(sys.argv) > 1 else "")
```

---

## Technical Troubleshooting Matrix

| CI/farm signature | Automation check | Script fix |
| :--- | :--- | :--- |
| Exit 0 but empty frames | No assert on camera / renderer | Fail if `doc.GetActiveBaseDraw()` camera null |
| Texture pink / black on node | Relative path not remapped | Collect assets; rebase paths before submit |
| MoGraph duplicate each re-run | Create without name lookup | `doc.SearchObject("Cloner_Hero")` first |
| USD plugin ID wrong | Hardcoded ID from old build | Resolve via `plugins.FindPlugin` |

---

## Best Practices

1. Emit `.bat`/`.sh` wrappers that take `$SCENE` `$START` `$END` `$OUT` from the farm.
2. Prefer EXR multi-pass configs checked into the repo as a Take preset—not one-off UI clicks.
3. Unit-test Python with small fixture `.c4d` under `tests/fixtures/` (no client IP).

---

## Limitations

- Classic OM ≠ Scene Nodes; generate the API family the shot actually uses.
- Headless Redshift still needs a licensed GPU worker—scripting cannot bypass licensing.

---

## Agent Operational Directive

> **MANDATORY**: Generate headless-safe `c4dpy` with non-zero exits and document cleanup. Pin builds. Never invent license or credential values. Prefer preflight (textures, camera, paths) before Commandline submit.
finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the workStars: 323kUpdated Claude CodeCodexVerifiedInstall
systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixesStars: 323kUpdated Claude CodeCodexVerifiedInstall
test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation codeStars: 323kUpdated Claude CodeCodexVerifiedInstall
skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.Stars: 198kUpdated Claude CodeCodexVerifiedInstall