Node Wrangler: Add more specific poll methods
commitf8cac4acf95ae91f26edb1ce32dbd36558964710
authorDamien Picard <dam.pic@free.fr>
Mon, 29 Jan 2024 21:04:52 +0000 (29 22:04 +0100)
committerDamien Picard <dam.pic@free.fr>
Sat, 3 Feb 2024 14:15:53 +0000 (3 15:15 +0100)
tree3ad3f6225ec4004442f44c2dd8ba7ff0c943210c
parent17dd7cde6e93b5bc760616d723189e0625f927ac
Node Wrangler: Add more specific poll methods

Since it is useful to set a poll message to tell the user why an
operator cannot be called, decompose poll conditions into basic
functions and make every operator use them.

- Make the basic nw_check report issues.
- Add functions to check that:
  - the node tree is not empty,
  - a node is active,
  - a specified number of nodes are selected,
  - the active node is of a specific type,
  - it has visible outputs,
  - there is a viewer image.
- These functions report the issue to the poll message otherwise.
- Go through operators and add or update poll methods using those
  various functions.
- In a few operators, remove obsolete error reports that are now
  caught at the poll stage.

Fixes a few issues:
- PreviewNode would not work immediately when the active node was a
  material or world output.
- ReloadImages needed an active node.
node_wrangler/__init__.py
node_wrangler/interface.py
node_wrangler/operators.py
node_wrangler/utils/nodes.py