[Bf-blender-cvs] [3a61bfb4a0a] experimental-build: Revert "Squashed commit of the following:"

Rohan Rathi noreply at git.blender.org
Fri Jul 28 07:32:18 CEST 2017


Commit: 3a61bfb4a0a0412d4e3438c67e5594f2db0cc94f
Author: Rohan Rathi
Date:   Fri Jul 28 11:01:43 2017 +0530
Branches: experimental-build
https://developer.blender.org/rB3a61bfb4a0a0412d4e3438c67e5594f2db0cc94f

Revert "Squashed commit of the following:"

This reverts commit fc4d697408fe6eb5e7ade9e42f1be3b576889a72.

===================================================================

M	release/scripts/startup/bl_operators/mesh.py
M	release/scripts/startup/bl_ui/properties_data_modifier.py
M	release/scripts/startup/bl_ui/space_view3d_toolbar.py
M	source/blender/blenkernel/intern/editderivedmesh.c
M	source/blender/bmesh/bmesh_class.h
M	source/blender/bmesh/intern/bmesh_mesh.c
M	source/blender/bmesh/intern/bmesh_mesh.h
M	source/blender/bmesh/intern/bmesh_opdefines.c
M	source/blender/bmesh/intern/bmesh_operator_api.h
M	source/blender/editors/include/ED_screen.h
M	source/blender/editors/include/ED_transform.h
M	source/blender/editors/mesh/editmesh_tools.c
M	source/blender/editors/mesh/editmesh_undo.c
M	source/blender/editors/mesh/editmesh_utils.c
M	source/blender/editors/mesh/mesh_intern.h
M	source/blender/editors/mesh/mesh_ops.c
M	source/blender/editors/screen/screen_ops.c
M	source/blender/editors/transform/transform.c
M	source/blender/editors/transform/transform.h
M	source/blender/editors/transform/transform_generics.c
M	source/blender/editors/transform/transform_ops.c
M	source/blender/makesdna/DNA_modifier_types.h
M	source/blender/makesrna/RNA_access.h
M	source/blender/makesrna/intern/rna_modifier.c
M	source/blender/modifiers/CMakeLists.txt
M	source/blender/modifiers/MOD_modifiertypes.h
M	source/blender/modifiers/intern/MOD_util.c
D	source/blender/modifiers/intern/MOD_weighted_normal.c

===================================================================

diff --git a/release/scripts/startup/bl_operators/mesh.py b/release/scripts/startup/bl_operators/mesh.py
index 95e1fa0a1f2..4edefd7bf9b 100644
--- a/release/scripts/startup/bl_operators/mesh.py
+++ b/release/scripts/startup/bl_operators/mesh.py
@@ -203,7 +203,57 @@ 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,
diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py
index ef7f46e0954..d72855fab6b 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -1529,14 +1529,6 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
         if md.rest_source == 'BIND':
             layout.operator("object.correctivesmooth_bind", text="Unbind" if is_bind else "Bind")
 
