Skip to content

Commit 43bc059

Browse files
chore: cleanup debug prints and fix type errors in blender adapters
Signed-off-by: arounamounchili <patouossa.mounchili@gmail.com>
1 parent 16fb0d2 commit 43bc059

2 files changed

Lines changed: 12 additions & 8 deletions

File tree

platforms/blender/linkforge/blender/adapters/blender_to_core.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,14 +166,14 @@ def detect_primitive_type(obj: bpy.types.Object | None) -> str | None:
166166
return None
167167

168168
mesh = obj.data
169-
if mesh is None:
169+
if mesh is None or not isinstance(mesh, bpy.types.Mesh):
170170
return None
171171

172172
# Check for explicit geometry type tags
173173
# This guarantees round-trip stability and prevents auto-detection failures
174174
tags = ["source_geometry_type", "collision_geometry_type"]
175175
for tag in tags:
176-
if tag in obj:
176+
if obj.get(tag) is not None: # type: ignore[func-returns-value]
177177
geom_type = str(obj[tag])
178178
if geom_type in ("BOX", "CYLINDER", "SPHERE"):
179179
return geom_type
@@ -1071,7 +1071,7 @@ def _calculate_link_frames(
10711071
"""
10721072
link_frames = {} # link_name -> world matrix where link frame is
10731073

1074-
if root_link is not None and Matrix:
1074+
if root_link is not None and Matrix is not None:
10751075
root_name, root_obj = root_link
10761076
link_frames[root_name] = Matrix.Identity(4)
10771077

@@ -1174,7 +1174,7 @@ def scene_to_robot(
11741174
(parent_name := joint.parent)
11751175
and parent_name in link_frames
11761176
and joint.child in link_frames
1177-
and Matrix
1177+
and Matrix is not None
11781178
):
11791179
parent_frame = link_frames[parent_name]
11801180
child_frame = link_frames[joint.child]
@@ -1195,7 +1195,12 @@ def scene_to_robot(
11951195
for obj in sensor_objects:
11961196
try:
11971197
sensor = blender_sensor_to_core(obj)
1198-
if sensor and (link_name := sensor.link_name) and link_name in link_frames and Matrix:
1198+
if (
1199+
sensor
1200+
and (link_name := sensor.link_name)
1201+
and link_name in link_frames
1202+
and Matrix is not None
1203+
):
11991204
link_obj = link_objects.get(link_name)
12001205
if link_obj and obj.parent == link_obj:
12011206
# Extract relative origin using matrix math (robust against 'Keep Transform')

platforms/blender/linkforge/blender/logic/asynchronous_builder.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,6 @@ def process_next_chunk(self) -> float | None:
157157

158158
def _execute_task(self, task_type: str, data: typing.Any) -> None:
159159
"""Execute a single unit of work."""
160-
print(f"DEBUG: Executing task {task_type}")
161160
try:
162161
if task_type == "setup_scene":
163162
if self.context.scene:
@@ -211,8 +210,8 @@ def _execute_task(self, task_type: str, data: typing.Any) -> None:
211210
f"Auto-linked ROS2 Control joint '{rc_joint.name}' to {target_obj.name}"
212211
)
213212
except Exception as e:
214-
print(f"DEBUG: Task {task_type} failed: {e}")
215-
raise e
213+
logger.debug(f"Task {task_type} failed: {e}")
214+
raise
216215

217216
def finish(self) -> None:
218217
"""Clean up and finalize."""

0 commit comments

Comments
 (0)