Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # We need the absolute normals as generated by Blender
- for shape_vert in shape.vertices:
- shape_vert.co -= ob.data.vertices[shape_vert.index].co - corrective_target.vertices[shape_vert.index].co
- shape.calc_normals_split()
- for ob_loop in ob.data.loops:
- shape_loop = shape.loops[ob_loop.index]
- norm = shape_loop.normal
- if corrective:
- base = Vector(ob_loop.normal)
- for corrective_target in corrective_target_shapes:
- # Normals for corrective shape keys are deltas from those of the deformed mesh, not the basis shape.
- base += corrective_target.loops[shape_loop.index].normal - ob_loop.normal
- else:
- base = ob_loop.normal
- if norm.dot(base.normalized()) < 1 - 1e-3:
- shape_norms.append(datamodel.Vector3(norm - base))
- shape_normIndices.append(shape_loop.index)
- if wrinkle_scale:
- delta_len = delta_lengths[ob_loop.vertex_index]
- if delta_len:
- max_delta = max(max_delta,delta_len)
- wrinkle.append(delta_len)
- wrinkleIndices.append(texcoIndices[ob_loop.index])
- del shape_vert
- if wrinkle_scale and max_delta:
- wrinkle_mod = wrinkle_scale / max_delta
- if wrinkle_mod != 1:
- for i in range(len(wrinkle)):
- wrinkle[i] *= wrinkle_mod
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement