Python update-Callback infinite recursion
Closed, InvalidPublic

Description

Hi,

OS: Windows 7 64bit
3D-Card: Nvidia GTX 560
Blender Version: 2.58 r37724

the new update-callbacks for python go into a (indirect) recursion
if the variable which called the update-callback is changed within the update-callback.
The following example crashes if the String- and IntProperty are changed.
If the StringProperty is substituted with a FloatProperty or if only the StringProperty is changed
it doesnt crash.

import bpy

def func(self, context):
bpy.context.scene.my_settings.my_int = 2
bpy.context.scene.my_settings.my_string = "crash"

class MaterialSettings(bpy.types.PropertyGroup):
my_int = bpy.props.IntProperty(update=func)
my_string = bpy.props.StringProperty(update=func)

bpy.utils.register_class(MaterialSettings)

bpy.types.Scene.my_settings = \
bpy.props.PointerProperty(type=MaterialSettings)

bpy.context.scene.my_settings.my_string = "start"
bpy.context.scene.my_settings.my_int = 2

Details

Type
Bug

Assigning to campbell, he's with holidays now so it'll take a week or more.

Campbell, do you have any progress here? :)

Thinking about this, a property update function should remain low level, IMHO its reasonable to have users responsible for not getting into problematic situations where infinite recursion happens, Added note to docs saying this.

closing.

Add Comment