Focusing a node in a script

  • Finding out if a layer is in focus
  • Focus on a layer
  • Remove a layer from focus

Are these functions available in the API? If not, I would like to request them as new functions.
I felt the need for this functionality to pick up and remove multiple layers from the list of layers that meet certain criteria, such as name, layer type, etc. .selectedNodes() is not enough.

Perhaps the action of selecting and deselecting layers is already possible with only Python scripting? If you know, please let me know.

When I use .refreshProjection() to refresh the display screen, Krita stops because it is heavy. So as a workaround.

activeNode.setVisible(not activeNode.visible())
Krita.instance().action('toggle_layer_visibility').trigger()

This code updates the display screen. However, this method is not good if there are multiple layers selected, because layers other than the active layer will also be involved. So I am looking for a way to manipulate the selection state of the layers, or a way to refresh the screen with a lighter action.

It seems odd to me that (‘toggle_layer_visibility’) makes the visibility state of all selected layers the same. It makes sense if visible layers switch to invisible and invisible layers switch to visible…

This issue has been resolved.
https://krita-artists.org/t/storeroom-of-scripts/58681/28?u=dk8

2 Likes

This topic was automatically closed 4 days after the last reply. New replies are no longer allowed.