copy modifiers, as "Link Modifiers" - in Ctrl+L menu. difference between copy and link is vague especially since particle systems are ID data.
This commit is contained in:
@@ -62,6 +62,8 @@ void update_base_layer(struct Scene *scene, struct Object *ob);
|
||||
|
||||
void free_object(struct Object *ob);
|
||||
void object_free_display(struct Object *ob);
|
||||
|
||||
void object_link_modifiers(struct Object *ob, struct Object *from);
|
||||
void object_free_modifiers(struct Object *ob);
|
||||
|
||||
void object_make_proxy(struct Object *ob, struct Object *target, struct Object *gob);
|
||||
|
||||
@@ -207,6 +207,27 @@ void object_free_modifiers(Object *ob)
|
||||
object_free_softbody(ob);
|
||||
}
|
||||
|
||||
void object_link_modifiers(struct Object *ob, struct Object *from)
|
||||
{
|
||||
ModifierData *md;
|
||||
object_free_modifiers(ob);
|
||||
|
||||
for (md=from->modifiers.first; md; md=md->next) {
|
||||
ModifierData *nmd = NULL;
|
||||
|
||||
if(ELEM4(md->type, eModifierType_Hook, eModifierType_Softbody, eModifierType_ParticleInstance, eModifierType_Collision)) continue;
|
||||
|
||||
nmd = modifier_new(md->type);
|
||||
modifier_copyData(md, nmd);
|
||||
BLI_addtail(&ob->modifiers, nmd);
|
||||
}
|
||||
|
||||
copy_object_particlesystems(from, ob);
|
||||
copy_object_softbody(from, ob);
|
||||
|
||||
// TODO: smoke?, cloth?
|
||||
}
|
||||
|
||||
/* here we will collect all local displist stuff */
|
||||
/* also (ab)used in depsgraph */
|
||||
void object_free_display(Object *ob)
|
||||
|
||||
@@ -1183,6 +1183,7 @@ enum {
|
||||
MAKE_LINKS_MATERIALS,
|
||||
MAKE_LINKS_ANIMDATA,
|
||||
MAKE_LINKS_DUPLIGROUP,
|
||||
MAKE_LINKS_MODIFIERS
|
||||
};
|
||||
|
||||
static int make_links_data_exec(bContext *C, wmOperator *op)
|
||||
@@ -1235,6 +1236,10 @@ static int make_links_data_exec(bContext *C, wmOperator *op)
|
||||
obt->transflag |= OB_DUPLIGROUP;
|
||||
}
|
||||
break;
|
||||
case MAKE_LINKS_MODIFIERS:
|
||||
object_link_modifiers(obt, ob);
|
||||
obt->recalc |= OB_RECALC;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1274,6 +1279,7 @@ void OBJECT_OT_make_links_data(wmOperatorType *ot)
|
||||
{MAKE_LINKS_MATERIALS, "MATERIAL", 0, "Materials", ""},
|
||||
{MAKE_LINKS_ANIMDATA, "ANIMATION", 0, "Animation Data", ""},
|
||||
{MAKE_LINKS_DUPLIGROUP, "DUPLIGROUP", 0, "DupliGroup", ""},
|
||||
{MAKE_LINKS_MODIFIERS, "MODIFIERS", 0, "Modifiers", ""},
|
||||
{0, NULL, 0, NULL, NULL}};
|
||||
|
||||
PropertyRNA *prop;
|
||||
|
||||
Reference in New Issue
Block a user