Adjust Last Operation Changes Visible Bone Layers

I’m writing an addon for rigging (ChainTools ), and I want to find out if I’ve discovered a bug. If so, I hope someone can give me suggestions on a workaround!

When I change armature layers and then use the operators defined in my addon, and then use the Adjust Last Operation panel, the armature layers are changed back to whatever they were before I used my operators.The change in layers only occurs if I use a float or int bpy_prop and drag my mouse on the Adjust Last Operations panel. Also, the “restore point” is re-set when I do certain operations, like switching modes or moving a bone with the g key and confirming (it doesn’t work if I don’t move the bone).

Here’s the file I’m using to test my addon:

To get the error, install my addon, then open the file and change the bone layer to layer one. Then press F3 and search ‘chain’. Choose Select Bone Chain. Now search ‘chain’ again and choose ‘smooth bone chain’ and try moving the slider back and forth. Your Blender should switch back to the previous layer and the operator will no longer be functional.

Is this a bug or is something in my addon causing the problem? I make heavy usage of comparing the layers that bones are one to see if they’re in the same chain or not.

I tried hacking my way around the problem by getting the layers the armature was on in invoke(), saving them to a class property self.layers and re-assiging them in execute(), but that resulted in weird behaviour- random layers were chosen and very rarely were any of them right.

If this is a bug, I’ll be sure to report it, just want to make sure it isn’t my fault first!

I think I’ve narrowed down the source of the problem:
dataCrv =, 'CURVE') seems to be causing the bug.

I’ve isolated the problem, I’m pretty sure this is a bug now, so I’m gonna fill out a bug report.
Here’s a minimal addon that will recreate the problem in Blender 2.80.

bl_info = {
    "name": "Test",
    "author": "Joseph Brandenburg",
    "version": (0, 0, 0),
    "blender": (2, 80, 0),
    "location": "Search",
    "description": "Bug report",
    "warning": "",}
import bpy

class Dummy(bpy.types.Operator):
    bl_idname = "armature.dummy"
    bl_label = "Dummy"
    bl_options = {'REGISTER', 'UNDO'}

    def poll(cls, context):
        return ((context.active_object.type == 'ARMATURE') and (
                 context.mode == 'EDIT_ARMATURE'))
    quantity: bpy.props.IntProperty(
                name="Change Me",
                description="Doesn't do anything",
                default = 4,
                min = 0,
                soft_max = 256,
    def execute(self, context):
        print ("executing operator...")
        dataCrv ="name", 'CURVE')
        #print (
        return {"FINISHED"}

classes = [Dummy]

def register():
    for cls in classes:
def unregister():
    for cls in reversed(classes):
def menu_func(self, context):
    for cls in classes:
        self.layout.operator(cls.bl_idname, icon = 'PLUGIN')
if (__name__ == "__main__"):

Just save it to a .py and the steps I described above will give you the bug.

If anyone has any ideas for workarounds, I’d be really grateful. I need to make a curve object in Armature Edit Mode.

Bug Report:

@angavrilov Have you encountered this sort of bug while writing scripts for rigging? Am I using the API wrong somehow --maybe I should create curve objects in invoke() instead of execute()? (I’m pinging you because (I think) you’re the one who did the Rigify updates recently. Apologies if I have the wrong person! ) Anyways, I haven’t gotten any replies here or on the bug report task, and I hate to leave my addon in a buggy state, but I have no idea how to solve the issue on my end. I’ve seen a lot of great rigging-related commits from you on and so I thought maybe you can help or would be interested.