diff options
author | Ton Roosendaal <ton@blender.org> | 2005-12-06 18:39:25 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2005-12-06 18:39:25 +0300 |
commit | 6555ddbcd88b065dbe264594e50eefcfb71d5431 (patch) | |
tree | a5465998e1d71ef12cdb6cbd68ef70c5cc652c8f | |
parent | 898cbe370e0403da39347d91fc40f7a4a38aeaf2 (diff) |
Orange:
Series of fixes in Library linking of groups;
- On library-linking (SHIFT-F1) a Group, the Objects now don't get a "Base"
anymore, meaning they won't show up as Objects in the Scene.
This ensures you can use the linked Group as duplicator without having
your file polluted with new (and linked) objects.
(I realize it should be possible to have it with Base too, will check)
- On append or file-read, the linked Group Objects get drawn properly,
but the animation system doesn't run yet.
- Group buttons (F7) now shows if a Group is from Library
- Outliner draws Library linked data with blue-ish text
Other fixes;
- Using group-duplicator, with originals in hidden layer, now shows and
updates animated Objects correctly.
- All of Object button panels did not have a proper protection against
editing Library data.
-rw-r--r-- | source/blender/blenkernel/BKE_group.h | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/anim.c | 12 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/depsgraph.c | 21 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/group.c | 16 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/scene.c | 3 | ||||
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 10 | ||||
-rw-r--r-- | source/blender/src/buttons_object.c | 47 | ||||
-rw-r--r-- | source/blender/src/outliner.c | 12 |
8 files changed, 104 insertions, 18 deletions
diff --git a/source/blender/blenkernel/BKE_group.h b/source/blender/blenkernel/BKE_group.h index 4e69f18a238..2d42a9e284c 100644 --- a/source/blender/blenkernel/BKE_group.h +++ b/source/blender/blenkernel/BKE_group.h @@ -45,6 +45,7 @@ void add_to_group(struct Group *group, struct Object *ob); void rem_from_group(struct Group *group, struct Object *ob); struct Group *find_group(struct Object *ob); int object_in_group(struct Object *ob, struct Group *group); +void group_tag_recalc(struct Group *group); #endif diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index b448816589f..5b5f1fabdf2 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -303,9 +303,15 @@ static void group_duplilist(Object *ob) if(ob->dup_group==NULL) return; for(go= ob->dup_group->gobject.first; go; go= go->next) { - newob= new_dupli_object(&duplilist, go->ob, ob, 0); - Mat4CpyMat4(mat, newob->obmat); - Mat4MulMat4(newob->obmat, mat, ob->obmat); + if(go->ob!=ob) { + /* we need to check update for objects that are not in scene... */ + if(go->ob->recalc) + object_handle_update(go->ob); // bke_object.h + + newob= new_dupli_object(&duplilist, go->ob, ob, 0); + Mat4CpyMat4(mat, newob->obmat); + Mat4MulMat4(newob->obmat, mat, ob->obmat); + } } } diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 50ca6bc4fe6..e317554a186 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -46,6 +46,7 @@ #include "DNA_curve_types.h" #include "DNA_ID.h" #include "DNA_effect_types.h" +#include "DNA_group_types.h" #include "DNA_lattice_types.h" #include "DNA_key_types.h" #include "DNA_mesh_types.h" @@ -441,6 +442,18 @@ struct DagForest *build_dag(struct Scene *sce, short mask) addtoroot = 0; } + if (ob->transflag & OB_DUPLI) { + if((ob->transflag & OB_DUPLIGROUP) && ob->dup_group) { + GroupObject *go; + for(go= ob->dup_group->gobject.first; go; go= go->next) { + if(go->ob) { + node2 = dag_get_node(dag, go->ob); + dag_add_relation(dag, node2, node, DAG_RL_OB_OB); + } + } + } + } + if (ob->type==OB_MBALL) { Object *mom= find_basis_mball(ob); if(mom!=ob) { @@ -1314,10 +1327,12 @@ void DAG_scene_sort(struct Scene *sce) time++; base = sce->base.first; - while (base->object != node->ob) + while (base && base->object != node->ob) base = base->next; - BLI_remlink(&sce->base,base); - BLI_addhead(&tempbase,base); + if(base) { + BLI_remlink(&sce->base,base); + BLI_addhead(&tempbase,base); + } } } } diff --git a/source/blender/blenkernel/intern/group.c b/source/blender/blenkernel/intern/group.c index 7405f16d9c0..0ae6208c9de 100644 --- a/source/blender/blenkernel/intern/group.c +++ b/source/blender/blenkernel/intern/group.c @@ -95,11 +95,12 @@ void add_to_group(Group *group, Object *ob) } +/* also used for ob==NULL */ void rem_from_group(Group *group, Object *ob) { GroupObject *go, *gon; - if(group==NULL || ob==NULL) return; + if(group==NULL) return; go= group->gobject.first; while(go) { @@ -136,3 +137,16 @@ Group *find_group(Object *ob) } return NULL; } + +void group_tag_recalc(Group *group) +{ + GroupObject *go; + + if(group==NULL) return; + + for(go= group->gobject.first; go; go= go->next) { + if(go->ob) + go->ob->recalc= OB_RECALC; + } +} + diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 2cd387d7d93..fd0a6288dbe 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -65,6 +65,7 @@ #include "BKE_constraint.h" #include "BKE_depsgraph.h" #include "BKE_global.h" +#include "BKE_group.h" #include "BKE_ipo.h" #include "BKE_key.h" #include "BKE_library.h" @@ -275,7 +276,9 @@ void set_scene_bg(Scene *sce) base->flag |= flag; ob->flag= base->flag; + ob->recalc= OB_RECALC; + if(ob->dup_group) group_tag_recalc(ob->dup_group); /* for lib-linked stuff */ ob->ctime= -1234567.0; /* force ipo to be calculated later */ base= base->next; diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 75e04ec0c53..b095d13987a 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -3162,9 +3162,13 @@ static void lib_link_group(FileData *fd, Main *main) go= group->gobject.first; while(go) { go->ob= newlibadr(fd, group->id.lib, go->ob); - /* groups have inverse users... */ - if(go->ob && group->id.us==0) - group->id.us= 1; + if(go->ob) { + /* groups have inverse users... */ + if(group->id.us==0) + group->id.us= 1; + if(go->ob->id.us==0) + go->ob->id.us= 1; + } go= go->next; } rem_from_group(group, NULL); /* removes NULL entries */ diff --git a/source/blender/src/buttons_object.c b/source/blender/src/buttons_object.c index 2ac7b28cd53..f9679c3be92 100644 --- a/source/blender/src/buttons_object.c +++ b/source/blender/src/buttons_object.c @@ -1387,13 +1387,17 @@ static uiBlock *add_groupmenu(void *arg_unused) uiBlock *block; Group *group; short yco= 0; + char str[32]; block= uiNewBlock(&curarea->uiblocks, "add_constraintmenu", UI_EMBOSSP, UI_HELV, curarea->win); uiBlockSetButmFunc(block, do_add_groupmenu, NULL); uiDefBut(block, BUTM, B_NOP, "ADD NEW", 0, 20, 160, 19, NULL, 0.0, 0.0, 1, -1, ""); for(group= G.main->group.first; group; group= group->id.next, yco++) { - uiDefBut(block, BUTM, B_NOP, group->id.name+2, 0, -20*yco, 160, 19, NULL, 0.0, 0.0, 1, yco, ""); + if(group->id.lib) strcpy(str, "L "); + else strcpy(str, " "); + strcat(str, group->id.name+2); + uiDefBut(block, BUTM, B_NOP, str, 0, -20*yco, 160, 19, NULL, 0.0, 0.0, 1, yco, ""); } uiTextBoundsBlock(block, 50); @@ -1416,6 +1420,17 @@ static void group_ob_rem(void *gr_v, void *ob_v) } +static void group_local(void *gr_v, void *unused) +{ + Group *group= gr_v; + + group->id.lib= NULL; + + allqueue(REDRAWBUTSOBJECT, 0); + allqueue(REDRAWVIEW3D, 0); + +} + static void object_panel_object(Object *ob) { uiBlock *block; @@ -1426,6 +1441,8 @@ static void object_panel_object(Object *ob) block= uiNewBlock(&curarea->uiblocks, "object_panel_object", UI_EMBOSS, UI_HELV, curarea->win); if(uiNewPanel(curarea, block, "Object and Links", "Object", 0, 0, 318, 204)==0) return; + if(ob->id.lib) uiSetButLock(1, "Can't edit library data"); + /* object name */ uiBlockSetCol(block, TH_BUT_SETTING2); xco= std_libbuttons(block, 10, 180, 0, NULL, 0, &ob->id, NULL, &(G.buts->menunr), B_OBALONE, B_OBLOCAL, 0, 0, B_KEEPDATA); @@ -1440,10 +1457,17 @@ static void object_panel_object(Object *ob) uiBlockBeginAlign(block); for(group= G.main->group.first; group; group= group->id.next) { if(object_in_group(ob, group)) { + xco= 160; + but = uiDefBut(block, TEX, B_IDNAME, "GR:", 10, 120-a, 150, 20, group->id.name+2, 0.0, 19.0, 0, 0, "Displays Group name. Click to change."); uiButSetFunc(but, test_idbutton_cb, group->id.name, NULL); - but = uiDefIconBut(block, BUT, B_NOP, VICON_X, 160, 120-a, 20, 20, NULL, 0.0, 0.0, 0.0, 0.0, "Remove Group membership"); + if(group->id.lib) { + but= uiDefIconBut(block, BUT, B_NOP, ICON_PARLIB, 160, 120-a, 20, 20, NULL, 0.0, 0.0, 0.0, 0.0, "Make Group local"); + uiButSetFunc(but, group_local, group, NULL); + xco= 180; + } + but = uiDefIconBut(block, BUT, B_NOP, VICON_X, xco, 120-a, 20, 20, NULL, 0.0, 0.0, 0.0, 0.0, "Remove Group membership"); uiButSetFunc(but, group_ob_rem, group, ob); a+= 20; @@ -1459,6 +1483,8 @@ static void object_panel_anim(Object *ob) block= uiNewBlock(&curarea->uiblocks, "object_panel_anim", UI_EMBOSS, UI_HELV, curarea->win); if(uiNewPanel(curarea, block, "Anim settings", "Object", 320, 0, 318, 204)==0) return; + if(ob->id.lib) uiSetButLock(1, "Can't edit library data"); + uiBlockBeginAlign(block); uiDefButS(block, ROW,B_TRACKBUTS,"TrackX", 24,180,59,19, &ob->trackflag, 12.0, 0.0, 0, 0, "Specify the axis that points to another object"); uiDefButS(block, ROW,B_TRACKBUTS,"Y", 85,180,19,19, &ob->trackflag, 12.0, 1.0, 0, 0, "Specify the axis that points to another object"); @@ -1515,6 +1541,8 @@ static void object_panel_draw(Object *ob) block= uiNewBlock(&curarea->uiblocks, "object_panel_draw", UI_EMBOSS, UI_HELV, curarea->win); if(uiNewPanel(curarea, block, "Draw", "Object", 640, 0, 318, 204)==0) return; + if(ob->id.lib) uiSetButLock(1, "Can't edit library data"); + /* LAYERS */ xco= 120; dx= 35; @@ -1576,6 +1604,8 @@ void object_panel_constraint(char *context) block= uiNewBlock(&curarea->uiblocks, "object_panel_constraint", UI_EMBOSS, UI_HELV, curarea->win); if(uiNewPanel(curarea, block, "Constraints", context, 960, 0, 318, 204)==0) return; + if(ob->id.lib) uiSetButLock(1, "Can't edit library data"); + /* this is a variable height panel, newpanel doesnt force new size on existing panels */ /* so first we make it default height */ uiNewPanelHeight(block, 204); @@ -1802,6 +1832,8 @@ static void object_panel_fields(Object *ob) block= uiNewBlock(&curarea->uiblocks, "object_panel_fields", UI_EMBOSS, UI_HELV, curarea->win); if(uiNewPanel(curarea, block, "Fields and Deflection", "Physics", 0, 0, 318, 204)==0) return; + if(ob->id.lib) uiSetButLock(1, "Can't edit library data"); + /* should become button, option? */ if(ob->pd==NULL) { ob->pd= MEM_callocN(sizeof(PartDeflect), "PartDeflect"); @@ -1911,6 +1943,8 @@ static void object_softbodies(Object *ob) block= uiNewBlock(&curarea->uiblocks, "object_softbodies", UI_EMBOSS, UI_HELV, curarea->win); if(uiNewPanel(curarea, block, "Soft Body", "Physics", 640, 0, 318, 204)==0) return; + if(ob->id.lib) uiSetButLock(1, "Can't edit library data"); + /* do not allow to combine with force fields */ /* if(ob->pd && ob->pd->deflect) { */ /* no reason for that any more BM */ @@ -2029,6 +2063,8 @@ static void object_panel_particles_motion(Object *ob) uiNewPanelTabbed("Particles ", "Physics"); if(uiNewPanel(curarea, block, "Particle Motion", "Physics", 320, 0, 318, 204)==0) return; + if(ob->id.lib) uiSetButLock(1, "Can't edit library data"); + /* top row */ uiBlockBeginAlign(block); uiDefButI(block, NUM, B_CALCEFFECT, "Keys:", 0,180,75,20, &paf->totkey, 1.0, 100.0, 0, 0, "Specify the number of key positions"); @@ -2090,6 +2126,8 @@ static void object_panel_particles(Object *ob) block= uiNewBlock(&curarea->uiblocks, "object_panel_particles", UI_EMBOSS, UI_HELV, curarea->win); if(uiNewPanel(curarea, block, "Particles ", "Physics", 320, 0, 318, 204)==0) return; + if(ob->id.lib) uiSetButLock(1, "Can't edit library data"); + if (ob->type == OB_MESH) { uiBlockBeginAlign(block); if(paf==NULL) @@ -2176,6 +2214,8 @@ static void object_panel_fluidsim(Object *ob) uiNewPanelTabbed("Soft Body", "Physics"); if(uiNewPanel(curarea, block, "Fluid Simulation", "Physics", 1060, 0, 318, 204)==0) return; + if(ob->id.lib) uiSetButLock(1, "Can't edit library data"); + uiDefButBitS(block, TOG, OB_FLUIDSIM_ENABLE, REDRAWBUTSOBJECT, "Enable", 0,yline, 75,objHeight, &ob->fluidsimFlag, 0, 0, 0, 0, "Sets object to participate in fluid simulation"); @@ -2331,8 +2371,6 @@ void object_panels() /* check context here */ ob= OBACT; if(ob) { - if(ob->id.lib) uiSetButLock(1, "Can't edit library data"); - object_panel_object(ob); object_panel_anim(ob); object_panel_draw(ob); @@ -2349,7 +2387,6 @@ void physics_panels() /* check context here */ ob= OBACT; if(ob) { - if(ob->id.lib) uiSetButLock(1, "Can't edit library data"); object_panel_fields(ob); object_panel_particles(ob); object_panel_particles_motion(ob); diff --git a/source/blender/src/outliner.c b/source/blender/src/outliner.c index c4c11a4c294..fe00f6f1262 100644 --- a/source/blender/src/outliner.c +++ b/source/blender/src/outliner.c @@ -2251,7 +2251,7 @@ static void outliner_draw_tree_element(SpaceOops *soops, TreeElement *te, int st if(active) { uiSetRoundBox(15); uiRoundBox( (float)startx+OL_H-1.5, (float)*starty+2.0, (float)startx+2*OL_H-4.0, (float)*starty+OL_H-1.0, OL_H/2.0-2.0); - glEnable(GL_BLEND); + glEnable(GL_BLEND); /* roundbox disables it */ te->flag |= TE_ACTIVE; // for lookup in display hierarchies } @@ -2280,8 +2280,14 @@ static void outliner_draw_tree_element(SpaceOops *soops, TreeElement *te, int st glDisable(GL_BLEND); /* name */ - if(active==1) BIF_ThemeColor(TH_TEXT_HI); - else BIF_ThemeColor(TH_TEXT); + if(tselem->id->lib) { + if(active==1) glColor3ub(0xBB, 0xFF, 0xFF); + else glColor3ub(0, 0x30, 0x30); + } + else { + if(active==1) BIF_ThemeColor(TH_TEXT_HI); + else BIF_ThemeColor(TH_TEXT); + } glRasterPos2i(startx+offsx, *starty+5); BIF_RasterPos(startx+offsx, *starty+5); BIF_DrawString(G.font, te->name, 0); |