Docs
Download

Mode and editor checks

Check Blender's mode and an object's type, and find an editor to run code in.

Three nodes answer questions add-ons ask all the time: is Blender in Edit Mode, is this object a mesh, where is the 3D Viewport. Use them to show the right buttons in a panel, to stop an operator before it fails, or to run an operator in an editor that isn't the one the user is in.

A panel showing the current mode, OBJECT, and "Mesh tools ready" because the active object is a mesh, next to its nodes

Is in Mode

Is in Mode checks the mode Blender is in right now (context.mode).

Mode (on the node)The mode to check: Object, Mesh Edit, Sculpt, Pose, Weight Paint, Texture Paint, a Grease Pencil or Curves mode, ...
Is in Mode (output)True while Blender is in that mode
Current Mode (output)The mode's identifier as a String: OBJECT, EDIT_MESH, SCULPT, POSE, PAINT_WEIGHT, ...

Edit Mode has one mode per kind of data: EDIT_MESH for meshes, EDIT_CURVE for curves, EDIT_ARMATURE for armatures. Is in Mode with Mesh Edit is False while editing a curve.

Is Object Type

Is Object Type checks what kind of object the Object input is: pick Mesh, Curve, Light, Camera, Armature, Empty, Grease Pencil, ... on the node. Is Type is True if it is, and False for None, so it also covers "no active object". Connect an Active Object node (Add › Blender Data › Active Object) to check the object the user has selected last.

Area by Type

Area by Type finds the first editor of a type (pick 3D Viewport, Image Editor, Shader Editor, ...) in the current window.

Output
AreaThe editor's area, None if the window has none
RegionIts main region, where its content is drawn
FoundWhether there is one

Many operators only work in their editor: a 3D Viewport operator run from a button in the Image Editor or from a timer fails. Connect Area and Region to the inputs of a Temp Override node (Print and Temp Override) and run the operator in its During flow. Check Found first if the user may not have that editor open.