在生产环境中部署 Blender¶
本页包含在动画工作室和学校等环境中设置 Blender 的技巧。
这些环境通常对安全性、自动部署和定制化有特殊要求。
安装 Blender¶
Blender downloads can be extracted to any directory on the system, as a self contained installation. Multiple Blender versions can co-exist on the same system, and deployment can be automated using standard file management tools.
New Blender versions may add, remove or change functionality that affects the results of production files. For a given project, it is advisable to use a single LTS version of Blender. LTS versions receive bug fixes for two years.
离线工作¶
出于安全或其他原因,工作站可能无法访问互联网。
默认情况下,Blender 不会访问互联网,但可以在系统偏好设置中通过联机访问选项启用。
脱机工作可通过使用 --offline-mode
命令行参数来强制执行。这样,用户就无法在偏好设置中启用在线访问。
Note
遵循此设置的插件只有在启用的情况下才会连接到互联网。然而,Blender 无法阻止第三方插件违反这一规则。
捆绑扩展¶
When working offline or in a more controlled environment, it may be useful to provide a set of extensions to all users. For this there is a default read-only System repository. This repository can for example be located on a read-only network drive or in a system directory.
The $BLENDER_SYSTEM_EXTENSIONS
environment variable
controls the default location. This should point to a directory, within
which a system
directory should exist.
Extensions packages should be extracted in this system
directory,
with a resulting path like this:
$BLENDER_SYSTEM_EXTENSIONS/system/my-addon/blender_manifest.toml
In the Extensions preferences, it's possible to manually set a custom directory for the default System repository, or to create multiple repositories.
捆绑脚本¶
Besides extensions, it's possible to bundle scripts for presets, application templates, legacy add-ons, as well as scripts run on startup.
Script directories can be manually added in the File Paths preferences.
The $BLENDER_SYSTEM_SCRIPTS
can also be used to add a script directory
without modifying the preferences.
These script directories are expected to contain specific directories
like presets
, addons
and startup
for different types of
scripts. See 路径布局 for a complete list.
启动脚本¶
Blender Python API 可用于定制 Blender。这包括更改偏好设置、更改启动文件和添加用户界面元素。
例如,一个可以为每个用户启用插件的脚本。
$BLENDER_SYSTEM_SCRIPTS/startup/enable_addons.py
def register():
import addon_utils
addon_utils.enable("my-addon")
def unregister():
pass
if __name__ == "__main__":
register()
应用模板¶
应用模板可以用来为特定任务或项目设置 Blender,与默认配置分开。创建新文件时,用户可以选择模板。
这些文件应该像这样放置在系统脚本目录中:
$BLENDER_SYSTEM_SCRIPTS/startup/bl_app_templates_system/MyTemplate/__init__.py
$BLENDER_SYSTEM_SCRIPTS/startup/bl_app_templates_system/MyTemplate/startup.blend
旧式插件¶
尚未转换为扩展的插件需要放在 addons
脚本目录中。
例如,插件可以位于:
$BLENDER_SYSTEM_SCRIPTS/addons/simple_addon.py
$BLENDER_SYSTEM_SCRIPTS/addons/complex_addon/__init__.py
VFX 平台¶
Blender follows the VFX reference platform, which means it is able to run on the same systems as other VFX software and exchange image, volume and scene files with them.
Python 版本¶
Blender and the bpy module are only compatible with a single Python version. This makes it possible for add-ons and VFX software in general to only have to target a single Python version.
Blender bundles a complete Python installation and does not interact with the
system Python by default. This can be changed with the --python-use-system-env
command line argument, if care is
taken to set up a compatible Python version.