New answers tagged

1

bl_info = { "name": "", "description": "", "author": "", "blender": (2, 80, 0), "version": (0, 0), "category": "", "location": "3D View > UI > Create", "warning": "", } import boy class PrinterFunction(bpy.types.Operator): """desc""" bl_idname = "print.helloworld" bl_label = "Hello World" bl_options = {'...


2

You have to create custom Operator class and register it. Inside the operator you have to check if the object has the modifier or not. If it is not then add or else remove it. Then replace the YourOperator.bl_idname with "object.modifier_add". Added shade smooth and flat toggle. For shortcut you can click on the button and "add shortcut". Note: Your ...


-1

Ok so that's what ended up having that works the way I wanted import bpy class Weld(bpy.types.Operator): bl_idname = "edit.weld" bl_label = "Weld" bl_description = "Weld vertices by distance\nHold CTRL to weld at center" bl_options = {'REGISTER', 'UNDO'} merge_dist: bpy.props.FloatProperty( name="Merge Distance", ...


1

Here is the solution for Windows I was looking for: import ctypes VK_ESCAPE = 0x1B ctypes.windll.user32.keybd_event(VK_ESCAPE) Beeing written as a function and appended to bpy.app.handlers.render_pre it simulates pressing ESC on the keyboard and aborts the render. In my addon I used another solution: it turned out to be possible to replace original ...


2

In 2.8, you can use message bus to do that: The principle is to obtain the path using a path name through the object. Then declare a subscription to message bus. import bpy #The callback when then change occurs def a_callback(object, data): print( object, data, "changed" ) def subscribe_to(object,data_path,callback): #Get a rna subscription ...


1

The add-on below demonstrates how to solves this by using a PropertyGroup that stores the state of the execution. The operator SCENE_OT_example toggles the value stored in bpy.context.scene.example_settings.success. In EXAMPLE_PT_panel the draw() method is used to display a label depending on the value of bpy.context.scene.example_settings.success. bl_info ...


Top 50 recent answers are included