diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-11-21 02:27:19 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-11-21 02:30:51 +0300 |
commit | 91e8509467415f22f1812a63baef439454d80990 (patch) | |
tree | 7c480ac58b5bc89d7ace04b37f2e704758f4b689 /source/blender | |
parent | 19875439b5fb2b7c569bc95f384b5be548a5e45f (diff) |
Cleanup: use boolean array for mirror modifier
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/makesdna/DNA_modifier_types.h | 6 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_modifier.c | 49 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_mirror.c | 10 |
3 files changed, 19 insertions, 46 deletions
diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h index e2f963b7a1b..c5045caec9c 100644 --- a/source/blender/makesdna/DNA_modifier_types.h +++ b/source/blender/makesdna/DNA_modifier_types.h @@ -324,9 +324,9 @@ enum { MOD_MIR_BISECT_AXIS_X = (1 << 8), MOD_MIR_BISECT_AXIS_Y = (1 << 9), MOD_MIR_BISECT_AXIS_Z = (1 << 10), - MOD_MIR_FLIP_AXIS_X = (1 << 11), - MOD_MIR_FLIP_AXIS_Y = (1 << 12), - MOD_MIR_FLIP_AXIS_Z = (1 << 13), + MOD_MIR_BISECT_FLIP_AXIS_X = (1 << 11), + MOD_MIR_BISECT_FLIP_AXIS_Y = (1 << 12), + MOD_MIR_BISECT_FLIP_AXIS_Z = (1 << 13), }; typedef struct EdgeSplitModifierData { diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index c2fa89891b0..c1c2ceca7bc 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -1541,19 +1541,22 @@ static void rna_def_modifier_mirror(BlenderRNA *brna) RNA_def_struct_sdna(srna, "MirrorModifierData"); RNA_def_struct_ui_icon(srna, ICON_MOD_MIRROR); - prop = RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE); + prop = RNA_def_property(srna, "use_axis", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_AXIS_X); - RNA_def_property_ui_text(prop, "X", "Enable X axis mirror"); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Mirror Axis", "Enable axis mirror"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); - prop = RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_AXIS_Y); - RNA_def_property_ui_text(prop, "Y", "Enable Y axis mirror"); + prop = RNA_def_property(srna, "use_bisect_axis", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_BISECT_AXIS_X); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Bisect Axis", "Cuts the mesh across the mirrorplane"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); - prop = RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_AXIS_Z); - RNA_def_property_ui_text(prop, "Z", "Enable Z axis mirror"); + prop = RNA_def_property(srna, "use_bisect_flip_axis", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_BISECT_FLIP_AXIS_X); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Bisect Flip Axis", "Flips the direction of the slice"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); prop = RNA_def_property(srna, "use_clip", PROP_BOOLEAN, PROP_NONE); @@ -1561,36 +1564,6 @@ static void rna_def_modifier_mirror(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Clip", "Prevent vertices from going through the mirror during transform"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); - prop = RNA_def_property(srna, "use_bisect_x", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_BISECT_AXIS_X); - RNA_def_property_ui_text(prop, "X", "Cuts the mesh across the mirrorplane"); - RNA_def_property_update(prop, 0, "rna_Modifier_update"); - - prop = RNA_def_property(srna, "use_bisect_y", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_BISECT_AXIS_Y); - RNA_def_property_ui_text(prop, "Y", "Cuts the mesh across the mirrorplane"); - RNA_def_property_update(prop, 0, "rna_Modifier_update"); - - prop = RNA_def_property(srna, "use_bisect_z", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_BISECT_AXIS_Z); - RNA_def_property_ui_text(prop, "Z", "Cuts the mesh across the mirrorplane"); - RNA_def_property_update(prop, 0, "rna_Modifier_update"); - - prop = RNA_def_property(srna, "flip_x", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_FLIP_AXIS_X); - RNA_def_property_ui_text(prop, "X", "Flips the direction of the slice"); - RNA_def_property_update(prop, 0, "rna_Modifier_update"); - - prop = RNA_def_property(srna, "flip_y", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_FLIP_AXIS_Y); - RNA_def_property_ui_text(prop, "Y", "Flips the direction of the slice"); - RNA_def_property_update(prop, 0, "rna_Modifier_update"); - - prop = RNA_def_property(srna, "flip_z", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_FLIP_AXIS_Z); - RNA_def_property_ui_text(prop, "Z", "Flips the direction of the slice"); - RNA_def_property_update(prop, 0, "rna_Modifier_update"); - prop = RNA_def_property(srna, "use_mirror_vertex_groups", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_VGROUP); RNA_def_property_ui_text(prop, "Mirror Vertex Groups", "Mirror vertex groups (e.g. .R->.L)"); diff --git a/source/blender/modifiers/intern/MOD_mirror.c b/source/blender/modifiers/intern/MOD_mirror.c index df08122aebf..659ac0dee30 100644 --- a/source/blender/modifiers/intern/MOD_mirror.c +++ b/source/blender/modifiers/intern/MOD_mirror.c @@ -88,10 +88,10 @@ static Mesh *doBiscetOnMirrorPlane( int axis, float mirrormat[4][4]) { - bool do_flip_axis = ( - (axis == 0 && mmd->flag & MOD_MIR_FLIP_AXIS_X) || - (axis == 1 && mmd->flag & MOD_MIR_FLIP_AXIS_Y) || - (axis == 2 && mmd->flag & MOD_MIR_FLIP_AXIS_Z)); + bool do_bisect_flip_axis = ( + (axis == 0 && mmd->flag & MOD_MIR_BISECT_FLIP_AXIS_X) || + (axis == 1 && mmd->flag & MOD_MIR_BISECT_FLIP_AXIS_Y) || + (axis == 2 && mmd->flag & MOD_MIR_BISECT_FLIP_AXIS_Z)); const float bisect_distance = 0.001; @@ -132,7 +132,7 @@ static Mesh *doBiscetOnMirrorPlane( copy_v3_v3(plane_offset, plane); plane_offset[3] = plane[3] - bisect_distance; - if (do_flip_axis) { + if (do_bisect_flip_axis) { negate_v3(plane_offset); } |