self.report printed twice #30060

Closed
opened 2012-02-03 16:22:10 +01:00 by Dirk Freyer · 4 comments

%%%Hi,

If a operator calls a operator the self.report() prints twice the message to console window.
The error is only if the operator is called from the UI, not from the python interactive console.

See this example:

import bpy
from bpy.props import *

class SimpleOperator(bpy.types.Operator):

  bl_idname = "object.simple_operator"
  bl_label = "Simple Object Operator"
  def execute(self, context):
      self.report({'INFO'},'Info1')
      bpy.ops.object.simple_operator2()
      return {'FINISHED'}

class SimpleOperator2(bpy.types.Operator):

  bl_idname = "object.simple_operator2"
  bl_label = "Simple Object Operator2"
  def execute(self, context):
      self.report({'INFO'},'Info2')
      return {'FINISHED'}

def register():

  bpy.utils.register_class(SimpleOperator)
  bpy.utils.register_class(SimpleOperator2)

def unregister():

  bpy.utils.unregister_class(SimpleOperator)
  bpy.utils.unregister_class(SimpleOperator2)

if name == "main":

  register()

%%%

%%%Hi, If a operator calls a operator the self.report() prints twice the message to console window. The error is only if the operator is called from the UI, not from the python interactive console. See this example: import bpy from bpy.props import * class SimpleOperator(bpy.types.Operator): ``` bl_idname = "object.simple_operator" bl_label = "Simple Object Operator" ``` ``` def execute(self, context): self.report({'INFO'},'Info1') bpy.ops.object.simple_operator2() return {'FINISHED'} ``` class SimpleOperator2(bpy.types.Operator): ``` bl_idname = "object.simple_operator2" bl_label = "Simple Object Operator2" ``` ``` def execute(self, context): self.report({'INFO'},'Info2') return {'FINISHED'} ``` def register(): ``` bpy.utils.register_class(SimpleOperator) bpy.utils.register_class(SimpleOperator2) ``` def unregister(): ``` bpy.utils.unregister_class(SimpleOperator) bpy.utils.unregister_class(SimpleOperator2) ``` if __name__ == "__main__": ``` register() ``` %%%
Author

Changed status to: 'Open'

Changed status to: 'Open'
Author

%%%Blender version r42615
Win7 64bit
%%%

%%%Blender version r42615 Win7 64bit %%%

%%%fixed r43875.%%%

%%%fixed r43875.%%%

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 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#30060
No description provided.