Skip to content

Commit 1671c62

Browse files
committed
fix: correct data type setting for capture attribute items
1 parent f904376 commit 1671c62

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

ntp_operator.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,11 +1151,18 @@ def _enum_definition(self, enum_def: bpy.types.NodeEnumDefinition,
11511151

11521152
if bpy.app.version >= (4, 2, 0):
11531153
def _capture_attribute_items(self, capture_attribute_items: bpy.types.NodeGeometryCaptureAttributeItems, capture_attrs_str: str) -> None:
1154+
"""
1155+
Sets capture attribute items
1156+
"""
11541157
self._write(f"{capture_attrs_str}.clear()")
1155-
for i, item in enumerate(capture_attribute_items):
1156-
data_type = enum_to_py_str(item.data_type)
1158+
for item in capture_attribute_items:
11571159
name = str_to_py_str(item.name)
1158-
self._write(f"{capture_attrs_str}.new({data_type}, {name})")
1160+
self._write(f"{capture_attrs_str}.new('FLOAT', {name})")
1161+
1162+
# Need to initialize capture attribute item with a socket,
1163+
# which has a slightly different enum to the attribute type
1164+
data_type = enum_to_py_str(item.data_type)
1165+
self._write(f"{capture_attrs_str}[{name}].data_type = {data_type}")
11591166

11601167
def _menu_switch_items(self, menu_switch_items: bpy.types.NodeMenuSwitchItems, menu_switch_items_str: str) -> None:
11611168
self._write(f"{menu_switch_items_str}.clear()")

0 commit comments

Comments
 (0)