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
This commit is contained in:
@@ -1035,6 +1035,11 @@ if(WITH_GPU_COMPOSITOR_TESTS AND TEST_SRC_DIR_EXISTS)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_blender_test(
|
||||
compositing_node_group
|
||||
--python ${CMAKE_CURRENT_LIST_DIR}/compositing_node_group.py
|
||||
)
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# GEOMETRY NODE TESTS
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
26
tests/python/compositing_node_group.py
Normal file
26
tests/python/compositing_node_group.py
Normal file
@@ -0,0 +1,26 @@
|
||||
# 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()
|
||||
Reference in New Issue
Block a user