Skip to content

Commit

Permalink
feat: add the ability to recall previous edge bevel weights
Browse files Browse the repository at this point in the history
  • Loading branch information
tristan-hm committed Jun 25, 2022
1 parent 2ccb087 commit e381ab3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions bevels/edge_bevel.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ def summon_old_operator(self, context, mods):
self.segments_prev = self.segments = self.bevel.segments
self.profile_prev = self.profile = self.bevel.profile
self.harden_normals_prev = self.harden_normals = self.bevel.harden_normals
self.weight = self.edge_weight_average


def add_smooth_shading(self, context):
Expand Down Expand Up @@ -279,6 +280,7 @@ def add_weld_modifier(self, context):

def take_edges_snapshot(self, context):
self.edges_snapshot = {}
self.edge_weight_average = 0

data = context.active_object.data
bm = bmesh.from_edit_mesh(data)
Expand All @@ -287,6 +289,9 @@ def take_edges_snapshot(self, context):
selected_edges = [edge for edge in bm.edges if edge.select]
for edge in selected_edges:
self.edges_snapshot[edge.index] = edge[bevel_weight_layer]
self.edge_weight_average += edge[bevel_weight_layer]

self.edge_weight_average /= len(selected_edges)


def operate(self, context):
Expand Down

0 comments on commit e381ab3

Please sign in to comment.