Skip to content

Commit

Permalink
Merge pull request princeton-vl#317 from princeton-vl/f_broken_chair
Browse files Browse the repository at this point in the history
Fix broken chair
  • Loading branch information
pvl-bot authored Nov 1, 2024
2 parents 4b2119a + bab8fd7 commit e2ea884
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
17 changes: 5 additions & 12 deletions infinigen/assets/objects/seating/chairs/chair.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions infinigen/assets/utils/draw.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e2ea884

Please sign in to comment.