1
$\begingroup$

I'm a computer scientist myself and i'm learning blender API and Python, i'm mixing a bunch of tutorials, examples and other things i found along the web and i'm experimenting a couple of codes in blender python language.

My first addon was a operator in a simple panel, i 'wrote' the code using a template i found online, but i kinda was able to understand the things.The moment i changed the value, the mesh updates itself.

It works great, so i move on to a new challenge, make that fancy pop-up operators, i got some examples and i was able to achieve this :

import bpy


class DialogOperator(bpy.types.Operator):
    bl_idname = "mesh.dialog_operator"
    bl_label = "Property Example"
    bl_options = {'REGISTER', 'UNDO'}

    distance = bpy.props.FloatProperty(
    name="Distance",
    default=0.02,
    precision=3,
    description="distance"
    )


    depth = bpy.props.FloatProperty(
        name = "Depth",
        description = "Depth",
        precision=3,
        default = 0.00
        )

    def execute(self, context):
        bpy.ops.mesh.inset(use_boundary=True, use_even_offset=True, use_relative_offset=False, use_edge_rail=False, thickness=self.distance, depth=self.depth, use_outset=False, use_select_inset=False, use_individual=False, use_interpolate=True)   
        return {'FINISHED'}

    def invoke(self, context, event):
        wm = context.window_manager
        return wm.invoke_props_dialog(self)


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

if __name__ == "__main__":
register()

That works and showed up the Pop-up i was looking for, however by the time i change the values, the mesh itself doesn't update realtime like it did with simple panel method above, only when i press"OK", the window closes, the inset is executed and it shows on the mesh.

enter image description here

And after it, for somehow it also appears on the side as a ordinary panel.

enter image description here

I believe it could be easy mistakes, but i want to understand what i'm really doing in here, i read some stuff, but doesn't mean anything yet, is like a couple jigsaw pieces that i'm putting together. Thank you in advance

$\endgroup$

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.