Emile31
(Emile31)
1
Hello,
Say I have two classes :
- class WIZARD_Generic(object):
isLIB = False
class WIZARD_Lib(bpy.types.Operator, WIZARD_Generic):
isLIB = True
I do bpy.utils.register_class(WIZARD_lib), but then, it says WIZARD_Lib does not have any attribute called isLIB.
Would you know how to use inheritance in Blender ?
Thanks
CoDEmanX
(CoDEmanX)
2
seems fine here
import bpy
class WIZARD_Generic(object):
isLIB = False
class SimpleOperator(bpy.types.Operator, WIZARD_Generic):
"""Tooltip"""
bl_idname = "object.simple_operator"
bl_label = "Simple Object Operator"
isLIB = True
@classmethod
def poll(cls, context):
return context.active_object is not None
def execute(self, context):
print("isLIB =", self.__class__.isLIB)
return {'FINISHED'}
def register():
bpy.utils.register_class(SimpleOperator)
def unregister():
bpy.utils.unregister_class(SimpleOperator)
if __name__ == "__main__":
register()
# test call
bpy.ops.object.simple_operator()