Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/changelog.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
title: Changelog
---

## v520.35.1

### Fixes

- **`c.VoronoiTexture()` starts 2D in the compositor**, as Blender does, instead of 3D; Noise Texture got the same fix in 520.35.0.

## v520.35.0

### Enhancements
Expand Down
5 changes: 3 additions & 2 deletions gen/introspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,13 +252,14 @@ def collect_property_info(node, node_type):
# temperature and tint sockets through the color management config and
# writes them back to those sockets. A default would be config-specific and
# would be overwritten by the socket defaults anyway.
# - Noise Texture starts 2D in the compositor and 3D elsewhere, and one class
# serves both trees.
# - Noise, White Noise and Voronoi Texture start 2D in the compositor and 3D
# elsewhere, and one class serves both trees.
OPTIONAL_PROPERTIES = {
"is_active_output",
"input_whitepoint",
"output_whitepoint",
"noise_dimensions",
"voronoi_dimensions",
}


Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "nodebpy"
version = "520.35.0"
version = "520.35.1"
description = "Build nodes trees in Blender more elegantly with code"
readme = "README.md"
authors = [
Expand Down
5 changes: 3 additions & 2 deletions src/nodebpy/nodes/geometry/texture.py
Original file line number Diff line number Diff line change
Expand Up @@ -1118,7 +1118,7 @@ def __init__(
exponent: InputFloat = 0.5,
randomness: InputFloat = 1.0,
*,
voronoi_dimensions: Literal["1D", "2D", "3D", "4D"] = "3D",
voronoi_dimensions: Literal["1D", "2D", "3D", "4D"] | None = None,
distance: Literal[
"EUCLIDEAN", "MANHATTAN", "CHEBYCHEV", "MINKOWSKI"
] = "EUCLIDEAN",
Expand All @@ -1139,7 +1139,8 @@ def __init__(
"Exponent": exponent,
"Randomness": randomness,
}
self.voronoi_dimensions = voronoi_dimensions
if voronoi_dimensions is not None:
self.voronoi_dimensions = voronoi_dimensions
self.distance = distance
self.feature = feature
self.normalize = normalize
Expand Down
22 changes: 16 additions & 6 deletions tests/test_socket_defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,16 @@ def test_generated_constructor_keeps_fresh_properties(module, tree_type):
The constructor assigns every property it takes, so a default read from RNA
instead of a fresh node silently overrides what the node's init function
sets (Ambient Occlusion's 16 samples, Mix's Clamp Factor, Noise Texture's
Normalize).
Normalize). Enums are compared too, since some start differently in each
kind of tree (Noise and Voronoi Texture are 2D in the compositor).
"""
base_props = {p.identifier for p in bpy.types.Node.bl_rna.properties}
# which output is active and which menu item is selected in the UI list are
# state of the tree, not settings of the node
tree_state = {"is_active_output", "active_index"}
# nodebpy's Menu Switch takes its type from the factory (MenuSwitch.float)
# and defaults to FLOAT, where Blender picks one per tree
by_design = {("MenuSwitch", "data_type")}
mismatches = []
with TreeBuilder(bpy.data.node_groups.new("props", tree_type)) as tree:
for cls in _node_classes(module):
Expand All @@ -117,14 +121,20 @@ def test_generated_constructor_keeps_fresh_properties(module, tree_type):
continue # not available in this tree type
built = cls().node
for prop in fresh.bl_rna.properties:
if prop.identifier in base_props | tree_state or prop.type not in (
"BOOLEAN",
"INT",
"FLOAT",
if (
prop.identifier in base_props | tree_state
or (cls.__name__, prop.identifier) in by_design
or prop.is_readonly
or prop.type not in ("BOOLEAN", "INT", "FLOAT", "ENUM")
):
continue
expected = getattr(fresh, prop.identifier)
actual = getattr(built, prop.identifier)
if _as_f32(expected) != _as_f32(actual):
if prop.type == "ENUM":
if expected != actual:
mismatches.append(
(cls.__name__, prop.identifier, expected, actual)
)
elif _as_f32(expected) != _as_f32(actual):
mismatches.append((cls.__name__, prop.identifier, expected, actual))
assert not mismatches
4 changes: 2 additions & 2 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading