Fix to enable copying of the vertex group field for the Curve, Lattice,
Armature and Hook modifiers, and the flag field for the Mirror modifier. These modifiers should all be copied correctly now. This fix also means that converting modifiers to mesh with Alt-C now works correctly (the convertmenu function copies the modifers before applying them, so it wasn't always giving correct results for the above modifiers before). The convertmenu function has also been changed to use DM_to_mesh instead of converting to DispListMesh and using displistmesh_to_mesh, which means that extra mesh data such as dverts is preserved.
This commit is contained in:
@@ -179,6 +179,7 @@ static void curveModifier_copyData(ModifierData *md, ModifierData *target)
|
||||
CurveModifierData *tcmd = (CurveModifierData*) target;
|
||||
|
||||
tcmd->object = cmd->object;
|
||||
strncpy(tcmd->name, cmd->name, 32);
|
||||
}
|
||||
|
||||
static int curveModifier_isDisabled(ModifierData *md)
|
||||
@@ -243,6 +244,7 @@ static void latticeModifier_copyData(ModifierData *md, ModifierData *target)
|
||||
LatticeModifierData *tlmd = (LatticeModifierData*) target;
|
||||
|
||||
tlmd->object = lmd->object;
|
||||
strncpy(tlmd->name, lmd->name, 32);
|
||||
}
|
||||
|
||||
static int latticeModifier_isDisabled(ModifierData *md)
|
||||
@@ -1076,6 +1078,7 @@ static void mirrorModifier_copyData(ModifierData *md, ModifierData *target)
|
||||
MirrorModifierData *tmmd = (MirrorModifierData*) target;
|
||||
|
||||
tmmd->axis = mmd->axis;
|
||||
tmmd->flag = mmd->flag;
|
||||
tmmd->tolerance = mmd->tolerance;
|
||||
}
|
||||
|
||||
@@ -1258,10 +1261,10 @@ static void edgesplitModifier_initData(ModifierData *md)
|
||||
static void edgesplitModifier_copyData(ModifierData *md, ModifierData *target)
|
||||
{
|
||||
EdgeSplitModifierData *emd = (EdgeSplitModifierData*) md;
|
||||
EdgeSplitModifierData *tamd = (EdgeSplitModifierData*) target;
|
||||
EdgeSplitModifierData *temd = (EdgeSplitModifierData*) target;
|
||||
|
||||
tamd->split_angle = emd->split_angle;
|
||||
tamd->flags = emd->flags;
|
||||
temd->split_angle = emd->split_angle;
|
||||
temd->flags = emd->flags;
|
||||
}
|
||||
|
||||
typedef struct SmoothMesh {
|
||||
@@ -3055,6 +3058,7 @@ static void armatureModifier_copyData(ModifierData *md, ModifierData *target)
|
||||
|
||||
tamd->object = amd->object;
|
||||
tamd->deformflag = amd->deformflag;
|
||||
strncpy(tamd->defgrp_name, amd->defgrp_name, 32);
|
||||
}
|
||||
|
||||
static int armatureModifier_isDisabled(ModifierData *md)
|
||||
@@ -3134,6 +3138,7 @@ static void hookModifier_copyData(ModifierData *md, ModifierData *target)
|
||||
thmd->totindex = hmd->totindex;
|
||||
thmd->indexar = MEM_dupallocN(hmd->indexar);
|
||||
memcpy(thmd->parentinv, hmd->parentinv, sizeof(hmd->parentinv));
|
||||
strncpy(thmd->name, hmd->name, 32);
|
||||
}
|
||||
|
||||
static void hookModifier_freeData(ModifierData *md)
|
||||
|
||||
@@ -2359,7 +2359,6 @@ void convertmenu(void)
|
||||
|
||||
if(ob->flag & OB_DONE);
|
||||
else if(ob->type==OB_MESH && ob->modifiers.first) { /* converting a mesh with no modifiers causes a segfault */
|
||||
DispListMesh *dlm;
|
||||
DerivedMesh *dm;
|
||||
int needsfree=0;
|
||||
|
||||
@@ -2390,8 +2389,8 @@ void convertmenu(void)
|
||||
dm= mesh_get_derived_final(ob1, &needsfree);
|
||||
//dm= mesh_create_derived_no_deform(ob1, NULL); this was called original (instead of get_derived). man o man why! (ton)
|
||||
|
||||
dlm= dm->convertToDispListMesh(dm, 0);
|
||||
displistmesh_to_mesh(dlm, ob1->data);
|
||||
DM_to_mesh(dm, ob1->data);
|
||||
|
||||
if(needsfree) dm->release(dm);
|
||||
object_free_modifiers(ob1); /* after derivedmesh calls! */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user