Blender 2.5 Python animated world texture setup

匿名 (未验证) 提交于 2019-12-03 01:34:02

问题:

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 

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()?

回答1:

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 

Tested with blender 2.58a



易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!