Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-01-04 19:26:07 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-01-04 19:26:07 +0300
commitd92a6f140d0b9ba90de290feb8fdb8ef47125f08 (patch)
tree997560417dafe375b49ade577cb9ef5fa03b869a /source/blender
parent50de143ca30ad8211668d5e74cbda46fc695348e (diff)
copy modifiers, as "Link Modifiers" - in Ctrl+L menu. difference between copy and link is vague especially since particle systems are ID data.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/BKE_object.h2
-rw-r--r--source/blender/blenkernel/intern/object.c21
-rw-r--r--source/blender/editors/object/object_relations.c6
3 files changed, 29 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h
index 9e70251c782..d0c2052f0d6 100644
--- a/source/blender/blenkernel/BKE_object.h
+++ b/source/blender/blenkernel/BKE_object.h
@@ -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);
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 55cea3de188..0f9198df263 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -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)
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index b8839360296..d4bf721e14e 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -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;