3
$\begingroup$

I want to listen for a change of perspective in the 3d area, maybe can use msgbus api.The code I try as followed.But it does't work.How can I choose the correct properties.

def notify_test(*args):
    print('change123')
    
subscribe_to = bpy.types.RegionView3D,'view_rotation'
bpy.msgbus.subscribe_rna(
        key=subscribe_to,
        owner=object(),
        args=(1, 2, 3),
        notify=notify_test,
    )
bpy.msgbus.publish_rna(key=subscribe_to)
```
$\endgroup$
4
  • $\begingroup$ Some suggestions: blender.stackexchange.com/a/249814/60486 $\endgroup$ Feb 24 at 19:27
  • 1
    $\begingroup$ Yup I think the only one which will work here is the 3D view handler. The depsgraph doesn't get updated when the viewport camera moves and I wouldn't count on msgbus. $\endgroup$
    – Gorgious
    Feb 25 at 9:45
  • $\begingroup$ @MarkusvonBroady Thank you for your helpful suggestiion! I will learn more about them. $\endgroup$
    – fage
    Feb 26 at 6:22
  • $\begingroup$ @Gorgious Oh. thanks.Moreover, is there any links for me to learn about the 3D view handler? $\endgroup$
    – fage
    Feb 26 at 6:26

0

You must log in to answer this question.

Browse other questions tagged .