Commit: 4c996758e5e243b13cea952540fc203dc86e1246 Author: Bastien Montagne Date: Mon Nov 3 12:34:59 2014 +0100 Branches: temp_custom_loop_normals https://developer.blender.org/rB4c996758e5e243b13cea952540fc203dc86e1246
Address some review points: always use clnors is present (bypass 'Autosmooth' setting). Also moved create/delete clnors data button to Geometry Data panel =================================================================== M release/scripts/startup/bl_ui/properties_data_mesh.py M source/blender/blenkernel/intern/DerivedMesh.c M source/blender/makesrna/intern/rna_mesh.c =================================================================== diff --git a/release/scripts/startup/bl_ui/properties_data_mesh.py b/release/scripts/startup/bl_ui/properties_data_mesh.py index 6b0add8..43ac42b 100644 --- a/release/scripts/startup/bl_ui/properties_data_mesh.py +++ b/release/scripts/startup/bl_ui/properties_data_mesh.py @@ -148,26 +148,17 @@ class DATA_PT_normals(MeshButtonsPanel, Panel): layout = self.layout mesh = context.mesh - has_clnors = mesh.has_custom_normals split = layout.split() col = split.column() col.prop(mesh, "use_auto_smooth") sub = col.column() - sub.active = mesh.use_auto_smooth and not has_clnors + sub.active = mesh.use_auto_smooth and not mesh.has_custom_normals sub.prop(mesh, "auto_smooth_angle", text="Angle") split.prop(mesh, "show_double_sided") - row = layout.row() - if has_clnors: - row.operator("mesh.customdata_add_clear_custom_splitnormals", - icon='X', text="Clear Custom Split Normals Data") - else: - row.operator("mesh.customdata_add_clear_custom_splitnormals", - icon='ZOOMIN', text="Add Custom Split Normals Data") - class DATA_PT_texture_space(MeshButtonsPanel, Panel): bl_label = "Texture Space" @@ -382,6 +373,13 @@ class DATA_PT_customdata(MeshButtonsPanel, Panel): col.operator("mesh.customdata_clear_mask", icon='X') col.operator("mesh.customdata_clear_skin", icon='X') + if me.has_custom_normals: + col.operator("mesh.customdata_add_clear_custom_splitnormals", + icon='X', text="Clear Custom Split Normals Data") + else: + col.operator("mesh.customdata_add_clear_custom_splitnormals", + icon='ZOOMIN', text="Add Custom Split Normals Data") + col = layout.column() col.enabled = (obj.mode != 'EDIT') diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 81c03d8..aa098fe 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -1500,7 +1500,7 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos /* XXX Same as above... For now, only weights preview in WPaint mode. */ const bool do_mod_wmcol = do_init_wmcol; - const bool do_loop_normals = (me->flag & ME_AUTOSMOOTH); + bool do_loop_normals = (me->flag & ME_AUTOSMOOTH); const float loop_normals_split_angle = me->smoothresh; VirtualModifierData virtualModifierData; @@ -1904,6 +1904,8 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos add_orco_dm(ob, NULL, *deform_r, NULL, CD_ORCO); } + do_loop_normals = (do_loop_normals || DM_get_loop_data_layer(finaldm, CD_CUSTOMLOOPNORMAL)); + if (do_loop_normals) { /* Compute loop normals (note: will compute poly and vert normals as well, if needed!) */ DM_calc_loop_normals(finaldm, loop_normals_split_angle); @@ -2006,7 +2008,7 @@ static void editbmesh_calc_modifiers(Scene *scene, Object *ob, BMEditMesh *em, D const bool do_mod_wmcol = do_init_wmcol; VirtualModifierData virtualModifierData; - const bool do_loop_normals = (((Mesh *)(ob->data))->flag & ME_AUTOSMOOTH); + bool do_loop_normals = (((Mesh *)(ob->data))->flag & ME_AUTOSMOOTH); const float loop_normals_split_angle = ((Mesh *)(ob->data))->smoothresh; modifiers_clearErrors(ob); @@ -2220,6 +2222,8 @@ static void editbmesh_calc_modifiers(Scene *scene, Object *ob, BMEditMesh *em, D DM_update_statvis_color(scene, ob, *final_r); } + do_loop_normals = (do_loop_normals || DM_get_loop_data_layer(*final_r, CD_CUSTOMLOOPNORMAL)); + if (do_loop_normals) { /* Compute loop normals */ DM_calc_loop_normals(*final_r, loop_normals_split_angle); diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index 25853ea..4339e6e 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -3202,9 +3202,9 @@ static void rna_def_mesh(BlenderRNA *brna) prop = RNA_def_property(srna, "use_auto_smooth", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_AUTOSMOOTH); - RNA_def_property_ui_text(prop, "Split Normals", - "Use split normals - auto smooth (based on smooth/sharp faces/edges and angle between " - "faces), and/or use custom split normals data if available"); + RNA_def_property_ui_text(prop, "Auto Smooth", + "Auto smooth (based on smooth/sharp faces/edges and angle between faces) - " + "WARNING: overridden by custom split normals if available"); RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); prop = RNA_def_property(srna, "auto_smooth_angle", PROP_FLOAT, PROP_ANGLE); _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs