diff options
author | Ton Roosendaal <ton@blender.org> | 2006-11-14 20:16:15 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2006-11-14 20:16:15 +0300 |
commit | 9ab91ab3616f667f39610c4e076644615d2fe632 (patch) | |
tree | d8b67a3091249ec5493fce489cf0b0f1826a116b | |
parent | ba71fbb785c0aa99bb111ed702a5734fa2358f91 (diff) |
New dupli-group feature: you can now set in Groups the layers you want
a group to show when used for duplicators. Is in the Object Buttons,
"Object and Links" panel. Note that the duplicator layer itself still
defines still visiblitily of entire group.
-rw-r--r-- | source/blender/blenkernel/intern/anim.c | 8 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/group.c | 1 | ||||
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 5 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_group_types.h | 3 | ||||
-rw-r--r-- | source/blender/src/buttons_editing.c | 4 | ||||
-rw-r--r-- | source/blender/src/buttons_object.c | 34 |
6 files changed, 42 insertions, 13 deletions
diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index 57692ed65d2..0bb0b65bb83 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -303,20 +303,22 @@ static DupliObject *new_dupli_object(ListBase *lb, Object *ob, float mat[][4], i static void group_duplilist(ListBase *lb, Object *ob, int level) { DupliObject *dob; + Group *group; GroupObject *go; float mat[4][4]; if(ob->dup_group==NULL) return; + group= ob->dup_group; /* simple preventing of too deep nested groups */ if(level>4) return; /* handles animated groups, and */ /* we need to check update for objects that are not in scene... */ - group_handle_recalc_and_update(ob, ob->dup_group); + group_handle_recalc_and_update(ob, group); - for(go= ob->dup_group->gobject.first; go; go= go->next) { - if(go->ob!=ob) { + for(go= group->gobject.first; go; go= go->next) { + if(go->ob!=ob && (go->ob->lay & group->layer)) { Mat4MulMat4(mat, go->ob->obmat, ob->obmat); dob= new_dupli_object(lb, go->ob, mat, ob->lay, 0); if(go->ob->dup_group) { diff --git a/source/blender/blenkernel/intern/group.c b/source/blender/blenkernel/intern/group.c index bf1b573afe5..f56407af74d 100644 --- a/source/blender/blenkernel/intern/group.c +++ b/source/blender/blenkernel/intern/group.c @@ -110,6 +110,7 @@ Group *add_group() Group *group; group = alloc_libblock(&G.main->group, ID_GR, "Group"); + group->layer= (1<<20)-1; return group; } diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index e781341dc27..924baf0c1f2 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -5757,6 +5757,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) Object *ob; Curve *cu; Material *ma; + Group *group; Nurb *nu; BezTriple *bezt; BPoint *bp; @@ -5870,6 +5871,10 @@ static void do_versions(FileData *fd, Library *lib, Main *main) ma->shad_alpha= 1.0f; } + for(group= main->group.first; group; group= group->id.next) + if(group->layer==0) + group->layer= (1<<20)-1; + /* History fix (python?), shape key adrcode numbers have to be sorted */ sort_shape_fix(main); } diff --git a/source/blender/makesdna/DNA_group_types.h b/source/blender/makesdna/DNA_group_types.h index 09ecc3a68c1..34764fac47d 100644 --- a/source/blender/makesdna/DNA_group_types.h +++ b/source/blender/makesdna/DNA_group_types.h @@ -52,7 +52,8 @@ typedef struct Group { ID id; ListBase gobject; /* GroupObject */ - + unsigned int layer; + int pad; } Group; diff --git a/source/blender/src/buttons_editing.c b/source/blender/src/buttons_editing.c index 0d9a32d26bd..094cf9260a4 100644 --- a/source/blender/src/buttons_editing.c +++ b/source/blender/src/buttons_editing.c @@ -3280,13 +3280,13 @@ static void editing_panel_armature_bones(Object *ob, bArmature *arm) uiBlockBeginAlign(block); for(a=0; a<8; a++) { short dx= 21; - but= uiDefButBitS(block, TOG, 1<<a, REDRAWVIEW3D, "", -10+a*dx, by-57, dx, 15, &curBone->layer, 0, 0, 0, 0, ""); + but= uiDefButBitS(block, TOG, 1<<a, REDRAWVIEW3D, "", -10+a*dx, by-57, dx, 15, &curBone->layer, 0, 0, 0, 0, "Don't draw this layer for group-duplicators"); uiButSetFunc(but, armature_layer_cb, &curBone->layer, (void *)(1<<a)); } uiBlockBeginAlign(block); for(a=8; a<16; a++) { short dx= 21; - but= uiDefButBitS(block, TOG, 1<<a, REDRAWVIEW3D, "", -6+a*dx, by-57, dx, 15, &curBone->layer, 0, 0, 0, 0, ""); + but= uiDefButBitS(block, TOG, 1<<a, REDRAWVIEW3D, "", -6+a*dx, by-57, dx, 15, &curBone->layer, 0, 0, 0, 0, "Don't draw this layer for group-duplicators"); uiButSetFunc(but, armature_layer_cb, &curBone->layer, (void *)(1<<a)); } diff --git a/source/blender/src/buttons_object.c b/source/blender/src/buttons_object.c index 7f08da6a27b..3e104a2e623 100644 --- a/source/blender/src/buttons_object.c +++ b/source/blender/src/buttons_object.c @@ -1747,8 +1747,9 @@ static void object_panel_object(Object *ob) uiBlock *block; uiBut *but; Group *group; - int a=0, xco; - + int a, xco, yco=0; + short dx= 33, dy= 30; + 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; @@ -1765,23 +1766,42 @@ static void object_panel_object(Object *ob) uiDefBlockBut(block, add_groupmenu, NULL, "Add to Group", 10,150,150,20, "Add Object to a new Group"); /* all groups */ - 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."); + uiBlockBeginAlign(block); + but = uiDefBut(block, TEX, B_IDNAME, "GR:", 10, 120-yco, 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); 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"); + but= uiDefIconBut(block, BUT, B_NOP, ICON_PARLIB, 160, 120-yco, 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"); + but = uiDefIconBut(block, BUT, B_NOP, VICON_X, xco, 120-yco, 20, 20, NULL, 0.0, 0.0, 0.0, 0.0, "Remove Group membership"); uiButSetFunc(but, group_ob_rem, group, ob); - a+= 20; + yco+= 20; + xco= 10; + + /* layers */ + uiBlockBeginAlign(block); + for(a=0; a<5; a++) + uiDefButBitI(block, TOG, 1<<a, B_REDR+a, "", (short)(xco+a*(dx/2)), 120-yco, (short)(dx/2), (short)(dy/2), &(group->layer), 0, 0, 0, 0, ""); + for(a=0; a<5; a++) + uiDefButBitI(block, TOG, 1<<(a+10), B_REDR+a+10, "", (short)(xco+a*(dx/2)), 105-yco, (short)(dx/2), (short)(dy/2), &(group->layer), 0, 0, 0, 0, ""); + + xco+= 7; + uiBlockBeginAlign(block); + for(a=5; a<10; a++) + uiDefButBitI(block, TOG, 1<<a, B_REDR+a, "", (short)(xco+a*(dx/2)), 120-yco, (short)(dx/2), (short)(dy/2), &(group->layer), 0, 0, 0, 0, ""); + for(a=5; a<10; a++) + uiDefButBitI(block, TOG, 1<<(a+10), B_REDR+a+10, "", (short)(xco+a*(dx/2)), 105-yco, (short)(dx/2), (short)(dy/2), &(group->layer), 0, 0, 0, 0, ""); + + uiBlockEndAlign(block); + + yco+= 40; } } } |