diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-11-13 00:16:53 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-11-13 00:16:53 +0300 |
commit | bdfe7d89e2f1292644577972c716931b4ce3c6c3 (patch) | |
tree | d00eb50b749cb001e2b08272c91791e66740b05d /source/blender/blenkernel/intern/group.c | |
parent | 78a1c27c4a6abe0ed31ca93ad21910f3df04da56 (diff) | |
parent | 7e4db234cee71ead34ee81a12e27da4bd548eb4b (diff) |
Merge of trunk into blender 2.5:
svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r12987:17416
Issues:
* GHOST/X11 had conflicting changes. Some code was added in 2.5, which was
later added in trunk also, but reverted partially, specifically revision
16683. I have left out this reversion in the 2.5 branch since I think it is
needed there.
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16683
* Scons had various conflicting changes, I decided to go with trunk version
for everything except priorities and some library renaming.
* In creator.c, there were various fixes and fixes for fixes related to the -w
-W and -p options. In 2.5 -w and -W is not coded yet, and -p is done
differently. Since this is changed so much, and I don't think those fixes
would be needed in 2.5, I've left them out.
* Also in creator.c: there was code for a python bugfix where the screen was not
initialized when running with -P. The code that initializes the screen there
I had to disable, that can't work in 2.5 anymore but left it commented as a
reminder.
Further I had to disable some new function calls. using src/ and python/, as
was done already in this branch, disabled function calls:
* bpath.c: error reporting
* BME_conversions.c: editmesh conversion functions.
* SHD_dynamic: disabled almost completely, there is no python/.
* KX_PythonInit.cpp and Ketsji/ build files: Mathutils is not there, disabled.
* text.c: clipboard copy call.
* object.c: OB_SUPPORT_MATERIAL.
* DerivedMesh.c and subsurf_ccg, stipple_quarttone.
Still to be done:
* Go over files and functions that were moved to a different location but could
still use changes that were done in trunk.
Diffstat (limited to 'source/blender/blenkernel/intern/group.c')
-rw-r--r-- | source/blender/blenkernel/intern/group.c | 75 |
1 files changed, 61 insertions, 14 deletions
diff --git a/source/blender/blenkernel/intern/group.c b/source/blender/blenkernel/intern/group.c index 201d93220f9..0d2f86bb151 100644 --- a/source/blender/blenkernel/intern/group.c +++ b/source/blender/blenkernel/intern/group.c @@ -41,6 +41,7 @@ #include "DNA_object_types.h" #include "DNA_nla_types.h" #include "DNA_scene_types.h" +#include "DNA_particle_types.h" #include "BLI_blenlib.h" @@ -77,14 +78,37 @@ void unlink_group(Group *group) { Material *ma; Object *ob; + Scene *sce; + SceneRenderLayer *srl; + ParticleSystem *psys; for(ma= G.main->mat.first; ma; ma= ma->id.next) { if(ma->group==group) ma->group= NULL; } + for(ma= G.main->mat.first; ma; ma= ma->id.next) { + if(ma->group==group) + ma->group= NULL; + } + for (sce= G.main->scene.first; sce; sce= sce->id.next) { + Base *base= sce->base.first; + + /* ensure objects are not in this group */ + for(; base; base= base->next) { + if(rem_from_group(group, base->object) && find_group(base->object, NULL)==NULL) { + base->object->flag &= ~OB_FROMGROUP; + base->flag &= ~OB_FROMGROUP; + } + } + + for(srl= sce->r.layers.first; srl; srl= srl->next) { + if (srl->light_override==group) + srl->light_override= NULL; + } + } + for(ob= G.main->object.first; ob; ob= ob->id.next) { bActionStrip *strip; - PartEff *paf; if(ob->dup_group==group) { ob->dup_group= NULL; @@ -95,13 +119,17 @@ void unlink_group(Group *group) strip->object= NULL; } } - for(paf= ob->effect.first; paf; paf= paf->next) { - if(paf->type==EFF_PARTICLE) { - if(paf->group) - paf->group= NULL; - } + + for(psys=ob->particlesystem.first; psys; psys=psys->next){ + if(psys->part->dup_group==group) + psys->part->dup_group= NULL; + if(psys->part->eff_group==group) + psys->part->eff_group= NULL; } } + + /* group stays in library, but no members */ + free_group(group); group->id.us= 0; } @@ -134,11 +162,11 @@ void add_to_group(Group *group, Object *ob) } /* also used for ob==NULL */ -void rem_from_group(Group *group, Object *ob) +int rem_from_group(Group *group, Object *ob) { GroupObject *go, *gon; - - if(group==NULL) return; + int removed = 0; + if(group==NULL) return 0; go= group->gobject.first; while(go) { @@ -146,9 +174,12 @@ void rem_from_group(Group *group, Object *ob) if(go->ob==ob) { BLI_remlink(&group->gobject, go); free_group_object(go); + removed = 1; + /* should break here since an object being in a group twice cant happen? */ } go= gon; } + return removed; } int object_in_group(Object *ob, Group *group) @@ -164,9 +195,12 @@ int object_in_group(Object *ob, Group *group) return 0; } -Group *find_group(Object *ob) +Group *find_group(Object *ob, Group *group) { - Group *group= G.main->group.first; + if (group) + group= group->id.next; + else + group= G.main->group.first; while(group) { if(object_in_group(ob, group)) @@ -188,6 +222,20 @@ void group_tag_recalc(Group *group) } } +int group_is_animated(Object *parent, Group *group) +{ + GroupObject *go; + + if(give_timeoffset(parent) != 0.0f || parent->nlastrips.first) + return 1; + + for(go= group->gobject.first; go; go= go->next) + if(go->ob && go->ob->proxy) + return 1; + + return 0; +} + /* only replaces object strips or action when parent nla instructs it */ /* keep checking nla.c though, in case internal structure of strip changes */ static void group_replaces_nla(Object *parent, Object *target, char mode) @@ -228,7 +276,6 @@ static void group_replaces_nla(Object *parent, Object *target, char mode) } } - /* puts all group members in local timing system, after this call you can draw everything, leaves tags in objects to signal it needs further updating */ @@ -238,12 +285,12 @@ void group_handle_recalc_and_update(Object *parent, Group *group) GroupObject *go; /* if animated group... */ - if(parent->sf != 0.0f || parent->nlastrips.first) { + if(give_timeoffset(parent) != 0.0f || parent->nlastrips.first) { int cfrao; /* switch to local time */ cfrao= G.scene->r.cfra; - G.scene->r.cfra -= (int)parent->sf; + G.scene->r.cfra -= (int)give_timeoffset(parent); /* we need a DAG per group... */ for(go= group->gobject.first; go; go= go->next) { |