[Bf-blender-cvs] [c78d94bf08c] experimental-build: Revert "--no-edit"
Rohan Rathi
noreply at git.blender.org
Tue Sep 5 15:28:23 CEST 2017
Commit: c78d94bf08cb02740f79f0da211821af4dd96f48
Author: Rohan Rathi
Date: Tue Sep 5 18:54:06 2017 +0530
Branches: experimental-build
https://developer.blender.org/rBc78d94bf08cb02740f79f0da211821af4dd96f48
Revert "--no-edit"
This reverts commit edfb48f20974c686eb019167d5b6a9fb3b8c7bc5.
===================================================================
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_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/makesdna/DNA_scene_types.h
M source/blender/makesrna/RNA_access.h
M source/blender/makesrna/intern/rna_modifier.c
M source/blender/makesrna/intern/rna_scene.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 d489cc9c3a6..14d016dca5f 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -1530,22 +1530,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):
- has_vgroup = bool(md.vertex_group)
-
- col = layout.column()
- col.label("Weighting Mode:")
- col.prop(md, "mode", text="")
-
- layout.prop(md, "weight", text="Weight")
- layout.prop(md, "thresh", text="Threshold")
- row = layout.row(align=True)
- row.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
- row.active = has_vgroup
- row.prop(md, "invert_vertex_group", text="", icon='ARROW_LEFTRIGHT')
- layout.prop(md, "keep_sharp")
- layout.prop(md, "face_influence")
-
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 af8d8ee84e4..eb1b2e5971d 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -432,56 +432,7 @@ class VIEW3D_PT_tools_shading(View3DPanel, Panel):
col.label(text="Normals:")
col.operator("mesh.normals_make_consistent", text="Recalculate")
col.operator("mesh.flip_normals", text="Flip Direction")
-
-
-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
- toolsettings = context.tool_settings
-
- col = layout.column(align=True)
- col.operator("mesh.set_normals_from_faces", text="Set From Faces")
- 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("mesh.merge_loop_normals", text = "Merge Normals")
- col.operator("mesh.split_loop_normals", text = "Split Normals")
-
- col = layout.column(align=True)
- col.label(text="Average by: ")
-
- col.operator_menu_enum("mesh.average_loop_normals", "average_type")
-
- col = layout.column(align=True)
- col.label(text="Normal Vector: ")
- col.operator("mesh.custom_normal_tools", text="Reset").mode = "Reset"
- col.prop(toolsettings, "normal_vector", text = '')
-
- row = col.row(align=True)
- row.operator("mesh.custom_normal_tools", text="Copy").mode = "Copy"
- row.operator("mesh.custom_normal_tools", text="Paste").mode = "Paste"
-
- row = col.row(align=True)
- row.operator("mesh.custom_normal_tools", text = "Multiply").mode = "Multiply"
- row.operator("mesh.custom_normal_tools", text="Add").mode = "Add"
-
- col = layout.column(align=True)
- col.operator("mesh.smoothen_custom_normals", text="Smoothen")
-
- col = layout.column(align=True)
- col.label(text="Face Strength")
- row = col.row(align=True)
-
- row.prop(toolsettings, "face_strength", text="")
- row.operator("mesh.mod_weighted_strength", text="", icon = "FACESEL").set=False
- row.operator("mesh.mod_weighted_strength", text="", icon = "ZOOMIN").set=True
+ col.operator("mesh.set_normals_from_faces", text="Set From Faces")
class VIEW3D_PT_tools_uvs(View3DPanel, Panel):
@@ -2073,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 a4c56532df9..f29af28a782 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 b3d1c6b3348..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);
}
@@ -558,7 +552,7 @@ static void bm_mesh_edges_sharp_tag(
/* Check whether gievn loop is part of an unknown-so-far cyclic smooth fan, or not.
* Needed because cyclic smooth fans have no obvious 'entry point', and yet we need to walk them once, and only once. */
-bool bm_mesh_loop_check_cyclic_smooth_fan(BMLoop *l_curr)
+static bool bm_mesh_loop_check_cyclic_smooth_fan(BMLoop *l_curr)
{
BMLoop *lfan_pivot_next = l_curr;
BMEdge *e_next = l_curr->e;
@@ -595,7 +589,7 @@ 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 cyc
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list