forked from bartvdbraak/blender
code cleanup: remove deprecated bevel code (unused since 2.64)
This commit is contained in:
parent
cbf63e4698
commit
e50c37d90f
@ -1,98 +0,0 @@
|
||||
/*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2004 Blender Foundation.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): Geoffrey Bantle.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#ifndef __BKE_BMESH_H__
|
||||
#define __BKE_BMESH_H__
|
||||
|
||||
/** \file BKE_bmesh.h
|
||||
* \ingroup bke
|
||||
* \since January 2007
|
||||
* \brief BMesh modeler structure and functions.
|
||||
*
|
||||
*/
|
||||
|
||||
/*NOTE: this is the bmesh 1.0 code. it's completely outdated.*/
|
||||
|
||||
/* uncomment to use the new bevel operator as a modifier */
|
||||
#define USE_BM_BEVEL_OP_AS_MOD
|
||||
|
||||
/* bevel tool defines */
|
||||
/* element flags */
|
||||
#define BME_BEVEL_ORIG 1
|
||||
#define BME_BEVEL_BEVEL (1 << 1)
|
||||
#define BME_BEVEL_NONMAN (1 << 2)
|
||||
#define BME_BEVEL_WIRE (1 << 3)
|
||||
|
||||
/* tool options */
|
||||
#define BME_BEVEL_SELECT 1
|
||||
#define BME_BEVEL_VERT (1 << 1)
|
||||
#define BME_BEVEL_RADIUS (1 << 2)
|
||||
#define BME_BEVEL_ANGLE (1 << 3)
|
||||
#define BME_BEVEL_WEIGHT (1 << 4)
|
||||
#define BME_BEVEL_VGROUP (1 << 5)
|
||||
//~ #define BME_BEVEL_EWEIGHT (1<<4)
|
||||
//~ #define BME_BEVEL_VWEIGHT (1<<5)
|
||||
#define BME_BEVEL_PERCENT (1 << 6)
|
||||
#define BME_BEVEL_EMIN (1 << 7)
|
||||
#define BME_BEVEL_EMAX (1 << 8)
|
||||
#define BME_BEVEL_RUNNING (1 << 9)
|
||||
#define BME_BEVEL_RES (1 << 10)
|
||||
|
||||
#define BME_BEVEL_EVEN (1 << 11) /* this is a new setting not related to old (trunk bmesh bevel code) but adding
|
||||
* here because they are mixed - campbell */
|
||||
#define BME_BEVEL_DIST (1 << 12) /* same as above */
|
||||
|
||||
#define BME_BEVEL_OVERLAP_OK (1 << 13)
|
||||
|
||||
typedef struct BME_TransData {
|
||||
struct BMesh *bm; /* the bmesh the vert belongs to */
|
||||
struct BMVert *v; /* pointer to the vert this tdata applies to */
|
||||
float co[3]; /* the original coordinate */
|
||||
float org[3]; /* the origin */
|
||||
float vec[3]; /* a directional vector; always, always normalize! */
|
||||
void *loc; /* a pointer to the data to transform (likely the vert's cos) */
|
||||
float factor; /* primary scaling factor; also accumulates number of weighted edges for beveling tool */
|
||||
float weight; /* another scaling factor; used primarily for propogating vertex weights to transforms; */
|
||||
/* weight is also used across recursive bevels to help with the math */
|
||||
float maxfactor; /* the unscaled, original factor (used only by "edge verts" in recursive beveling) */
|
||||
float *max; /* the maximum distance this vert can be transformed; negative is infinite
|
||||
* it points to the "parent" maxfactor (where maxfactor makes little sense)
|
||||
* where the max limit is stored (limits are stored per-corner) */
|
||||
} BME_TransData;
|
||||
|
||||
typedef struct BME_TransData_Head {
|
||||
struct GHash *gh; /* the hash structure for element lookup */
|
||||
struct MemArena *ma; /* the memory "pool" we will be drawing individual elements from */
|
||||
int len;
|
||||
} BME_TransData_Head;
|
||||
|
||||
struct BME_TransData *BME_get_transdata(struct BME_TransData_Head *td, struct BMVert *v);
|
||||
void BME_free_transdata(struct BME_TransData_Head *td);
|
||||
struct BMesh *BME_bevel(struct BMesh *bm, float value, int res, int options, int defgrp_index, float angle,
|
||||
BME_TransData_Head **rtd);
|
||||
|
||||
#endif
|
@ -46,7 +46,6 @@ extern "C" {
|
||||
/* forwards */
|
||||
struct Main;
|
||||
struct Object;
|
||||
struct BME_Glob;
|
||||
|
||||
typedef struct Global {
|
||||
|
||||
|
@ -165,7 +165,6 @@ set(SRC
|
||||
BKE_armature.h
|
||||
BKE_autoexec.h
|
||||
BKE_blender.h
|
||||
BKE_bmesh.h
|
||||
BKE_bmfont.h
|
||||
BKE_bmfont_types.h
|
||||
BKE_boids.h
|
||||
|
@ -37,7 +37,6 @@
|
||||
#include "BLI_array.h"
|
||||
|
||||
#include "BKE_DerivedMesh.h"
|
||||
#include "BKE_bmesh.h"
|
||||
#include "BKE_editmesh.h"
|
||||
|
||||
/* Static function for alloc */
|
||||
|
@ -23,7 +23,7 @@
|
||||
#
|
||||
# ***** END GPL LICENSE BLOCK *****
|
||||
|
||||
set(INC
|
||||
set(INC
|
||||
.
|
||||
../blenfont
|
||||
../blenkernel
|
||||
@ -50,7 +50,7 @@ set(SRC
|
||||
operators/bmo_edgenet.c
|
||||
operators/bmo_extrude.c
|
||||
operators/bmo_fill_edgeloop.c
|
||||
operators/bmo_fill_grid.c
|
||||
operators/bmo_fill_grid.c
|
||||
operators/bmo_hull.c
|
||||
operators/bmo_inset.c
|
||||
operators/bmo_join_triangles.c
|
||||
@ -115,7 +115,6 @@ set(SRC
|
||||
intern/bmesh_operator_api.h
|
||||
intern/bmesh_error.h
|
||||
|
||||
tools/BME_bevel.c
|
||||
tools/bmesh_bevel.c
|
||||
tools/bmesh_bevel.h
|
||||
tools/bmesh_decimate_collapse.c
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -61,7 +61,6 @@
|
||||
#include "BLI_linklist.h"
|
||||
|
||||
#include "BKE_nla.h"
|
||||
#include "BKE_bmesh.h"
|
||||
#include "BKE_editmesh_bvh.h"
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_constraint.h"
|
||||
|
@ -66,7 +66,6 @@
|
||||
#include "BKE_DerivedMesh.h"
|
||||
#include "BKE_action.h"
|
||||
#include "BKE_armature.h"
|
||||
#include "BKE_bmesh.h"
|
||||
#include "BKE_constraint.h"
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_curve.h"
|
||||
|
@ -281,16 +281,23 @@ typedef struct BevelModifierData {
|
||||
short val_flags; /* 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 bevel_angle; /* if the BME_BEVEL_ANGLE is set, this will be how "sharp" an edge must be before it gets beveled */
|
||||
char defgrp_name[64]; /* if the BME_BEVEL_VWEIGHT option is set, this will be the name of the vert group, MAX_VGROUP_NAME */
|
||||
float bevel_angle; /* if the MOD_BEVEL_ANGLE is set, this will be how "sharp" an edge must be before it gets beveled */
|
||||
char defgrp_name[64]; /* if the MOD_BEVEL_VWEIGHT option is set, this will be the name of the vert group, MAX_VGROUP_NAME */
|
||||
} BevelModifierData;
|
||||
|
||||
typedef struct BMeshModifierData {
|
||||
ModifierData modifier;
|
||||
|
||||
float pad;
|
||||
int type;
|
||||
} BMeshModifierData;
|
||||
#define MOD_BEVEL_VERT (1 << 1)
|
||||
// #define MOD_BEVEL_RADIUS (1 << 2)
|
||||
#define MOD_BEVEL_ANGLE (1 << 3)
|
||||
#define MOD_BEVEL_WEIGHT (1 << 4)
|
||||
#define MOD_BEVEL_VGROUP (1 << 5)
|
||||
#define MOD_BEVEL_EMIN (1 << 7)
|
||||
#define MOD_BEVEL_EMAX (1 << 8)
|
||||
// #define MOD_BEVEL_RUNNING (1 << 9)
|
||||
// #define MOD_BEVEL_RES (1 << 10)
|
||||
// #define MOD_BEVEL_EVEN (1 << 11) /* this is a new setting not related to old (trunk bmesh bevel code) but adding
|
||||
// * here because they are mixed - campbell */
|
||||
// #define MOD_BEVEL_DIST (1 << 12) /* same as above */
|
||||
#define MOD_BEVEL_OVERLAP_OK (1 << 13)
|
||||
|
||||
|
||||
/* Smoke modifier flags */
|
||||
|
@ -43,7 +43,6 @@
|
||||
#include "BLF_translation.h"
|
||||
|
||||
#include "BKE_animsys.h"
|
||||
#include "BKE_bmesh.h" /* For BevelModifierData */
|
||||
#include "BKE_dynamicpaint.h"
|
||||
#include "BKE_multires.h"
|
||||
#include "BKE_smoke.h" /* For smokeModifier_free & smokeModifier_createType */
|
||||
@ -2300,10 +2299,10 @@ static void rna_def_modifier_bevel(BlenderRNA *brna)
|
||||
|
||||
static EnumPropertyItem prop_limit_method_items[] = {
|
||||
{0, "NONE", 0, "None", "Bevel the entire mesh by a constant amount"},
|
||||
{BME_BEVEL_ANGLE, "ANGLE", 0, "Angle", "Only bevel edges with sharp enough angles between faces"},
|
||||
{BME_BEVEL_WEIGHT, "WEIGHT", 0, "Weight",
|
||||
{MOD_BEVEL_ANGLE, "ANGLE", 0, "Angle", "Only bevel edges with sharp enough angles between faces"},
|
||||
{MOD_BEVEL_WEIGHT, "WEIGHT", 0, "Weight",
|
||||
"Use bevel weights to determine how much bevel is applied in edge mode"},
|
||||
{BME_BEVEL_VGROUP, "VGROUP", 0, "Vertex Group",
|
||||
{MOD_BEVEL_VGROUP, "VGROUP", 0, "Vertex Group",
|
||||
"Use vertex group weights to determine how much bevel is applied in vertex mode"},
|
||||
{0, NULL, 0, NULL, NULL}
|
||||
};
|
||||
@ -2311,8 +2310,8 @@ static void rna_def_modifier_bevel(BlenderRNA *brna)
|
||||
/* TO BE DEPRECATED */
|
||||
static EnumPropertyItem prop_edge_weight_method_items[] = {
|
||||
{0, "AVERAGE", 0, "Average", ""},
|
||||
{BME_BEVEL_EMIN, "SHARPEST", 0, "Sharpest", ""},
|
||||
{BME_BEVEL_EMAX, "LARGEST", 0, "Largest", ""},
|
||||
{MOD_BEVEL_EMIN, "SHARPEST", 0, "Sharpest", ""},
|
||||
{MOD_BEVEL_EMAX, "LARGEST", 0, "Largest", ""},
|
||||
{0, NULL, 0, NULL, NULL}
|
||||
};
|
||||
|
||||
@ -2335,7 +2334,7 @@ static void rna_def_modifier_bevel(BlenderRNA *brna)
|
||||
RNA_def_property_update(prop, 0, "rna_Modifier_update");
|
||||
|
||||
prop = RNA_def_property(srna, "use_only_vertices", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flags", BME_BEVEL_VERT);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_BEVEL_VERT);
|
||||
RNA_def_property_ui_text(prop, "Only Vertices", "Bevel verts/corners, not edges");
|
||||
RNA_def_property_update(prop, 0, "rna_Modifier_update");
|
||||
|
||||
@ -2352,22 +2351,14 @@ static void rna_def_modifier_bevel(BlenderRNA *brna)
|
||||
RNA_def_property_ui_text(prop, "Edge Weight Method", "What edge weight to use for weighting a vertex");
|
||||
RNA_def_property_update(prop, 0, "rna_Modifier_update");
|
||||
|
||||
#if 1 /* expose as radians */
|
||||
prop = RNA_def_property(srna, "angle_limit", PROP_FLOAT, PROP_ANGLE);
|
||||
RNA_def_property_float_funcs(prop, "rna_BevelModifier_angle_limit_get",
|
||||
"rna_BevelModifier_angle_limit_set", NULL);
|
||||
RNA_def_property_range(prop, 0, DEG2RAD(180));
|
||||
RNA_def_property_ui_range(prop, 0, DEG2RAD(180), 100, 2);
|
||||
#else
|
||||
prop = RNA_def_property(srna, "angle_limit", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "bevel_angle");
|
||||
RNA_def_property_range(prop, 0, 180);
|
||||
RNA_def_property_ui_range(prop, 0, 180, 100, 2);
|
||||
#endif
|
||||
RNA_def_property_ui_text(prop, "Angle", "Angle above which to bevel edges");
|
||||
RNA_def_property_update(prop, 0, "rna_Modifier_update");
|
||||
|
||||
#ifdef USE_BM_BEVEL_OP_AS_MOD
|
||||
prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
|
||||
RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
|
||||
RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name");
|
||||
@ -2375,11 +2366,9 @@ static void rna_def_modifier_bevel(BlenderRNA *brna)
|
||||
RNA_def_property_update(prop, 0, "rna_Modifier_update");
|
||||
|
||||
prop = RNA_def_property(srna, "use_clamp_overlap", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_negative_sdna(prop, NULL, "flags", BME_BEVEL_OVERLAP_OK);
|
||||
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");
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
static void rna_def_modifier_shrinkwrap(BlenderRNA *brna)
|
||||
|
@ -42,7 +42,6 @@
|
||||
#include "BKE_deform.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_mesh.h"
|
||||
#include "BKE_bmesh.h" /* only for defines */
|
||||
|
||||
#include "MOD_util.h"
|
||||
|
||||
@ -91,8 +90,6 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
|
||||
return dataMask;
|
||||
}
|
||||
|
||||
#ifdef USE_BM_BEVEL_OP_AS_MOD
|
||||
|
||||
/*
|
||||
* This calls the new bevel code (added since 2.64)
|
||||
*/
|
||||
@ -110,13 +107,13 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Object *ob,
|
||||
MDeformVert *dvert = NULL;
|
||||
BevelModifierData *bmd = (BevelModifierData *) md;
|
||||
const float threshold = cosf((bmd->bevel_angle + 0.00001f) * (float)M_PI / 180.0f);
|
||||
const bool vertex_only = (bmd->flags & BME_BEVEL_VERT) != 0;
|
||||
const bool do_clamp = !(bmd->flags & BME_BEVEL_OVERLAP_OK);
|
||||
const bool vertex_only = (bmd->flags & MOD_BEVEL_VERT) != 0;
|
||||
const bool do_clamp = !(bmd->flags & MOD_BEVEL_OVERLAP_OK);
|
||||
|
||||
bm = DM_to_bmesh(dm, true);
|
||||
|
||||
if (vertex_only) {
|
||||
if ((bmd->lim_flags & BME_BEVEL_VGROUP) && bmd->defgrp_name[0]) {
|
||||
if ((bmd->lim_flags & MOD_BEVEL_VGROUP) && bmd->defgrp_name[0]) {
|
||||
modifier_get_vgroup(ob, dm, bmd->defgrp_name, &dvert, &vgroup);
|
||||
}
|
||||
BM_ITER_MESH(v, &iter, bm, BM_VERTS_OF_MESH) {
|
||||
@ -131,7 +128,7 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Object *ob,
|
||||
BM_elem_flag_enable(v, BM_ELEM_TAG);
|
||||
}
|
||||
}
|
||||
else if (bmd->lim_flags & BME_BEVEL_ANGLE) {
|
||||
else if (bmd->lim_flags & MOD_BEVEL_ANGLE) {
|
||||
BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
|
||||
/* check for 1 edge having 2 face users */
|
||||
BMLoop *l_a, *l_b;
|
||||
@ -148,7 +145,7 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Object *ob,
|
||||
/* crummy, is there a way just to operator on all? - campbell */
|
||||
BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
|
||||
if (BM_edge_is_manifold(e)) {
|
||||
if (bmd->lim_flags & BME_BEVEL_WEIGHT) {
|
||||
if (bmd->lim_flags & MOD_BEVEL_WEIGHT) {
|
||||
weight = BM_elem_float_data_get(&bm->edata, e, CD_BWEIGHT);
|
||||
if (weight == 0.0f)
|
||||
continue;
|
||||
@ -161,7 +158,7 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Object *ob,
|
||||
}
|
||||
|
||||
BM_mesh_bevel(bm, bmd->value, bmd->res,
|
||||
vertex_only, bmd->lim_flags & BME_BEVEL_WEIGHT, do_clamp,
|
||||
vertex_only, bmd->lim_flags & MOD_BEVEL_WEIGHT, do_clamp,
|
||||
dvert, vgroup);
|
||||
|
||||
result = CDDM_from_bmesh(bm, TRUE);
|
||||
@ -176,46 +173,6 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Object *ob,
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
#else /* from trunk, see note above */
|
||||
|
||||
static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob),
|
||||
DerivedMesh *derivedData,
|
||||
ModifierApplyFlag UNUSED(flag))
|
||||
{
|
||||
DerivedMesh *result;
|
||||
BMesh *bm;
|
||||
|
||||
/*bDeformGroup *def;*/
|
||||
int /*i,*/ options, defgrp_index = -1;
|
||||
BevelModifierData *bmd = (BevelModifierData *) md;
|
||||
|
||||
options = bmd->flags | bmd->val_flags | bmd->lim_flags | bmd->e_flags;
|
||||
|
||||
#if 0
|
||||
if ((options & BME_BEVEL_VWEIGHT) && bmd->defgrp_name[0]) {
|
||||
defgrp_index = defgroup_name_index(ob, bmd->defgrp_name);
|
||||
if (defgrp_index == -1) {
|
||||
options &= ~BME_BEVEL_VWEIGHT;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
bm = DM_to_bmesh(derivedData);
|
||||
BME_bevel(bm, bmd->value, bmd->res, options, defgrp_index, DEG2RADF(bmd->bevel_angle), NULL);
|
||||
result = CDDM_from_bmesh(bm, TRUE);
|
||||
BM_mesh_free(bm);
|
||||
|
||||
/* until we allow for dirty normal flag, always calc,
|
||||
* note: calculating on the CDDM is faster then the BMesh equivalent */
|
||||
result->dirty |= DM_DIRTY_NORMALS;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
ModifierTypeInfo modifierType_Bevel = {
|
||||
/* name */ "Bevel",
|
||||
/* structName */ "BevelModifierData",
|
||||
|
Loading…
Reference in New Issue
Block a user