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:
authorTon Roosendaal <ton@blender.org>2005-12-14 18:58:52 +0300
committerTon Roosendaal <ton@blender.org>2005-12-14 18:58:52 +0300
commite65e6237a2a99df0c48670d704fee33145df7577 (patch)
tree807648a2b80ef156728e3b66a0db5276288c46ad /source/blender/blenkernel/intern/group.c
parenta6cc7204d98e5c870ba106aa2ad4bbed097db1b2 (diff)
Orange; Magical Group relink option. :)
This is the case: - Empty has Group duplicator - Empty has NLA strips to animate the group On linking the Empty to another group (with button in ObjectButtons), it checks for the current strips in NLA, and tries to find the proper objects in the new Group, based on name matches. If not found, it sets the strip-objects to zero.
Diffstat (limited to 'source/blender/blenkernel/intern/group.c')
-rw-r--r--source/blender/blenkernel/intern/group.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/group.c b/source/blender/blenkernel/intern/group.c
index 5e2d0d6fc6d..130e285761a 100644
--- a/source/blender/blenkernel/intern/group.c
+++ b/source/blender/blenkernel/intern/group.c
@@ -289,3 +289,32 @@ Object *group_get_member_with_action(Group *group, bAction *act)
}
return NULL;
}
+
+/* if group has NLA, we try to map the used objects in NLA to group members */
+/* this assuming that object has received a new group link */
+void group_relink_nla_objects(Object *ob)
+{
+ Group *group;
+ GroupObject *go;
+ bActionStrip *strip;
+
+ if(ob==NULL || ob->dup_group==NULL) return;
+ group= ob->dup_group;
+
+ for(strip= ob->nlastrips.first; strip; strip= strip->next) {
+ if(strip->object) {
+ for(go= group->gobject.first; go; go= go->next) {
+ if(go->ob) {
+ if(strcmp(go->ob->id.name, strip->object->id.name)==0)
+ break;
+ }
+ }
+ if(go)
+ strip->object= go->ob;
+ else
+ strip->object= NULL;
+ }
+
+ }
+}
+