2
$\begingroup$

I'm making a grease pencil addon, and to mantain my system integrity, I need to check when a grease pencil layer has been renamed. (As far as I know, their name act basically as an ID).

I need to know when a renaming happens so I can trigger all the changes I need.

I learned about Application Handlers, and about msgbus from an user here. But I'm not sure if they work for my needs. I wasn't able to make it work.

Any idea? (Thank you so much for the help)

$\endgroup$

1 Answer 1

1
$\begingroup$

I found the solution. Msgbus worked nice, I just had to:

owner = object()
subscribe_to_layer_info_change = bpy.types.GPencilLayer, "info"
...
bpy.msgbus.subscribe_rna(
    key=subscribe_to_layer_info_change,
    owner=owner,
    args=(),
    notify=msgbus_callback_on_layer_renamed,
    options={"PERSISTENT"},
    )
$\endgroup$

You must log in to answer this question.

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