From f18f950a425611f3ff278731e8011c761038020e Mon Sep 17 00:00:00 2001 From: gradywoodruff Date: Fri, 8 Sep 2023 14:47:05 -0500 Subject: [PATCH] Update for blender 3.6 --- spaceship_generator.py | 50 +++++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/spaceship_generator.py b/spaceship_generator.py index a040fef..cf52591 100644 --- a/spaceship_generator.py +++ b/spaceship_generator.py @@ -201,8 +201,8 @@ def add_cylinders_to_face(bm, face): cap_ends=True, cap_tris=False, segments=num_segments, - diameter1=cylinder_size, - diameter2=cylinder_size, + radius1=cylinder_size / 2, + radius2=cylinder_size / 2, depth=cylinder_depth, matrix=cylinder_matrix) @@ -233,8 +233,8 @@ def add_weapons_to_face(bm, face): cap_ends=True, cap_tris=False, segments=num_segments, - diameter1=weapon_size * 0.9, - diameter2=weapon_size, + radius1=(weapon_size * 0.9) / 2, + radius2=weapon_size / 2, depth=weapon_depth, matrix=face_matrix) @@ -246,8 +246,8 @@ def add_weapons_to_face(bm, face): cap_ends=True, cap_tris=False, segments=num_segments, - diameter1=weapon_size * 0.6, - diameter2=weapon_size * 0.5, + radius1=(weapon_size * 0.6) / 2, + radius2=(weapon_size * 0.5) / 2, depth=weapon_depth * 2, matrix=left_guard_mat) @@ -259,8 +259,8 @@ def add_weapons_to_face(bm, face): cap_ends=True, cap_tris=False, segments=num_segments, - diameter1=weapon_size * 0.5, - diameter2=weapon_size * 0.6, + radius1=(weapon_size * 0.5) / 2, + radius2=(weapon_size * 0.6) / 2, depth=weapon_depth * 2, matrix=right_guard_mat) @@ -273,8 +273,8 @@ def add_weapons_to_face(bm, face): cap_ends=True, cap_tris=False, segments=8, - diameter1=weapon_size * 0.4, - diameter2=weapon_size * 0.4, + radius1=(weapon_size * 0.4) / 2, + radius2=(weapon_size * 0.4) / 2, depth=weapon_depth * 5, matrix=turret_house_mat) @@ -283,8 +283,8 @@ def add_weapons_to_face(bm, face): cap_ends=True, cap_tris=False, segments=8, - diameter1=weapon_size * 0.1, - diameter2=weapon_size * 0.1, + radius1=(weapon_size * 0.1) / 2, + radius2=(weapon_size * 0.1) / 2, depth=weapon_depth * 6, matrix=turret_house_mat @ \ Matrix.Translation(Vector((weapon_size * 0.2, 0, -weapon_size))).to_4x4()) @@ -292,8 +292,8 @@ def add_weapons_to_face(bm, face): cap_ends=True, cap_tris=False, segments=8, - diameter1=weapon_size * 0.1, - diameter2=weapon_size * 0.1, + radius1=(weapon_size * 0.1) / 2, + radius2=(weapon_size * 0.1) / 2, depth=weapon_depth * 6, matrix=turret_house_mat @ \ Matrix.Translation(Vector((weapon_size * -0.2, 0, -weapon_size))).to_4x4()) @@ -309,7 +309,7 @@ def add_sphere_to_face(bm, face): uniform(0, sphere_size * 0.5)) result = bmesh.ops.create_icosphere(bm, subdivisions=3, - diameter=sphere_size, + radius=sphere_size / 2, matrix=sphere_matrix) for vert in result['verts']: for face in vert.link_faces: @@ -337,13 +337,13 @@ def add_surface_antenna_to_face(bm, face): material_index = Material.hull if random() > 0.5 else Material.hull_dark # Spire - num_segments = uniform(3, 6) + num_segments = int(uniform(3, 6)) result = bmesh.ops.create_cone(bm, cap_ends=False, cap_tris=False, segments=num_segments, - diameter1=0, - diameter2=base_diameter, + radius1=0, + radius2=base_diameter / 2, depth=depth, matrix=get_face_matrix(face, pos + face.normal * depth * 0.5)) for vert in result['verts']: @@ -355,8 +355,8 @@ def add_surface_antenna_to_face(bm, face): cap_ends=True, cap_tris=False, segments=num_segments, - diameter1=base_diameter * uniform(1, 1.5), - diameter2=base_diameter * uniform(1.5, 2), + radius1=(base_diameter * uniform(1, 1.5) / 2), + radius2=(base_diameter * uniform(1.5, 2)) / 2, depth=depth_short, matrix=get_face_matrix(face, pos + face.normal * depth_short * 0.45)) for vert in result['verts']: @@ -373,16 +373,16 @@ def add_disc_to_face(bm, face): cap_ends=True, cap_tris=False, segments=32, - diameter1=depth * 3, - diameter2=depth * 4, + radius1=(depth * 3) / 2, + radius2=(depth * 4) / 2, depth=depth, matrix=get_face_matrix(face, face.calc_center_bounds() + face.normal * depth * 0.5)) result = bmesh.ops.create_cone(bm, cap_ends=False, cap_tris=False, segments=32, - diameter1=depth * 1.25, - diameter2=depth * 2.25, + radius1=(depth * 1.25) / 2, + radius2=(depth * 2.25) / 2, depth=0.0, matrix=get_face_matrix(face, face.calc_center_bounds() + face.normal * depth * 1.05)) for vert in result['verts']: @@ -585,7 +585,7 @@ def generate_spaceship(random_seed='', face = ribbed_extrude_face( bm, face, hull_segment_length, randint(2, 4), rib_scale) - # Add some large asymmetrical sections of the hull that stick out + # Add some large asynmmetrical sections of the hull that stick out if create_asymmetry_segments: for face in bm.faces[:]: # Skip any long thin faces as it'll probably look stupid