Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'release/scripts/startup/bl_operators/mesh.py')
-rw-r--r--release/scripts/startup/bl_operators/mesh.py50
1 files changed, 0 insertions, 50 deletions
diff --git a/release/scripts/startup/bl_operators/mesh.py b/release/scripts/startup/bl_operators/mesh.py
index a7475dcc6ef..1149d7a0dfb 100644
--- a/release/scripts/startup/bl_operators/mesh.py
+++ b/release/scripts/startup/bl_operators/mesh.py
@@ -205,57 +205,7 @@ class MeshSelectPrev(Operator):
return {'FINISHED'}
-# XXX This is hackish (going forth and back from Object mode...), to be redone once we have proper support of
-# custom normals in BMesh/edit mode.
-class MehsSetNormalsFromFaces(Operator):
- """Set the custom vertex normals from the selected faces ones"""
- bl_idname = "mesh.set_normals_from_faces"
- bl_label = "Set Normals From Faces"
- bl_options = {'REGISTER', 'UNDO'}
-
- @classmethod
- def poll(cls, context):
- return (context.mode == 'EDIT_MESH' and context.edit_object.data.polygons)
-
- def execute(self, context):
- import mathutils
-
- bpy.ops.object.mode_set(mode='OBJECT')
- obj = context.active_object
- me = obj.data
-
- v2nors = {}
- for p in me.polygons:
- if not p.select:
- continue
- for lidx, vidx in zip(p.loop_indices, p.vertices):
- assert(me.loops[lidx].vertex_index == vidx)
- v2nors.setdefault(vidx, []).append(p.normal)
-
- for nors in v2nors.values():
- nors[:] = [sum(nors, mathutils.Vector((0, 0, 0))).normalized()]
-
- if not me.has_custom_normals:
- me.create_normals_split()
- me.calc_normals_split()
-
- normals = []
- for l in me.loops:
- nor = v2nors.get(l.vertex_index, [None])[0]
- if nor is None:
- nor = l.normal
- normals.append(nor.to_tuple())
-
- me.normals_split_custom_set(normals)
-
- me.free_normals_split()
- bpy.ops.object.mode_set(mode='EDIT')
-
- return {'FINISHED'}
-
-
classes = (
- MehsSetNormalsFromFaces,
MeshMirrorUV,
MeshSelectNext,
MeshSelectPrev,