CLI: support defining custom commands via C++ & Python API

Add support for add-ons to define commands using the new argument
`-c` or `--command`.

Commands behave as follows:

- Passing in a command enables background mode without the need to pass
  in `--background`.
- All arguments following the command are passed to the command
  (without the need to use the `--` argument).
- Add-ons can define their own commands via
  `bpy.utils.register_cli_command` (see examples in API docs).
- Passing in `--command help` lists all available commands.

Ref !119115
This commit is contained in:
Campbell Barton
2024-03-08 11:07:41 +11:00
parent 5214e6f35d
commit 9372e0dfe0
15 changed files with 776 additions and 1 deletions
+4
View File
@@ -21,6 +21,8 @@ __all__ = (
"refresh_script_paths",
"app_template_paths",
"register_class",
"register_cli_command",
"unregister_cli_command",
"register_manual_map",
"unregister_manual_map",
"register_classes_factory",
@@ -49,9 +51,11 @@ from _bpy import (
flip_name,
unescape_identifier,
register_class,
register_cli_command,
resource_path,
script_paths as _bpy_script_paths,
unregister_class,
unregister_cli_command,
user_resource as _user_resource,
system_resource,
)