Python update-Callback infinite recursion #27793

Closed
opened 2011-06-28 12:50:53 +02:00 by christian l · 5 comments

%%%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
%%%

%%%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 %%%
Author

Changed status to: 'Open'

Changed status to: 'Open'
Member

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

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

%%%Campbell, do you have any progress here? :)%%%

%%%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.%%%

%%%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.%%%

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'
Sign in to join this conversation.
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#27793
No description provided.