Page MenuHome

shape keys created while the Relative checkbox is unchecked start out with frame=0
Closed, ResolvedPublic

Description

System Information
Linux bubastis 3.10.25-gentoo #10 SMP Thu Jan 30 22:17:35 UTC 2014 x86_64 Intel(R) Core(TM) i7-4800MQ CPU @ 2.70GHz GenuineIntel GNU/Linux
01:00.0 VGA compatible controller: NVIDIA Corporation GK107GLM [Quadro K1100M] (
rev a1) (prog-if 00 [VGA controller])

Blender Version
Broken: 2.70

Short description of error
When creating shape keys if the Relative checkbox is checked the hidden "frame" field is set to max(frame)+0.1 . Relative shape keys don't actually use the frame field, so this is irrelevant.

However, if the Relative checkbox is unchecked (for absolute shape keys) then the hidden frame field is set to 0.0 for new shape keys. Since absolute shape keys need this frame field to be something distinct, this seems to be a bad thing.

Exact steps for others to reproduce the error
Based on a (as simple as possible) attached .blend file with minimum amount of steps

select the default Cube. go to the mesh properties and add four shape keys.

Then run this python script with the cube still selected:

import bpy
import bmesh

def dump(mesh):

    bm = bmesh.new()
    bm.from_mesh(mesh)

    for key in bm.verts.layers.shape.keys():
        val = bm.verts.layers.shape.get(key)
        print("%s = %s" % (key,val) )
        sk=mesh.shape_keys.key_blocks[key]
        print("v=%f, f=%f" % ( sk.value, sk.frame))
        for i in range(len(bm.verts)):
            v = bm.verts[i]
            delta = v[val] - v.co
            if (delta.length > 0):
                print ( "v[%d]+%s" % ( i,delta) )

dump(bpy.context.active_object.data)

You will get something like this:

Basis = <BMLayerItem object at 0x7f8e15604270>
v=0.000000, f=0.000000
Key 1 = <BMLayerItem object at 0x7f8e156042a0>
v=0.000000, f=0.100000
Key 2 = <BMLayerItem object at 0x7f8e156042d0>
v=0.000000, f=0.200000
Key 3 = <BMLayerItem object at 0x7f8e15604270>
v=0.000000, f=0.300000

The frame value for each created shape key is incremented relative to the previous, but since these are relative shape keys it does not matter.

Now delete all but the basis key.
Uncheck Relative.
Add 3 more (absolute) shape keys.
Run the python fragment to examine the secret frame field.

It will look like this:

Basis = <BMLayerItem object at 0x7f8e15604270>
v=0.000000, f=0.000000
Key 1 = <BMLayerItem object at 0x7f8e156042d0>
v=0.000000, f=0.000000
Key 2 = <BMLayerItem object at 0x7f8e156042a0>
v=0.000000, f=0.000000
Key 3 = <BMLayerItem object at 0x7f8e15604270>
v=0.000000, f=0.000000

In the situation where the frame value is actually relevant, new keys are created with a somewhat useless value.

You can extend the test by actually altering one of the shape keys. I recommend dragging a vertex for Key 2 and then set your Evaluation Time to 30. The cube does not deform. Click Reset Timings and then the cube deforms.

This is not a showstopper since the Reset Timing button will fix it, but it is a speedbump that will trip up any new users whose understanding of absolute shape keys is weak. The fact that "frame" does not appear in the UI compounds the problem.

Event Timeline

Robert Forsman (mutantbob) created this task.
Robert Forsman (mutantbob) raised the priority of this task from to Needs Triage by Developer.
Bastien Montagne (mont29) triaged this task as Normal priority.