0

I load an animated texture in Blender 2.58 using python like this (see this question earlier):

#setup world
wtex = bpy.data.textures.new(name="WorldTexture", 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
    img=bpy.data.images.load(filepath='\\vtex.avi')
    if img:
      slot.texture.image=img

How can I get the number of frames in the video (img)? Blender obviously does it when loading a texture from GUI, but I didn't find a way to make it from Python.

Community
  • 1
  • 1
bonext
  • 147
  • 5
  • I realized blender was installed on a computer at the office, so I had a shot, but unfortunatly couldn't find anything. If you load it as a texture instead there is a `animFrames` property, but it was always `100` on the files I tested :( – carlpett Jul 14 '11 at 14:56
  • Thanks for noticing, that might help. I'll check it tomorrow. – bonext Jul 14 '11 at 20:57

1 Answers1

0

Use img.frame_duration; It gives the total number of frames in the video.

tshepang
  • 12,111
  • 21
  • 91
  • 136
kivig
  • 116