6
$\begingroup$

I noticed that many operators are under the module bpy.ops.wm namespace. What does this name stand for? I looked it up in the official docs but only found this:

All the other modules are pretty self-explanatory, but I still don't get what wm means.

$\endgroup$
1
  • 7
    $\begingroup$ wm is shorthand for window manager $\endgroup$
    – batFINGER
    Jul 3, 2021 at 17:12

1 Answer 1

10
$\begingroup$

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

>>> wm = C.window_manager

Like objects, meshes, cameras the window manager is a subclass of bpy.types.ID and hence can be used to store ID properties.

>>> issubclass(bpy.types.WindowManager, bpy.types.ID)
True

>>> wm["foo"] = 33
>>> wm["foo"]
33

When set are available for the current session of blender and hence are often used for temporary session variables, that are lost when blender is exited.

UI windows, eg the confirm dialog box, or a popover of a draw method

>>> def draw(self, context):
...     self.layout.label(text="Foo")
... 
>>> wm.popover(draw)

starting modals, event timers, storing operator history, the clipboard contents etc.

Operators associated with the window manager bpy.ops.wm... tend to be misc generic operations that poll in most contexts like show splash screen, popup a menu, set a context member, save a blend file, restore factory settings.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .