blender bpy 常见操作命令

blender bpy 常见操作命令 目录bpy安装使用节点添加节点添加mp4 或图片开启运动模糊bpy安装pip install bpy -i https://pypi.tuna.tsinghua.edu.cn/simple使用节点bpy.context.scene.use_nodes True添加节点bpy.ops.node.add_node(typeCompositorNodeImage, use_transformTrue)添加mp4 或图片bpy.ops.node.add_file(filepathF:\\test_222.mp4)bpy.data.scenes[Scene].node_tree.nodes[图像.001].frame_duration 10000bpy.data.scenes[Scene].node_tree.nodes[图像.001].use_cyclic Truebpy.data.scenes[Scene].node_tree.nodes[缩放].space RENDER_SIZE渲染属性胶片-透明bpy.context.scene.render.film_transparent True添加输出节点bpy.ops.node.add_node(typeCompositorNodeOutputFile, use_transformTrue)合成使用alpha 通道bpy.data.scenes[Scene].node_tree.nodes[合成].use_alpha False开启运动模糊bpy.context.scene.render.use_motion_blur Truebpy.context.scene.render.motion_blur_shutter 0.5bpy.context.scene.render.motion_blur_samples 16在这个示例中我们首先设置了渲染参数包括渲染引擎、分辨率、渲染百分比、运动模糊开关、快门时间和样本数。然后我们使用 bpy.ops.render.render() 方法来渲染场景。请注意在这个示例中我们设置了 use_motion_blur 为 True 来启用运动模糊并将 motion_blur_shutter 设置为 0.5表示快门时间为 0.5 帧。我们还将 motion_blur_samples 设置为 16以增加模糊效果的质量。你可以根据需要自定义这些参数。请注意如果你想渲染动画序列并添加运动模糊效果则需要将 animation 参数设置为 True。# 渲染动画序列bpy.ops.render.render(animationTrue, write_stillTrue)