Commit: d1ee704e7b755d053f64f58dcb342745d096be2c
Author: Campbell Barton
Date:   Wed Feb 4 22:31:55 2015 +1100
Branches: temp_custom_loop_normals
https://developer.blender.org/rBd1ee704e7b755d053f64f58dcb342745d096be2c

minor tweaks

naming, style, remove redundant includes & poll function

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

M       release/scripts/startup/bl_ui/properties_data_modifier.py
M       source/blender/editors/mesh/mesh_data.c
M       source/blender/makesdna/DNA_modifier_types.h
M       source/blender/makesrna/intern/rna_mesh_api.c
M       source/blender/makesrna/intern/rna_modifier.c
M       source/blender/modifiers/intern/MOD_normal_edit.c
M       source/blender/render/intern/source/convertblender.c

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

diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py 
b/release/scripts/startup/bl_ui/properties_data_modifier.py
index e6679b2..283340b 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -1353,7 +1353,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
     def NORMAL_EDIT(self, layout, ob, md):
         has_vgroup = bool(md.vertex_group)
         needs_object_offset = (((md.mode == 'RADIAL') and not md.target) or
-                               ((md.mode == 'DIRECTIONAL') and 
md.use_directional_parallel))
+                               ((md.mode == 'DIRECTIONAL') and 
md.use_direction_parallel))
 
         row = layout.row()
         row.prop(md, "mode", expand=True)
@@ -1370,7 +1370,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
         col = split.column()
         row = col.row()
         row.active = (md.mode == 'DIRECTIONAL')
-        row.prop(md, "use_directional_parallel")
+        row.prop(md, "use_direction_parallel")
 
         subcol = col.column(align=True)
         subcol.label("Mix Mode:")
diff --git a/source/blender/editors/mesh/mesh_data.c 
b/source/blender/editors/mesh/mesh_data.c
index c56e7c8..30e9a85 100644
--- a/source/blender/editors/mesh/mesh_data.c
+++ b/source/blender/editors/mesh/mesh_data.c
@@ -57,6 +57,7 @@
 
 #include "ED_mesh.h"
 #include "ED_object.h"
+#include "ED_screen.h"
 #include "ED_uvedit.h"
 #include "ED_view3d.h"
 
@@ -839,19 +840,6 @@ void MESH_OT_customdata_clear_skin(wmOperatorType *ot)
 }
 
 /* Clear custom loop normals */
