Files
test2/tests/python/compositing_node_group.py
Habib Gahbiche 5783c600dc Fix: wrong user count for compositing node tree
**How to reproduce:**
1. Assign a node tree to the scene compositing node group in Python
2. Notice how the node tree has the wrong user count

Example:
```python
C.scene.compositing_node_group = \
    D.node_groups.new("ntree", "CompositorNodeTree")
print(C.scene.compositing_node_group.users) # returns 0
```

Pull Request: https://projects.blender.org/blender/blender/pulls/143577
2025-07-30 13:18:47 +02:00

27 lines
696 B
Python

# SPDX-FileCopyrightText: 2025 Blender Authors
#
# SPDX-License-Identifier: Apache-2.0
import bpy
import unittest
class CompositingNodeGroupTest(unittest.TestCase):
"""
Tests specific to the root compositing node tree
"""
def setUp(self):
bpy.ops.wm.read_factory_settings(use_empty=True)
def test_assign_invalid(self):
scene = bpy.data.scenes["Scene"]
with self.assertRaises(RuntimeError):
scene.compositing_node_group = bpy.data.node_groups.new("invalid", "GeometryNodeTree")
if __name__ == "__main__":
import sys
sys.argv = [__file__] + (sys.argv[sys.argv.index("--") + 1:] if "--" in sys.argv else [])
unittest.main()