class BTOOLS_OT_add_roof(bpy.types.Operator):
    """Create roof from selected upward facing faces"""

    bl_idname = "btools.add_roof"
    bl_label = "Add Roof"
    bl_options = {"REGISTER", "UNDO", "PRESET"}

    props: bpy.props.PointerProperty(type=RoofProperty)

    def poll(cls, context):
        return context.object is not None and context.mode == "EDIT_MESH"

    def execute(self, context):
        return Roof.build(context, self.props)

    def draw(self, context):
        self.props.draw(context, self.layout)

Is it possible to get props in the above class?

from bpy.types import BTOOLS_OT_add_roof as bmt

 print(bmt.bl_idname)//get "btools.add_roof"

 print(bmt.props)//get nothing has no attribute props
  • 1
    $\begingroup$ You have only added typing information to props in the snippet, so it will be None unless you assign it. Perhaps you could include a link to the base class? $\endgroup$
    – Emil
    Jul 26 at 5:33
  • $\begingroup$ As it is an add-on, I can not change the code. Is it possible to call props by another way? $\endgroup$
    – Derekcbr
    Jul 27 at 1:01
  • 1
    $\begingroup$ The common case for addons is just a bunch of python scripts in a zip file. I am not familiar with the code. $\endgroup$
    – Emil
    Jul 27 at 6:41
  • $\begingroup$ Thank you for the help! $\endgroup$
    – Derekcbr
    Jul 27 at 8:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.