-static int mesh_customdata_custom_splitnormals_add_clear_poll(bContext *C)
-{
-       Object *ob = ED_object_context(C);
-
-       if (ob && ob->type == OB_MESH) {
-               Mesh *me = ob->data;
-               if (me->id.lib == NULL) {
-                       return true;
-               }
-       }
-       return false;
-}
-
 static int mesh_customdata_custom_splitnormals_add_exec(bContext *C, 
wmOperator *UNUSED(op))
 {
        Object *ob = ED_object_context(C);
@@ -884,7 +872,7 @@ void 
MESH_OT_customdata_custom_splitnormals_add(wmOperatorType *ot)
 
        /* api callbacks */
        ot->exec = mesh_customdata_custom_splitnormals_add_exec;
-       ot->poll = mesh_customdata_custom_splitnormals_add_clear_poll;
+       ot->poll = ED_operator_object_active_editable_mesh;
 
        /* flags */
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -910,7 +898,7 @@ void 
MESH_OT_customdata_custom_splitnormals_clear(wmOperatorType *ot)
 
        /* api callbacks */
        ot->exec = mesh_customdata_custom_splitnormals_clear_exec;
-       ot->poll = mesh_customdata_custom_splitnormals_add_clear_poll;
+       ot->poll = ED_operator_object_active_editable_mesh;
 
        /* flags */
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
diff --git a/source/blender/makesdna/DNA_modifier_types.h 
b/source/blender/makesdna/DNA_modifier_types.h
index c6833b9..b32b228 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -1450,9 +1450,9 @@ typedef struct NormalEditModifierData {
        char defgrp_name[64];  /* MAX_VGROUP_NAME */
        struct Object *target;  /* Source of normals, or center of ellipsoid. */
        short mode;
-       short flags;
+       short flag;
        short mix_mode;
-       short pad_s1;
+       char pad[2];
        float mix_factor;
        float offset[3];
 } NormalEditModifierData;
@@ -1466,7 +1466,7 @@ enum {
 /* NormalEditModifierData.flags */
 enum {
        MOD_NORMALEDIT_INVERT_VGROUP            = (1 << 0),
-       MOD_NORMALEDIT_USE_PARALLEL_DIRECTIONAL = (1 << 1),
+       MOD_NORMALEDIT_USE_DIRECTION_PARALLEL   = (1 << 1),
 };
 
 /* NormalEditModifierData.mix_mode */
diff --git a/source/blender/makesrna/intern/rna_mesh_api.c 
b/source/blender/makesrna/intern/rna_mesh_api.c
index 2ce2c92..63aeb01 100644
--- a/source/blender/makesrna/intern/rna_mesh_api.c
+++ b/source/blender/makesrna/intern/rna_mesh_api.c
@@ -85,9 +85,8 @@ static void rna_Mesh_calc_normals_split(Mesh *mesh)
                CustomData_set_layer_flag(&mesh->ldata, CD_NORMAL, 
CD_FLAG_TEMPORARY);
        }
 
-       if (CustomData_has_layer(&mesh->ldata, CD_CUSTOMLOOPNORMAL)) {
-               clnors = CustomData_get_layer(&mesh->ldata, 
CD_CUSTOMLOOPNORMAL);
-       }
+       /* may be NULL */
+       clnors = CustomData_get_layer(&mesh->ldata, CD_CUSTOMLOOPNORMAL);
 
        if (CustomData_has_layer(&mesh->pdata, CD_NORMAL)) {
                /* This assume that layer is always up to date, not sure this 
is the case (esp. in Edit mode?)... */
@@ -160,8 +159,8 @@ static void rna_Mesh_define_normals_split_custom_do(Mesh 
*mesh, float (*custom_l
        const int numloops = mesh->totloop;
        bool free_polynors = false;
 
-       if (CustomData_has_layer(&mesh->ldata, CD_CUSTOMLOOPNORMAL)) {
-               clnors = CustomData_get_layer(&mesh->ldata, 
CD_CUSTOMLOOPNORMAL);
+       clnors = CustomData_get_layer(&mesh->ldata, CD_CUSTOMLOOPNORMAL);
+       if (clnors) {
                memset(clnors, 0, sizeof(*clnors) * numloops);
        }
        else {
diff --git a/source/blender/makesrna/intern/rna_modifier.c 
b/source/blender/makesrna/intern/rna_modifier.c
index 04da2c4..ed8d166 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -4381,7 +4381,7 @@ static void rna_def_modifier_normaledit(BlenderRNA *brna)
 
        static EnumPropertyItem prop_mix_mode_items[] = {
                {MOD_NORMALEDIT_MIX_COPY, "COPY", 0, "Copy", "Copy new normals 
(overwrite existing)"},
-               {MOD_NORMALEDIT_MIX_ADD, "ADD", 0, "Add", "Copy sum of new and 
org normals"},
+               {MOD_NORMALEDIT_MIX_ADD, "ADD", 0, "Add", "Copy sum of new and 
old normals"},
                {MOD_NORMALEDIT_MIX_SUB, "SUB", 0, "Substract", "Copy new 
normals minus old normals"},
                {MOD_NORMALEDIT_MIX_MUL, "MUL", 0, "Multiply", "Copy product of 
old and new normals (*not* cross product)"},
                {0, NULL, 0, NULL, NULL}
@@ -4418,7 +4418,7 @@ static void rna_def_modifier_normaledit(BlenderRNA *brna)
        RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
        prop = RNA_def_property(srna, "use_invert_vertex_group", PROP_BOOLEAN, 
PROP_NONE);
-       RNA_def_property_boolean_sdna(prop, NULL, "flags", 
MOD_NORMALEDIT_INVERT_VGROUP);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", 
MOD_NORMALEDIT_INVERT_VGROUP);
        RNA_def_property_ui_text(prop, "Invert", "Invert vertex group 
influence");
        RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
@@ -4428,8 +4428,8 @@ static void rna_def_modifier_normaledit(BlenderRNA *brna)
        RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
        RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
 
-       prop = RNA_def_property(srna, "use_directional_parallel", PROP_BOOLEAN, 
PROP_NONE);
-       RNA_def_property_boolean_sdna(prop, NULL, "flags", 
MOD_NORMALEDIT_USE_PARALLEL_DIRECTIONAL);
+       prop = RNA_def_property(srna, "use_direction_parallel", PROP_BOOLEAN, 
PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", 
MOD_NORMALEDIT_USE_DIRECTION_PARALLEL);
        RNA_def_property_boolean_default(prop, true);
        RNA_def_property_ui_text(prop, "Parallel Normals",
                                 "Use same direction for all normals, from 
origin to target's center "
diff --git a/source/blender/modifiers/intern/MOD_normal_edit.c 
b/source/blender/modifiers/intern/MOD_normal_edit.c
index e9fcf4f..eb30358 100644
--- a/source/blender/modifiers/intern/MOD_normal_edit.c
+++ b/source/blender/modifiers/intern/MOD_normal_edit.c
@@ -36,29 +36,23 @@
 #include "BLI_math.h"
 #include "BLI_utildefines.h"
 #include "BLI_bitmap.h"
-#include "BLI_linklist.h"
-#include "BLI_string.h"
 
 #include "BKE_cdderivedmesh.h"
 #include "BKE_mesh.h"
-#include "BKE_modifier.h"
-#include "BKE_object.h"
 #include "BKE_deform.h"
 
 #include "depsgraph_private.h"
 
-#include "RE_shader_ext.h"
-
 #include "MOD_util.h"
 
 
-static void generate_vert_coordinates(DerivedMesh *dm, Object *ob, Object 
*ob_center, const float offset[3],
-                                      const int num_verts, float (*r_cos)[3], 
float r_size[3])
+static void generate_vert_coordinates(
+        DerivedMesh *dm, Object *ob, Object *ob_center, const float offset[3],
+        const int num_verts, float (*r_cos)[3], float r_size[3])
 {
        float min_co[3], max_co[3];
        float diff[3];
        bool do_diff = false;
-       int i;
 
        INIT_MINMAX(min_co, max_co);
 
@@ -103,7 +97,7 @@ static void generate_vert_coordinates(DerivedMesh *dm, 
Object *ob, Object *ob_ce
        /* Else, no need to change coordinates! */
 
        if (do_diff) {
-               i = num_verts;
+               int i = num_verts;
                while (i--) {
                        add_v3_v3(r_cos[i], diff);
                }
@@ -170,13 +164,13 @@ static void normalEditModifier_do_radial(
 
        generate_vert_coordinates(dm, ob, smd->target, smd->offset, num_verts, 
cos, size);
 
-       /* size gives us our spheroid coefficients (A, B, C).
-        * Then, we want to find out for each vert its (a, b, c) triple 
(proportional to (A, B, C) one).
+       /* size gives us our spheroid coefficients (a, b, c).
+        * Then, we want to find out for each vert its (a, b, c) triple 
(proportional to (a, b, c) one).
         *
         * Ellipsoid basic equation: (x^2/a^2) + (y^2/b^2) + (z^2/c^2) = 1.
-        * Since we want to find (a, b, c) matching this equation and 
proportional to (A, B, C), we can do:
-        *     m = B / A
-        *     n = C / A
+        * Since we want to find (a, b, c) matching this equation and 
proportional to (a, b, c), we can do:
+        *     m = b / a
+        *     n = c / a
         * hence:
         *     (x^2/a^2) + (y^2/b^2) + (z^2/c^2) = 1
         *  -> b^2*c^2*x^2 + a^2*c^2*y^2 + a^2*b^2*z^2 = a^2*b^2*c^2
@@ -193,9 +187,9 @@ static void normalEditModifier_do_radial(
         * And we are done!
         */
        {
-               const float A = size[0], B = size[1], C = size[2];
-               const float m2 = (B * B) / (A * A);
-               const float n2 = (C * C) / (A * A);
+               const float a = size[0], b = size[1], c = size[2];
+               const float m2 = (b * b) / (a * a);
+               const float n2 = (c * c) / (a * a);
 
                MLoop *ml;
                float (*no)[3];
@@ -245,7 +239,7 @@ static void normalEditModifier_do_directional(
         MVert *mvert, const int num_verts, MEdge *medge, const int num_edges,
         MLoop *mloop, const int num_loops, MPoly *mpoly, const int num_polys)
 {
-       const bool use_parallel_normals = (smd->flags & 
MOD_NORMALEDIT_USE_PARALLEL_DIRECTIONAL) != 0;
+       const bool use_parallel_normals = (smd->flag & 
MOD_NORMALEDIT_USE_DIRECTION_PARALLEL) != 0;
 
        float (*cos)[3] = MEM_mallocN(sizeof(*cos) * num_verts, __func__);
        float (*nos)[3] = MEM_mallocN(sizeof(*nos) * num_loops, 

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to