Blender 2.5 Python动画世界纹理设置 [英] Blender 2.5 Python animated world texture setup

查看:160
本文介绍了Blender 2.5 Python动画世界纹理设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用Python在Blender 2.58中设置动画(即从视频文件)世界纹理. 我制作这样的纹理:

I need to set up an animated (i.e. from video file) world texture in blender 2.58 using python. I make a texture like this:

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 并将其绑定到插槽.如何制作 ImageTexture 并将其设置为以视频作为源?或者,如何指定由bpy.ops.texture.new()制作的新纹理的类型?

This creates a new CloudsTexture and binds it to slot. How can I make an ImageTexture and set it up to have a video as a source? Or, how can I specify the type of a new texture made by bpy.ops.texture.new()?

推荐答案

对于数据添加/删除,最好不要使用运算符,为此,我们从bpy.data提供了api函数.

For data addition/removal, its best not to use operators, we have api functions from bpy.data for this.

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

经过搅拌器2.58a测试

Tested with blender 2.58a

这篇关于Blender 2.5 Python动画世界纹理设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