From fa09ffc58521e271a504a314f431855284d414f2 Mon Sep 17 00:00:00 2001 From: "demeterdzadik@gmail.com" Date: Wed, 23 Aug 2023 18:59:58 +0200 Subject: [PATCH] Document 110239: How callbacks work on Operator properties After writing add-ons for like the past 8 years, I didn't realize that the first parameter of update callbacks of operator properties, conventionally named `self` is not actually what a Python coder would expect from a variable named `self`. I tried to document that here. This is in response to [what I thought was a bug](https://projects.blender.org/blender/blender/issues/110239). Pull Request: https://projects.blender.org/blender/blender/pulls/110242 --- doc/python_api/examples/bpy.props.4.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/python_api/examples/bpy.props.4.py b/doc/python_api/examples/bpy.props.4.py index 93e4a9fda62..73c314498ed 100644 --- a/doc/python_api/examples/bpy.props.4.py +++ b/doc/python_api/examples/bpy.props.4.py @@ -10,6 +10,12 @@ All properties define update functions except for CollectionProperty. .. warning:: Remember that these callbacks may be executed in threaded context. +.. warning:: + If the property belongs to an Operator, the update callback's first + parameter will be an OperatorProperties instance, rather than an instance + of the operator itself. This means you can't access other internal functions + of the operator, only its other properties. + """ import bpy