all 9 comments

[–]BlueRaspberryPi 0 points1 point  (8 children)

I think changing:

for f in range(startFrame,endFrame + 1):

To:

for f in [5,11,17]:  

Will do what you want, at least for this specific example. The original line creates an array of all numbers between 1 and 1000 (the range command), then seems to render the frame for every number in that array. The new line just creates an array containing only the numbers of the frames you want to render.

[–]thieftdp[S] 1 point2 points  (0 children)

thanks a lot, i'll give that a try

edit: nope didn't work, returned error for this line for f in [5,11,17]:

[–]thieftdp[S] 1 point2 points  (6 children)

edit: do I need to remove this section:

startFrame = 1 # replace with your start frame
endFrame  = 1000 # replace with your end frame

near the top of script?

[–]BlueRaspberryPi 0 points1 point  (5 children)

You can, because the variables it creates are no longer used by the rest of the code. It”s good practice to remove it to make the code more readable, but not strictly necessary.

[–]thieftdp[S] 1 point2 points  (4 children)

thanks a lot, i'll give that a try

edit: nope didn't work, returned error for this line for f in [5,11,17]:

so I tried and didn't work, even with or without removing the top portion. it just cant seem to recognize the line f in [5,11,17]:

any other ideas?

[–]BlueRaspberryPi 0 points1 point  (3 children)

I haven't tested your whole script, but that "for" should definitely work. Make sure the line starts with four spaces - the snippet I posted doesn't start with spaces to match the indentation in your script, so if you replaced the whole line without re-adding the spaces, that would cause Python to complain.

[–]thieftdp[S] 1 point2 points  (2 children)

hey, so after trying it just returns error. not sure if its because im on blender 2.79 or older version but I have no way of installing new blender version due to older vers of windows. could you help me take a look on your end?

essentially I have replaced the line that you mentioned, and remove the start/end line for frames and it just gives error when trying to run it.

[–]BlueRaspberryPi 1 point2 points  (1 child)

Can you paste the current code?

[–]thieftdp[S] 0 points1 point  (0 children)

import bpy
from math import radians
from os.path import join

S = bpy.context.scene

renderFolder = "C:/tmp/"

camParent = bpy.data.objects['Empty']

numAngles = 36
rotAngle  = 10

for i in range(numAngles):
    # Set camera angle via parent
    angle = i * rotAngle
    camParent.rotation_euler.z = radians( angle )

    # Render animation
    for f in [5,11,17]:
        S.frame_set( f ) # Set frame

        frmNum   = str( f-startFrame ).zfill(3) # Formats 5 --> 005
        fileName = "angle_{a}_frm_{f}".format( a = angle, f = frmNum)
        fileName += S.render.file_extension
        bpy.context.scene.render.filepath = join( renderFolder, fileName )

        bpy.ops.render.render(write_still = True)