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:
20
source/blender/python/intern/bpy_cli_command.h
Normal file
20
source/blender/python/intern/bpy_cli_command.h
Normal file
@@ -0,0 +1,20 @@
|
||||
/* SPDX-FileCopyrightText: 2023 Blender Authors
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
/** \file
|
||||
* \ingroup pythonintern
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern PyMethodDef BPY_cli_command_register_def;
|
||||
extern PyMethodDef BPY_cli_command_unregister_def;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user