-    def WEIGHTED_NORMAL(self, layout, ob, md):
-        col = layout.column()
-        col.label("Weighting Mode:")
-        col.prop(md, "mode", text="")
-
-        layout.prop(md, "weight", text="Weight")
-        layout.prop(md, "thresh", text="Threshold")
-
 
 classes = (
     DATA_PT_modifiers,
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index be083302f65..4026bc972fe 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -435,31 +435,6 @@ class VIEW3D_PT_tools_shading(View3DPanel, Panel):
         col.operator("mesh.set_normals_from_faces", text="Set From Faces")
 
 
-class VIEW3D_PT_tools_normal(View3DPanel, Panel):
-	bl_category = "Shading / UVs"
-	bl_context = "mesh_edit"
-	bl_label = "Normal Tools"
-
-	def draw(self, context):
-		layout = self.layout
-
-		col = layout.column(align=True)
-		col.operator("transform.rotate_normal", text = "Rotate Normal")
-		col.operator("mesh.point_normals")
-
-		col = layout.column(align=True)
-		col.label(text="Split/Merge: ")
-
-		col.operator_menu_enum("mesh.merge_loop_normals", "merge_type")
-		col.operator_menu_enum("mesh.split_loop_normals", "split_type")
-		
-		col = layout.column(align=True)
-		col.label(text="Copy/Paste Loop")
-		row = col.row(align=True)
-		row.operator("mesh.copy_normal", text="Copy").copy = True
-		row.operator("mesh.copy_normal", text="Paste").copy = False
-
-
 class VIEW3D_PT_tools_uvs(View3DPanel, Panel):
     bl_category = "Shading / UVs"
     bl_context = "mesh_edit"
@@ -2049,7 +2024,6 @@ classes = (
     VIEW3D_PT_tools_meshweight,
     VIEW3D_PT_tools_add_mesh_edit,
     VIEW3D_PT_tools_shading,
-	VIEW3D_PT_tools_normal,
     VIEW3D_PT_tools_uvs,
     VIEW3D_PT_tools_meshedit_options,
     VIEW3D_PT_tools_transform_curve,
diff --git a/source/blender/blenkernel/intern/editderivedmesh.c b/source/blender/blenkernel/intern/editderivedmesh.c
index ff3479609d5..ab614b8f460 100644
--- a/source/blender/blenkernel/intern/editderivedmesh.c
+++ b/source/blender/blenkernel/intern/editderivedmesh.c
@@ -212,7 +212,7 @@ static void emDM_calcLoopNormalsSpaceArray(
 	cd_loop_clnors_offset = clnors_data ? -1 : CustomData_get_offset(&bm->ldata, CD_CUSTOMLOOPNORMAL);
 
 	BM_loops_calc_normal_vcos(bm, vertexCos, vertexNos, polyNos, use_split_normals, split_angle, loopNos,
-	                          r_lnors_spacearr, clnors_data, cd_loop_clnors_offset, false);
+	                          r_lnors_spacearr, clnors_data, cd_loop_clnors_offset);
 #ifdef DEBUG_CLNORS
 	if (r_lnors_spacearr) {
 		int i;
diff --git a/source/blender/bmesh/bmesh_class.h b/source/blender/bmesh/bmesh_class.h
index b080c634cdf..64a5cad812a 100644
--- a/source/blender/bmesh/bmesh_class.h
+++ b/source/blender/bmesh/bmesh_class.h
@@ -38,8 +38,6 @@ struct BMEdge;
 struct BMLoop;
 struct BMFace;
 
-struct MLoopNorSpaceArray;
-
 struct BLI_mempool;
 
 /* note: it is very important for BMHeader to start with two
@@ -255,9 +253,6 @@ typedef struct BMesh {
 	ListBase errorstack;
 
 	void *py_handle;
-
-	struct MLoopNorSpaceArray *lnor_spacearr;  /* Stores MLoopNorSpaceArray for this BMesh */
-	char spacearr_dirty;
 } BMesh;
 
 /* BMHeader->htype (char) */
@@ -268,31 +263,9 @@ enum {
 	BM_FACE = 8
 };
 
-typedef struct TransDataLoopNormal {
-	int loop_index;
-	float mtx[3][3];
-	float smtx[3][3];
-	float niloc[3];
-	float nloc[3];
-	float *loc;
-	short *clnors_data;
-} TransDataLoopNormal;
-
-typedef struct LoopNormalData {
-	TransDataLoopNormal *normal;
-
-	int offset;
-	int totloop;
-	void *funcdata;
-} LoopNormalData;
-
 #define BM_ALL (BM_VERT | BM_EDGE | BM_LOOP | BM_FACE)
 #define BM_ALL_NOLOOP (BM_VERT | BM_EDGE | BM_FACE)
 
-#define BM_SPACEARR_DIRTY (1 << 1)
-#define BM_SPACEARR_DIRTY_ALL (1 << 2)
-#define BM_SPACEARR_BMO_SET (1 << 3)
-
 /* args for _Generic */
 #define _BM_GENERIC_TYPE_ELEM_NONCONST \
 	void *, BMVert *, BMEdge *, BMLoop *, BMFace *, \
@@ -372,9 +345,6 @@ enum {
 	 * since tools may want to tag verts and
 	 * not have functions clobber them */
 	BM_ELEM_INTERNAL_TAG = (1 << 7),
-
-	/* Space invalid when set. */
-	BM_ELEM_LNORSPACE = (1 << 6)
 };
 
 struct BPy_BMGeneric;
diff --git a/source/blender/bmesh/intern/bmesh_mesh.c b/source/blender/bmesh/intern/bmesh_mesh.c
index d9f6352d4ad..d5d9e4abe2c 100644
--- a/source/blender/bmesh/intern/bmesh_mesh.c
+++ b/source/blender/bmesh/intern/bmesh_mesh.c
@@ -30,7 +30,6 @@
 
 #include "DNA_listBase.h"
 #include "DNA_object_types.h"
-#include "DNA_scene_types.h"
 
 #include "BLI_linklist_stack.h"
 #include "BLI_listbase.h"
@@ -271,11 +270,6 @@ void BM_mesh_data_free(BMesh *bm)
 
 	BLI_freelistN(&bm->selected);
 
-	if (bm->lnor_spacearr) {
-		BKE_lnor_spacearr_free(bm->lnor_spacearr);
-		MEM_freeN(bm->lnor_spacearr);
-	}
-
 	BMO_error_clear(bm);
 }
 
@@ -595,7 +589,7 @@ static bool bm_mesh_loop_check_cyclic_smooth_fan(BMLoop *l_curr)
  * Will use first clnors_data array, and fallback to cd_loop_clnors_offset (use NULL and -1 to not use clnors). */
 static void bm_mesh_loops_calc_normals(
         BMesh *bm, const float (*vcos)[3], const float (*fnos)[3], float (*r_lnos)[3],
-        MLoopNorSpaceArray *r_lnors_spacearr, short (*clnors_data)[2], const int cd_loop_clnors_offset, bool rebuild)
+        MLoopNorSpaceArray *r_lnors_spacearr, short (*clnors_data)[2], const int cd_loop_clnors_offset)
 {
 	BMIter fiter;
 	BMFace *f_curr;
@@ -651,8 +645,6 @@ static void bm_mesh_loops_calc_normals(
 
 		l_curr = l_first = BM_FACE_FIRST_LOOP(f_curr);
 		do {
-			if (rebuild && !BM_elem_flag_test(l_curr, BM_ELEM_LNORSPACE) && !(bm->spacearr_dirty & BM_SPACEARR_DIRTY_ALL))
-				continue;
 			/* A smooth edge, we have to check for cyclic smooth fan case.
 			 * If we find a new, never-processed cyclic smooth fan, we can do it now using that loop/edge as
 			 * 'entry point', otherwise we can skip it. */
@@ -853,10 +845,7 @@ static void bm_mesh_loops_calc_normals(
 								clnors_avg[0] /= clnors_nbr;
 								clnors_avg[1] /= clnors_nbr;
 								/* Fix/update all clnors of this fan with computed average value. */
-								
-								/* Prints continuously when merge custom normals, so commenting -Rohan
-								printf("Invalid clnors in this fan!\n");*/
-
+								printf("Invalid clnors in this fan!\n");
 								while ((clnor = BLI_SMALLSTACK_POP(clnors))) {
 									//print_v2("org clnor", clnor);
 									clnor[0] = (short)clnors_avg[0];
@@ -971,7 +960,7 @@ void BM_mesh_loop_normals_update(
 void BM_loops_calc_normal_vcos(
         BMesh *bm, const float (*vcos)[3], const float (*vnos)[3], const float (*fnos)[3],
         const bool use_split_normals, const float split_angle, float (*r_lnos)[3],
-        MLoopNorSpaceArray *r_lnors_spacearr, short (*clnors_data)[2], const int cd_loop_clnors_offset, bool rebuild)
+        MLoopNorSpaceArray *r_lnors_spacearr, short (*clnors_data)[2], const int cd_loop_clnors_offset)
 {
 	const bool has_clnors = clnors_data || (cd_loop_clnors_offset != -1);
 
@@ -981,7 +970,7 @@ void BM_loops_calc_normal_vcos(
 		bm_mesh_edges_sharp_tag(bm, vnos, fnos, has_clnors ? (float)M_PI : split_angle, r_lnos);
 
 		/* Finish computing lnos by accumulating face normals in each fan of faces defined by sharp edges. */
-		bm_mesh_loops_calc_normals(bm, vcos, fnos, r_lnos, r_lnors_spacearr, clnors_data, cd_loop_clnors_offset, rebuild);
+		bm_mesh_loops_calc_normals(bm, vcos, fnos, r_lnos, r_lnors_spacearr, clnors_data, cd_loop_clnors_offset);
 	}
 	else {
 		BLI_assert(!r_lnors_spacearr);
@@ -989,352 +978,6 @@ void BM_loops_calc_normal_vcos(
 	}
 }
 
-void BM_lnorspacearr_store(BMesh *bm, float (*r_lnor

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list