Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--release/scripts/startup/bl_ui/properties_data_modifier.py6
-rw-r--r--source/blender/blenloader/intern/versioning_260.c15
-rw-r--r--source/blender/makesdna/DNA_modifier_types.h13
-rw-r--r--source/blender/makesrna/intern/rna_modifier.c22
-rw-r--r--source/blender/modifiers/intern/MOD_bevel.c8
5 files changed, 56 insertions, 8 deletions
diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py
index 59b369df6d4..f9684794b79 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -126,6 +126,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
col = split.column()
col.prop(md, "width")
col.prop(md, "segments")
+ col.prop(md, "profile")
col = split.column()
col.prop(md, "use_only_vertices")
@@ -138,8 +139,9 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
elif md.limit_method == 'VGROUP':
layout.label(text="Vertex Group:")
layout.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
- # elif md.limit_method == 'WEIGHT':
- # layout.row().prop(md, "edge_weight_method", expand=True)
+
+ layout.label(text="Width Method:")
+ layout.row().prop(md, "offset_type", expand=True)
def BOOLEAN(self, layout, ob, md):
split = layout.split()
diff --git a/source/blender/blenloader/intern/versioning_260.c b/source/blender/blenloader/intern/versioning_260.c
index d8e3e02b196..06355d3a812 100644
--- a/source/blender/blenloader/intern/versioning_260.c
+++ b/source/blender/blenloader/intern/versioning_260.c
@@ -2655,4 +2655,19 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *main)
}
}
}
+
+ if (!DNA_struct_elem_find(fd->filesdna, "BevelModifierData", "float", "profile")) {
+ Object *ob;
+
+ for (ob = main->object.first; ob; ob = ob->id.next) {
+ ModifierData *md;
+ for (md = ob->modifiers.first; md; md = md->next) {
+ if (md->type = eModifierType_Bevel) {
+ BevelModifierData *bmd = (BevelModifierData *)md;
+ bmd->profile = 0.5f;
+ bmd->val_flags = MOD_BEVEL_AMT_OFFSET;
+ }
+ }
+ }
+ }
}
diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h
index b8849f333e7..6756a18e382 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -295,17 +295,18 @@ typedef struct BevelModifierData {
float value; /* the "raw" bevel value (distance/amount to bevel) */
int res; /* the resolution (as originally coded, it is the number of recursive bevels) */
- int pad;
short flags; /* general option flags */
- short val_flags; /* flags used to interpret the bevel value */
+ short val_flags; /* used to interpret the bevel value */
short lim_flags; /* flags to tell the tool how to limit the bevel */
short e_flags; /* flags to direct how edge weights are applied to verts */
+ float profile; /* controls profile shape (0->1, .5 is round) */
/* if the MOD_BEVEL_ANGLE is set, this will be how "sharp" an edge must be before it gets beveled */
float bevel_angle;
/* if the MOD_BEVEL_VWEIGHT option is set, this will be the name of the vert group, MAX_VGROUP_NAME */
char defgrp_name[64];
} BevelModifierData;
+/* BevelModifierData->flags and BevelModifierData->lim_flags */
enum {
MOD_BEVEL_VERT = (1 << 1),
/* MOD_BEVEL_RADIUS = (1 << 2), */
@@ -324,6 +325,14 @@ enum {
MOD_BEVEL_OVERLAP_OK = (1 << 13),
};
+/* BevelModifierData->val_flags (not used as flags any more) */
+enum {
+ MOD_BEVEL_AMT_OFFSET = 0,
+ MOD_BEVEL_AMT_WIDTH = 1,
+ MOD_BEVEL_AMT_DEPTH = 2,
+ MOD_BEVEL_AMT_PERCENT = 3,
+};
+
typedef struct SmokeModifierData {
ModifierData modifier;
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index eb01f47098f..4de9615d24c 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -2322,6 +2322,14 @@ static void rna_def_modifier_bevel(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL}
};
+ static EnumPropertyItem prop_val_type_items[] = {
+ {MOD_BEVEL_AMT_OFFSET, "OFFSET", 0, "Offset", "Amount is offset of new edges from original"},
+ {MOD_BEVEL_AMT_WIDTH, "WIDTH", 0, "Width", "Amount is width of new face"},
+ {MOD_BEVEL_AMT_DEPTH, "DEPTH", 0, "Depth", "Amount is perpendicular distance from original edge to bevel face"},
+ {MOD_BEVEL_AMT_PERCENT, "PERCENT", 0, "Percent", "Amount is percent of adjacent edge length"},
+ {0, NULL, 0, NULL, NULL}
+ };
+
/* TO BE DEPRECATED */
static EnumPropertyItem prop_edge_weight_method_items[] = {
{0, "AVERAGE", 0, "Average", ""},
@@ -2338,7 +2346,7 @@ static void rna_def_modifier_bevel(BlenderRNA *brna)
prop = RNA_def_property(srna, "width", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "value");
RNA_def_property_range(prop, 0, FLT_MAX);
- RNA_def_property_ui_range(prop, 0, 10, 0.1, 4);
+ RNA_def_property_ui_range(prop, 0.0f, 100.0f, 0.1, 4);
RNA_def_property_ui_text(prop, "Width", "Bevel value/amount");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
@@ -2383,6 +2391,18 @@ static void rna_def_modifier_bevel(BlenderRNA *brna)
RNA_def_property_boolean_negative_sdna(prop, NULL, "flags", MOD_BEVEL_OVERLAP_OK);
RNA_def_property_ui_text(prop, "Clamp Overlap", "Clamp the width to avoid overlap");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "offset_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "val_flags");
+ RNA_def_property_enum_items(prop, prop_val_type_items);
+ RNA_def_property_ui_text(prop, "Amount Type", "What distance Width measures");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "profile", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_range(prop, 0.15f, 1.0f, 0.05, 2);
+ RNA_def_property_ui_text(prop, "Profile", "Controls profile shape (0.5 = round)");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
}
static void rna_def_modifier_shrinkwrap(BlenderRNA *brna)
diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c
index 87b3c230b75..0a0f97fdcbe 100644
--- a/source/blender/modifiers/intern/MOD_bevel.c
+++ b/source/blender/modifiers/intern/MOD_bevel.c
@@ -58,9 +58,10 @@ static void initData(ModifierData *md)
bmd->value = 0.1f;
bmd->res = 1;
bmd->flags = 0;
- bmd->val_flags = 0;
+ bmd->val_flags = MOD_BEVEL_AMT_OFFSET;
bmd->lim_flags = 0;
bmd->e_flags = 0;
+ bmd->profile = 0.5f;
bmd->bevel_angle = DEG2RADF(30.0f);
bmd->defgrp_name[0] = '\0';
}
@@ -76,6 +77,7 @@ static void copyData(ModifierData *md, ModifierData *target)
tbmd->val_flags = bmd->val_flags;
tbmd->lim_flags = bmd->lim_flags;
tbmd->e_flags = bmd->e_flags;
+ tbmd->profile = bmd->profile;
tbmd->bevel_angle = bmd->bevel_angle;
BLI_strncpy(tbmd->defgrp_name, bmd->defgrp_name, sizeof(tbmd->defgrp_name));
}
@@ -110,6 +112,7 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Object *ob,
const float threshold = cosf(bmd->bevel_angle + 0.000000175f);
const bool vertex_only = (bmd->flags & MOD_BEVEL_VERT) != 0;
const bool do_clamp = !(bmd->flags & MOD_BEVEL_OVERLAP_OK);
+ const int offset_type = bmd->val_flags;
bm = DM_to_bmesh(dm, true);
@@ -158,8 +161,7 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Object *ob,
}
}
- /* TODO: add offset_kind to modifier properties to, and pass in as 3rd arg here */
- BM_mesh_bevel(bm, bmd->value, 0, bmd->res, 0.5f,
+ BM_mesh_bevel(bm, bmd->value, offset_type, bmd->res, bmd->profile,
vertex_only, bmd->lim_flags & MOD_BEVEL_WEIGHT, do_clamp,
dvert, vgroup);