Skip to main content
grammar, links
Source Link
brockmann
  • 12.8k
  • 4
  • 51
  • 94

you needYou would have to delete or comment completely

I mean you need deleteremove or commentcomment out the method including the @classmethod too@classmethod decorator:

import bpy

class MonkeyOperator(bpy.types.Operator):
    """Tooltip"""
    bl_idname = "object.make_monkey"
    bl_label = "Monkey Operator"

    
    

    def execute(self, context):
        main(context)# do stuff
        return {'FINISHED'}
 

def register():
    bpy.utils.register_class(MonkeyOperator)
 

def unregister():
    bpy.utils.unregister_class(MonkeyOperator)


if __name__ == "__main__":
    register()

For multiline comments you can use triple-quoted strings:

'''
@classmethod
def poll(cls, context):
    return context.object is None
'''

you need to delete or comment completely

I mean you need delete or comment the @classmethod too

import bpy

class MonkeyOperator(bpy.types.Operator):
    """Tooltip"""
    bl_idname = "object.make_monkey"
    bl_label = "Monkey Operator"

    
    

    def execute(self, context):
        main(context)
        return {'FINISHED'}
 

def register():
    bpy.utils.register_class(MonkeyOperator)
 

def unregister():
    bpy.utils.unregister_class(MonkeyOperator)


if __name__ == "__main__":
    register()

You would have to remove or comment out the method including the @classmethod decorator:

import bpy

class MonkeyOperator(bpy.types.Operator):
    """Tooltip"""
    bl_idname = "object.make_monkey"
    bl_label = "Monkey Operator"

    def execute(self, context):
        # do stuff
        return {'FINISHED'}

def register():
    bpy.utils.register_class(MonkeyOperator)

def unregister():
    bpy.utils.unregister_class(MonkeyOperator)


if __name__ == "__main__":
    register()

For multiline comments you can use triple-quoted strings:

'''
@classmethod
def poll(cls, context):
    return context.object is None
'''
Source Link
yhoyo
  • 2.3k
  • 13
  • 33

you need to delete or comment completely

I mean you need delete or comment the @classmethod too

import bpy

class MonkeyOperator(bpy.types.Operator):
    """Tooltip"""
    bl_idname = "object.make_monkey"
    bl_label = "Monkey Operator"

    
    

    def execute(self, context):
        main(context)
        return {'FINISHED'}


def register():
    bpy.utils.register_class(MonkeyOperator)


def unregister():
    bpy.utils.unregister_class(MonkeyOperator)


if __name__ == "__main__":
    register()