python - Blender 2.5 Python 动画世界纹理设置

标签 python blender blender-2.50 bpython

我需要使用 python 在 blender 2.58 中设置动画(即来自视频文件)世界纹理。 我制作了这样的纹理:

import bpy
# create new clouds texture
bpy.ops.texture.new()
wtex = bpy.data.textures[-1]
# set World texture
wrld = bpy.data.worlds['World']
slot = wrld.texture_slots.add()
slot.texture = wtex
slot.use_map_horizon = True

这将创建一个新的 CloudsTexture 并将其绑定(bind)到插槽。如何制作 ImageTexture 并将其设置为将视频作为源?或者,如何指定由 bpy.ops.texture.new() 制作的新纹理的类型?

最佳答案

对于数据的添加/删除,最好不要使用运算符,我们有来自 bpy.data 的 api 函数。

import bpy
# create new clouds texture
wtex = bpy.data.textures.new(name="MyTexture", type='IMAGE')
# set World texture
wrld = bpy.context.scene.world
if wrld:
    slot = wrld.texture_slots.add()
    slot.texture = wtex
    slot.use_map_horizon = True

使用 blender 2.58a 测试

关于python - Blender 2.5 Python 动画世界纹理设置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6681039/

相关文章:

Python 3 - 从低于 1920x1080 的文件夹中删除图片

python - mustache /pystache : Rendering complex objects

javascript - 使用 Three.js (JSON) 导出器在 Three.js 中加载 Blender 动画

blender - 重置动画时间轴 - blender 2.6

Blender如何使脸的边缘变圆

python - 将 Pandas Dataframe 转换为 numpy 数组

python - 如何在python中生成没有重复字符的组合?

ios - blender 和 xcode 之间的工作流程(scenekit)

javascript - 将模型导入 three.js - 性能

blender - 如何分析Blender的源代码