forked from bartvdbraak/blender
rename defgroup functions to be more consistant.
* no functional changes *
This commit is contained in:
parent
50a7cdd116
commit
e307f6c6a0
@ -40,21 +40,24 @@ struct ListBase;
|
||||
struct bDeformGroup;
|
||||
struct MDeformVert;
|
||||
|
||||
void copy_defgroups (struct ListBase *lb1, struct ListBase *lb2);
|
||||
struct bDeformGroup *copy_defgroup (struct bDeformGroup *ingroup);
|
||||
struct bDeformGroup *get_named_vertexgroup (Object *ob, char *name);
|
||||
int get_defgroup_num (struct Object *ob, struct bDeformGroup *dg);
|
||||
int *get_defgroup_flip_map(struct Object *ob);
|
||||
int get_named_vertexgroup_num (Object *ob, const char *name);
|
||||
void unique_vertexgroup_name (struct bDeformGroup *dg, struct Object *ob);
|
||||
void flip_vertexgroup_name (char *name, const char *from_name, int strip_number);
|
||||
void defgroup_copy_list(struct ListBase *lb1, struct ListBase *lb2);
|
||||
struct bDeformGroup *defgroup_duplicate(struct bDeformGroup *ingroup);
|
||||
struct bDeformGroup *defgroup_find_name(Object *ob, char *name);
|
||||
int defgroup_find_index(struct Object *ob, struct bDeformGroup *dg);
|
||||
int *defgroup_flip_map(struct Object *ob);
|
||||
int defgroup_name_index(Object *ob, const char *name);
|
||||
void defgroup_unique_name(struct bDeformGroup *dg, struct Object *ob);
|
||||
|
||||
float deformvert_get_weight(const struct MDeformVert *dvert, int group_num);
|
||||
float vertexgroup_get_vertex_weight(const struct MDeformVert *dvert, int index, int group_num);
|
||||
float defvert_find_weight(const struct MDeformVert *dvert, int group_num);
|
||||
float defvert_find_weight_safe(const struct MDeformVert *dvert, int index, int group_num);
|
||||
|
||||
void copy_defvert (struct MDeformVert *dvert_r, const struct MDeformVert *dvert);
|
||||
void flip_defvert (struct MDeformVert *dvert, int *flip_map);
|
||||
void normalize_defvert (struct MDeformVert *dvert);
|
||||
void defvert_copy(struct MDeformVert *dvert_r, const struct MDeformVert *dvert);
|
||||
void defvert_flip(struct MDeformVert *dvert, int *flip_map);
|
||||
void defvert_normalize(struct MDeformVert *dvert);
|
||||
|
||||
/* utility function, note that 32 chars is the maximum string length since its only
|
||||
* used with defgroups currently */
|
||||
void flip_side_name(char *name, const char *from_name, int strip_number);
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -415,7 +415,7 @@ static void contarget_get_mesh_mat (Scene *scene, Object *ob, char *substring, f
|
||||
copy_m4_m4(mat, ob->obmat);
|
||||
|
||||
/* get index of vertex group */
|
||||
dgroup = get_named_vertexgroup_num(ob, substring);
|
||||
dgroup = defgroup_name_index(ob, substring);
|
||||
if (dgroup < 0) return;
|
||||
|
||||
/* get DerivedMesh */
|
||||
@ -524,7 +524,7 @@ static void contarget_get_lattice_mat (Object *ob, char *substring, float mat[][
|
||||
copy_m4_m4(mat, ob->obmat);
|
||||
|
||||
/* get index of vertex group */
|
||||
dgroup = get_named_vertexgroup_num(ob, substring);
|
||||
dgroup = defgroup_name_index(ob, substring);
|
||||
if (dgroup < 0) return;
|
||||
if (dvert == NULL) return;
|
||||
|
||||
|
@ -67,19 +67,19 @@
|
||||
#endif
|
||||
|
||||
|
||||
void copy_defgroups (ListBase *outbase, ListBase *inbase)
|
||||
void defgroup_copy_list (ListBase *outbase, ListBase *inbase)
|
||||
{
|
||||
bDeformGroup *defgroup, *defgroupn;
|
||||
|
||||
outbase->first= outbase->last= 0;
|
||||
|
||||
for (defgroup = inbase->first; defgroup; defgroup=defgroup->next){
|
||||
defgroupn= copy_defgroup(defgroup);
|
||||
defgroupn= defgroup_duplicate(defgroup);
|
||||
BLI_addtail(outbase, defgroupn);
|
||||
}
|
||||
}
|
||||
|
||||
bDeformGroup *copy_defgroup (bDeformGroup *ingroup)
|
||||
bDeformGroup *defgroup_duplicate (bDeformGroup *ingroup)
|
||||
{
|
||||
bDeformGroup *outgroup;
|
||||
|
||||
@ -96,7 +96,7 @@ bDeformGroup *copy_defgroup (bDeformGroup *ingroup)
|
||||
return outgroup;
|
||||
}
|
||||
|
||||
void copy_defvert (MDeformVert *dvert_r, const MDeformVert *dvert)
|
||||
void defvert_copy (MDeformVert *dvert_r, const MDeformVert *dvert)
|
||||
{
|
||||
if(dvert_r->totweight == dvert->totweight) {
|
||||
if(dvert->totweight)
|
||||
@ -115,7 +115,7 @@ void copy_defvert (MDeformVert *dvert_r, const MDeformVert *dvert)
|
||||
}
|
||||
}
|
||||
|
||||
void normalize_defvert (MDeformVert *dvert)
|
||||
void defvert_normalize (MDeformVert *dvert)
|
||||
{
|
||||
if(dvert->totweight<=0) {
|
||||
/* nothing */
|
||||
@ -137,7 +137,7 @@ void normalize_defvert (MDeformVert *dvert)
|
||||
}
|
||||
}
|
||||
|
||||
void flip_defvert (MDeformVert *dvert, int *flip_map)
|
||||
void defvert_flip (MDeformVert *dvert, int *flip_map)
|
||||
{
|
||||
MDeformWeight *dw;
|
||||
int i;
|
||||
@ -148,7 +148,7 @@ void flip_defvert (MDeformVert *dvert, int *flip_map)
|
||||
}
|
||||
|
||||
|
||||
bDeformGroup *get_named_vertexgroup (Object *ob, char *name)
|
||||
bDeformGroup *defgroup_find_name (Object *ob, char *name)
|
||||
{
|
||||
/* return a pointer to the deform group with this name
|
||||
* or return NULL otherwise.
|
||||
@ -163,11 +163,11 @@ bDeformGroup *get_named_vertexgroup (Object *ob, char *name)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int get_named_vertexgroup_num (Object *ob, const char *name)
|
||||
int defgroup_name_index (Object *ob, const char *name)
|
||||
{
|
||||
/* Return the location of the named deform group within the list of
|
||||
* deform groups. This function is a combination of get_defgroup_num and
|
||||
* get_named_vertexgroup. The other two could be called instead, but that
|
||||
* deform groups. This function is a combination of defgroup_find_index and
|
||||
* defgroup_find_name. The other two could be called instead, but that
|
||||
* require looping over the vertexgroups twice.
|
||||
*/
|
||||
bDeformGroup *curdef;
|
||||
@ -183,7 +183,7 @@ int get_named_vertexgroup_num (Object *ob, const char *name)
|
||||
return -1;
|
||||
}
|
||||
|
||||
int get_defgroup_num (Object *ob, bDeformGroup *dg)
|
||||
int defgroup_find_index (Object *ob, bDeformGroup *dg)
|
||||
{
|
||||
/* Fetch the location of this deform group
|
||||
* within the linked list of deform groups.
|
||||
@ -225,7 +225,7 @@ int get_defgroup_num (Object *ob, bDeformGroup *dg)
|
||||
}
|
||||
|
||||
/* note, must be freed */
|
||||
int *get_defgroup_flip_map(Object *ob)
|
||||
int *defgroup_flip_map(Object *ob)
|
||||
{
|
||||
bDeformGroup *dg;
|
||||
int totdg= BLI_countlist(&ob->defbase);
|
||||
@ -240,9 +240,9 @@ int *get_defgroup_flip_map(Object *ob)
|
||||
|
||||
for (dg=ob->defbase.first, i=0; dg; dg=dg->next, i++) {
|
||||
if(map[i] == -1) { /* may be calculated previously */
|
||||
flip_vertexgroup_name(name, dg->name, 0);
|
||||
flip_side_name(name, dg->name, 0);
|
||||
if(strcmp(name, dg->name)) {
|
||||
flip_num= get_named_vertexgroup_num(ob, name);
|
||||
flip_num= defgroup_name_index(ob, name);
|
||||
if(flip_num > -1) {
|
||||
map[i]= flip_num;
|
||||
map[flip_num]= i; /* save an extra lookup */
|
||||
@ -254,7 +254,7 @@ int *get_defgroup_flip_map(Object *ob)
|
||||
}
|
||||
}
|
||||
|
||||
void unique_vertexgroup_name (bDeformGroup *dg, Object *ob)
|
||||
void defgroup_unique_name (bDeformGroup *dg, Object *ob)
|
||||
{
|
||||
bDeformGroup *curdef;
|
||||
int number;
|
||||
@ -311,7 +311,7 @@ void unique_vertexgroup_name (bDeformGroup *dg, Object *ob)
|
||||
|
||||
/* finds the best possible flipped name. For renaming; check for unique names afterwards */
|
||||
/* if strip_number: removes number extensions */
|
||||
void flip_vertexgroup_name (char *name, const char *from_name, int strip_number)
|
||||
void flip_side_name (char *name, const char *from_name, int strip_number)
|
||||
{
|
||||
int len;
|
||||
char prefix[sizeof((bDeformGroup *)NULL)->name]={""}; /* The part before the facing */
|
||||
@ -425,7 +425,7 @@ void flip_vertexgroup_name (char *name, const char *from_name, int strip_number)
|
||||
|
||||
|
||||
|
||||
float deformvert_get_weight(const struct MDeformVert *dvert, int group_num)
|
||||
float defvert_find_weight(const struct MDeformVert *dvert, int group_num)
|
||||
{
|
||||
if(dvert)
|
||||
{
|
||||
@ -441,11 +441,11 @@ float deformvert_get_weight(const struct MDeformVert *dvert, int group_num)
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
float vertexgroup_get_vertex_weight(const struct MDeformVert *dvert, int index, int group_num)
|
||||
float defvert_find_weight_safe(const struct MDeformVert *dvert, int index, int group_num)
|
||||
{
|
||||
if(group_num == -1 || dvert == NULL)
|
||||
return 1.0;
|
||||
|
||||
return deformvert_get_weight(dvert+index, group_num);
|
||||
return defvert_find_weight(dvert+index, group_num);
|
||||
}
|
||||
|
||||
|
@ -867,7 +867,7 @@ static DerivedMesh *maskModifier_applyModifier(ModifierData *md, Object *ob,
|
||||
}
|
||||
else /* --- Using Nominated VertexGroup only --- */
|
||||
{
|
||||
int defgrp_index = get_named_vertexgroup_num(ob, mmd->vgroup);
|
||||
int defgrp_index = defgroup_name_index(ob, mmd->vgroup);
|
||||
|
||||
/* get dverts */
|
||||
if (defgrp_index >= 0)
|
||||
@ -1812,7 +1812,7 @@ static DerivedMesh *doMirrorOnAxis(MirrorModifierData *mmd,
|
||||
|
||||
|
||||
if (do_vgroup_mirr) {
|
||||
flip_map= get_defgroup_flip_map(ob);
|
||||
flip_map= defgroup_flip_map(ob);
|
||||
if(flip_map == NULL)
|
||||
do_vgroup_mirr= 0;
|
||||
}
|
||||
@ -1874,7 +1874,7 @@ static DerivedMesh *doMirrorOnAxis(MirrorModifierData *mmd,
|
||||
if (do_vgroup_mirr) {
|
||||
MDeformVert *dvert= DM_get_vert_data(result, numVerts, CD_MDEFORMVERT);
|
||||
if(dvert) {
|
||||
flip_defvert(dvert, flip_map);
|
||||
defvert_flip(dvert, flip_map);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3298,7 +3298,7 @@ static DerivedMesh *bevelModifier_applyModifier(
|
||||
options = bmd->flags|bmd->val_flags|bmd->lim_flags|bmd->e_flags;
|
||||
|
||||
/*if ((options & BME_BEVEL_VWEIGHT) && bmd->defgrp_name[0]) {
|
||||
defgrp_index = get_named_vertexgroup_num(ob, bmd->defgrp_name);
|
||||
defgrp_index = defgroup_name_index(ob, bmd->defgrp_name);
|
||||
if (defgrp_index < 0) {
|
||||
options &= ~BME_BEVEL_VWEIGHT;
|
||||
}
|
||||
@ -3553,7 +3553,7 @@ static void displaceModifier_do(
|
||||
|
||||
if(!dmd->texture) return;
|
||||
|
||||
defgrp_index = get_named_vertexgroup_num(ob, dmd->defgrp_name);
|
||||
defgrp_index = defgroup_name_index(ob, dmd->defgrp_name);
|
||||
|
||||
mvert = CDDM_get_verts(dm);
|
||||
if(defgrp_index >= 0)
|
||||
@ -4169,7 +4169,7 @@ static void smoothModifier_do(
|
||||
medges = dm->getEdgeArray(dm);
|
||||
numDMEdges = dm->getNumEdges(dm);
|
||||
|
||||
defgrp_index = get_named_vertexgroup_num(ob, smd->defgrp_name);
|
||||
defgrp_index = defgroup_name_index(ob, smd->defgrp_name);
|
||||
|
||||
if (defgrp_index >= 0)
|
||||
dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT);
|
||||
@ -4424,7 +4424,7 @@ static void castModifier_sphere_do(
|
||||
|
||||
/* 3) if we were given a vertex group name,
|
||||
* only those vertices should be affected */
|
||||
defgrp_index = get_named_vertexgroup_num(ob, cmd->defgrp_name);
|
||||
defgrp_index = defgroup_name_index(ob, cmd->defgrp_name);
|
||||
|
||||
if ((ob->type == OB_MESH) && dm && defgrp_index >= 0)
|
||||
dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT);
|
||||
@ -4582,7 +4582,7 @@ static void castModifier_cuboid_do(
|
||||
|
||||
/* 3) if we were given a vertex group name,
|
||||
* only those vertices should be affected */
|
||||
defgrp_index = get_named_vertexgroup_num(ob, cmd->defgrp_name);
|
||||
defgrp_index = defgroup_name_index(ob, cmd->defgrp_name);
|
||||
|
||||
if ((ob->type == OB_MESH) && dm && defgrp_index >= 0)
|
||||
dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT);
|
||||
@ -5080,7 +5080,7 @@ static void waveModifier_do(WaveModifierData *md,
|
||||
}
|
||||
|
||||
/* get the index of the deform group */
|
||||
defgrp_index = get_named_vertexgroup_num(ob, wmd->defgrp_name);
|
||||
defgrp_index = defgroup_name_index(ob, wmd->defgrp_name);
|
||||
|
||||
if(defgrp_index >= 0){
|
||||
dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT);
|
||||
@ -5511,7 +5511,7 @@ static void hookModifier_deformVerts(
|
||||
Mesh *me = ob->data;
|
||||
int use_dverts = 0;
|
||||
int maxVerts = 0;
|
||||
int defgrp_index = get_named_vertexgroup_num(ob, hmd->name);
|
||||
int defgrp_index = defgroup_name_index(ob, hmd->name);
|
||||
|
||||
if(dm) {
|
||||
if(dm->getVertData(dm, 0, CD_MDEFORMVERT)) {
|
||||
@ -7123,7 +7123,7 @@ static void explodeModifier_createFacepa(ExplodeModifierData *emd,
|
||||
for(i=0; i<totvert; i++){
|
||||
val = BLI_frand();
|
||||
val = (1.0f-emd->protect)*val + emd->protect*0.5f;
|
||||
if(val < deformvert_get_weight(dvert+i,emd->vgroup-1))
|
||||
if(val < defvert_find_weight(dvert+i,emd->vgroup-1))
|
||||
vertpa[i] = -1;
|
||||
}
|
||||
}
|
||||
@ -8164,7 +8164,7 @@ static void meshdeformModifier_do(
|
||||
VECCOPY(dco[a], co)
|
||||
}
|
||||
|
||||
defgrp_index = get_named_vertexgroup_num(ob, mmd->defgrp_name);
|
||||
defgrp_index = defgroup_name_index(ob, mmd->defgrp_name);
|
||||
|
||||
if (defgrp_index >= 0)
|
||||
dvert= dm->getVertDataArray(dm, CD_MDEFORMVERT);
|
||||
|
@ -1286,7 +1286,7 @@ Object *copy_object(Object *ob)
|
||||
if(ob->type==OB_ARMATURE)
|
||||
armature_rebuild_pose(obn, obn->data);
|
||||
}
|
||||
copy_defgroups(&obn->defbase, &ob->defbase);
|
||||
defgroup_copy_list(&obn->defbase, &ob->defbase);
|
||||
copy_constraints(&obn->constraints, &ob->constraints);
|
||||
|
||||
obn->mode = 0;
|
||||
|
@ -184,7 +184,7 @@ static void shrinkwrap_calc_nearest_vertex(ShrinkwrapCalcData *calc)
|
||||
{
|
||||
float *co = calc->vertexCos[i];
|
||||
float tmp_co[3];
|
||||
float weight = vertexgroup_get_vertex_weight(calc->dvert, i, calc->vgroup);
|
||||
float weight = defvert_find_weight_safe(calc->dvert, i, calc->vgroup);
|
||||
if(weight == 0.0f) continue;
|
||||
|
||||
|
||||
@ -356,7 +356,7 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc, struct S
|
||||
{
|
||||
float *co = calc->vertexCos[i];
|
||||
float tmp_co[3], tmp_no[3];
|
||||
float weight = vertexgroup_get_vertex_weight(calc->dvert, i, calc->vgroup);
|
||||
float weight = defvert_find_weight_safe(calc->dvert, i, calc->vgroup);
|
||||
|
||||
if(weight == 0.0f) continue;
|
||||
|
||||
@ -447,7 +447,7 @@ static void shrinkwrap_calc_nearest_surface_point(ShrinkwrapCalcData *calc)
|
||||
{
|
||||
float *co = calc->vertexCos[i];
|
||||
float tmp_co[3];
|
||||
float weight = vertexgroup_get_vertex_weight(calc->dvert, i, calc->vgroup);
|
||||
float weight = defvert_find_weight_safe(calc->dvert, i, calc->vgroup);
|
||||
if(weight == 0.0f) continue;
|
||||
|
||||
//Convert the vertex to tree coordinates
|
||||
@ -519,7 +519,7 @@ void shrinkwrapModifier_deform(ShrinkwrapModifierData *smd, Scene *scene, Object
|
||||
calc.vertexCos = vertexCos;
|
||||
|
||||
//DeformVertex
|
||||
calc.vgroup = get_named_vertexgroup_num(calc.ob, calc.smd->vgroup_name);
|
||||
calc.vgroup = defgroup_name_index(calc.ob, calc.smd->vgroup_name);
|
||||
if(dm)
|
||||
{
|
||||
calc.dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT);
|
||||
@ -545,7 +545,7 @@ void shrinkwrapModifier_deform(ShrinkwrapModifierData *smd, Scene *scene, Object
|
||||
|
||||
|
||||
|
||||
calc.vgroup = get_named_vertexgroup_num(calc.ob, smd->vgroup_name);
|
||||
calc.vgroup = defgroup_name_index(calc.ob, smd->vgroup_name);
|
||||
|
||||
if(dm != NULL && smd->shrinkType == MOD_SHRINKWRAP_PROJECT)
|
||||
{
|
||||
|
@ -149,7 +149,7 @@ void SimpleDeformModifier_do(SimpleDeformModifierData *smd, struct Object *ob, s
|
||||
float smd_limit[2], smd_factor;
|
||||
SpaceTransform *transf = NULL, tmp_transf;
|
||||
void (*simpleDeform_callback)(const float factor, const float dcut[3], float *co) = NULL; //Mode callback
|
||||
int vgroup = get_named_vertexgroup_num(ob, smd->vgroup_name);
|
||||
int vgroup = defgroup_name_index(ob, smd->vgroup_name);
|
||||
MDeformVert *dvert = NULL;
|
||||
|
||||
//Safe-check
|
||||
@ -227,7 +227,7 @@ void SimpleDeformModifier_do(SimpleDeformModifierData *smd, struct Object *ob, s
|
||||
|
||||
for(i=0; i<numVerts; i++)
|
||||
{
|
||||
float weight = vertexgroup_get_vertex_weight(dvert, i, vgroup);
|
||||
float weight = defvert_find_weight_safe(dvert, i, vgroup);
|
||||
|
||||
if(weight != 0.0f)
|
||||
{
|
||||
|
@ -3267,7 +3267,7 @@ static void mesh_to_softbody(Scene *scene, Object *ob)
|
||||
|
||||
if (sb->namedVG_Mass[0])
|
||||
{
|
||||
int grp= get_named_vertexgroup_num (ob,sb->namedVG_Mass);
|
||||
int grp= defgroup_name_index (ob,sb->namedVG_Mass);
|
||||
/* printf("VGN %s %d \n",sb->namedVG_Mass,grp); */
|
||||
if(grp > -1){
|
||||
get_scalar_from_vertexgroup(ob, a,(short) (grp), &bp->mass);
|
||||
@ -3281,7 +3281,7 @@ static void mesh_to_softbody(Scene *scene, Object *ob)
|
||||
|
||||
if (sb->namedVG_Spring_K[0])
|
||||
{
|
||||
int grp= get_named_vertexgroup_num (ob,sb->namedVG_Spring_K);
|
||||
int grp= defgroup_name_index (ob,sb->namedVG_Spring_K);
|
||||
//printf("VGN %s %d \n",sb->namedVG_Spring_K,grp);
|
||||
if(grp > -1){
|
||||
get_scalar_from_vertexgroup(ob, a,(short) (grp), &bp->springweight);
|
||||
|
@ -7813,10 +7813,10 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
|
||||
}
|
||||
}
|
||||
if(ob->soft && ob->soft->vertgroup==0) {
|
||||
bDeformGroup *locGroup = get_named_vertexgroup(ob, "SOFTGOAL");
|
||||
bDeformGroup *locGroup = defgroup_find_name(ob, "SOFTGOAL");
|
||||
if(locGroup){
|
||||
/* retrieve index for that group */
|
||||
ob->soft->vertgroup = 1 + get_defgroup_num(ob, locGroup);
|
||||
ob->soft->vertgroup = 1 + defgroup_find_index(ob, locGroup);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -8502,7 +8502,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
|
||||
for(curdef= ob->defbase.first; curdef; curdef=curdef->next) {
|
||||
/* replace an empty-string name with unique name */
|
||||
if (curdef->name[0] == '\0') {
|
||||
unique_vertexgroup_name(curdef, ob);
|
||||
defgroup_unique_name(curdef, ob);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -942,7 +942,7 @@ public:
|
||||
// at this stage we get vertex influence info that should go into me->verts and ob->defbase
|
||||
// there's no info to which object this should be long so we associate it with skin controller data UID
|
||||
|
||||
// don't forget to call unique_vertexgroup_name before we copy
|
||||
// don't forget to call defgroup_unique_name before we copy
|
||||
|
||||
// controller data uid -> [armature] -> joint data,
|
||||
// [mesh object]
|
||||
|
@ -4489,7 +4489,7 @@ static int ED_vgroup_add_unique_bone(Object *ob, Bone *bone, void *data)
|
||||
* If such a vertex group aleady exist the routine exits.
|
||||
*/
|
||||
if (!(bone->flag & BONE_NO_DEFORM)) {
|
||||
if (!get_named_vertexgroup(ob,bone->name)) {
|
||||
if (!defgroup_find_name(ob,bone->name)) {
|
||||
ED_vgroup_add_name(ob, bone->name);
|
||||
return 1;
|
||||
}
|
||||
@ -4533,7 +4533,7 @@ static int dgroup_skinnable(Object *ob, Bone *bone, void *datap)
|
||||
else
|
||||
segments = 1;
|
||||
|
||||
if (!(defgroup = get_named_vertexgroup(ob, bone->name)))
|
||||
if (!(defgroup = defgroup_find_name(ob, bone->name)))
|
||||
defgroup = ED_vgroup_add_name(ob, bone->name);
|
||||
|
||||
if (data->list != NULL) {
|
||||
|
@ -142,7 +142,7 @@ bDeformGroup *ED_vgroup_add_name(Object *ob, char *name)
|
||||
BLI_strncpy(defgroup->name, name, 32);
|
||||
|
||||
BLI_addtail(&ob->defbase, defgroup);
|
||||
unique_vertexgroup_name(defgroup, ob);
|
||||
defgroup_unique_name(defgroup, ob);
|
||||
|
||||
ob->actdef = BLI_countlist(&ob->defbase);
|
||||
|
||||
@ -362,7 +362,7 @@ void ED_vgroup_vert_add(Object *ob, bDeformGroup *dg, int vertnum, float weight,
|
||||
/* get the deform group number, exit if
|
||||
* it can't be found
|
||||
*/
|
||||
def_nr = get_defgroup_num(ob, dg);
|
||||
def_nr = defgroup_find_index(ob, dg);
|
||||
if(def_nr < 0) return;
|
||||
|
||||
/* if there's no deform verts then create some,
|
||||
@ -393,7 +393,7 @@ void ED_vgroup_vert_remove(Object *ob, bDeformGroup *dg, int vertnum)
|
||||
* to this deform group, and abort if it
|
||||
* can not be found.
|
||||
*/
|
||||
def_nr = get_defgroup_num(ob, dg);
|
||||
def_nr = defgroup_find_index(ob, dg);
|
||||
if(def_nr < 0) return;
|
||||
|
||||
/* call another routine to do the work
|
||||
@ -446,7 +446,7 @@ float ED_vgroup_vert_weight(Object *ob, bDeformGroup *dg, int vertnum)
|
||||
|
||||
if(!ob) return 0.0f;
|
||||
|
||||
def_nr = get_defgroup_num(ob, dg);
|
||||
def_nr = defgroup_find_index(ob, dg);
|
||||
if(def_nr < 0) return 0.0f;
|
||||
|
||||
return get_vert_def_nr(ob, def_nr, vertnum);
|
||||
@ -541,7 +541,7 @@ static void vgroup_duplicate(Object *ob)
|
||||
}
|
||||
else {
|
||||
BLI_snprintf(name, 32, "%s_copy", dg->name);
|
||||
while(get_named_vertexgroup(ob, name)) {
|
||||
while(defgroup_find_name(ob, name)) {
|
||||
if((strlen(name) + 6) > 32) {
|
||||
if (G.f & G_DEBUG)
|
||||
printf("Internal error: the name for the new vertex group is > 32 characters");
|
||||
@ -552,9 +552,9 @@ static void vgroup_duplicate(Object *ob)
|
||||
}
|
||||
}
|
||||
|
||||
cdg = copy_defgroup(dg);
|
||||
cdg = defgroup_duplicate(dg);
|
||||
strcpy(cdg->name, name);
|
||||
unique_vertexgroup_name(cdg, ob);
|
||||
defgroup_unique_name(cdg, ob);
|
||||
|
||||
BLI_addtail(&ob->defbase, cdg);
|
||||
|
||||
@ -923,7 +923,7 @@ void ED_vgroup_mirror(Object *ob, int mirror_weights, int flip_vgroups)
|
||||
if(!CustomData_has_layer(&em->vdata, CD_MDEFORMVERT))
|
||||
return;
|
||||
|
||||
flip_map= get_defgroup_flip_map(ob);
|
||||
flip_map= defgroup_flip_map(ob);
|
||||
|
||||
/* Go through the list of editverts and assign them */
|
||||
for(eve=em->verts.first; eve; eve=eve->next){
|
||||
@ -937,8 +937,8 @@ void ED_vgroup_mirror(Object *ob, int mirror_weights, int flip_vgroups)
|
||||
if(mirror_weights)
|
||||
SWAP(MDeformVert, *dvert, *dvert_mirr);
|
||||
if(flip_vgroups) {
|
||||
flip_defvert(dvert, flip_map);
|
||||
flip_defvert(dvert_mirr, flip_map);
|
||||
defvert_flip(dvert, flip_map);
|
||||
defvert_flip(dvert_mirr, flip_map);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -948,9 +948,9 @@ void ED_vgroup_mirror(Object *ob, int mirror_weights, int flip_vgroups)
|
||||
}
|
||||
|
||||
if(mirror_weights)
|
||||
copy_defvert(dvert, dvert_mirr);
|
||||
defvert_copy(dvert, dvert_mirr);
|
||||
if(flip_vgroups) {
|
||||
flip_defvert(dvert, flip_map);
|
||||
defvert_flip(dvert, flip_map);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1394,11 +1394,11 @@ static int wpaint_stroke_test_start(bContext *C, wmOperator *op, wmEvent *event)
|
||||
bPoseChannel *pchan= get_pose_channel(modob->pose, actbone->name);
|
||||
|
||||
if(pchan) {
|
||||
bDeformGroup *dg= get_named_vertexgroup(ob, pchan->name);
|
||||
bDeformGroup *dg= defgroup_find_name(ob, pchan->name);
|
||||
if(dg==NULL)
|
||||
dg= ED_vgroup_add_name(ob, pchan->name); /* sets actdef */
|
||||
else
|
||||
ob->actdef= 1 + get_defgroup_num(ob, dg);
|
||||
ob->actdef= 1 + defgroup_find_index(ob, dg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4773,7 +4773,7 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname)
|
||||
else {
|
||||
switch(tselem->type) {
|
||||
case TSE_DEFGROUP:
|
||||
unique_vertexgroup_name(te->directdata, (Object *)tselem->id); // id = object
|
||||
defgroup_unique_name(te->directdata, (Object *)tselem->id); // id = object
|
||||
break;
|
||||
case TSE_NLA_ACTION:
|
||||
test_idbutton(tselem->id->name+2);
|
||||
|
@ -523,7 +523,7 @@ static void vgroup_copy_active_to_sel(Object *ob)
|
||||
if(eve->f & SELECT && eve != eve_act) {
|
||||
dvert= CustomData_em_get(&em->vdata, eve->data, CD_MDEFORMVERT);
|
||||
if(dvert)
|
||||
copy_defvert(dvert, dvert_act);
|
||||
defvert_copy(dvert, dvert_act);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -584,7 +584,7 @@ static void vgroup_normalize_active(Object *ob)
|
||||
if(dvert_act==NULL)
|
||||
return;
|
||||
|
||||
normalize_defvert(dvert_act);
|
||||
defvert_normalize(dvert_act);
|
||||
}
|
||||
|
||||
static void do_view3d_vgroup_buttons(bContext *C, void *arg, int event)
|
||||
|
@ -343,7 +343,7 @@ static void rna_Mesh_assign_verts_to_group(Object *ob, bDeformGroup *group, int
|
||||
}
|
||||
|
||||
Mesh *me = (Mesh*)ob->data;
|
||||
int group_index = get_defgroup_num(ob, group);
|
||||
int group_index = defgroup_find_index(ob, group);
|
||||
if (group_index == -1) {
|
||||
BKE_report(reports, RPT_ERROR, "No deform groups assigned to mesh.");
|
||||
return;
|
||||
|
@ -590,7 +590,7 @@ static void psys_vg_name_set__internal(PointerRNA *ptr, const char *value, int i
|
||||
psys->vgroup[index]= 0;
|
||||
}
|
||||
else {
|
||||
int vgroup_num = get_named_vertexgroup_num(ob, (char*)value);
|
||||
int vgroup_num = defgroup_name_index(ob, (char*)value);
|
||||
|
||||
if(vgroup_num == -1)
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user