Skip to content

Commit 5dece56

Browse files
committed
feat: replace print statements with Blender reporting
1 parent 3287f2c commit 5dece56

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

geometry/operator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ def _process_zone_output_node(self, node: GeometryNode, inner: str,
4545
elif node.bl_idname == 'GeometryNodeRepeatOutput':
4646
items = "repeat_items"
4747
else:
48-
self.report({'WARNING'}, f"{node.bl_idname} is not recognized "
49-
f" as avalid zone output")
48+
self.report({'WARNING'}, f"NodeToPython: {node.bl_idname} is "
49+
f"not recognized as a valid zone output")
5050

5151
self._write(f"{inner}# Remove generated {items}\n")
5252
self._write(f"{inner}for item in {node_var}.{items}:\n")

ntp_operator.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,15 +224,22 @@ def _set_settings_defaults(self, node: Node, inner: str, node_var: str
224224
node_var (str): name of the variable we're using for the node in our add-on
225225
"""
226226
if node.bl_idname not in self._settings:
227-
print((f"NodeToPython: couldn't find {node.bl_idname} in settings."
228-
f"Your Blender version may not be supported"))
227+
self.report({'WARNING'},
228+
(f"NodeToPython: couldn't find {node.bl_idname} in "
229+
f"settings. Your Blender version may not be supported"))
229230
return
230231

231232
for (attr_name, type) in self._settings[node.bl_idname]:
233+
if not hasattr(node, attr_name):
234+
self.report({'WARNING'},
235+
f"NodeToPython: Couldn't find attribute "
236+
f"\"{attr_name}\" for node {node.name} of type "
237+
f"{node.bl_idname}")
238+
continue
232239
attr = getattr(node, attr_name, None)
233240
if attr is None:
234-
print(f"\"{node_var}.{attr_name}\" not found")
235241
continue
242+
236243
setting_str = f"{inner}{node_var}.{attr_name}"
237244
if type == ST.ENUM:
238245
if attr != '':

0 commit comments

Comments
 (0)