Skip to main content
45 votes
Accepted

How to call a confirmation dialog box?

When calling an operator via bpy.ops.* without any execution context the execute() method of the respective operator runs by ...
p2or's user avatar
  • 16k
16 votes
Accepted

Add menu entry to generic right-click menu?

As of this commit, thanks to @p2or and @brecht, the bpy.ops.ui.copy_data_path_button() operator now allows to copy the full data-path of the active property under the mouse cursor to the clipboard ...
brockmann's user avatar
  • 12.7k
16 votes
Accepted

How do I get the correct context for Python operators?

After looking through the api documentation, it does not appear that there is a direct way to know which contexts an operator will work in. Therefore, one way to determine this is to call an operator'...
David's user avatar
  • 49.6k
13 votes

A comprehensive list of operator overrides

Operator Required context members Q&A's ed.lib_id_generate_preview() id - Object ...
12 votes
Accepted

Create keyboard shortcut for an operator using python?

Minimal add-on example using keymap_items.new() to register a new hotkey CtrlW in 3d View: ...
brockmann's user avatar
  • 12.7k
11 votes
Accepted

Force a Blender operator to always start with default values

Add 'SKIP_SAVE' to the blender property option set. When defining properties for the operator, any with 'SKIP_SAVE' in their ...
batFINGER's user avatar
  • 84.8k
11 votes

How to create toggle button use python in blender

Create a bool property for Window Manager (it can be for anything, but WM will store our modal operator handler so why not put this in the same place): ...
Jaroslav Jerryno Novotny's user avatar
11 votes
Accepted

What does "wm" stand for?

Window manager. As the name suggests Window manager data-block defining open windows and other user interface data The one instance of the window manager ...
batFINGER's user avatar
  • 84.8k
8 votes
Accepted

How can I add items in the node editor context menu in 2.8?

The Shader Editor context menu is called NODE_MT_context_menu (found by inspecting Preferences> Keymap> Node Editor and looking for Right Mouse) and we can '...
Ray Mairlot's user avatar
  • 29.3k
7 votes

How can I update a popup while shown?

While your Operator.check(...) method returns True the popup will redraw. Simple return True method used in ...
batFINGER's user avatar
  • 84.8k
7 votes
Accepted

How can I pass arguments to an Operator inside a Macro Operator?

Macro.define("TRANSFORM_OT_translate") returns a OperatorMacro which has a properties ...
ideasman42's user avatar
  • 47.7k
7 votes
Accepted

How to pass a bpy.data.objects / bpy.data.materials / etc to an operator from the layout?

Add context members for your op to use. Would assume you tried object: PointerProperty(type=bpy.types.Object) only to get the error message saying you can't ...
batFINGER's user avatar
  • 84.8k
7 votes

A comprehensive list of operator overrides

I'm still working on my script that helps me to detect what elements a context override requires, but I guess I might as well share it now and update it later... Making context copy First, prepare a ...
Markus von Broady's user avatar
7 votes

Automatically run a script when an object is transformed or a condition is met

Driver It should update if one of the variables changes: Rotate N objects identically, but with unique variations Consider using the driver interface even if you do something more elaborate, just in ...
Markus von Broady's user avatar
6 votes

Python: Operator Undo Method

Blender's undo system works by saving the blend file to memory, and loading it to perform the undo. If your operator doesn't fully undo, you're probably calling other operators from within its code. ...
dr. Sybren's user avatar
  • 7,234
6 votes
Accepted

How to assign PointerProperty in Operator through UI?

Aafter continuing researching, apparently operators can only take basic properties (e.g. string, bool, int, float, collections of the property types just mentioned), and PointerProperties only work if ...
S. Magnusson's user avatar
  • 1,533
6 votes
Accepted

How can I display a FloatVector without it being editable by the user?

You can disable the row (makes it read-only) and set emboss to False for example: ...
Gorgious's user avatar
  • 31.9k
6 votes
Accepted

How to control spacing/alignment of Label + Horizontal Enum Property?

Just set layout.use_property_split property in your draw method to True: ...
brockmann's user avatar
  • 12.7k
6 votes
Accepted

Align & Scale Light (Portal) to Face

A Python script to do that. The tricky part (I think) is to make it work whatever the face is: orientation, number of vertices, concavities... I guess that in this kind of cases, we want the light to ...
lemon's user avatar
  • 60.6k
5 votes

Why avoid bpy.ops?

Apart from what's been said already, operators also create undo steps. This means that every time you execute an operator, the entire blend file is saved in memory. This is one of the reasons calling ...
dr. Sybren's user avatar
  • 7,234
5 votes

Making Property sliders act similar to Operators

You can use the 'update' function value that can be assigned to the property's definition: Update function is triggered each time the slider's value is changing. ...
lemon's user avatar
  • 60.6k
5 votes
Accepted

How to avoid operator `collection_instance_add`?

Just do all necessary steps Create a new Empty object Set instance_collection to the collection you want Set instance_type to <...
Stefan Krüger s-light's user avatar
5 votes
Accepted

How to change description in an operator depending on the option assigned in the UI?

Operator description method Combining answers from Changing tooltip for menu entries which use the same operator Since 2.81 An operator now has a ...
batFINGER's user avatar
  • 84.8k
5 votes
Accepted

Operator Search: 'Free Data' not available in Blender 2.9 anymore?

The default behavior of the Operator Search dialog in 2.9x is to only list the operators that can be found in menus. In order to search for all registered operators, you currently have to enable the ...
Robert Gützkow's user avatar
5 votes

Change the "OK" button name in dialog-boxes?

Unfortunately this isn't something you have any control over. The window_manager.invoke_props_dialog function is defined in C here, and ultimately uses the ...
Chris Hayes's user avatar
5 votes
Accepted

How can I add a panel to the properties area of the file browser?

You would have to add a draw() method along with a pass statement to the operator in order to skip drawing and declare a ...
brockmann's user avatar
  • 12.7k
5 votes
Accepted

How do you access the TEXT_EDITOR header so you can add an operator?

Result: You can see the operator button added to the header Answer: You were on the right path. The link you shared shows how to add extra items in headers. You don't need to create new header class ...
Reigen's user avatar
  • 905
4 votes
Accepted

Using a hint/information-bar like the trasformations are using

You do this by using Area.header_text_set() Here is an example using the Modal Operator template: ...
cmomoney's user avatar
  • 2,660
4 votes

Know when edit-mode is entered by script? (python)

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. ...
lemon's user avatar
  • 60.6k
4 votes

Python performance with Blender operators

Is there something particular to know to improve these performance or a way to use the bpy.ops methods with better performances? The top answer is correct, calling an operator updates the current ...
scurest's user avatar
  • 10.5k

Only top scored, non community-wiki answers of a minimum length are eligible