Page MenuHome

Python: frame_set skips frame -1; frame_set(n) sets to frame n-1 for (only) negative number n, and sets to frame n for non-negative number n.
Closed, ResolvedPublic


System Information
Windows 7 64-bit, GTX 580

Blender Version
Broken: BuildBot 2.71 revision ea07d93 (August 18th, 2014), at least all the way back to the beginning of July.

Short description of error

Run a little Python script like this:

import bpy

What frame does that set the scene to? You'd think it would be frame -1, but instead it's frame -2! If you enter any negative number n into frame_set(), it will set the scene to frame n-1. If you enter any non-negative number nn into frame_set, it will set the scene to frame nn.

I've been able to set the frame to -1 only by doing this:


But I don't think that's how it's supposed to work.

Exact steps for others to reproduce the error
This (

) file contains this code:

import bpy
#bpy.context.scene.frame_set(2) #This gives frame 2
#bpy.context.scene.frame_set(1) #This gives frame 1
#bpy.context.scene.frame_set(0) #This gives frame 0
#bpy.context.scene.frame_set(-1) #This gives frame -2
#bpy.context.scene.frame_set(-2) #This gives frame -3
#bpy.context.scene.frame_set(-1,subframe=0.5) #This gives frame -1

Uncomment any one of the lines and verify that the frame that the scene was set to matches the end-of-line comment's predictions.

Event Timeline

Tom Benedett (moak) raised the priority of this task from to 90.
Tom Benedett (moak) updated the task description. (Show Details)
Tom Benedett (moak) edited a custom field.

Odd, seems to have been introduced on purpose in rB94cb20ff4e78bf733c1bf1a89134ad26f26f45aa, but no explanation at all about that… Will revert for now.

Bastien Montagne (mont29) changed the task status from Unknown Status to Resolved.Aug 24 2014, 9:00 AM