diff options
author | Stephen Leger <stephen@3dservices.ch> | 2018-11-16 17:31:26 +0300 |
---|---|---|
committer | Stephen Leger <stephen@3dservices.ch> | 2018-11-16 17:34:51 +0300 |
commit | bfbbd112c170d96e86838208b8781fd46df52514 (patch) | |
tree | 9fda29f608a32f8ac5a88e5873730bf6422dd280 /archipack/archipack_roof.py | |
parent | 64198b8817042962dcdedc71bb81ee9492b19a4d (diff) |
archipack 2.8 compatibility (step1)
Diffstat (limited to 'archipack/archipack_roof.py')
-rw-r--r-- | archipack/archipack_roof.py | 356 |
1 files changed, 178 insertions, 178 deletions
diff --git a/archipack/archipack_roof.py b/archipack/archipack_roof.py index 7d396d36..5ab21a38 100644 --- a/archipack/archipack_roof.py +++ b/archipack/archipack_roof.py @@ -1564,7 +1564,7 @@ class RoofGenerator(CutAbleGenerator): use_dissolve_boundaries=False, verts=bm.verts, edges=bm.edges, - delimit=1) + delimit={'MATERIAL'}) geom = bm.faces[:] verts = bm.verts[:] @@ -1595,7 +1595,7 @@ class RoofGenerator(CutAbleGenerator): BEVEL_AMT_PERCENT }; """ - offset_type = 3 + offset_type = 'PERCENT' if d.tile_offset > 0: offset = - d.tile_offset / 100 @@ -1694,8 +1694,8 @@ class RoofGenerator(CutAbleGenerator): step = 100 / ttl - if d.quick_edit: - context.scene.archipack_progress_text = "Build tiles:" + # if d.quick_edit: + # context.scene.archipack_progress_text = "Build tiles:" for i, pan in enumerate(self.pans): @@ -1742,8 +1742,8 @@ class RoofGenerator(CutAbleGenerator): progress = step * i + substep * k # print("progress %s" % (progress)) - if d.quick_edit: - context.scene.archipack_progress = progress + # if d.quick_edit: + # context.scene.archipack_progress = progress y = k * dy @@ -1759,7 +1759,7 @@ class RoofGenerator(CutAbleGenerator): for j in range(nx): x = x0 + j * dx - lM = tM * Matrix([ + lM = tM @ Matrix([ [sx, 0, 0, x], [0, sy, 0, -y], [0, 0, sz, 0], @@ -1768,7 +1768,7 @@ class RoofGenerator(CutAbleGenerator): v = len(verts) - verts.extend([lM * p for p in t_pts]) + verts.extend([lM @ p for p in t_pts]) faces.extend([tuple(i + v for i in f) for f in t_faces]) mid = randint(idmat, idmat + rand) t_mats = [mid for i in range(n_faces)] @@ -1847,7 +1847,7 @@ class RoofGenerator(CutAbleGenerator): segs[-1].p1 = p f_geom = [f for f in bm.faces if not pan.inside(f.calc_center_median().to_2d(), segs)] if len(f_geom) > 0: - bmesh.ops.delete(bm, geom=f_geom, context=5) + bmesh.ops.delete(bm, geom=f_geom, context="FACES") self.cut_holes(bm, pan) @@ -1856,7 +1856,7 @@ class RoofGenerator(CutAbleGenerator): use_dissolve_boundaries=False, verts=bm.verts[:], edges=bm.edges[:], - delimit=1) + delimit={'MATERIAL'}) if d.tile_bevel: geom = bm.verts[:] @@ -1868,7 +1868,7 @@ class RoofGenerator(CutAbleGenerator): segments=d.tile_bevel_segs, profile=0.5, vertex_only=False, - clight_overlap=True, + clamp_overlap=True, material=-1) if d.tile_solidify: @@ -1881,8 +1881,8 @@ class RoofGenerator(CutAbleGenerator): bmed.bmesh_join(context, o, [bm], normal_update=True) bpy.ops.object.mode_set(mode='OBJECT') - if d.quick_edit: - context.scene.archipack_progress = -1 + # if d.quick_edit: + # context.scene.archipack_progress = -1 def _bargeboard(self, s, i, boundary, pan, width, height, altitude, offset, idmat, @@ -2774,7 +2774,7 @@ class RoofGenerator(CutAbleGenerator): use_dissolve_boundaries=False, verts=bm.verts, edges=bm.edges, - delimit=1) + delimit={'MATERIAL'}) geom = bm.faces[:] verts = bm.verts[:] @@ -3040,7 +3040,7 @@ class RoofGenerator(CutAbleGenerator): t_verts[i].z += dz * t_verts[i].y for k in range(n_x): - lM = tM * Matrix([ + lM = tM @ Matrix([ [1, 0, 0, x0 + k * dx], [0, -1, 0, 0], [0, 0, 1, 0], @@ -3048,7 +3048,7 @@ class RoofGenerator(CutAbleGenerator): ]) f = len(verts) - verts.extend([lM * p for p in t_verts]) + verts.extend([lM @ p for p in t_verts]) faces.extend([tuple(i + f for i in p) for p in t_faces]) matids.extend(t_idmats) uvs.extend(t_uvs) @@ -3132,14 +3132,14 @@ class RoofGenerator(CutAbleGenerator): t_verts[i].z -= t_verts[i].y * (pan.slope - d.tile_size_z / d.tile_size_y) for k in range(n_obj): - lM = tM * Matrix([ + lM = tM @ Matrix([ [1, 0, 0, x0 + k * dx], [0, -1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1] ]) v = len(verts) - verts.extend([lM * p for p in t_verts]) + verts.extend([lM @ p for p in t_verts]) faces.extend([tuple(i + v for i in f) for f in t_faces]) matids.extend(t_idmats) uvs.extend(t_uvs) @@ -3243,19 +3243,19 @@ class RoofGenerator(CutAbleGenerator): pts = [p.to_3d() for p in pts] if hole_obj is None: - context.scene.objects.active = o.parent + context.view_layer.objects.active = o.parent bpy.ops.archipack.roof_cutter(parent=d.t_parent, auto_manipulate=False) hole_obj = context.active_object else: - context.scene.objects.active = hole_obj + context.view_layer.objects.active = hole_obj - hole_obj.select = True + hole_obj.select_set(state=True) if d.parts[0].a0 < 0: y = -d.t_dist_y else: y = d.t_dist_y - hole_obj.matrix_world = o.matrix_world * Matrix([ + hole_obj.matrix_world = o.matrix_world @ Matrix([ [1, 0, 0, 0], [0, 1, 0, y], [0, 0, 1, 0], @@ -3265,15 +3265,15 @@ class RoofGenerator(CutAbleGenerator): hd = archipack_roof_cutter.datablock(hole_obj) hd.boundary = o.name hd.update_points(context, hole_obj, pts, update_parent=update_parent) - hole_obj.select = False + hole_obj.select_set(state=False) - context.scene.objects.active = o + context.view_layer.objects.active = o def change_coordsys(self, fromTM, toTM): """ move shape fromTM into toTM coordsys """ - dp = (toTM.inverted() * fromTM.translation).to_2d() + dp = (toTM.inverted() @ fromTM.translation).to_2d() da = toTM.row[1].to_2d().angle_signed(fromTM.row[1].to_2d()) ca = cos(da) sa = sin(da) @@ -3282,7 +3282,7 @@ class RoofGenerator(CutAbleGenerator): [sa, ca] ]) for s in self.segs: - tp = (rM * s.p0) - s.p0 + dp + tp = (rM @ s.p0) - s.p0 + dp s.rotate(da) s.translate(tp) @@ -3357,9 +3357,9 @@ class RoofGenerator(CutAbleGenerator): wall_t[widx].append((0, z, 0)) old = context.active_object - old_sel = wall.select - wall.select = True - context.scene.objects.active = wall + old_sel = wall.select_get() + wall.select_set(state=True) + context.view_layer.objects.active = wall wd.auto_update = False # setup splits count and first split to 0 @@ -3412,8 +3412,8 @@ class RoofGenerator(CutAbleGenerator): for s in wg.segs: s.as_curve(context) """ - wall.select = old_sel - context.scene.objects.active = old + wall.select_set(state=old_sel) + context.view_layer.objects.active = old def boundary(self, context, o): """ @@ -3494,14 +3494,14 @@ def update_components(self, context): class ArchipackSegment(): - length = FloatProperty( + length : FloatProperty( name="Length", min=0.01, max=1000.0, default=4.0, update=update ) - a0 = FloatProperty( + a0 : FloatProperty( name="Angle", min=-2 * pi, max=2 * pi, @@ -3509,17 +3509,17 @@ class ArchipackSegment(): subtype='ANGLE', unit='ROTATION', update=update_cutter ) - manipulators = CollectionProperty(type=archipack_manipulator) + manipulators : CollectionProperty(type=archipack_manipulator) class ArchipackLines(): - n_parts = IntProperty( + n_parts : IntProperty( name="Parts", min=1, default=1, update=update_manipulators ) # UI layout related - parts_expand = BoolProperty( + parts_expand : BoolProperty( default=False ) @@ -3580,37 +3580,37 @@ class ArchipackLines(): class archipack_roof_segment(ArchipackSegment, PropertyGroup): - bound_idx = IntProperty( + bound_idx : IntProperty( name="Link to", default=0, min=0, update=update_manipulators ) - width_left = FloatProperty( + width_left : FloatProperty( name="L Width", min=0.01, default=3.0, update=update_cutter ) - width_right = FloatProperty( + width_right : FloatProperty( name="R Width", min=0.01, default=3.0, update=update_cutter ) - slope_left = FloatProperty( + slope_left : FloatProperty( name="L slope", min=0.0, default=0.3, update=update_cutter ) - slope_right = FloatProperty( + slope_right : FloatProperty( name="R slope", min=0.0, default=0.3, update=update_cutter ) - auto_left = EnumProperty( + auto_left : EnumProperty( description="Left mode", name="Left", items=( @@ -3622,7 +3622,7 @@ class archipack_roof_segment(ArchipackSegment, PropertyGroup): default="AUTO", update=update_manipulators ) - auto_right = EnumProperty( + auto_right : EnumProperty( description="Right mode", name="Right", items=( @@ -3634,19 +3634,19 @@ class archipack_roof_segment(ArchipackSegment, PropertyGroup): default="AUTO", update=update_manipulators ) - triangular_end = BoolProperty( + triangular_end : BoolProperty( name="Triangular end", default=False, update=update ) - take_precedence = BoolProperty( + take_precedence : BoolProperty( name="Take precedence", description="On T segment take width precedence", default=False, update=update ) - constraint_type = EnumProperty( + constraint_type : EnumProperty( items=( ('HORIZONTAL', 'Horizontal', '', 0), ('SLOPE', 'Slope', '', 1) @@ -3655,7 +3655,7 @@ class archipack_roof_segment(ArchipackSegment, PropertyGroup): update=update_manipulators ) - enforce_part = EnumProperty( + enforce_part : EnumProperty( name="Enforce part", items=( ('AUTO', 'Auto', '', 0), @@ -3687,7 +3687,7 @@ class archipack_roof_segment(ArchipackSegment, PropertyGroup): if self.constraint_type == 'SLOPE': box.prop(self, "enforce_part", text="") else: - box.label("Part 1:") + box.label(text="Part 1:") box.prop(self, "length") box.prop(self, "a0") @@ -3720,63 +3720,63 @@ class archipack_roof_segment(ArchipackSegment, PropertyGroup): class archipack_roof(ArchipackLines, ArchipackObject, Manipulable, PropertyGroup): - parts = CollectionProperty(type=archipack_roof_segment) - z = FloatProperty( + parts : CollectionProperty(type=archipack_roof_segment) + z : FloatProperty( name="Altitude", default=3, precision=2, step=1, unit='LENGTH', subtype='DISTANCE', update=update_childs ) - slope_left = FloatProperty( + slope_left : FloatProperty( name="L slope", default=0.5, precision=2, step=1, update=update_childs ) - slope_right = FloatProperty( + slope_right : FloatProperty( name="R slope", default=0.5, precision=2, step=1, update=update_childs ) - width_left = FloatProperty( + width_left : FloatProperty( name="L width", default=3, precision=2, step=1, unit='LENGTH', subtype='DISTANCE', update=update_cutter ) - width_right = FloatProperty( + width_right : FloatProperty( name="R width", default=3, precision=2, step=1, unit='LENGTH', subtype='DISTANCE', update=update_cutter ) - draft = BoolProperty( + draft : BoolProperty( options={'SKIP_SAVE'}, name="Draft mode", default=False, update=update_manipulators ) - auto_update = BoolProperty( + auto_update : BoolProperty( options={'SKIP_SAVE'}, default=True, update=update_manipulators ) - quick_edit = BoolProperty( + quick_edit : BoolProperty( options={'SKIP_SAVE'}, name="Quick Edit", - default=True + default=False ) - tile_enable = BoolProperty( + tile_enable : BoolProperty( name="Enable", default=True, update=update_components ) - tile_solidify = BoolProperty( + tile_solidify : BoolProperty( name="Solidify", default=True, update=update_components ) - tile_height = FloatProperty( + tile_height : FloatProperty( name="Height", description="Amount for solidify", min=0, @@ -3784,12 +3784,12 @@ class archipack_roof(ArchipackLines, ArchipackObject, Manipulable, PropertyGroup unit='LENGTH', subtype='DISTANCE', update=update_components ) - tile_bevel = BoolProperty( + tile_bevel : BoolProperty( name="Bevel", default=False, update=update_components ) - tile_bevel_amt = FloatProperty( + tile_bevel_amt : FloatProperty( name="Amount", description="Amount for bevel", min=0, @@ -3797,19 +3797,19 @@ class archipack_roof(ArchipackLines, ArchipackObject, Manipulable, PropertyGroup unit='LENGTH', subtype='DISTANCE', update=update_components ) - tile_bevel_segs = IntProperty( + tile_bevel_segs : IntProperty( name="Segs", description="Bevel Segs", min=1, default=2, update=update_components ) - tile_alternate = BoolProperty( + tile_alternate : BoolProperty( name="Alternate", default=False, update=update_components ) - tile_offset = FloatProperty( + tile_offset : FloatProperty( name="Offset", description="Offset from start", min=0, @@ -3817,14 +3817,14 @@ class archipack_roof(ArchipackLines, ArchipackObject, Manipulable, PropertyGroup subtype="PERCENTAGE", update=update_components ) - tile_altitude = FloatProperty( + tile_altitude : FloatProperty( name="Altitude", description="Altitude from roof", default=0.1, unit='LENGTH', subtype='DISTANCE', update=update_components ) - tile_size_x = FloatProperty( + tile_size_x : FloatProperty( name="Width", description="Size of tiles on x axis", min=0.01, @@ -3832,7 +3832,7 @@ class archipack_roof(ArchipackLines, ArchipackObject, Manipulable, PropertyGroup unit='LENGTH', subtype='DISTANCE', update=update_components ) - tile_size_y = FloatProperty( + tile_size_y : FloatProperty( name="Length", description="Size of tiles on y axis", min=0.01, @@ -3840,7 +3840,7 @@ class archipack_roof(ArchipackLines, ArchipackObject, Manipulable, PropertyGroup unit='LENGTH', subtype='DISTANCE', update=update_components ) - tile_size_z = FloatProperty( + tile_size_z : FloatProperty( name="Thickness", description="Size of tiles on z axis", min=0.0, @@ -3848,7 +3848,7 @@ class archipack_roof(ArchipackLines, ArchipackObject, Manipulable, PropertyGroup unit='LENGTH', subtype='DISTANCE', update=update_components ) - tile_space_x = FloatProperty( + tile_space_x : FloatProperty( name="Width", description="Space between tiles on x axis", min=0.01, @@ -3856,7 +3856,7 @@ class archipack_roof(ArchipackLines, ArchipackObject, Manipulable, PropertyGroup unit='LENGTH', subtype='DISTANCE', update=update_components ) - tile_space_y = FloatProperty( + tile_space_y : FloatProperty( name="Length", description="Space between tiles on y axis", min=0.01, @@ -3864,25 +3864,25 @@ class archipack_roof(ArchipackLines, ArchipackObject, Manipulable, PropertyGroup unit='LENGTH', subtype='DISTANCE', update=update_components ) - tile_fit_x = BoolProperty( + tile_fit_x : BoolProperty( name="Fit x", description="Fit roof on x axis", default=True, update=update_components ) - tile_fit_y = BoolProperty( + tile_fit_y : BoolProperty( name="Fit y", description="Fit roof on y axis", default=True, update=update_components ) - tile_expand = BoolProperty( + tile_expand : BoolProperty( options={'SKIP_SAVE'}, name="Tiles", description="Expand tiles panel", default=False ) - tile_model = EnumProperty( + tile_model : EnumProperty( name="Model", items=( ('BRAAS1', 'Braas 1', '', 0), @@ -3899,14 +3899,14 @@ class archipack_roof(ArchipackLines, ArchipackObject, Manipulable, PropertyGroup default="BRAAS2", update=update_components ) - tile_side = FloatProperty( + tile_side : FloatProperty( name="Side", description="Space on side", default=0, unit='LENGTH', subtype='DISTANCE', update=update_components ) - tile_couloir = FloatProperty( + tile_couloir : FloatProperty( name="Valley", description="Space between tiles on valley", min=0, @@ -3914,7 +3914,7 @@ class archipack_roof(ArchipackLines, ArchipackObject, Manipulable, PropertyGroup unit='LENGTH', subtype='DISTANCE', update=update_components ) - tile_border = FloatProperty( + tile_border : FloatProperty( name="Bottom", description="Tiles offset from bottom", default=0, @@ -3922,25 +3922,25 @@ class archipack_roof(ArchipackLines, ArchipackObject, Manipulable, PropertyGroup update=update_components ) - gutter_expand = BoolProperty( + gutter_expand : BoolProperty( options={'SKIP_SAVE'}, name="Gutter", description="Expand gutter panel", default=False ) - gutter_enable = BoolProperty( + gutter_enable : BoolProperty( name="Enable", default=True, update=update_components ) - gutter_alt = FloatProperty( + gutter_alt : FloatProperty( name="Altitude", description="altitude", default=0, unit='LENGTH', subtype='DISTANCE', update=update_components ) - gutter_width = FloatProperty( + gutter_width : FloatProperty( name="Width", description="Width", min=0.01, @@ -3948,7 +3948,7 @@ class archipack_roof(ArchipackLines, ArchipackObject, Manipulable, PropertyGroup unit='LENGTH', subtype='DISTANCE', update=update_components ) - gutter_dist = FloatProperty( + gutter_dist : FloatProperty( name="Spacing", description="Spacing", min=0, @@ -3956,7 +3956,7 @@ class archipack_roof(ArchipackLines, ArchipackObject, Manipulable, PropertyGroup unit='LENGTH', subtype='DISTANCE', update=update_components ) - gutter_boudin = FloatProperty( + gutter_boudin : FloatProperty( name="Small width", description="Small width", min=0, @@ -3964,25 +3964,25 @@ class archipack_roof(ArchipackLines, ArchipackObject, Manipulable, PropertyGroup unit='LENGTH', subtype='DISTANCE', update=update_components ) - gutter_segs = IntProperty( + gutter_segs : IntProperty( default=6, min=1, name="Segs", update=update_components ) - beam_expand = BoolProperty( + beam_expand : BoolProperty( options={'SKIP_SAVE'}, name="Beam", description="Expand beam panel", default=False ) - beam_enable = BoolProperty( + beam_enable : BoolProperty( name="Ridge pole", default=True, update=update_components ) - beam_width = FloatProperty( + beam_width : FloatProperty( name="Width", description="Width", min=0.01, @@ -3990,7 +3990,7 @@ class archipack_roof(ArchipackLines, ArchipackObject, Manipulable, PropertyGroup unit='LENGTH', subtype='DISTANCE', update=update_components ) - beam_height = FloatProperty( + beam_height : FloatProperty( name="Height", description="Height", min=0.01, @@ -3998,26 +3998,26 @@ class archipack_roof(ArchipackLines, ArchipackObject, Manipulable, PropertyGroup unit='LENGTH', subtype='DISTANCE', update=update_components ) - beam_offset = FloatProperty( + beam_offset : FloatProperty( name="Offset", description="Distance from roof border", default=0.02, unit='LENGTH', subtype='DISTANCE', update=update_components ) - beam_alt = FloatProperty( + beam_alt : FloatProperty( name="Altitude", description="Altitude from roof", default=-0.15, unit='LENGTH', subtype='DISTANCE', update=update_components ) - beam_sec_enable = BoolProperty( + beam_sec_enable : BoolProperty( name="Hip rafter", default=True, update=update_components ) - beam_sec_width = FloatProperty( + beam_sec_width : FloatProperty( name="Width", description="Width", min=0.01, @@ -4025,7 +4025,7 @@ class archipack_roof(ArchipackLines, ArchipackObject, Manipulable, PropertyGroup unit='LENGTH', subtype='DISTANCE', update=update_components ) - beam_sec_height = FloatProperty( + beam_sec_height : FloatProperty( name="Height", description="Height", min=0.01, @@ -4033,19 +4033,19 @@ class archipack_roof(ArchipackLines, ArchipackObject, Manipulable, PropertyGroup unit='LENGTH', subtype='DISTANCE', update=update_components ) - beam_sec_alt = FloatProperty( + beam_sec_alt : FloatProperty( name="Altitude", description="Distance from roof", default=-0.1, unit='LENGTH', subtype='DISTANCE', update=update_components ) - rafter_enable = BoolProperty( + rafter_enable : BoolProperty( name="Rafter", default=True, update=update_components ) - rafter_width = FloatProperty( + rafter_width : FloatProperty( name="Width", description="Width", min=0.01, @@ -4053,7 +4053,7 @@ class archipack_roof(ArchipackLines, ArchipackObject, Manipulable, PropertyGroup unit='LENGTH', subtype='DISTANCE', update=update_components ) - rafter_height = FloatProperty( + rafter_height : FloatProperty( name="Height", description="Height", min=0.01, @@ -4061,7 +4061,7 @@ class archipack_roof(ArchipackLines, ArchipackObject, Manipulable, PropertyGroup unit='LENGTH', subtype='DISTANCE', update=update_components ) - rafter_spacing = FloatProperty( + rafter_spacing : FloatProperty( name="Spacing", description="Spacing", min=0.1, @@ -4069,7 +4069,7 @@ class archipack_roof(ArchipackLines, ArchipackObject, Manipulable, PropertyGroup unit='LENGTH', subtype='DISTANCE', update=update_components ) - rafter_start = FloatProperty( + rafter_start : FloatProperty( name="Offset", description="Spacing from roof border", min=0, @@ -4077,7 +4077,7 @@ class archipack_roof(ArchipackLines, ArchipackObject, Manipulable, PropertyGroup unit='LENGTH', subtype='DISTANCE', update=update_components ) - rafter_alt = FloatProperty( + rafter_alt : FloatProperty( name="Altitude", description="Altitude from roof", max=-0.0001, @@ -4086,25 +4086,25 @@ class archipack_roof(ArchipackLines, ArchipackObject, Manipulable, PropertyGroup update=update_components ) - hip_enable = BoolProperty( + hip_enable : BoolProperty( name="Enable", default=True, update=update_components ) - hip_expand = BoolProperty( + hip_expand : BoolProperty( options={'SKIP_SAVE'}, name="Hips", description="Expand hips panel", default=False ) - hip_alt = FloatProperty( + hip_alt : FloatProperty( name="Altitude", description="Hip altitude from roof", default=0.1, unit='LENGTH', subtype='DISTANCE', update=update_components ) - hip_space_x = FloatProperty( + hip_space_x : FloatProperty( name="Spacing", description="Space between hips", min=0.01, @@ -4112,7 +4112,7 @@ class archipack_roof(ArchipackLines, ArchipackObject, Manipulable, PropertyGroup unit='LENGTH', subtype='DISTANCE', update=update_components ) - hip_size_x = FloatProperty( + hip_size_x : FloatProperty( name="Length", description="Length of hip", min=0.01, @@ -4120,7 +4120,7 @@ class archipack_roof(ArchipackLines, ArchipackObject, Manipulable, PropertyGroup unit='LENGTH', subtype='DISTANCE', update=update_components ) - hip_size_y = FloatProperty( + hip_size_y : FloatProperty( name="Width", description="Width of hip", min=0.01, @@ -4128,7 +4128,7 @@ class archipack_roof(ArchipackLines, ArchipackObject, Manipulable, PropertyGroup unit='LENGTH', subtype='DISTANCE', update=update_components ) - hip_size_z = FloatProperty( + hip_size_z : FloatProperty( name="Height", description="Height of hip", min=0.0, @@ -4136,7 +4136,7 @@ class archipack_roof(ArchipackLines, ArchipackObject, Manipulable, PropertyGroup unit='LENGTH', subtype='DISTANCE', update=update_components ) - hip_model = EnumProperty( + hip_model : EnumProperty( name="Model", items=( ('ROUND', 'Round', '', 0), @@ -4146,32 +4146,32 @@ class archipack_roof(ArchipackLines, ArchipackObject, Manipulable, PropertyGroup default="ROUND", update=update_components ) - valley_altitude = FloatProperty( + valley_altitude : FloatProperty( name="Altitude", description="Valley altitude from roof", default=0.1, unit='LENGTH', subtype='DISTANCE', update=update_components ) - valley_enable = BoolProperty( + valley_enable : BoolProperty( name="Valley", default=True, update=update_components ) - fascia_enable = BoolProperty( + fascia_enable : BoolProperty( name="Enable", description="Enable Fascia", default=True, update=update_components ) - fascia_expand = BoolProperty( + fascia_expand : BoolProperty( options={'SKIP_SAVE'}, name="Fascia", description="Expand fascia panel", default=False ) - fascia_height = FloatProperty( + fascia_height : FloatProperty( name="Height", description="Height", min=0.01, @@ -4179,7 +4179,7 @@ class archipack_roof(ArchipackLines, ArchipackObject, Manipulable, PropertyGroup unit='LENGTH', subtype='DISTANCE', update=update_components ) - fascia_width = FloatProperty( + fascia_width : FloatProperty( name="Width", description="Width", min=0.01, @@ -4187,14 +4187,14 @@ class archipack_roof(ArchipackLines, ArchipackObject, Manipulable, PropertyGroup unit='LENGTH', subtype='DISTANCE', update=update_components ) - fascia_offset = FloatProperty( + fascia_offset : FloatProperty( name="Offset", description="Offset from roof border", default=0, unit='LENGTH', subtype='DISTANCE', update=update_components ) - fascia_altitude = FloatProperty( + fascia_altitude : FloatProperty( name="Altitude", description="Fascia altitude from roof", default=0.1, @@ -4202,19 +4202,19 @@ class archipack_roof(ArchipackLines, ArchipackObject, Manipulable, PropertyGroup update=update_components ) - bargeboard_enable = BoolProperty( + bargeboard_enable : BoolProperty( name="Enable", description="Enable Bargeboard", default=True, update=update_components ) - bargeboard_expand = BoolProperty( + bargeboard_expand : BoolProperty( options={'SKIP_SAVE'}, name="Bargeboard", description="Expand Bargeboard panel", default=False ) - bargeboard_height = FloatProperty( + bargeboard_height : FloatProperty( name="Height", description="Height", min=0.01, @@ -4222,7 +4222,7 @@ class archipack_roof(ArchipackLines, ArchipackObject, Manipulable, PropertyGroup unit='LENGTH', subtype='DISTANCE', update=update_components ) - bargeboard_width = FloatProperty( + bargeboard_width : FloatProperty( name="Width", description="Width", min=0.01, @@ -4230,14 +4230,14 @@ class archipack_roof(ArchipackLines, ArchipackObject, Manipulable, PropertyGroup unit='LENGTH', subtype='DISTANCE', update=update_components ) - bargeboard_offset = FloatProperty( + bargeboard_offset : FloatProperty( name="Offset", description="Offset from roof border", default=0.001, unit='LENGTH', subtype='DISTANCE', update=update_components ) - bargeboard_altitude = FloatProperty( + bargeboard_altitude : FloatProperty( name="Altitude", description="Fascia altitude from roof", default=0.1, @@ -4245,25 +4245,25 @@ class archipack_roof(ArchipackLines, ArchipackObject, Manipulable, PropertyGroup update=update_components ) - t_parent = StringProperty( + t_parent : StringProperty( name="Parent", default="", update=update_parent ) - t_part = IntProperty( + t_part : IntProperty( name="Part", description="Parent part index", default=0, min=0, update=update_cutter ) - t_dist_x = FloatProperty( + t_dist_x : FloatProperty( name="Dist x", description="Location on axis ", default=0, update=update_cutter ) - t_dist_y = FloatProperty( + t_dist_y : FloatProperty( name="Dist y", description="Lateral distance from axis", min=0.0001, @@ -4271,21 +4271,21 @@ class archipack_roof(ArchipackLines, ArchipackObject, Manipulable, PropertyGroup update=update_cutter ) - hole_offset_left = FloatProperty( + hole_offset_left : FloatProperty( name="Left", description="Left distance from border", min=0, default=0, update=update_cutter ) - hole_offset_right = FloatProperty( + hole_offset_right : FloatProperty( name="Right", description="Right distance from border", min=0, default=0, update=update_cutter ) - hole_offset_front = FloatProperty( + hole_offset_front : FloatProperty( name="Front", description="Front distance from border", default=0, @@ -4420,7 +4420,7 @@ class archipack_roof(ArchipackLines, ArchipackObject, Manipulable, PropertyGroup t = (d.t_dist_x / seg.length) x, y, z = seg.lerp(t).to_3d() dy = -seg.v.normalized() - child.matrix_world = o.matrix_world * Matrix([ + child.matrix_world = o.matrix_world @ Matrix([ [dy.x, -dy.y, 0, x], [dy.y, dy.x, 0, y], [0, 0, 1, z], @@ -4438,13 +4438,13 @@ class archipack_roof(ArchipackLines, ArchipackObject, Manipulable, PropertyGroup d = archipack_roof.datablock(child) if d is not None and d.t_parent == o.name: # print("upate_childs(%s)" % (child.name)) - child.select = True - context.scene.objects.active = child + child.select_set(state=True) + context.view_layer.objects.active = child # regenerate hole d.update(context, update_hole=True, update_parent=False) - child.select = False - o.select = True - context.scene.objects.active = o + child.select_set(state=False) + o.select_set(state=True) + context.view_layer.objects.active = o def update(self, context, @@ -4726,8 +4726,8 @@ def update_operation(self, context): class archipack_roof_cutter_segment(ArchipackCutterPart, PropertyGroup): - manipulators = CollectionProperty(type=archipack_manipulator) - type = EnumProperty( + manipulators : CollectionProperty(type=archipack_manipulator) + type : EnumProperty( name="Type", items=( ('SIDE', 'Side', 'Side with bargeboard', 0), @@ -4754,8 +4754,8 @@ class archipack_roof_cutter_segment(ArchipackCutterPart, PropertyGroup): class archipack_roof_cutter(ArchipackCutter, ArchipackObject, Manipulable, PropertyGroup): # boundary - parts = CollectionProperty(type=archipack_roof_cutter_segment) - boundary = StringProperty( + parts : CollectionProperty(type=archipack_roof_cutter_segment) + boundary : StringProperty( default="", name="Boundary", description="Boundary of t child to cut parent" @@ -4778,11 +4778,11 @@ class archipack_roof_cutter(ArchipackCutter, ArchipackObject, Manipulable, Prope d = archipack_roof.datablock(o.parent) if d is not None: - o.parent.select = True - context.scene.objects.active = o.parent + o.parent.select_set(state=True) + context.view_layer.objects.active = o.parent d.update(context, update_childs=False, update_hole=False) - o.parent.select = False - context.scene.objects.active = o + o.parent.select_set(state=False) + context.view_layer.objects.active = o # print("update_parent") @@ -4791,7 +4791,7 @@ class ARCHIPACK_PT_roof_cutter(Panel): bl_label = "Roof Cutter" bl_space_type = 'VIEW_3D' bl_region_type = 'UI' - bl_category = 'ArchiPack' + bl_category = 'Archipack' @classmethod def poll(cls, context): @@ -4808,7 +4808,7 @@ class ARCHIPACK_PT_roof_cutter(Panel): box.label(text="Auto Cutter:") box.label(text=prop.boundary) else: - box.operator('archipack.roof_cutter_manipulate', icon='HAND') + box.operator('archipack.roof_cutter_manipulate', icon='VIEW_PAN') box.prop(prop, 'operation', text="") box = layout.box() box.label(text="From curve") @@ -4828,7 +4828,7 @@ class ARCHIPACK_PT_roof(Panel): bl_label = "Roof" bl_space_type = 'VIEW_3D' bl_region_type = 'UI' - bl_category = 'ArchiPack' + bl_category = 'Archipack' @classmethod def poll(cls, context): @@ -4842,13 +4842,13 @@ class ARCHIPACK_PT_roof(Panel): scene = context.scene layout = self.layout row = layout.row(align=True) - row.operator('archipack.roof_manipulate', icon='HAND') + row.operator('archipack.roof_manipulate', icon='VIEW_PAN') box = layout.box() row = box.row(align=True) row.operator("archipack.roof_preset_menu", text=bpy.types.ARCHIPACK_OT_roof_preset_menu.bl_label) - row.operator("archipack.roof_preset", text="", icon='ZOOMIN') - row.operator("archipack.roof_preset", text="", icon='ZOOMOUT').remove_active = True + row.operator("archipack.roof_preset", text="", icon='ADD') + row.operator("archipack.roof_preset", text="", icon='REMOVE').remove_active = True box = layout.box() box.prop_search(prop, "t_parent", scene, "objects", text="Parent", icon='OBJECT_DATA') layout.operator('archipack.roof_cutter').parent = o.name @@ -5029,9 +5029,9 @@ class ARCHIPACK_OT_roof(ArchipackCreateTool, Operator): d = m.archipack_roof.add() # make manipulators selectable d.manipulable_selectable = True - context.scene.objects.link(o) - o.select = True - context.scene.objects.active = o + context.scene.collection.objects.link(o) + o.select_set(state=True) + context.view_layer.objects.active = o self.add_material(o) # disable progress bar when @@ -5050,8 +5050,8 @@ class ARCHIPACK_OT_roof(ArchipackCreateTool, Operator): bpy.ops.object.select_all(action="DESELECT") o = self.create(context) o.location = context.scene.cursor_location - o.select = True - context.scene.objects.active = o + o.select_set(state=True) + context.view_layer.objects.active = o self.manipulate() return {'FINISHED'} else: @@ -5066,7 +5066,7 @@ class ARCHIPACK_OT_roof_cutter(ArchipackCreateTool, Operator): bl_category = 'Archipack' bl_options = {'REGISTER', 'UNDO'} - parent = StringProperty("") + parent : StringProperty("") def create(self, context): m = bpy.data.meshes.new("Roof Cutter") @@ -5081,7 +5081,7 @@ class ARCHIPACK_OT_roof_cutter(ArchipackCreateTool, Operator): x1, y1, z = bbox[6] x = 0.2 * (x1 - x0) y = 0.2 * (y1 - y0) - o.matrix_world = parent.matrix_world * Matrix([ + o.matrix_world = parent.matrix_world @ Matrix([ [1, 0, 0, -3 * x], [0, 1, 0, 0], [0, 0, 1, 0], @@ -5104,9 +5104,9 @@ class ARCHIPACK_OT_roof_cutter(ArchipackCreateTool, Operator): o.location = context.scene.cursor_location # make manipulators selectable d.manipulable_selectable = True - context.scene.objects.link(o) - o.select = True - context.scene.objects.active = o + context.scene.collection.objects.link(o) + o.select_set(state=True) + context.view_layer.objects.active = o self.add_material(o) self.load_preset(d) update_operation(d, context) @@ -5119,8 +5119,8 @@ class ARCHIPACK_OT_roof_cutter(ArchipackCreateTool, Operator): if context.mode == "OBJECT": bpy.ops.object.select_all(action="DESELECT") o = self.create(context) - o.select = True - context.scene.objects.active = o + o.select_set(state=True) + context.view_layer.objects.active = o self.manipulate() return {'FINISHED'} else: @@ -5140,7 +5140,7 @@ class ARCHIPACK_OT_roof_from_curve(Operator): bl_category = 'Archipack' bl_options = {'REGISTER', 'UNDO'} - auto_manipulate = BoolProperty(default=True) + auto_manipulate : BoolProperty(default=True) @classmethod def poll(self, context): @@ -5149,7 +5149,7 @@ class ARCHIPACK_OT_roof_from_curve(Operator): def draw(self, context): layout = self.layout row = layout.row() - row.label("Use Properties panel (N) to define parms", icon='INFO') + row.label(text="Use Properties panel (N) to define parms", icon='INFO') def create(self, context): curve = context.active_object @@ -5159,9 +5159,9 @@ class ARCHIPACK_OT_roof_from_curve(Operator): # make manipulators selectable d.manipulable_selectable = True d.user_defined_path = curve.name - context.scene.objects.link(o) - o.select = True - context.scene.objects.active = o + context.scene.collection.objects.link(o) + o.select_set(state=True) + context.view_layer.objects.active = o d.update_path(context) spline = curve.data.splines[0] @@ -5172,14 +5172,14 @@ class ARCHIPACK_OT_roof_from_curve(Operator): else: pt = Vector((0, 0, 0)) # pretranslate - o.matrix_world = curve.matrix_world * Matrix([ + o.matrix_world = curve.matrix_world @ Matrix([ [1, 0, 0, pt.x], [0, 1, 0, pt.y], [0, 0, 1, pt.z], [0, 0, 0, 1] ]) - o.select = True - context.scene.objects.active = o + o.select_set(state=True) + context.view_layer.objects.active = o return o # ----------------------------------------------------- @@ -5250,7 +5250,7 @@ class ArchipackThrottleHandler(): def start_timer(self, context): self.start = time.time() - self._timer = context.window_manager.event_timer_add(self.delay, context.window) + self._timer = context.window_manager.event_timer_add(self.delay, window=context.window) def stop_timer(self, context): if self._timer is not None: @@ -5300,7 +5300,7 @@ class ARCHIPACK_OT_roof_throttle_update(Operator): bl_idname = "archipack.roof_throttle_update" bl_label = "Update childs with a delay" - name = StringProperty() + name : StringProperty() def kill_handler(self, context, name): if name in throttle_handlers.keys(): @@ -5321,16 +5321,16 @@ class ARCHIPACK_OT_roof_throttle_update(Operator): o = context.scene.objects.get(self.name) # print("delay update of %s" % (self.name)) if o is not None: - selected = o.select - o.select = True - context.scene.objects.active = o + selected = o.select_get() + o.select_set(state=True) + context.view_layer.objects.active = o d = o.data.archipack_roof[0] d.update(context, force_update=True, update_parent=False) # skip_parent_update=self.skip_parent_update) - o.select = selected - context.scene.objects.active = act + o.select_set(state=selected) + context.view_layer.objects.active = act del throttle_handlers[self.name] return {'FINISHED'} else: |