Created
July 7, 2022 10:21
-
-
Save Durman/d364ffd796bcee3e3da6aad88865596e to your computer and use it in GitHub Desktop.
The way how to get notifications whenever active object is changed in Blender.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bpy | |
owner = object() | |
subscribe_to = (bpy.types.LayerObjects, 'active') | |
def msgbus_callback(*args): | |
print("Active object is changed!", args) | |
bpy.msgbus.subscribe_rna( | |
key=subscribe_to, | |
owner=owner, | |
args=(1, 2, 3), | |
notify=msgbus_callback, | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment