Fix [#37266] Skin modifier can't be copied.

Patch by Martin Felke, many thanks.

When copying that modifier across objects, we also have to ensure that a skin CDLayer is present in dest objects (just as when adding it).
This commit is contained in:
Bastien Montagne 2013-11-01 08:31:36 +00:00
parent 1512cda61d
commit b375388959
3 changed files with 8 additions and 3 deletions

View File

@ -357,6 +357,7 @@ bool modifiers_usesArmature(struct Object *ob, struct bArmature *arm);
bool modifiers_isCorrectableDeformed(struct Scene *scene, struct Object *ob);
void modifier_freeTemporaryData(struct ModifierData *md);
bool modifiers_isPreview(struct Object *ob);
void modifier_skin_customdata_ensure(struct Object *ob);
typedef struct CDMaskLink {
struct CDMaskLink *next;

View File

@ -32,7 +32,7 @@
#include <string.h>
#include <math.h>
#include <stdio.h>
#include <stdio.h>
#include "MEM_guardedalloc.h"
@ -256,6 +256,11 @@ void BKE_object_link_modifiers(struct Object *ob_dst, struct Object *ob_src)
if (!BKE_object_support_modifier_type_check(ob_dst, md->type))
continue;
if (md->type == eModifierType_Skin) {
/* ensure skin-node customdata exists */
modifier_skin_customdata_ensure(ob_dst);
}
nmd = modifier_new(md->type);
BLI_strncpy(nmd->name, md->name, sizeof(nmd->name));

View File

@ -87,7 +87,6 @@
#include "object_intern.h"
static void modifier_skin_customdata_ensure(struct Object *ob);
static void modifier_skin_customdata_delete(struct Object *ob);
/******************************** API ****************************/
@ -1434,7 +1433,7 @@ void OBJECT_OT_multires_base_apply(wmOperatorType *ot)
/************************** skin modifier ***********************/
static void modifier_skin_customdata_ensure(Object *ob)
void modifier_skin_customdata_ensure(Object *ob)
{
Mesh *me = ob->data;
BMesh *bm = me->edit_btmesh ? me->edit_btmesh->bm : NULL;