Fix: USD hooks leak

If hooks are not unregistered Blender will report a leak on exit.

Store the hooks as unique_ptrs to remove manual memory management and
encapsulate the previous global list inside a function. These changes
ensure that everything is cleaned up on termination.

Also makes a small change to the hook documentation for a missing
`import` statement.

Pull Request: https://projects.blender.org/blender/blender/pulls/118294
This commit is contained in:
Jesse Yurkovich
2024-02-16 01:53:33 +01:00
committed by Jesse Yurkovich
parent 401a2397db
commit 9e8bbc1129
4 changed files with 40 additions and 41 deletions

View File

@@ -55,6 +55,7 @@ import pxr.Gf as Gf
import pxr.Sdf as Sdf
import pxr.Usd as Usd
import pxr.UsdShade as UsdShade
import textwrap
class USDHookExample(bpy.types.USDHook):