Merge branch 'master' into blender2.8
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
#
|
||||
# ***** END GPL LICENSE BLOCK *****
|
||||
|
||||
set(INC
|
||||
set(INC
|
||||
.
|
||||
intern
|
||||
../blenkernel
|
||||
|
@@ -60,7 +60,7 @@
|
||||
static void initData(ModifierData *md)
|
||||
{
|
||||
ArmatureModifierData *amd = (ArmatureModifierData *) md;
|
||||
|
||||
|
||||
amd->deformflag = ARM_DEF_VGROUP;
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ static void deformVerts(
|
||||
ArmatureModifierData *amd = (ArmatureModifierData *) md;
|
||||
|
||||
modifier_vgroup_cache(md, vertexCos); /* if next modifier needs original vertices */
|
||||
|
||||
|
||||
armature_deform_verts(amd->object, ctx->object, mesh, vertexCos, NULL,
|
||||
numVerts, amd->deformflag, (float(*)[3])amd->prevCos, amd->defgrp_name);
|
||||
|
||||
|
@@ -31,7 +31,7 @@
|
||||
/** \file blender/modifiers/intern/MOD_bevel.c
|
||||
* \ingroup modifiers
|
||||
*/
|
||||
|
||||
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_mesh_types.h"
|
||||
|
||||
|
@@ -346,7 +346,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *UNUSED(
|
||||
CustomDataMask dataMask = CD_MASK_MTFACE | CD_MASK_MEDGE;
|
||||
|
||||
dataMask |= CD_MASK_MDEFORMVERT;
|
||||
|
||||
|
||||
return dataMask;
|
||||
}
|
||||
|
||||
|
@@ -116,7 +116,7 @@ static Mesh *applyModifier(
|
||||
MPoly *mpoly, *mp;
|
||||
MLoop *ml, *mloop;
|
||||
uintptr_t hash_num, hash_num_alt;
|
||||
|
||||
|
||||
if (bmd->flag & MOD_BUILD_FLAG_RANDOMIZE) {
|
||||
BLI_array_randomize(faceMap, sizeof(*faceMap),
|
||||
numPoly_src, bmd->seed);
|
||||
@@ -254,7 +254,7 @@ static Mesh *applyModifier(
|
||||
|
||||
mpoly_dst = result->mpoly;
|
||||
ml_dst = result->mloop;
|
||||
|
||||
|
||||
/* copy the faces across, remapping indices */
|
||||
k = 0;
|
||||
for (i = 0; i < numFaces_dst; i++) {
|
||||
@@ -279,7 +279,7 @@ static Mesh *applyModifier(
|
||||
BLI_ghash_free(vertHash, NULL, NULL);
|
||||
BLI_ghash_free(edgeHash, NULL, NULL);
|
||||
BLI_ghash_free(edgeHash2, NULL, NULL);
|
||||
|
||||
|
||||
MEM_freeN(vertMap);
|
||||
MEM_freeN(edgeMap);
|
||||
MEM_freeN(faceMap);
|
||||
|
@@ -67,7 +67,7 @@ static bool isDisabled(ModifierData *md, int UNUSED(useRenderParams))
|
||||
{
|
||||
CastModifierData *cmd = (CastModifierData *) md;
|
||||
short flag;
|
||||
|
||||
|
||||
flag = cmd->flag & (MOD_CAST_X | MOD_CAST_Y | MOD_CAST_Z);
|
||||
|
||||
if ((cmd->fac == 0.0f) || flag == 0) return true;
|
||||
@@ -125,7 +125,7 @@ static void sphere_do(
|
||||
flag = cmd->flag;
|
||||
type = cmd->type; /* projection type: sphere or cylinder */
|
||||
|
||||
if (type == MOD_CAST_TYPE_CYLINDER)
|
||||
if (type == MOD_CAST_TYPE_CYLINDER)
|
||||
flag &= ~MOD_CAST_Z;
|
||||
|
||||
ctrl_ob = cmd->object;
|
||||
|
@@ -56,18 +56,18 @@
|
||||
|
||||
#include "MOD_util.h"
|
||||
|
||||
static void initData(ModifierData *md)
|
||||
static void initData(ModifierData *md)
|
||||
{
|
||||
ClothModifierData *clmd = (ClothModifierData *) md;
|
||||
|
||||
|
||||
clmd->sim_parms = MEM_callocN(sizeof(ClothSimSettings), "cloth sim parms");
|
||||
clmd->coll_parms = MEM_callocN(sizeof(ClothCollSettings), "cloth coll parms");
|
||||
clmd->point_cache = BKE_ptcache_add(&clmd->ptcaches);
|
||||
|
||||
|
||||
/* check for alloc failing */
|
||||
if (!clmd->sim_parms || !clmd->coll_parms || !clmd->point_cache)
|
||||
return;
|
||||
|
||||
|
||||
cloth_init(clmd);
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ static void deformVerts(
|
||||
{
|
||||
Mesh *mesh_src;
|
||||
ClothModifierData *clmd = (ClothModifierData *) md;
|
||||
|
||||
|
||||
/* check for alloc failing */
|
||||
if (!clmd->sim_parms || !clmd->coll_parms) {
|
||||
initData(md);
|
||||
@@ -166,7 +166,7 @@ static void copyData(const ModifierData *md, ModifierData *target)
|
||||
|
||||
if (tclmd->coll_parms)
|
||||
MEM_freeN(tclmd->coll_parms);
|
||||
|
||||
|
||||
BKE_ptcache_free_list(&tclmd->ptcaches);
|
||||
tclmd->point_cache = NULL;
|
||||
|
||||
@@ -189,13 +189,13 @@ static bool dependsOnTime(ModifierData *UNUSED(md))
|
||||
static void freeData(ModifierData *md)
|
||||
{
|
||||
ClothModifierData *clmd = (ClothModifierData *) md;
|
||||
|
||||
|
||||
if (clmd) {
|
||||
if (G.debug_value > 0)
|
||||
printf("clothModifier_freeData\n");
|
||||
|
||||
|
||||
cloth_free_modifier_extern(clmd);
|
||||
|
||||
|
||||
if (clmd->sim_parms) {
|
||||
if (clmd->sim_parms->effector_weights)
|
||||
MEM_freeN(clmd->sim_parms->effector_weights);
|
||||
@@ -203,13 +203,13 @@ static void freeData(ModifierData *md)
|
||||
}
|
||||
if (clmd->coll_parms)
|
||||
MEM_freeN(clmd->coll_parms);
|
||||
|
||||
|
||||
BKE_ptcache_free_list(&clmd->ptcaches);
|
||||
clmd->point_cache = NULL;
|
||||
|
||||
|
||||
if (clmd->hairdata)
|
||||
MEM_freeN(clmd->hairdata);
|
||||
|
||||
|
||||
if (clmd->solver_result)
|
||||
MEM_freeN(clmd->solver_result);
|
||||
}
|
||||
|
@@ -55,10 +55,10 @@
|
||||
|
||||
#include "DEG_depsgraph_query.h"
|
||||
|
||||
static void initData(ModifierData *md)
|
||||
static void initData(ModifierData *md)
|
||||
{
|
||||
CollisionModifierData *collmd = (CollisionModifierData *) md;
|
||||
|
||||
|
||||
collmd->x = NULL;
|
||||
collmd->xnew = NULL;
|
||||
collmd->current_x = NULL;
|
||||
@@ -74,7 +74,7 @@ static void initData(ModifierData *md)
|
||||
static void freeData(ModifierData *md)
|
||||
{
|
||||
CollisionModifierData *collmd = (CollisionModifierData *) md;
|
||||
|
||||
|
||||
if (collmd) { /* Seriously? */
|
||||
if (collmd->bvhtree) {
|
||||
BLI_bvhtree_free(collmd->bvhtree);
|
||||
@@ -111,7 +111,7 @@ static void deformVerts(
|
||||
Mesh *mesh_src;
|
||||
MVert *tempVert = NULL;
|
||||
Object *ob = ctx->object;
|
||||
|
||||
|
||||
if (mesh == NULL) {
|
||||
mesh_src = get_mesh(ob, NULL, NULL, NULL, false, false);
|
||||
}
|
||||
@@ -131,21 +131,21 @@ static void deformVerts(
|
||||
printf("CollisionModifier deformVerts: Should not happen!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (mesh_src) {
|
||||
float current_time = 0;
|
||||
unsigned int mvert_num = 0;
|
||||
|
||||
BKE_mesh_apply_vert_coords(mesh_src, vertexCos);
|
||||
BKE_mesh_calc_normals(mesh_src);
|
||||
|
||||
|
||||
current_time = DEG_get_ctime(ctx->depsgraph);
|
||||
|
||||
|
||||
if (G.debug_value > 0)
|
||||
printf("current_time %f, collmd->time_xnew %f\n", current_time, collmd->time_xnew);
|
||||
|
||||
|
||||
mvert_num = mesh_src->totvert;
|
||||
|
||||
|
||||
if (current_time > collmd->time_xnew) {
|
||||
unsigned int i;
|
||||
|
||||
@@ -161,7 +161,7 @@ static void deformVerts(
|
||||
/* we save global positions */
|
||||
mul_m4_v3(ob->obmat, collmd->x[i].co);
|
||||
}
|
||||
|
||||
|
||||
collmd->xnew = MEM_dupallocN(collmd->x); // frame end position
|
||||
collmd->current_x = MEM_dupallocN(collmd->x); // inter-frame
|
||||
collmd->current_xnew = MEM_dupallocN(collmd->x); // inter-frame
|
||||
@@ -218,9 +218,9 @@ static void deformVerts(
|
||||
collmd->tri, collmd->tri_num,
|
||||
ob->pd->pdef_sboft);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* happens on file load (ONLY when i decomment changes in readfile.c) */
|
||||
if (!collmd->bvhtree) {
|
||||
collmd->bvhtree = bvhtree_build_from_mvert(
|
||||
@@ -243,7 +243,7 @@ static void deformVerts(
|
||||
else if (mvert_num != collmd->mvert_num) {
|
||||
freeData((ModifierData *)collmd);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else if (current_time < collmd->time_xnew) {
|
||||
freeData((ModifierData *)collmd);
|
||||
@@ -254,7 +254,7 @@ static void deformVerts(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (mesh_src != mesh) {
|
||||
BKE_id_free(NULL, mesh_src);
|
||||
}
|
||||
|
@@ -47,10 +47,10 @@
|
||||
|
||||
#include "MOD_modifiertypes.h"
|
||||
|
||||
static void initData(ModifierData *md)
|
||||
static void initData(ModifierData *md)
|
||||
{
|
||||
DynamicPaintModifierData *pmd = (DynamicPaintModifierData *) md;
|
||||
|
||||
|
||||
pmd->canvas = NULL;
|
||||
pmd->brush = NULL;
|
||||
pmd->type = MOD_DYNAMICPAINT_TYPE_CANVAS;
|
||||
@@ -60,7 +60,7 @@ static void copyData(const ModifierData *md, ModifierData *target)
|
||||
{
|
||||
const DynamicPaintModifierData *pmd = (const DynamicPaintModifierData *)md;
|
||||
DynamicPaintModifierData *tpmd = (DynamicPaintModifierData *)target;
|
||||
|
||||
|
||||
dynamicPaint_Modifier_copy(pmd, tpmd);
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
|
||||
DynamicPaintSurface *surface = pmd->canvas->surfaces.first;
|
||||
for (; surface; surface = surface->next) {
|
||||
/* tface */
|
||||
if (surface->format == MOD_DPAINT_SURFACE_F_IMAGESEQ ||
|
||||
if (surface->format == MOD_DPAINT_SURFACE_F_IMAGESEQ ||
|
||||
surface->init_color_type == MOD_DPAINT_INITIAL_TEXTURE)
|
||||
{
|
||||
dataMask |= CD_MASK_MLOOPUV;
|
||||
|
@@ -65,7 +65,7 @@ static void initData(ModifierData *md)
|
||||
static void freeData(ModifierData *md)
|
||||
{
|
||||
ExplodeModifierData *emd = (ExplodeModifierData *) md;
|
||||
|
||||
|
||||
MEM_SAFE_FREE(emd->facepa);
|
||||
}
|
||||
static void copyData(const ModifierData *md, ModifierData *target)
|
||||
@@ -192,7 +192,7 @@ static int edgecut_get(EdgeHash *edgehash, unsigned int v1, unsigned int v2)
|
||||
return GET_INT_FROM_POINTER(BLI_edgehash_lookup(edgehash, v1, v2));
|
||||
}
|
||||
|
||||
|
||||
|
||||
static const short add_faces[24] = {
|
||||
0,
|
||||
0, 0, 2, 0, 1, 2, 2, 0, 2, 1,
|
||||
@@ -634,7 +634,7 @@ static DerivedMesh *cutEdges(ExplodeModifierData *emd, DerivedMesh *dm)
|
||||
/* count new faces due to splitting */
|
||||
for (i = 0, fs = facesplit; i < totface; i++, fs++)
|
||||
totfsplit += add_faces[*fs];
|
||||
|
||||
|
||||
splitdm = CDDM_from_template_ex(
|
||||
dm, totesplit, 0, totface + totfsplit, 0, 0,
|
||||
CD_MASK_DERIVEDMESH | CD_MASK_FACECORNERS);
|
||||
@@ -844,7 +844,7 @@ static DerivedMesh *explodeMesh(
|
||||
* with BLI_edgehashIterator_getKey */
|
||||
if (facepa[i] == totpart || cfra < (pars + facepa[i])->time)
|
||||
mindex = totvert + totpart;
|
||||
else
|
||||
else
|
||||
mindex = totvert + facepa[i];
|
||||
|
||||
mf = &mface[i];
|
||||
@@ -935,12 +935,12 @@ static DerivedMesh *explodeMesh(
|
||||
|
||||
dm->getTessFace(dm, i, &source);
|
||||
mf = CDDM_get_tessface(explode, u);
|
||||
|
||||
|
||||
orig_v4 = source.v4;
|
||||
|
||||
if (facepa[i] != totpart && cfra < pa->time)
|
||||
mindex = totvert + totpart;
|
||||
else
|
||||
else
|
||||
mindex = totvert + facepa[i];
|
||||
|
||||
source.v1 = edgecut_get(vertpahash, source.v1, mindex);
|
||||
@@ -1021,7 +1021,7 @@ static DerivedMesh *applyModifier(
|
||||
{
|
||||
if (psmd->flag & eParticleSystemFlag_Pars)
|
||||
psmd->flag &= ~eParticleSystemFlag_Pars;
|
||||
|
||||
|
||||
if (emd->flag & eExplodeFlag_CalcFaces)
|
||||
emd->flag &= ~eExplodeFlag_CalcFaces;
|
||||
|
||||
|
@@ -55,13 +55,13 @@
|
||||
static void initData(ModifierData *md)
|
||||
{
|
||||
FluidsimModifierData *fluidmd = (FluidsimModifierData *) md;
|
||||
|
||||
|
||||
fluidsim_init(fluidmd);
|
||||
}
|
||||
static void freeData(ModifierData *md)
|
||||
{
|
||||
FluidsimModifierData *fluidmd = (FluidsimModifierData *) md;
|
||||
|
||||
|
||||
fluidsim_free(fluidmd);
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ static void copyData(const ModifierData *md, ModifierData *target)
|
||||
{
|
||||
const FluidsimModifierData *fluidmd = (const FluidsimModifierData *) md;
|
||||
FluidsimModifierData *tfluidmd = (FluidsimModifierData *) target;
|
||||
|
||||
|
||||
if (fluidmd->fss) {
|
||||
tfluidmd->fss = MEM_dupallocN(fluidmd->fss);
|
||||
if (tfluidmd->fss && (tfluidmd->fss->meshVelocities != NULL)) {
|
||||
@@ -91,11 +91,11 @@ static DerivedMesh *applyModifier(
|
||||
{
|
||||
FluidsimModifierData *fluidmd = (FluidsimModifierData *) md;
|
||||
DerivedMesh *result = NULL;
|
||||
|
||||
|
||||
/* check for alloc failing */
|
||||
if (!fluidmd->fss) {
|
||||
initData(md);
|
||||
|
||||
|
||||
if (!fluidmd->fss) {
|
||||
return dm;
|
||||
}
|
||||
|
@@ -72,10 +72,10 @@ void fluidsim_init(FluidsimModifierData *fluidmd)
|
||||
FluidsimSettings *fss = MEM_callocN(sizeof(FluidsimSettings), "fluidsimsettings");
|
||||
|
||||
fluidmd->fss = fss;
|
||||
|
||||
|
||||
if (!fss)
|
||||
return;
|
||||
|
||||
|
||||
fss->fmd = fluidmd;
|
||||
fss->type = OB_FLUIDSIM_ENABLE;
|
||||
fss->threads = 0;
|
||||
@@ -89,12 +89,12 @@ void fluidsim_init(FluidsimModifierData *fluidmd)
|
||||
|
||||
fss->viscosityValue = 1.0;
|
||||
fss->viscosityExponent = 6;
|
||||
|
||||
|
||||
fss->grav[0] = 0.0;
|
||||
fss->grav[1] = 0.0;
|
||||
fss->grav[2] = -9.81;
|
||||
|
||||
fss->animStart = 0.0;
|
||||
fss->animStart = 0.0;
|
||||
fss->animEnd = 4.0;
|
||||
fss->animRate = 1.0;
|
||||
fss->gstar = 0.005; // used as normgstar
|
||||
@@ -130,18 +130,18 @@ void fluidsim_init(FluidsimModifierData *fluidmd)
|
||||
fss->cpsTimeStart = fss->animStart;
|
||||
fss->cpsTimeEnd = fss->animEnd;
|
||||
fss->cpsQuality = 10.0; // 1.0 / 10.0 => means 0.1 width
|
||||
|
||||
|
||||
/*
|
||||
* BAD TODO: this is done in buttons_object.c in the moment
|
||||
* Mesh *mesh = ob->data;
|
||||
* // calculate bounding box
|
||||
* fluid_get_bb(mesh->mvert, mesh->totvert, ob->obmat, fss->bbStart, fss->bbSize);
|
||||
*/
|
||||
|
||||
|
||||
fss->meshVelocities = NULL;
|
||||
|
||||
|
||||
fss->lastgoodframe = -1;
|
||||
|
||||
|
||||
fss->flag |= OB_FLUIDSIM_ACTIVE;
|
||||
|
||||
}
|
||||
@@ -163,7 +163,7 @@ void fluidsim_free(FluidsimModifierData *fluidmd)
|
||||
/* Seems to never be used, but for sqke of consistency... */
|
||||
BLI_assert(fluidmd->point_cache == NULL);
|
||||
fluidmd->point_cache = NULL;
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -434,7 +434,7 @@ static DerivedMesh *fluidsim_read_cache(
|
||||
Object *ob, DerivedMesh *orgdm,
|
||||
FluidsimModifierData *fluidmd, int framenr, int useRenderParams)
|
||||
{
|
||||
int curFrame = framenr /* - 1 */ /*scene->r.sfra*/; /* start with 0 at start frame */
|
||||
int curFrame = framenr /* - 1 */ /*scene->r.sfra*/; /* start with 0 at start frame */
|
||||
/* why start with 0 as start frame?? Animations + time are frozen for frame 0 anyway. (See physics_fluid.c for that. - DG */
|
||||
/* If we start with frame 0, we need to remap all animation channels, too, because they will all be 1 frame late if using frame-1! - DG */
|
||||
|
||||
@@ -530,7 +530,7 @@ DerivedMesh *fluidsimModifier_do(
|
||||
FluidsimSettings *fss = NULL;
|
||||
|
||||
framenr = (int)DEG_get_ctime(depsgraph);
|
||||
|
||||
|
||||
/* only handle fluidsim domains */
|
||||
if (fluidmd && fluidmd->fss && (fluidmd->fss->type != OB_FLUIDSIM_DOMAIN))
|
||||
return dm;
|
||||
@@ -549,12 +549,12 @@ DerivedMesh *fluidsimModifier_do(
|
||||
framenr = fss->lastgoodframe - framenr + 1;
|
||||
CLAMP(framenr, 1, fss->lastgoodframe);
|
||||
}
|
||||
|
||||
|
||||
/* try to read from cache */
|
||||
/* if the frame is there, fine, otherwise don't do anything */
|
||||
if ((result = fluidsim_read_cache(ob, dm, fluidmd, framenr, useRenderParams)))
|
||||
return result;
|
||||
|
||||
|
||||
return dm;
|
||||
#else
|
||||
/* unused */
|
||||
|
@@ -53,7 +53,7 @@
|
||||
|
||||
#include "MOD_util.h"
|
||||
|
||||
static void initData(ModifierData *md)
|
||||
static void initData(ModifierData *md)
|
||||
{
|
||||
HookModifierData *hmd = (HookModifierData *) md;
|
||||
|
||||
@@ -259,7 +259,7 @@ static void deformVerts_do(
|
||||
float dmat[4][4];
|
||||
int i, *index_pt;
|
||||
struct HookData_cb hd;
|
||||
|
||||
|
||||
if (hmd->curfalloff == NULL) {
|
||||
/* should never happen, but bad lib linking could cause it */
|
||||
hmd->curfalloff = curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
|
||||
|
@@ -115,17 +115,17 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
|
||||
}
|
||||
|
||||
/* Overview of Method:
|
||||
* 1. Get the vertices that are in the vertexgroup of interest
|
||||
* 1. Get the vertices that are in the vertexgroup of interest
|
||||
* 2. Filter out unwanted geometry (i.e. not in vertexgroup), by populating mappings with new vs old indices
|
||||
* 3. Make a new mesh containing only the mapping data
|
||||
*/
|
||||
|
||||
|
||||
/* get original number of verts, edges, and faces */
|
||||
maxVerts = mesh->totvert;
|
||||
maxEdges = mesh->totedge;
|
||||
maxPolys = mesh->totpoly;
|
||||
|
||||
/* check if we can just return the original mesh
|
||||
|
||||
/* check if we can just return the original mesh
|
||||
* - must have verts and therefore verts assigned to vgroups to do anything useful
|
||||
*/
|
||||
if (!(ELEM(mmd->mode, MOD_MASK_MODE_ARM, MOD_MASK_MODE_VGROUP)) ||
|
||||
@@ -133,7 +133,7 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
|
||||
{
|
||||
return mesh;
|
||||
}
|
||||
|
||||
|
||||
/* if mode is to use selected armature bones, aggregate the bone groups */
|
||||
if (mmd->mode == MOD_MASK_MODE_ARM) { /* --- using selected bones --- */
|
||||
Object *oba = mmd->ob_arm;
|
||||
@@ -142,18 +142,18 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
|
||||
bool *bone_select_array;
|
||||
int bone_select_tot = 0;
|
||||
const int defbase_tot = BLI_listbase_count(&ob->defbase);
|
||||
|
||||
|
||||
/* check that there is armature object with bones to use, otherwise return original mesh */
|
||||
if (ELEM(NULL, oba, oba->pose, ob->defbase.first)) {
|
||||
return mesh;
|
||||
}
|
||||
|
||||
/* determine whether each vertexgroup is associated with a selected bone or not
|
||||
|
||||
/* determine whether each vertexgroup is associated with a selected bone or not
|
||||
* - each cell is a boolean saying whether bone corresponding to the ith group is selected
|
||||
* - groups that don't match a bone are treated as not existing (along with the corresponding ungrouped verts)
|
||||
*/
|
||||
bone_select_array = MEM_malloc_arrayN((size_t)defbase_tot, sizeof(char), "mask array");
|
||||
|
||||
|
||||
for (i = 0, def = ob->defbase.first; def; def = def->next, i++) {
|
||||
pchan = BKE_pose_channel_find_name(oba->pose, def->name);
|
||||
if (pchan && pchan->bone && (pchan->bone->flag & BONE_SELECTED)) {
|
||||
@@ -169,8 +169,8 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
|
||||
* key = oldindex, value = newindex
|
||||
*/
|
||||
vertHash = BLI_ghash_int_new_ex("mask vert gh", (unsigned int)maxVerts);
|
||||
|
||||
/* add vertices which exist in vertexgroups into vertHash for filtering
|
||||
|
||||
/* add vertices which exist in vertexgroups into vertHash for filtering
|
||||
* - dv = for each vertex, what vertexgroups does it belong to
|
||||
* - dw = weight that vertex was assigned to a vertexgroup it belongs to
|
||||
*/
|
||||
@@ -178,7 +178,7 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
|
||||
MDeformWeight *dw = dv->dw;
|
||||
bool found = false;
|
||||
int j;
|
||||
|
||||
|
||||
/* check the groups that vertex is assigned to, and see if it was any use */
|
||||
for (j = 0; j < dv->totweight; j++, dw++) {
|
||||
if (dw->def_nr < defbase_tot) {
|
||||
@@ -190,16 +190,16 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (found_test != found) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
/* add to ghash for verts (numVerts acts as counter for mapping) */
|
||||
BLI_ghash_insert(vertHash, SET_INT_IN_POINTER(i), SET_INT_IN_POINTER(numVerts));
|
||||
numVerts++;
|
||||
}
|
||||
|
||||
|
||||
/* free temp hashes */
|
||||
MEM_freeN(bone_select_array);
|
||||
}
|
||||
@@ -210,10 +210,10 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
|
||||
if (defgrp_index == -1) {
|
||||
return mesh;
|
||||
}
|
||||
|
||||
|
||||
/* hashes for quickly providing a mapping from old to new - use key=oldindex, value=newindex */
|
||||
vertHash = BLI_ghash_int_new_ex("mask vert2 bh", (unsigned int)maxVerts);
|
||||
|
||||
|
||||
/* add vertices which exist in vertexgroup into ghash for filtering */
|
||||
for (i = 0, dv = dvert; i < maxVerts; i++, dv++) {
|
||||
const bool found = defvert_find_weight(dv, defgrp_index) != 0.0f;
|
||||
@@ -239,12 +239,12 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
|
||||
/* overalloc, assume all polys are seen */
|
||||
loop_mapping = MEM_malloc_arrayN((size_t)maxPolys, sizeof(int), "mask loopmap");
|
||||
|
||||
/* loop over edges and faces, and do the same thing to
|
||||
* ensure that they only reference existing verts
|
||||
/* loop over edges and faces, and do the same thing to
|
||||
* ensure that they only reference existing verts
|
||||
*/
|
||||
for (i = 0; i < maxEdges; i++) {
|
||||
const MEdge *me = &medge_src[i];
|
||||
|
||||
|
||||
/* only add if both verts will be in new mesh */
|
||||
if (BLI_ghash_haskey(vertHash, SET_INT_IN_POINTER(me->v1)) &&
|
||||
BLI_ghash_haskey(vertHash, SET_INT_IN_POINTER(me->v2)))
|
||||
@@ -258,14 +258,14 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
|
||||
const MLoop *ml_src = &mloop_src[mp_src->loopstart];
|
||||
bool ok = true;
|
||||
int j;
|
||||
|
||||
|
||||
for (j = 0; j < mp_src->totloop; j++, ml_src++) {
|
||||
if (!BLI_ghash_haskey(vertHash, SET_INT_IN_POINTER(ml_src->v))) {
|
||||
ok = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* all verts must be available */
|
||||
if (ok) {
|
||||
BLI_ghash_insert(polyHash, SET_INT_IN_POINTER(i), SET_INT_IN_POINTER(numPolys));
|
||||
@@ -274,13 +274,13 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
|
||||
numLoops += mp_src->totloop;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* now we know the number of verts, edges and faces,
|
||||
|
||||
|
||||
/* now we know the number of verts, edges and faces,
|
||||
* we can create the new (reduced) mesh
|
||||
*/
|
||||
result = BKE_mesh_new_nomain_from_template(mesh, numVerts, numEdges, 0, numLoops, numPolys);
|
||||
|
||||
|
||||
mpoly_dst = result->mpoly;
|
||||
mloop_dst = result->mloop;
|
||||
medge_dst = result->medge;
|
||||
@@ -293,21 +293,21 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
|
||||
MVert *v_dst;
|
||||
const int i_src = GET_INT_FROM_POINTER(BLI_ghashIterator_getKey(&gh_iter));
|
||||
const int i_dst = GET_INT_FROM_POINTER(BLI_ghashIterator_getValue(&gh_iter));
|
||||
|
||||
|
||||
v_src = &mvert_src[i_src];
|
||||
v_dst = &mvert_dst[i_dst];
|
||||
|
||||
*v_dst = *v_src;
|
||||
CustomData_copy_data(&mesh->vdata, &result->vdata, i_src, i_dst, 1);
|
||||
}
|
||||
|
||||
|
||||
/* edges */
|
||||
GHASH_ITER (gh_iter, edgeHash) {
|
||||
const MEdge *e_src;
|
||||
MEdge *e_dst;
|
||||
const int i_src = GET_INT_FROM_POINTER(BLI_ghashIterator_getKey(&gh_iter));
|
||||
const int i_dst = GET_INT_FROM_POINTER(BLI_ghashIterator_getValue(&gh_iter));
|
||||
|
||||
|
||||
e_src = &medge_src[i_src];
|
||||
e_dst = &medge_dst[i_dst];
|
||||
|
||||
@@ -316,7 +316,7 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
|
||||
e_dst->v1 = GET_UINT_FROM_POINTER(BLI_ghash_lookup(vertHash, SET_UINT_IN_POINTER(e_src->v1)));
|
||||
e_dst->v2 = GET_UINT_FROM_POINTER(BLI_ghash_lookup(vertHash, SET_UINT_IN_POINTER(e_src->v2)));
|
||||
}
|
||||
|
||||
|
||||
/* faces */
|
||||
GHASH_ITER (gh_iter, polyHash) {
|
||||
const int i_src = GET_INT_FROM_POINTER(BLI_ghashIterator_getKey(&gh_iter));
|
||||
@@ -327,7 +327,7 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
|
||||
const int i_ml_dst = loop_mapping[i_dst];
|
||||
const MLoop *ml_src = &mloop_src[i_ml_src];
|
||||
MLoop *ml_dst = &mloop_dst[i_ml_dst];
|
||||
|
||||
|
||||
CustomData_copy_data(&mesh->pdata, &result->pdata, i_src, i_dst, 1);
|
||||
CustomData_copy_data(&mesh->ldata, &result->ldata, i_ml_src, i_ml_dst, mp_src->totloop);
|
||||
|
||||
@@ -344,7 +344,7 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
|
||||
/* why is this needed? - campbell */
|
||||
/* recalculate normals */
|
||||
result->runtime.cd_dirty_vert |= CD_MASK_NORMAL;
|
||||
|
||||
|
||||
/* free hashes */
|
||||
BLI_ghash_free(vertHash, NULL, NULL);
|
||||
BLI_ghash_free(edgeHash, NULL, NULL);
|
||||
|
@@ -98,7 +98,7 @@ static void copyData(const ModifierData *md, ModifierData *target)
|
||||
}
|
||||
|
||||
static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
|
||||
{
|
||||
{
|
||||
MeshDeformModifierData *mmd = (MeshDeformModifierData *)md;
|
||||
CustomDataMask dataMask = 0;
|
||||
|
||||
@@ -305,7 +305,7 @@ static void meshdeformModifier_do(
|
||||
* We'll support this case once granular dependency graph is landed.
|
||||
*/
|
||||
cagemesh = BKE_modifier_get_evaluated_mesh_from_evaluated_object(mmd->object, &free_cagemesh);
|
||||
|
||||
|
||||
if (cagemesh == NULL) {
|
||||
modifier_setError(md, "Cannot get mesh from cage object");
|
||||
return;
|
||||
@@ -444,7 +444,7 @@ void modifier_mdef_compact_influences(ModifierData *md)
|
||||
weights = mmd->bindweights;
|
||||
if (!weights)
|
||||
return;
|
||||
|
||||
|
||||
totvert = mmd->totvert;
|
||||
totcagevert = mmd->totcagevert;
|
||||
|
||||
@@ -490,7 +490,7 @@ void modifier_mdef_compact_influences(ModifierData *md)
|
||||
}
|
||||
|
||||
mmd->bindoffsets[b] = totinfluence;
|
||||
|
||||
|
||||
/* free */
|
||||
MEM_freeN(mmd->bindweights);
|
||||
mmd->bindweights = NULL;
|
||||
|
@@ -189,7 +189,7 @@ static Mesh *doMirrorOnAxis(
|
||||
vtmap_b++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* handle shape keys */
|
||||
totshape = CustomData_number_of_layers(&result->vdata, CD_SHAPEKEY);
|
||||
for (a = 0; a < totshape; a++) {
|
||||
@@ -198,14 +198,14 @@ static Mesh *doMirrorOnAxis(
|
||||
mul_m4_v3(mtx, cos[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* adjust mirrored edge vertex indices */
|
||||
me = result->medge + maxEdges;
|
||||
for (i = 0; i < maxEdges; i++, me++) {
|
||||
me->v1 += maxVerts;
|
||||
me->v2 += maxVerts;
|
||||
}
|
||||
|
||||
|
||||
/* adjust mirrored poly loopstart indices, and reverse loop order (normals) */
|
||||
mp = result->mpoly + maxPolys;
|
||||
ml = result->mloop;
|
||||
@@ -229,7 +229,7 @@ static Mesh *doMirrorOnAxis(
|
||||
ml2[j].e = ml2[j + 1].e;
|
||||
}
|
||||
ml2[mp->totloop - 1].e = e;
|
||||
|
||||
|
||||
mp->loopstart += maxLoops;
|
||||
}
|
||||
|
||||
@@ -267,7 +267,7 @@ static Mesh *doMirrorOnAxis(
|
||||
int *flip_map = NULL, flip_map_len = 0;
|
||||
|
||||
flip_map = defgroup_flip_map(ob, &flip_map_len, false);
|
||||
|
||||
|
||||
if (flip_map) {
|
||||
for (i = 0; i < maxVerts; dvert++, i++) {
|
||||
/* merged vertices get both groups, others get flipped */
|
||||
|
@@ -93,17 +93,17 @@ static DerivedMesh *applyModifier(
|
||||
|
||||
if (useRenderParams || !(ctx->flag & MOD_APPLY_USECACHE)) {
|
||||
DerivedMesh *cddm;
|
||||
|
||||
|
||||
cddm = CDDM_copy(result);
|
||||
|
||||
/* copy hidden/masks to vertices */
|
||||
if (!useRenderParams) {
|
||||
struct MDisps *mdisps;
|
||||
struct GridPaintMask *grid_paint_mask;
|
||||
|
||||
|
||||
mdisps = CustomData_get_layer(&me->ldata, CD_MDISPS);
|
||||
grid_paint_mask = CustomData_get_layer(&me->ldata, CD_GRID_PAINT_MASK);
|
||||
|
||||
|
||||
if (mdisps) {
|
||||
subsurf_copy_grid_hidden(result, me->mpoly,
|
||||
cddm->getVertArray(cddm),
|
||||
|
@@ -51,7 +51,7 @@
|
||||
#include "MOD_util.h"
|
||||
|
||||
|
||||
static void initData(ModifierData *md)
|
||||
static void initData(ModifierData *md)
|
||||
{
|
||||
ParticleSystemModifierData *psmd = (ParticleSystemModifierData *) md;
|
||||
psmd->psys = NULL;
|
||||
@@ -115,7 +115,7 @@ static void deformVerts(
|
||||
psys = psmd->psys;
|
||||
else
|
||||
return;
|
||||
|
||||
|
||||
if (!psys_check_enabled(ctx->object, psys, (ctx->flag & MOD_APPLY_RENDER) != 0))
|
||||
return;
|
||||
|
||||
|
@@ -99,7 +99,7 @@ static void *dualcon_alloc_output(int totvert, int totquad)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
output->mesh = BKE_mesh_new_nomain(totvert, 0, 0, 4 * totquad, totquad);
|
||||
return output;
|
||||
}
|
||||
@@ -108,9 +108,9 @@ static void dualcon_add_vert(void *output_v, const float co[3])
|
||||
{
|
||||
DualConOutput *output = output_v;
|
||||
Mesh *mesh = output->mesh;
|
||||
|
||||
|
||||
assert(output->curvert < mesh->totvert);
|
||||
|
||||
|
||||
copy_v3_v3(mesh->mvert[output->curvert].co, co);
|
||||
output->curvert++;
|
||||
}
|
||||
@@ -122,17 +122,17 @@ static void dualcon_add_quad(void *output_v, const int vert_indices[4])
|
||||
MLoop *mloop;
|
||||
MPoly *cur_poly;
|
||||
int i;
|
||||
|
||||
|
||||
assert(output->curface < mesh->totpoly);
|
||||
|
||||
mloop = mesh->mloop;
|
||||
cur_poly = &mesh->mpoly[output->curface];
|
||||
|
||||
|
||||
cur_poly->loopstart = output->curface * 4;
|
||||
cur_poly->totloop = 4;
|
||||
for (i = 0; i < 4; i++)
|
||||
mloop[output->curface * 4 + i].v = vert_indices[i];
|
||||
|
||||
|
||||
output->curface++;
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@ static Mesh *applyModifier(
|
||||
mode = DUALCON_SHARP_FEATURES;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
output = dualcon(&input,
|
||||
dualcon_alloc_output,
|
||||
dualcon_add_vert,
|
||||
@@ -183,7 +183,7 @@ static Mesh *applyModifier(
|
||||
if (rmd->flag & MOD_REMESH_SMOOTH_SHADING) {
|
||||
MPoly *mpoly = result->mpoly;
|
||||
int i, totpoly = result->totpoly;
|
||||
|
||||
|
||||
/* Apply smooth shading to output faces */
|
||||
for (i = 0; i < totpoly; i++) {
|
||||
mpoly[i].flag |= ME_SMOOTH;
|
||||
|
@@ -90,7 +90,7 @@ static void screwvert_iter_init(ScrewVertIter *iter, ScrewVertConnect *array, un
|
||||
iter->v_poin = NULL;
|
||||
iter->e = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void screwvert_iter_step(ScrewVertIter *iter)
|
||||
@@ -185,7 +185,7 @@ static Mesh *applyModifier(
|
||||
Mesh *result;
|
||||
ScrewModifierData *ltmd = (ScrewModifierData *) md;
|
||||
const bool use_render_params = (ctx->flag & MOD_APPLY_RENDER) != 0;
|
||||
|
||||
|
||||
int *origindex;
|
||||
int mpoly_index = 0;
|
||||
unsigned int step;
|
||||
@@ -228,18 +228,18 @@ static Mesh *applyModifier(
|
||||
float angle = ltmd->angle;
|
||||
float screw_ofs = ltmd->screw_ofs;
|
||||
float axis_vec[3] = {0.0f, 0.0f, 0.0f};
|
||||
float tmp_vec1[3], tmp_vec2[3];
|
||||
float tmp_vec1[3], tmp_vec2[3];
|
||||
float mat3[3][3];
|
||||
float mtx_tx[4][4]; /* transform the coords by an object relative to this objects transformation */
|
||||
float mtx_tx_inv[4][4]; /* inverted */
|
||||
float mtx_tmp_a[4][4];
|
||||
|
||||
|
||||
unsigned int vc_tot_linked = 0;
|
||||
short other_axis_1, other_axis_2;
|
||||
const float *tmpf1, *tmpf2;
|
||||
|
||||
unsigned int edge_offset;
|
||||
|
||||
|
||||
MPoly *mpoly_orig, *mpoly_new, *mp_new;
|
||||
MLoop *mloop_orig, *mloop_new, *ml_new;
|
||||
MEdge *medge_orig, *med_orig, *med_new, *med_new_firstloop, *medge_new;
|
||||
@@ -354,7 +354,7 @@ static Mesh *applyModifier(
|
||||
close = 1;
|
||||
step_tot--;
|
||||
if (step_tot < 3) step_tot = 3;
|
||||
|
||||
|
||||
maxVerts = totvert * step_tot; /* -1 because we're joining back up */
|
||||
maxEdges = (totvert * step_tot) + /* these are the edges between new verts */
|
||||
(totedge * step_tot); /* -1 because vert edges join */
|
||||
@@ -375,9 +375,9 @@ static Mesh *applyModifier(
|
||||
if ((ltmd->flag & MOD_SCREW_UV_STRETCH_U) == 0) {
|
||||
uv_u_scale = (uv_u_scale / (float)ltmd->iter) * (angle / ((float)M_PI * 2.0f));
|
||||
}
|
||||
|
||||
|
||||
result = BKE_mesh_new_nomain_from_template(mesh, (int)maxVerts, (int)maxEdges, 0, (int)maxPolys * 4, (int)maxPolys);
|
||||
|
||||
|
||||
/* copy verts from mesh */
|
||||
mvert_orig = mesh->mvert;
|
||||
medge_orig = mesh->medge;
|
||||
@@ -421,10 +421,10 @@ static Mesh *applyModifier(
|
||||
}
|
||||
|
||||
/* Set the locations of the first set of verts */
|
||||
|
||||
|
||||
mv_new = mvert_new;
|
||||
mv_orig = mvert_orig;
|
||||
|
||||
|
||||
/* Copy the first set of edges */
|
||||
med_orig = medge_orig;
|
||||
med_new = medge_new;
|
||||
@@ -434,7 +434,7 @@ static Mesh *applyModifier(
|
||||
med_new->crease = med_orig->crease;
|
||||
med_new->flag = med_orig->flag & ~ME_LOOSEEDGE;
|
||||
}
|
||||
|
||||
|
||||
/* build polygon -> edge map */
|
||||
if (totpoly) {
|
||||
MPoly *mp_orig;
|
||||
@@ -829,7 +829,7 @@ static Mesh *applyModifier(
|
||||
}
|
||||
}
|
||||
/* done with edge connectivity based normal flipping */
|
||||
|
||||
|
||||
/* Add Faces */
|
||||
for (step = 1; step < step_tot; step++) {
|
||||
const unsigned int varray_stride = totvert * step;
|
||||
@@ -855,7 +855,7 @@ static Mesh *applyModifier(
|
||||
|
||||
mv_new_base = mvert_new;
|
||||
mv_new = &mvert_new[varray_stride]; /* advance to the next slice */
|
||||
|
||||
|
||||
for (j = 0; j < totvert; j++, mv_new_base++, mv_new++) {
|
||||
/* set normal */
|
||||
if (vert_connect) {
|
||||
@@ -864,13 +864,13 @@ static Mesh *applyModifier(
|
||||
/* set the normal now its transformed */
|
||||
normal_float_to_short_v3(mv_new->no, nor_tx);
|
||||
}
|
||||
|
||||
|
||||
/* set location */
|
||||
copy_v3_v3(mv_new->co, mv_new_base->co);
|
||||
|
||||
|
||||
/* only need to set these if using non cleared memory */
|
||||
/*mv_new->mat_nr = mv_new->flag = 0;*/
|
||||
|
||||
|
||||
if (ltmd->ob_axis) {
|
||||
sub_v3_v3(mv_new->co, mtx_tx[3]);
|
||||
|
||||
@@ -881,7 +881,7 @@ static Mesh *applyModifier(
|
||||
else {
|
||||
mul_m4_v3(mat, mv_new->co);
|
||||
}
|
||||
|
||||
|
||||
/* add the new edge */
|
||||
med_new->v1 = varray_stride + j;
|
||||
med_new->v2 = med_new->v1 - totvert;
|
||||
@@ -907,11 +907,11 @@ static Mesh *applyModifier(
|
||||
med_new++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
mp_new = mpoly_new;
|
||||
ml_new = mloop_new;
|
||||
med_new_firstloop = medge_new;
|
||||
|
||||
|
||||
/* more of an offset in this case */
|
||||
edge_offset = totedge + (totvert * (step_tot - (close ? 0 : 1)));
|
||||
|
||||
@@ -1049,7 +1049,7 @@ static Mesh *applyModifier(
|
||||
ml_new += 4;
|
||||
mpoly_index++;
|
||||
}
|
||||
|
||||
|
||||
/* new vertical edge */
|
||||
med_new->v1 = i1;
|
||||
med_new->v2 = i2;
|
||||
|
@@ -153,7 +153,7 @@ static bool dependsOnNormals(ModifierData *md)
|
||||
|
||||
if (smd->target && smd->shrinkType == MOD_SHRINKWRAP_PROJECT)
|
||||
return (smd->projAxis == MOD_SHRINKWRAP_PROJECT_OVER_NORMAL);
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@@ -268,7 +268,7 @@ static bool build_hull(SkinOutput *so, Frame **frames, int totframe)
|
||||
BMO_ITER (v, &oiter, op.slots_out, "geom_interior.out", BM_VERT) {
|
||||
for (i = 0; i < totframe; i++) {
|
||||
Frame *frame = frames[i];
|
||||
|
||||
|
||||
if (!frame->detached) {
|
||||
for (j = 0; j < 4; j++) {
|
||||
if (frame->verts[j] == v) {
|
||||
@@ -294,7 +294,7 @@ static bool build_hull(SkinOutput *so, Frame **frames, int totframe)
|
||||
frame->detached = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Remove triangles that would fill the original frames -- skip if
|
||||
* frame is partially detached */
|
||||
BM_mesh_elem_hflag_disable_all(bm, BM_ALL_NOLOOP, BM_ELEM_TAG, false);
|
||||
@@ -449,7 +449,7 @@ static void node_frames_init(SkinNode *nf, int totframe)
|
||||
|
||||
nf->totframe = totframe;
|
||||
memset(nf->frames, 0, sizeof(nf->frames));
|
||||
|
||||
|
||||
nf->flag = 0;
|
||||
for (i = 0; i < 2; i++)
|
||||
nf->seam_edges[i] = -1;
|
||||
@@ -465,7 +465,7 @@ static void create_frame(
|
||||
|
||||
mul_v3_v3fl(ry, mat[1], radius[0]);
|
||||
mul_v3_v3fl(rz, mat[2], radius[1]);
|
||||
|
||||
|
||||
add_v3_v3v3(frame->co[3], co, ry);
|
||||
add_v3_v3v3(frame->co[3], frame->co[3], rz);
|
||||
|
||||
@@ -680,7 +680,7 @@ static void build_emats_stack(
|
||||
|
||||
/* Mark edge as visited */
|
||||
BLI_BITMAP_ENABLE(visited_e, e);
|
||||
|
||||
|
||||
/* Process edge */
|
||||
|
||||
parent_is_branch = ((emap[parent_v].count > 2) ||
|
||||
@@ -938,14 +938,14 @@ static Mesh *subdivide_base(Mesh *orig)
|
||||
/* Interpolate vertex group weights */
|
||||
for (k = 0; k < totvgroup; k++) {
|
||||
float weight;
|
||||
|
||||
|
||||
vg = &vgroups[k];
|
||||
weight = interpf(vg->w2, vg->w1, t);
|
||||
|
||||
if (weight > 0)
|
||||
defvert_add_index_notest(&outdvert[v], vg->def_nr, weight);
|
||||
}
|
||||
|
||||
|
||||
outedge->v1 = u;
|
||||
outedge->v2 = v;
|
||||
u = v;
|
||||
@@ -953,7 +953,7 @@ static Mesh *subdivide_base(Mesh *orig)
|
||||
|
||||
if (vgroups)
|
||||
MEM_freeN(vgroups);
|
||||
|
||||
|
||||
/* Link up to final vertex */
|
||||
outedge->v1 = u;
|
||||
outedge->v2 = e->v2;
|
||||
@@ -977,7 +977,7 @@ static void add_poly(
|
||||
{
|
||||
BMVert *verts[4] = {v1, v2, v3, v4};
|
||||
BMFace *f;
|
||||
|
||||
|
||||
BLI_assert(v1 != v2 && v1 != v3 && v1 != v4);
|
||||
BLI_assert(v2 != v3 && v2 != v4);
|
||||
BLI_assert(v3 != v4);
|
||||
@@ -1064,7 +1064,7 @@ static void output_frames(
|
||||
dv = CustomData_bmesh_get(&bm->vdata,
|
||||
v->head.data,
|
||||
CD_MDEFORMVERT);
|
||||
|
||||
|
||||
BLI_assert(dv->totweight == 0);
|
||||
defvert_copy(dv, input_dvert);
|
||||
}
|
||||
@@ -1094,14 +1094,14 @@ static int isect_ray_poly(const float ray_start[3],
|
||||
BMIter iter;
|
||||
float best_dist = FLT_MAX;
|
||||
bool hit = false;
|
||||
|
||||
|
||||
BM_ITER_ELEM (v, &iter, f, BM_VERTS_OF_FACE) {
|
||||
if (!v_first)
|
||||
v_first = v;
|
||||
else if (v_prev != v_first) {
|
||||
float dist;
|
||||
bool curhit;
|
||||
|
||||
|
||||
curhit = isect_ray_tri_v3(ray_start, ray_dir,
|
||||
v_first->co, v_prev->co, v->co,
|
||||
&dist, NULL);
|
||||
@@ -1162,7 +1162,7 @@ static BMFace *collapse_face_corners(BMesh *bm, BMFace *f, int n,
|
||||
f = NULL;
|
||||
BM_ITER_ELEM (vf, &iter, v_safe, BM_FACES_OF_VERT) {
|
||||
bool wrong_face = false;
|
||||
|
||||
|
||||
for (i = 0; i < orig_len; i++) {
|
||||
if (orig_verts[i] == v_merge) {
|
||||
orig_verts[i] = NULL;
|
||||
@@ -1260,7 +1260,7 @@ static void skin_choose_quad_bridge_order(BMVert *a[4], BMVert *b[4],
|
||||
shortest_len = FLT_MAX;
|
||||
for (i = 0; i < 8; i++) {
|
||||
float len = 0;
|
||||
|
||||
|
||||
/* Get total edge length for this configuration */
|
||||
for (j = 0; j < 4; j++)
|
||||
len += len_squared_v3v3(a[j]->co, b[orders[i][j]]->co);
|
||||
@@ -1308,7 +1308,7 @@ static void skin_fix_hole_no_good_verts(BMesh *bm, Frame *frame, BMFace *split_f
|
||||
/* Need at least four ring edges, so subdivide longest edge if
|
||||
* face is a triangle */
|
||||
longest_edge = BM_face_find_longest_loop(split_face)->e;
|
||||
|
||||
|
||||
BM_mesh_elem_hflag_disable_all(bm, BM_EDGE, BM_ELEM_TAG, false);
|
||||
BM_elem_flag_enable(longest_edge, BM_ELEM_TAG);
|
||||
|
||||
@@ -1514,7 +1514,7 @@ static void skin_merge_close_frame_verts(SkinNode *skin_nodes, int totvert,
|
||||
{
|
||||
Frame **hull_frames;
|
||||
int v, tothullframe;
|
||||
|
||||
|
||||
for (v = 0; v < totvert; v++) {
|
||||
/* Only check branch nodes */
|
||||
if (!skin_nodes[v].totframe) {
|
||||
@@ -1530,11 +1530,11 @@ static void skin_merge_close_frame_verts(SkinNode *skin_nodes, int totvert,
|
||||
static void skin_update_merged_vertices(SkinNode *skin_nodes, int totvert)
|
||||
{
|
||||
int v;
|
||||
|
||||
|
||||
for (v = 0; v < totvert; ++v) {
|
||||
SkinNode *sn = &skin_nodes[v];
|
||||
int i, j;
|
||||
|
||||
|
||||
for (i = 0; i < sn->totframe; i++) {
|
||||
Frame *f = &sn->frames[i];
|
||||
|
||||
@@ -1554,19 +1554,19 @@ static void skin_fix_hull_topology(BMesh *bm, SkinNode *skin_nodes,
|
||||
int totvert)
|
||||
{
|
||||
int v;
|
||||
|
||||
|
||||
for (v = 0; v < totvert; v++) {
|
||||
SkinNode *sn = &skin_nodes[v];
|
||||
int j;
|
||||
|
||||
|
||||
for (j = 0; j < sn->totframe; j++) {
|
||||
Frame *f = &sn->frames[j];
|
||||
|
||||
if (f->detached) {
|
||||
BMFace *target_face;
|
||||
|
||||
|
||||
skin_hole_detach_partially_attached_frame(bm, f);
|
||||
|
||||
|
||||
target_face = skin_hole_target_face(bm, f);
|
||||
if (target_face)
|
||||
skin_fix_hole_no_good_verts(bm, f, target_face);
|
||||
@@ -1579,14 +1579,14 @@ static void skin_output_end_nodes(SkinOutput *so, SkinNode *skin_nodes,
|
||||
int totvert)
|
||||
{
|
||||
int v;
|
||||
|
||||
|
||||
for (v = 0; v < totvert; ++v) {
|
||||
SkinNode *sn = &skin_nodes[v];
|
||||
/* Assuming here just two frames */
|
||||
if (sn->flag & SEAM_FRAME) {
|
||||
BMVert *v_order[4];
|
||||
int i, order[4];
|
||||
|
||||
|
||||
skin_choose_quad_bridge_order(sn->frames[0].verts,
|
||||
sn->frames[1].verts,
|
||||
order);
|
||||
@@ -1631,7 +1631,7 @@ static void skin_output_connections(SkinOutput *so, SkinNode *skin_nodes,
|
||||
int totedge)
|
||||
{
|
||||
int e;
|
||||
|
||||
|
||||
for (e = 0; e < totedge; e++) {
|
||||
SkinNode *a, *b;
|
||||
a = &skin_nodes[medge[e].v1];
|
||||
@@ -1647,7 +1647,7 @@ static void skin_output_connections(SkinOutput *so, SkinNode *skin_nodes,
|
||||
fr[0]++;
|
||||
if ((b->flag & SEAM_FRAME) && (e != b->seam_edges[0]))
|
||||
fr[1]++;
|
||||
|
||||
|
||||
skin_choose_quad_bridge_order(fr[0]->verts, fr[1]->verts, order);
|
||||
for (i = 0; i < 4; i++)
|
||||
v_order[i] = fr[1]->verts[order[i]];
|
||||
@@ -1730,15 +1730,15 @@ static bool skin_output_branch_hulls(SkinOutput *so, SkinNode *skin_nodes,
|
||||
{
|
||||
bool result = true;
|
||||
int v;
|
||||
|
||||
|
||||
for (v = 0; v < totvert; v++) {
|
||||
SkinNode *sn = &skin_nodes[v];
|
||||
|
||||
|
||||
/* Branch node hulls */
|
||||
if (!sn->totframe) {
|
||||
Frame **hull_frames;
|
||||
int tothullframe;
|
||||
|
||||
|
||||
hull_frames = collect_hull_frames(v, skin_nodes,
|
||||
emap, medge,
|
||||
&tothullframe);
|
||||
@@ -1766,7 +1766,7 @@ static BMesh *build_skin(SkinNode *skin_nodes,
|
||||
&bm_mesh_allocsize_default,
|
||||
&((struct BMeshCreateParams){.use_toolflags = true,}));
|
||||
so.mat_nr = 0;
|
||||
|
||||
|
||||
/* BMESH_TODO: bumping up the stack level (see MOD_array.c) */
|
||||
BM_mesh_elem_toolflags_ensure(so.bm);
|
||||
BMO_push(so.bm, NULL);
|
||||
@@ -1911,7 +1911,7 @@ static Mesh *final_skin(SkinModifierData *smd, Mesh *mesh)
|
||||
static void initData(ModifierData *md)
|
||||
{
|
||||
SkinModifierData *smd = (SkinModifierData *) md;
|
||||
|
||||
|
||||
/* Enable in editmode by default */
|
||||
md->mode |= eModifierMode_Editmode;
|
||||
|
||||
|
@@ -58,10 +58,10 @@
|
||||
|
||||
#include "MOD_modifiertypes.h"
|
||||
|
||||
static void initData(ModifierData *md)
|
||||
static void initData(ModifierData *md)
|
||||
{
|
||||
SmokeModifierData *smd = (SmokeModifierData *) md;
|
||||
|
||||
|
||||
smd->domain = NULL;
|
||||
smd->flow = NULL;
|
||||
smd->coll = NULL;
|
||||
@@ -73,14 +73,14 @@ static void copyData(const ModifierData *md, ModifierData *target)
|
||||
{
|
||||
const SmokeModifierData *smd = (const SmokeModifierData *)md;
|
||||
SmokeModifierData *tsmd = (SmokeModifierData *)target;
|
||||
|
||||
|
||||
smokeModifier_copy(smd, tsmd);
|
||||
}
|
||||
|
||||
static void freeData(ModifierData *md)
|
||||
{
|
||||
SmokeModifierData *smd = (SmokeModifierData *) md;
|
||||
|
||||
|
||||
smokeModifier_free(smd);
|
||||
}
|
||||
|
||||
|
@@ -167,7 +167,7 @@ static void smoothModifier_do(
|
||||
|
||||
/* fp is the sum of uctmp[i] verts, so must be averaged */
|
||||
facw = 0.0f;
|
||||
if (uctmp[i])
|
||||
if (uctmp[i])
|
||||
facw = f / (float)uctmp[i];
|
||||
|
||||
if (flag & MOD_SMOOTH_X)
|
||||
@@ -188,7 +188,7 @@ static void smoothModifier_do(
|
||||
|
||||
/* fp is the sum of uctmp[i] verts, so must be averaged */
|
||||
facw = 0.0f;
|
||||
if (uctmp[i])
|
||||
if (uctmp[i])
|
||||
facw = fac / (float)uctmp[i];
|
||||
|
||||
if (flag & MOD_SMOOTH_X)
|
||||
|
@@ -54,10 +54,10 @@
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
|
||||
static void initData(ModifierData *md)
|
||||
static void initData(ModifierData *md)
|
||||
{
|
||||
SurfaceModifierData *surmd = (SurfaceModifierData *) md;
|
||||
|
||||
|
||||
surmd->bvhtree = NULL;
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ static void freeData(ModifierData *md)
|
||||
}
|
||||
|
||||
MEM_SAFE_FREE(surmd->x);
|
||||
|
||||
|
||||
MEM_SAFE_FREE(surmd->v);
|
||||
}
|
||||
}
|
||||
@@ -95,7 +95,7 @@ static void deformVerts(
|
||||
{
|
||||
SurfaceModifierData *surmd = (SurfaceModifierData *) md;
|
||||
const int cfra = (int)DEG_get_ctime(ctx->depsgraph);
|
||||
|
||||
|
||||
if (surmd->mesh) {
|
||||
BKE_id_free(NULL, surmd->mesh);
|
||||
}
|
||||
@@ -112,7 +112,7 @@ static void deformVerts(
|
||||
false);
|
||||
}
|
||||
else surmd->mesh = get_mesh(ctx->object, NULL, NULL, NULL, false, false);
|
||||
|
||||
|
||||
if (!ctx->object->pd) {
|
||||
printf("SurfaceModifier deformVerts: Should not happen!\n");
|
||||
return;
|
||||
@@ -126,7 +126,7 @@ static void deformVerts(
|
||||
|
||||
BKE_mesh_apply_vert_coords(surmd->mesh, vertexCos);
|
||||
BKE_mesh_calc_normals(surmd->mesh);
|
||||
|
||||
|
||||
numverts = surmd->mesh->totvert;
|
||||
|
||||
if (numverts != surmd->numverts ||
|
||||
@@ -160,7 +160,7 @@ static void deformVerts(
|
||||
v->co[0] = v->co[1] = v->co[2] = 0.0f;
|
||||
else
|
||||
sub_v3_v3v3(v->co, vec, x->co);
|
||||
|
||||
|
||||
copy_v3_v3(x->co, vec);
|
||||
}
|
||||
|
||||
|
@@ -276,7 +276,7 @@ DerivedMesh *get_dm(
|
||||
CDDM_apply_vert_coords(dm, vertexCos);
|
||||
dm->dirty |= DM_DIRTY_NORMALS;
|
||||
}
|
||||
|
||||
|
||||
if (use_orco) {
|
||||
DM_add_vert_layer(dm, CD_ORCO, CD_ASSIGN, BKE_mesh_orco_verts_get(ob));
|
||||
}
|
||||
|
@@ -216,7 +216,7 @@ static Mesh *uvprojectModifier_do(
|
||||
/* convert coords to world space */
|
||||
for (i = 0, co = coords; i < numVerts; ++i, ++co)
|
||||
mul_m4_v3(ob->obmat, *co);
|
||||
|
||||
|
||||
/* if only one projector, project coords to UVs */
|
||||
if (num_projectors == 1 && projectors[0].uci == NULL)
|
||||
for (i = 0, co = coords; i < numVerts; ++i, ++co)
|
||||
|
@@ -230,7 +230,7 @@ static void get_vert2ob_distance(
|
||||
*/
|
||||
static float get_ob2ob_distance(const Object *ob, const Object *obr)
|
||||
{
|
||||
return len_v3v3(ob->obmat[3], obr->obmat[3]);
|
||||
return len_v3v3(ob->obmat[3], obr->obmat[3]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user