From bab8fd7c2520e169330523608e148e2f8b878d0b Mon Sep 17 00:00:00 2001 From: Lingjie Mei Date: Wed, 30 Oct 2024 01:04:44 -0400 Subject: [PATCH] Fix broken chair --- .../assets/objects/seating/chairs/chair.py | 17 +++++------------ infinigen/assets/utils/draw.py | 5 +++++ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/infinigen/assets/objects/seating/chairs/chair.py b/infinigen/assets/objects/seating/chairs/chair.py index 80208e7b..8be17860 100644 --- a/infinigen/assets/objects/seating/chairs/chair.py +++ b/infinigen/assets/objects/seating/chairs/chair.py @@ -202,10 +202,7 @@ def make_seat(self): np.array( [ 0, - -self.seat_back, - -self.seat_mid_x, - -1, - 0, + 0.1, 1, self.seat_mid_x, self.seat_back, @@ -216,17 +213,13 @@ def make_seat(self): / 2 ) y_anchors = ( - np.array( - [0, 0, -self.seat_mid, -1, -self.seat_front, -1, -self.seat_mid, 0, 0] - ) + np.array([-self.seat_front, -self.seat_front, -1, -self.seat_mid, 0, 0]) * self.size ) - z_anchors = ( - np.array([0, 0, self.seat_mid_z, 0, 0, 0, self.seat_mid_z, 0, 0]) - * self.thickness - ) - vector_locations = [1, 7] if self.is_seat_round else [1, 3, 5, 7] + z_anchors = np.array([0, 0, 0, self.seat_mid_z, 0, 0]) * self.thickness + vector_locations = [4] if self.is_seat_round else [2, 4] obj = bezier_curve((x_anchors, y_anchors, z_anchors), vector_locations) + butil.modify_mesh(obj, "MIRROR") with butil.ViewportMode(obj, "EDIT"): bpy.ops.mesh.select_all(action="SELECT") bpy.ops.mesh.fill_grid(use_interp_simple=True) diff --git a/infinigen/assets/utils/draw.py b/infinigen/assets/utils/draw.py index dd3a6256..ae22ab9c 100644 --- a/infinigen/assets/utils/draw.py +++ b/infinigen/assets/utils/draw.py @@ -110,6 +110,11 @@ def curve2mesh(obj): length = np.linalg.norm(cos[:-1] - cos[1:], axis=-1) min_length = 5e-3 with butil.ViewportMode(obj, "EDIT"): + for i in range(len(points)): + if points[i].handle_left_type == "FREE": + points[i].handle_left_type = "ALIGNED" + if points[i].handle_right_type == "FREE": + points[i].handle_right_type = "ALIGNED" for i in reversed(range(len(points) - 1)): points = list(obj.data.splines[0].bezier_points) number_cuts = min(int(length[i] / min_length) - 1, 64)