Skip to content

Commit 130382e

Browse files
docs: document pre-GUI submission hooks for Cinema 4D
Add a "Pre-GUI Submission Hooks" section to the README covering the pre-GUI hook support added to the Cinema 4D submitter (PR #480): - enabling env-sourced hooks (settings.allow_environment_hooks) and pointing DEADLINE_HOOKS_DIR at a hooks directory; - a hooks.yaml preGUI entry and a sample pregui_hook.py that reads the submission metadata on stdin and returns name/description/parameters (incl. deadline: job properties and CondaPackages) on stdout; - which submitter fields get pre-populated (Name/Description + the shared job-settings fields) and which Cinema 4D scene/render settings are NOT touched by the hook; - the Job Submission Confirmation prompt and settings.auto_accept. Docs only; no code changes. Signed-off-by: Leon Li <2182521+leon-li-inspire@users.noreply.github.com>
1 parent 3210d7a commit 130382e

1 file changed

Lines changed: 93 additions & 0 deletions

File tree

README.md

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ For instructions on installing and using this integration, visit the [user guide
1313
[cmf-ubl]: https://docs.aws.amazon.com/deadline-cloud/latest/developerguide/cmf-ubl.html
1414
[deadline-cloud]: https://docs.aws.amazon.com/deadline-cloud/latest/userguide/what-is-deadline-cloud.html
1515
[deadline-cloud-client]: https://github.com/aws-deadline/deadline-cloud
16+
[submission-hooks]: https://github.com/aws-deadline/deadline-cloud#submission-hooks
1617
[openjd-template]: https://github.com/OpenJobDescription/openjd-specifications/wiki/2023-09-Template-Schemas
1718
[openjd-adaptor-runtime]: https://github.com/OpenJobDescription/openjd-adaptor-runtime-for-python
1819
[openjd-adaptor-runtime-lifecycle]: https://github.com/OpenJobDescription/openjd-adaptor-runtime-for-python/blob/release/README.md#adaptor-lifecycle
@@ -139,6 +140,98 @@ chmod +x ~/Desktop/Cinema4D.command
139140

140141
To open Cinema 4D on Mac, click `Cinema4D.command` on your desktop. After you load a scene, click on `Extensions` > `AWS Deadline Cloud Submitter` to view the submitter.
141142

143+
## Pre-GUI Submission Hooks
144+
145+
The Cinema 4D submitter supports **pre-GUI hooks** — studio-provided scripts that run *before* the
146+
`Submit to AWS Deadline Cloud` dialog opens, so you can pre-populate the job name, description, and
147+
shared job properties (priority, maximum failed tasks, maximum retries, Conda packages, etc.). This
148+
is useful for enforcing studio defaults or pulling values from a pipeline / asset-management system
149+
before an artist sees the dialog.
150+
151+
Pre-GUI hooks are provided by the [AWS Deadline Cloud client library][deadline-cloud-client] and are
152+
shared across DCC submitters. For Cinema 4D, hooks are sourced only from the directory named by the
153+
`DEADLINE_HOOKS_DIR` environment variable — the Cinema 4D submitter has no on-disk job bundle at
154+
pre-GUI time, so bundle-sourced hooks do not apply. They complement the `preSubmission` /
155+
`postSubmission` hooks that run at submit time (see [Submission Hooks][submission-hooks]).
156+
157+
Pre-GUI hook support requires the `deadline` client library that ships with
158+
`deadline-cloud-for-cinema-4d[gui]` (`deadline[gui] >= 0.60.4`), which is installed for you when you
159+
install the submitter as described above.
160+
161+
### Enabling pre-GUI hooks
162+
163+
1. Allow environment-sourced hooks in your Deadline Cloud configuration (off by default):
164+
```
165+
deadline config set settings.allow_environment_hooks true
166+
```
167+
2. Point `DEADLINE_HOOKS_DIR` at a directory that holds your hook script(s) and a `hooks.yaml`.
168+
169+
On Windows (`cmd`):
170+
```cmd
171+
setx DEADLINE_HOOKS_DIR "C:\deadline-hooks"
172+
```
173+
On macOS/Linux:
174+
```
175+
export DEADLINE_HOOKS_DIR="$HOME/deadline-hooks"
176+
```
177+
Restart Cinema 4D (or log out/in on Windows) so the running Cinema 4D process picks up the
178+
environment variable before you open the submitter.
179+
3. Create `hooks.yaml` in that directory with a `preGUI` entry:
180+
```yaml
181+
preGUI:
182+
- command: C:/Program Files/Python311/python.exe
183+
args:
184+
- C:/deadline-hooks/pregui_hook.py
185+
timeout: 60
186+
```
187+
**Tip:** point `command` at a clean, standalone Python interpreter rather than Cinema 4D's
188+
bundled interpreter — a bundled interpreter can print a startup banner to stdout that corrupts
189+
the hook's JSON output.
190+
191+
### Writing a pre-GUI hook
192+
193+
A pre-GUI hook receives the current submission metadata as JSON on **stdin** and returns the fields
194+
it wants to override as JSON on **stdout**. Recognized keys are `name`, `description`, and
195+
`parameters` (a map of parameter name → value). `deadline:`-prefixed keys map to shared job
196+
properties — for example `deadline:priority`, `deadline:maxFailedTasksCount`, and
197+
`deadline:maxRetriesPerTask` — and `CondaPackages` overrides the Conda packages queue parameter.
198+
199+
```python
200+
# pregui_hook.py
201+
import json, sys
202+
203+
metadata = json.load(sys.stdin) # jobName, submitterName ("cinema4d"), parameters, farmId, queueId, ...
204+
205+
print(json.dumps({
206+
"name": "MyStudio Shot 010",
207+
"description": "Submitted via MyStudio pipeline",
208+
"parameters": {
209+
"deadline:priority": 75,
210+
"deadline:maxFailedTasksCount": 5,
211+
},
212+
}))
213+
```
214+
215+
When the submitter opens, its **Name** / **Description** and **Priority** / **Maximum failed tasks
216+
count** / **Maximum retries per task** fields on the shared job settings tab (plus any other
217+
returned shared parameters, such as `CondaPackages`) are pre-populated from the hook's output.
218+
219+
> **Note:** pre-GUI hooks set the shared job properties above; they do **not** set the Cinema
220+
> 4D-specific render options (take selection, frame range, output path, multi-pass path, tile
221+
> rendering, chunk size, error checking, detailed logging, etc.). Those are initialized from the
222+
> Cinema 4D scene's render settings and the per-scene sticky settings, and remain editable in the
223+
> submitter UI.
224+
225+
### Confirmation prompt
226+
227+
Before running any hooks, the submitter shows a **Job Submission Confirmation** dialog listing the
228+
hook scripts that will execute. Click **Yes** to run them, or **No** to cancel — clicking **No**
229+
aborts opening the submitter cleanly (no error). To skip the prompt on non-interactive or
230+
studio-locked workstations, enable auto-accept:
231+
```
232+
deadline config set settings.auto_accept true
233+
```
234+
142235
## Adaptor
143236

144237
Jobs created by the Cinema 4D submitter require the adaptor to be installed on your worker hosts.

0 commit comments

Comments
 (0)