diff options
author | Ton Roosendaal <ton@blender.org> | 2005-12-06 13:55:30 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2005-12-06 13:55:30 +0300 |
commit | d024452ebf97c0926b1601371d2ee802bd754f3c (patch) | |
tree | b6afebbe0b0cb682062bed92acbf33fe33b09aae /source/blender/src | |
parent | 863234481e751ae94dd77b18d65ea76df65ec4b1 (diff) |
Orange branch: Revived hidden treasure, the Groups!
Previous experiment (in 2000) didn't satisfy, it had even some primitive
NLA option in groups... so, cleaned up the old code (removed most) and
integrated it back in a more useful way.
Usage:
- CTRL+G gives menu to add group, add to existing group, or remove from
groups.
- In Object buttons, a new (should become first) Panel was added, showing
not only Object "ID button" and Parent, but also the Groups the Object
Belongs to. These buttons also allow rename, assigning or removing.
- To indicate Objects are grouped, they're drawn in a (not theme yet, so
temporal?) green wire color.
- Use ALT+SHIFT mouse-select to (de)select an entire group
But, the real power of groups is in the following features:
-> Particle Force field and Guide control
In the "Particle Motion" Panel, you can indicate a Group name, this then
limits force fields or guides to members of that Group. (Note that layers
still work on top of that... not sure about that).
-> Light Groups
In the Material "Shaders" Panel, you can indicate a Group name to limit
lighting for the Material to lamps in this group. The Lights in a Group do
need to be 'visible' for the Scene to be rendered (as usual).
-> Group Duplicator
In the Object "Anim" Panel, you can set any Object (use Empty!) to
duplicate an entire Group. It will make copies of all Objects in that Group.
Also works for animated Objects, but it will copy the current positions or
deforms. Control over 'local timing' (so we can do Massive anims!) will be
added later.
(Note; this commit won't render Group duplicators yet, a fix in bf-blender
will enable that, next commit will sync)
-> Library Appending
In the SHIFT-F1 or SHIFT+F4 browsers, you can also find the Groups listed.
By appending or linking the Group itself, and use the Group Duplicator, you
now can animate and position linked Objects. The nice thing is that the
local saved file itself will only store the Group name that was linked, so
on a next file read, the Group Objects will be re-read as stored (changed)
in the Library file.
(Note; current implementation also "gives a base" to linked Group Objects,
to show them as Objects in the current Scene. Need that now for testing
purposes, but probably will be removed later).
-> Outliner
Outliner now shows Groups as optio too, nice to organize your data a bit too!
In General, Groups have a very good potential... for example, it could
become default for MetaBall Objects too (jiri, I can help you later on how
this works). All current 'layer relationships' in Blender should be dropped
in time, I guess...
Diffstat (limited to 'source/blender/src')
-rw-r--r-- | source/blender/src/butspace.c | 30 | ||||
-rw-r--r-- | source/blender/src/buttons_object.c | 381 | ||||
-rw-r--r-- | source/blender/src/buttons_shading.c | 2 | ||||
-rw-r--r-- | source/blender/src/drawobject.c | 14 | ||||
-rw-r--r-- | source/blender/src/drawview.c | 1 | ||||
-rw-r--r-- | source/blender/src/editgroup.c | 115 | ||||
-rw-r--r-- | source/blender/src/editipo.c | 9 | ||||
-rw-r--r-- | source/blender/src/editobject.c | 12 | ||||
-rw-r--r-- | source/blender/src/editview.c | 35 | ||||
-rw-r--r-- | source/blender/src/filesel.c | 39 | ||||
-rw-r--r-- | source/blender/src/header_oops.c | 20 | ||||
-rw-r--r-- | source/blender/src/header_view3d.c | 2 | ||||
-rw-r--r-- | source/blender/src/outliner.c | 36 | ||||
-rw-r--r-- | source/blender/src/previewrender.c | 14 | ||||
-rw-r--r-- | source/blender/src/space.c | 53 |
15 files changed, 445 insertions, 318 deletions
diff --git a/source/blender/src/butspace.c b/source/blender/src/butspace.c index bb6dc671e14..752e831c2b4 100644 --- a/source/blender/src/butspace.c +++ b/source/blender/src/butspace.c @@ -107,7 +107,7 @@ void test_scriptpoin_but(char *name, ID **idpp) } id= id->next; } - *idpp= 0; + *idpp= NULL; } void test_actionpoin_but(char *name, ID **idpp) @@ -122,7 +122,7 @@ void test_actionpoin_but(char *name, ID **idpp) } id= id->next; } - *idpp= 0; + *idpp= NULL; } @@ -144,7 +144,7 @@ void test_obpoin_but(char *name, ID **idpp) } id= id->next; } - *idpp= 0; + *idpp= NULL; } void test_meshpoin_but(char *name, ID **idpp) @@ -162,7 +162,7 @@ void test_meshpoin_but(char *name, ID **idpp) } id= id->next; } - *idpp= 0; + *idpp= NULL; } void test_matpoin_but(char *name, ID **idpp) @@ -180,7 +180,7 @@ void test_matpoin_but(char *name, ID **idpp) } id= id->next; } - *idpp= 0; + *idpp= NULL; } void test_scenepoin_but(char *name, ID **idpp) @@ -198,7 +198,25 @@ void test_scenepoin_but(char *name, ID **idpp) } id= id->next; } - *idpp= 0; + *idpp= NULL; +} + +void test_grouppoin_but(char *name, ID **idpp) +{ + ID *id; + + if( *idpp ) (*idpp)->us--; + + id= G.main->group.first; + while(id) { + if( strcmp(name, id->name+2)==0 ) { + *idpp= id; + id_us_plus(id); + return; + } + id= id->next; + } + *idpp= NULL; } diff --git a/source/blender/src/buttons_object.c b/source/blender/src/buttons_object.c index 8281ce7bc8f..2ac7b28cd53 100644 --- a/source/blender/src/buttons_object.c +++ b/source/blender/src/buttons_object.c @@ -119,6 +119,7 @@ #include "BKE_displist.h" #include "BKE_effect.h" #include "BKE_font.h" +#include "BKE_group.h" #include "BKE_image.h" #include "BKE_ipo.h" #include "BKE_lattice.h" @@ -1133,118 +1134,6 @@ void do_constraintbuts(unsigned short event) allqueue (REDRAWBUTSOBJECT, 0); } -void object_panel_constraint(char *context) -{ - uiBlock *block; - Object *ob= OBACT; - ListBase *conlist; - bConstraint *curcon; - short xco, yco; - char str[64]; - - block= uiNewBlock(&curarea->uiblocks, "object_panel_constraint", UI_EMBOSS, UI_HELV, curarea->win); - if(uiNewPanel(curarea, block, "Constraints", context, 640, 0, 318, 204)==0) return; - - /* this is a variable height panel, newpanel doesnt force new size on existing panels */ - /* so first we make it default height */ - uiNewPanelHeight(block, 204); - - if(G.obedit==OBACT) return; // ?? - - conlist = get_active_constraints(OBACT); - - if (conlist) { - - uiDefBlockBut(block, add_constraintmenu, NULL, "Add Constraint", 0, 190, 130, 20, "Add a new constraint"); - - /* print active object or bone */ - str[0]= 0; - if (ob->flag & OB_POSEMODE){ - bPoseChannel *pchan= get_active_posechannel(ob); - if(pchan) sprintf(str, "To Bone: %s", pchan->name); - } - else { - sprintf(str, "To Object: %s", ob->id.name+2); - } - uiDefBut(block, LABEL, 1, str, 150, 190, 150, 20, NULL, 0.0, 0.0, 0, 0, "Displays Active Object or Bone name"); - - /* Go through the list of constraints and draw them */ - xco = 10; - yco = 160; - - for (curcon = conlist->first; curcon; curcon=curcon->next) { - /* hrms, the temporal constraint should not draw! */ - if(curcon->type==CONSTRAINT_TYPE_KINEMATIC) { - bKinematicConstraint *data= curcon->data; - if(data->flag & CONSTRAINT_IK_TEMP) - continue; - } - /* Draw default constraint header */ - draw_constraint(block, conlist, curcon, &xco, &yco); - } - - if(yco < 0) uiNewPanelHeight(block, 204-yco); - - } -} - -static void object_panel_draw(Object *ob) -{ - uiBlock *block; - int xco, a, dx, dy; - - block= uiNewBlock(&curarea->uiblocks, "object_panel_draw", UI_EMBOSS, UI_HELV, curarea->win); - if(uiNewPanel(curarea, block, "Draw", "Object", 320, 0, 318, 204)==0) return; - - /* LAYERS */ - xco= 120; - dx= 35; - dy= 30; - - uiDefBut(block, LABEL, 0, "Layers", 10,170,100,20, NULL, 0, 0, 0, 0, ""); - - uiBlockBeginAlign(block); - for(a=0; a<5; a++) - uiDefButBitI(block, TOG, 1<<a, B_OBLAY+a, "", (short)(xco+a*(dx/2)), 180, (short)(dx/2), (short)(dy/2), &(BASACT->lay), 0, 0, 0, 0, ""); - for(a=0; a<5; a++) - uiDefButBitI(block, TOG, 1<<(a+10), B_OBLAY+a+10, "", (short)(xco+a*(dx/2)), 165, (short)(dx/2), (short)(dy/2), &(BASACT->lay), 0, 0, 0, 0, ""); - - xco+= 7; - uiBlockBeginAlign(block); - for(a=5; a<10; a++) - uiDefButBitI(block, TOG, 1<<a, B_OBLAY+a, "", (short)(xco+a*(dx/2)), 180, (short)(dx/2), (short)(dy/2), &(BASACT->lay), 0, 0, 0, 0, ""); - for(a=5; a<10; a++) - uiDefButBitI(block, TOG, 1<<(a+10), B_OBLAY+a+10, "", (short)(xco+a*(dx/2)), 165, (short)(dx/2), (short)(dy/2), &(BASACT->lay), 0, 0, 0, 0, ""); - - uiBlockEndAlign(block); - - uiDefBut(block, LABEL, 0, "Drawtype", 10,120,100,20, NULL, 0, 0, 0, 0, ""); - - uiBlockBeginAlign(block); - uiDefButC(block, ROW, REDRAWVIEW3D, "Shaded", 10,100,100, 20, &ob->dt, 0, OB_SHADED, 0, 0, "Draw active object shaded or textured"); - uiDefButC(block, ROW, REDRAWVIEW3D, "Solid", 10,80,100, 20, &ob->dt, 0, OB_SOLID, 0, 0, "Draw active object in solid"); - uiDefButC(block, ROW, REDRAWVIEW3D, "Wire", 10,60, 100, 20, &ob->dt, 0, OB_WIRE, 0, 0, "Draw active object in wireframe"); - uiDefButC(block, ROW, REDRAWVIEW3D, "Bounds", 10,40, 100, 20, &ob->dt, 0, OB_BOUNDBOX, 0, 0, "Only draw object with bounding box"); - uiBlockEndAlign(block); - - uiDefBut(block, LABEL, 0, "Draw Extra", 120,120,90,20, NULL, 0, 0, 0, 0, ""); - - uiBlockBeginAlign(block); - uiDefButBitC(block, TOG, OB_BOUNDBOX, REDRAWVIEW3D, "Bounds", 120, 100, 90, 20, &ob->dtx, 0, 0, 0, 0, "Displays the active object's bounds"); - uiDefButBitC(block, TOG, OB_DRAWNAME, REDRAWVIEW3D, "Name", 210, 100, 90, 20, &ob->dtx, 0, 0, 0, 0, "Displays the active object's name"); - - uiDefButS(block, MENU, REDRAWVIEW3D, "Boundary Display%t|Box%x0|Sphere%x1|Cylinder%x2|Cone%x3|Polyheder%x4", - 120, 80, 90, 20, &ob->boundtype, 0, 0, 0, 0, "Selects the boundary display type"); - uiDefButBitC(block, TOG, OB_AXIS, REDRAWVIEW3D, "Axis", 210, 80, 90, 20, &ob->dtx, 0, 0, 0, 0, "Displays the active object's centre and axis"); - - uiDefButBitC(block, TOG, OB_TEXSPACE, REDRAWVIEW3D, "TexSpace", 120, 60, 90, 20, &ob->dtx, 0, 0, 0, 0, "Displays the active object's texture space"); - uiDefButBitC(block, TOG, OB_DRAWWIRE, REDRAWVIEW3D, "Wire", 210, 60, 90, 20, &ob->dtx, 0, 0, 0, 0, "Adds the active object's wireframe over solid drawing"); - - uiDefButBitC(block, TOG, OB_DRAWTRANSP, REDRAWVIEW3D, "Transp", 120, 40, 90, 20, &ob->dtx, 0, 0, 0, 0, "Enables transparent materials for the active object (Mesh only)"); - uiDefButBitC(block, TOG, OB_DRAWXRAY, REDRAWVIEW3D, "X-ray", 210, 40, 90, 20, &ob->dtx, 0, 0, 0, 0, "Makes the active object draw in front of others"); - -} - static void softbody_bake(Object *ob) { SoftBody *sb= ob->soft; @@ -1473,56 +1362,263 @@ void do_object_panels(unsigned short event) } +static void do_add_groupmenu(void *arg, int event) +{ + Object *ob= OBACT; + + if(ob) { + + if(event== -1) { + Group *group= add_group(); + add_to_group(group, ob); + } + else + add_to_group(BLI_findlink(&G.main->group, event), ob); + + ob->flag |= OB_FROMGROUP; + BASACT->flag |= OB_FROMGROUP; + allqueue(REDRAWBUTSOBJECT, 0); + allqueue(REDRAWVIEW3D, 0); + } +} + +static uiBlock *add_groupmenu(void *arg_unused) +{ + uiBlock *block; + Group *group; + short yco= 0; + + 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, ""); + } + + uiTextBoundsBlock(block, 50); + uiBlockSetDirection(block, UI_DOWN); + + return block; +} + +static void group_ob_rem(void *gr_v, void *ob_v) +{ + Object *ob= OBACT; + + rem_from_group(gr_v, ob); + if(find_group(ob)==NULL) { + ob->flag &= ~OB_FROMGROUP; + BASACT->flag &= ~OB_FROMGROUP; + } + allqueue(REDRAWBUTSOBJECT, 0); + allqueue(REDRAWVIEW3D, 0); + +} + +static void object_panel_object(Object *ob) +{ + uiBlock *block; + uiBut *but; + Group *group; + int a=0, xco; + + 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; + + /* 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); + uiBlockSetCol(block, TH_AUTO); + + /* parent */ + uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_OBJECTPANELPARENT, "Par:", xco+5, 180, 305-xco, 20, &ob->parent, "Parent Object"); + + 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)) { + 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"); + uiButSetFunc(but, group_ob_rem, group, ob); + + a+= 20; + } + } +} + static void object_panel_anim(Object *ob) { uiBlock *block; char str[32]; block= uiNewBlock(&curarea->uiblocks, "object_panel_anim", UI_EMBOSS, UI_HELV, curarea->win); - if(uiNewPanel(curarea, block, "Anim settings", "Object", 0, 0, 318, 204)==0) return; + if(uiNewPanel(curarea, block, "Anim settings", "Object", 320, 0, 318, 204)==0) return; uiBlockBeginAlign(block); - uiDefButS(block, ROW,B_TRACKBUTS,"TrackX", 24,190,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,190,19,19, &ob->trackflag, 12.0, 1.0, 0, 0, "Specify the axis that points to another object"); - uiDefButS(block, ROW,B_TRACKBUTS,"Z", 104,190,19,19, &ob->trackflag, 12.0, 2.0, 0, 0, "Specify the axis that points to another object"); - uiDefButS(block, ROW,B_TRACKBUTS,"-X", 124,190,24,19, &ob->trackflag, 12.0, 3.0, 0, 0, "Specify the axis that points to another object"); - uiDefButS(block, ROW,B_TRACKBUTS,"-Y", 150,190,24,19, &ob->trackflag, 12.0, 4.0, 0, 0, "Specify the axis that points to another object"); - uiDefButS(block, ROW,B_TRACKBUTS,"-Z", 178,190,24,19, &ob->trackflag, 12.0, 5.0, 0, 0, "Specify the axis that points to another object"); + 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"); + uiDefButS(block, ROW,B_TRACKBUTS,"Z", 104,180,19,19, &ob->trackflag, 12.0, 2.0, 0, 0, "Specify the axis that points to another object"); + uiDefButS(block, ROW,B_TRACKBUTS,"-X", 124,180,24,19, &ob->trackflag, 12.0, 3.0, 0, 0, "Specify the axis that points to another object"); + uiDefButS(block, ROW,B_TRACKBUTS,"-Y", 150,180,24,19, &ob->trackflag, 12.0, 4.0, 0, 0, "Specify the axis that points to another object"); + uiDefButS(block, ROW,B_TRACKBUTS,"-Z", 178,180,24,19, &ob->trackflag, 12.0, 5.0, 0, 0, "Specify the axis that points to another object"); uiBlockBeginAlign(block); - uiDefButS(block, ROW,REDRAWVIEW3D,"UpX", 226,190,45,19, &ob->upflag, 13.0, 0.0, 0, 0, "Specify the axis that points up"); - uiDefButS(block, ROW,REDRAWVIEW3D,"Y", 274,190,20,19, &ob->upflag, 13.0, 1.0, 0, 0, "Specify the axis that points up"); - uiDefButS(block, ROW,REDRAWVIEW3D,"Z", 298,190,19,19, &ob->upflag, 13.0, 2.0, 0, 0, "Specify the axis that points up"); + uiDefButS(block, ROW,REDRAWVIEW3D,"UpX", 226,180,45,19, &ob->upflag, 13.0, 0.0, 0, 0, "Specify the axis that points up"); + uiDefButS(block, ROW,REDRAWVIEW3D,"Y", 274,180,20,19, &ob->upflag, 13.0, 1.0, 0, 0, "Specify the axis that points up"); + uiDefButS(block, ROW,REDRAWVIEW3D,"Z", 298,180,19,19, &ob->upflag, 13.0, 2.0, 0, 0, "Specify the axis that points up"); + uiBlockBeginAlign(block); - uiDefButBitS(block, TOG, OB_DRAWKEY, REDRAWVIEW3D, "Draw Key", 24,160,71,19, &ob->ipoflag, 0, 0, 0, 0, "Draw object as key position"); - uiDefButBitS(block, TOG, OB_DRAWKEYSEL, REDRAWVIEW3D, "Draw Key Sel", 97,160,81,19, &ob->ipoflag, 0, 0, 0, 0, "Limit the drawing of object keys"); - uiDefButBitS(block, TOG, OB_POWERTRACK, REDRAWVIEW3D, "Powertrack", 180,160,78,19, &ob->transflag, 0, 0, 0, 0, "Switch objects rotation off"); - uiDefButBitS(block, TOG, PARSLOW, 0, "SlowPar", 260,160,56,19, &ob->partype, 0, 0, 0, 0, "Create a delay in the parent relationship"); + uiDefButBitS(block, TOG, OB_DRAWKEY, REDRAWVIEW3D, "Draw Key", 24,155,71,19, &ob->ipoflag, 0, 0, 0, 0, "Draw object as key position"); + uiDefButBitS(block, TOG, OB_DRAWKEYSEL, REDRAWVIEW3D, "Draw Key Sel", 97,155,81,19, &ob->ipoflag, 0, 0, 0, 0, "Limit the drawing of object keys"); + uiDefButBitS(block, TOG, OB_POWERTRACK, REDRAWVIEW3D, "Powertrack", 180,155,78,19, &ob->transflag, 0, 0, 0, 0, "Switch objects rotation off"); + uiDefButBitS(block, TOG, PARSLOW, 0, "SlowPar", 260,155,56,19, &ob->partype, 0, 0, 0, 0, "Create a delay in the parent relationship"); uiBlockBeginAlign(block); - uiDefButBitS(block, TOG, OB_DUPLIFRAMES, REDRAWVIEW3D, "DupliFrames", 24,128,89,19, &ob->transflag, 0, 0, 0, 0, "Make copy of object for every frame"); - uiDefButBitS(block, TOG, OB_DUPLIVERTS, REDRAWVIEW3D, "DupliVerts", 114,128,82,19, &ob->transflag, 0, 0, 0, 0, "Duplicate child objects on all vertices"); - uiDefButBitS(block, TOG, OB_DUPLIROT, REDRAWVIEW3D, "Rot", 200,128,31,19, &ob->transflag, 0, 0, 0, 0, "Rotate dupli according to facenormal"); - uiDefButBitS(block, TOG, OB_DUPLINOSPEED, REDRAWVIEW3D, "No Speed", 234,128,82,19, &ob->transflag, 0, 0, 0, 0, "Set dupliframes to still, regardless of frame"); + + uiDefButBitS(block, TOG, OB_DUPLIFRAMES, REDRAWVIEW3D, "DupliFrames", 24,130,89,20, &ob->transflag, 0, 0, 0, 0, "Make copy of object for every frame"); + uiDefButBitS(block, TOG, OB_DUPLIVERTS, REDRAWVIEW3D, "DupliVerts", 114,130,82,20, &ob->transflag, 0, 0, 0, 0, "Duplicate child objects on all vertices"); + uiDefButBitS(block, TOG, OB_DUPLIROT, REDRAWVIEW3D, "Rot", 200,130,31,20, &ob->transflag, 0, 0, 0, 0, "Rotate dupli according to facenormal"); + uiDefButBitS(block, TOG, OB_DUPLINOSPEED, REDRAWVIEW3D, "No Speed", 234,130,82,20, &ob->transflag, 0, 0, 0, 0, "Set dupliframes to still, regardless of frame"); + + uiDefButBitS(block, TOG, OB_DUPLIGROUP, REDRAWVIEW3D, "DupliGroup", 24,110,150,20, &ob->transflag, 0, 0, 0, 0, "Make copy of object for every frame"); + uiDefIDPoinBut(block, test_grouppoin_but, ID_GR, REDRAWVIEW3D, "GR:", 174,110,142,20, &ob->dup_group, "Duplicate this entire Group"); + uiBlockBeginAlign(block); - uiDefButS(block, NUM, REDRAWVIEW3D, "DupSta:", 24,105,141,19, &ob->dupsta, 1.0, (MAXFRAMEF - 1.0f), 0, 0, "Specify startframe for Dupliframes"); - uiDefButS(block, NUM, REDRAWVIEW3D, "DupOn:", 170,105,146,19, &ob->dupon, 1.0, 1500.0, 0, 0, ""); - uiDefButS(block, NUM, REDRAWVIEW3D, "DupEnd", 24,82,140,19, &ob->dupend, 1.0, MAXFRAMEF, 0, 0, "Specify endframe for Dupliframes"); - uiDefButS(block, NUM, REDRAWVIEW3D, "DupOff", 171,82,145,19, &ob->dupoff, 0.0, 1500.0, 0, 0, ""); + uiDefButS(block, NUM, REDRAWVIEW3D, "DupSta:", 24,85,141,19, &ob->dupsta, 1.0, (MAXFRAMEF - 1.0f), 0, 0, "Specify startframe for Dupliframes"); + uiDefButS(block, NUM, REDRAWVIEW3D, "DupOn:", 170,85,146,19, &ob->dupon, 1.0, 1500.0, 0, 0, ""); + uiDefButS(block, NUM, REDRAWVIEW3D, "DupEnd", 24,65,140,19, &ob->dupend, 1.0, MAXFRAMEF, 0, 0, "Specify endframe for Dupliframes"); + uiDefButS(block, NUM, REDRAWVIEW3D, "DupOff", 171,65,145,19, &ob->dupoff, 0.0, 1500.0, 0, 0, ""); uiBlockBeginAlign(block); - uiDefButBitS(block, TOG, OB_OFFS_OB, REDRAWALL, "Offs Ob", 24,51,56,20, &ob->ipoflag, 0, 0, 0, 0, "Let the timeoffset work on its own objectipo"); - uiDefButBitS(block, TOG, OB_OFFS_PARENT, REDRAWALL, "Offs Par", 82,51,56,20 , &ob->ipoflag, 0, 0, 0, 0, "Let the timeoffset work on the parent"); - uiDefButBitS(block, TOG, OB_OFFS_PARTICLE, REDRAWALL, "Offs Particle", 140,51,103,20, &ob->ipoflag, 0, 0, 0, 0, "Let the timeoffset work on the particle effect"); + uiDefButBitS(block, TOG, OB_OFFS_OB, REDRAWALL, "Offs Ob", 24,35,56,20, &ob->ipoflag, 0, 0, 0, 0, "Let the timeoffset work on its own objectipo"); + uiDefButBitS(block, TOG, OB_OFFS_PARENT, REDRAWALL, "Offs Par", 82,35,56,20 , &ob->ipoflag, 0, 0, 0, 0, "Let the timeoffset work on the parent"); + uiDefButBitS(block, TOG, OB_OFFS_PARTICLE, REDRAWALL, "Offs Particle", 140,35,103,20, &ob->ipoflag, 0, 0, 0, 0, "Let the timeoffset work on the particle effect"); uiBlockBeginAlign(block); - uiDefButF(block, NUM, REDRAWALL, "TimeOffset:", 24,17,115,30, &ob->sf, -MAXFRAMEF, MAXFRAMEF, 100, 0, "Specify an offset in frames"); - uiDefBut(block, BUT, B_AUTOTIMEOFS, "Automatic Time", 139,17,104,31, 0, 0, 0, 0, 0, "Generate automatic timeoffset values for all selected frames"); - uiDefBut(block, BUT, B_PRINTSPEED, "PrSpeed", 248,17,67,31, 0, 0, 0, 0, 0, "Print objectspeed"); + uiDefButF(block, NUM, REDRAWALL, "TimeOffset:", 24,10,115,20, &ob->sf, -MAXFRAMEF, MAXFRAMEF, 100, 0, "Specify an offset in frames"); + uiDefBut(block, BUT, B_AUTOTIMEOFS, "Automatic Time", 139,10,104,20, 0, 0, 0, 0, 0, "Generate automatic timeoffset values for all selected frames"); + uiDefBut(block, BUT, B_PRINTSPEED, "PrSpeed", 248,10,67,20, 0, 0, 0, 0, 0, "Print objectspeed"); uiBlockEndAlign(block); sprintf(str, "%.4f", prspeed); - uiDefBut(block, LABEL, 0, str, 247,40,63,31, NULL, 1.0, 0, 0, 0, ""); + uiDefBut(block, LABEL, 0, str, 247,35,63,31, NULL, 1.0, 0, 0, 0, ""); + +} + +static void object_panel_draw(Object *ob) +{ + uiBlock *block; + int xco, a, dx, dy; + + 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; + + /* LAYERS */ + xco= 120; + dx= 35; + dy= 30; + + uiDefBut(block, LABEL, 0, "Layers", 10,170,100,20, NULL, 0, 0, 0, 0, ""); + + uiBlockBeginAlign(block); + for(a=0; a<5; a++) + uiDefButBitI(block, TOG, 1<<a, B_OBLAY+a, "", (short)(xco+a*(dx/2)), 180, (short)(dx/2), (short)(dy/2), &(BASACT->lay), 0, 0, 0, 0, ""); + for(a=0; a<5; a++) + uiDefButBitI(block, TOG, 1<<(a+10), B_OBLAY+a+10, "", (short)(xco+a*(dx/2)), 165, (short)(dx/2), (short)(dy/2), &(BASACT->lay), 0, 0, 0, 0, ""); + + xco+= 7; + uiBlockBeginAlign(block); + for(a=5; a<10; a++) + uiDefButBitI(block, TOG, 1<<a, B_OBLAY+a, "", (short)(xco+a*(dx/2)), 180, (short)(dx/2), (short)(dy/2), &(BASACT->lay), 0, 0, 0, 0, ""); + for(a=5; a<10; a++) + uiDefButBitI(block, TOG, 1<<(a+10), B_OBLAY+a+10, "", (short)(xco+a*(dx/2)), 165, (short)(dx/2), (short)(dy/2), &(BASACT->lay), 0, 0, 0, 0, ""); + + uiBlockEndAlign(block); + + uiDefBut(block, LABEL, 0, "Drawtype", 10,120,100,20, NULL, 0, 0, 0, 0, ""); + + uiBlockBeginAlign(block); + uiDefButC(block, ROW, REDRAWVIEW3D, "Shaded", 10,100,100, 20, &ob->dt, 0, OB_SHADED, 0, 0, "Draw active object shaded or textured"); + uiDefButC(block, ROW, REDRAWVIEW3D, "Solid", 10,80,100, 20, &ob->dt, 0, OB_SOLID, 0, 0, "Draw active object in solid"); + uiDefButC(block, ROW, REDRAWVIEW3D, "Wire", 10,60, 100, 20, &ob->dt, 0, OB_WIRE, 0, 0, "Draw active object in wireframe"); + uiDefButC(block, ROW, REDRAWVIEW3D, "Bounds", 10,40, 100, 20, &ob->dt, 0, OB_BOUNDBOX, 0, 0, "Only draw object with bounding box"); + uiBlockEndAlign(block); + + uiDefBut(block, LABEL, 0, "Draw Extra", 120,120,90,20, NULL, 0, 0, 0, 0, ""); + + uiBlockBeginAlign(block); + uiDefButBitC(block, TOG, OB_BOUNDBOX, REDRAWVIEW3D, "Bounds", 120, 100, 90, 20, &ob->dtx, 0, 0, 0, 0, "Displays the active object's bounds"); + uiDefButBitC(block, TOG, OB_DRAWNAME, REDRAWVIEW3D, "Name", 210, 100, 90, 20, &ob->dtx, 0, 0, 0, 0, "Displays the active object's name"); + + uiDefButS(block, MENU, REDRAWVIEW3D, "Boundary Display%t|Box%x0|Sphere%x1|Cylinder%x2|Cone%x3|Polyheder%x4", + 120, 80, 90, 20, &ob->boundtype, 0, 0, 0, 0, "Selects the boundary display type"); + uiDefButBitC(block, TOG, OB_AXIS, REDRAWVIEW3D, "Axis", 210, 80, 90, 20, &ob->dtx, 0, 0, 0, 0, "Displays the active object's centre and axis"); + + uiDefButBitC(block, TOG, OB_TEXSPACE, REDRAWVIEW3D, "TexSpace", 120, 60, 90, 20, &ob->dtx, 0, 0, 0, 0, "Displays the active object's texture space"); + uiDefButBitC(block, TOG, OB_DRAWWIRE, REDRAWVIEW3D, "Wire", 210, 60, 90, 20, &ob->dtx, 0, 0, 0, 0, "Adds the active object's wireframe over solid drawing"); + + uiDefButBitC(block, TOG, OB_DRAWTRANSP, REDRAWVIEW3D, "Transp", 120, 40, 90, 20, &ob->dtx, 0, 0, 0, 0, "Enables transparent materials for the active object (Mesh only)"); + uiDefButBitC(block, TOG, OB_DRAWXRAY, REDRAWVIEW3D, "X-ray", 210, 40, 90, 20, &ob->dtx, 0, 0, 0, 0, "Makes the active object draw in front of others"); } +void object_panel_constraint(char *context) +{ + uiBlock *block; + Object *ob= OBACT; + ListBase *conlist; + bConstraint *curcon; + short xco, yco; + char str[64]; + + 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; + + /* this is a variable height panel, newpanel doesnt force new size on existing panels */ + /* so first we make it default height */ + uiNewPanelHeight(block, 204); + + if(G.obedit==OBACT) return; // ?? + + conlist = get_active_constraints(OBACT); + + if (conlist) { + + uiDefBlockBut(block, add_constraintmenu, NULL, "Add Constraint", 0, 190, 130, 20, "Add a new constraint"); + + /* print active object or bone */ + str[0]= 0; + if (ob->flag & OB_POSEMODE){ + bPoseChannel *pchan= get_active_posechannel(ob); + if(pchan) sprintf(str, "To Bone: %s", pchan->name); + } + else { + sprintf(str, "To Object: %s", ob->id.name+2); + } + uiDefBut(block, LABEL, 1, str, 150, 190, 150, 20, NULL, 0.0, 0.0, 0, 0, "Displays Active Object or Bone name"); + + /* Go through the list of constraints and draw them */ + xco = 10; + yco = 160; + + for (curcon = conlist->first; curcon; curcon=curcon->next) { + /* hrms, the temporal constraint should not draw! */ + if(curcon->type==CONSTRAINT_TYPE_KINEMATIC) { + bKinematicConstraint *data= curcon->data; + if(data->flag & CONSTRAINT_IK_TEMP) + continue; + } + /* Draw default constraint header */ + draw_constraint(block, conlist, curcon, &xco, &yco); + } + + if(yco < 0) uiNewPanelHeight(block, 204-yco); + + } +} + void do_effects_panels(unsigned short event) { Object *ob; @@ -1961,6 +2057,8 @@ static void object_panel_particles_motion(Object *ob) uiDefButS(block, NUM, B_CALCEFFECT, "Tex:", 75,10,75,20, &paf->timetex, 1.0, 10.0, 0, 0, "Specify texture used for the texture emission"); /* right collumn */ + uiDefIDPoinBut(block, test_grouppoin_but, ID_GR, B_CALCEFFECT, "GR:", 160, 155, 150, 20, &paf->group, "Limit Force Fields to this Group"); + uiBlockBeginAlign(block); uiDefBut(block, LABEL, 0, "Force:", 160,130,75,20, NULL, 0.0, 0, 0, 0, ""); uiDefButF(block, NUM, B_CALCEFFECT, "X:", 235,130,75,20, paf->force, -1.0, 1.0, 1, 2, "Specify the X axis of a continues force"); @@ -2235,6 +2333,7 @@ void object_panels() 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); object_panel_constraint("Object"); diff --git a/source/blender/src/buttons_shading.c b/source/blender/src/buttons_shading.c index 3b31009858f..d8121fd458f 100644 --- a/source/blender/src/buttons_shading.c +++ b/source/blender/src/buttons_shading.c @@ -3181,6 +3181,8 @@ static void material_panel_shading(Material *ma) uiDefButBitI(block, TOG, MA_RAYBIAS, 0, "Bias", 245,80,65,19, &(ma->mode), 0, 0, 0, 0, "Prevents ray traced shadow errors with phong interpolated normals (terminator problem)"); uiBlockEndAlign(block); + uiDefIDPoinBut(block, test_grouppoin_but, ID_GR, B_NOP, "GR:", 9, 55, 150, 19, &ma->group, "Limit Lighting to Lamps in this Group"); + uiDefButBitI(block, TOG, MA_RADIO, 0, "Radio", 245,55,65,19, &(ma->mode), 0, 0, 0, 0, "Enables material for radiosity rendering"); } diff --git a/source/blender/src/drawobject.c b/source/blender/src/drawobject.c index 3261c884ca6..92154d83348 100644 --- a/source/blender/src/drawobject.c +++ b/source/blender/src/drawobject.c @@ -222,7 +222,7 @@ static unsigned int colortab[24]= {0x0, 0xFF88FF, 0xFFBBFF, 0x403000, 0xFFFF88, 0xFFFFBB, 0x104040, 0x66CCCC, 0x77CCCC, - 0x101040, 0x5588FF, 0x88BBFF, + 0x104010, 0x55BB55, 0x66FF66, 0xFFFFFF }; @@ -3604,9 +3604,19 @@ void draw_object(Base *base, int flag) else colindex = 3; } else if(warning_recursive==1) { - if(base->flag & (SELECT+BA_WAS_SEL)) colindex = 7; + if(base->flag & (SELECT+BA_WAS_SEL)) { + if(G.scene->basact==base) colindex = 8; + else colindex= 7; + } else colindex = 6; } + else if(ob->flag & OB_FROMGROUP) { + if(base->flag & (SELECT+BA_WAS_SEL)) { + if(G.scene->basact==base) colindex = 11; + else colindex= 10; + } + else colindex = 9; + } } diff --git a/source/blender/src/drawview.c b/source/blender/src/drawview.c index d4654dd6718..04439c48f88 100644 --- a/source/blender/src/drawview.c +++ b/source/blender/src/drawview.c @@ -1702,6 +1702,7 @@ void do_viewbuts(unsigned short event) DAG_scene_sort(G.scene); DAG_object_flush_update(G.scene, ob, OB_RECALC_OB); allqueue(REDRAWVIEW3D, 1); + allqueue(REDRAWBUTSOBJECT, 0); } } break; diff --git a/source/blender/src/editgroup.c b/source/blender/src/editgroup.c index f55f07986a4..07b3258b776 100644 --- a/source/blender/src/editgroup.c +++ b/source/blender/src/editgroup.c @@ -58,61 +58,16 @@ #include <config.h> #endif -void set_active_group(void) +void add_selected_to_group(Group *group) { - /* with active object, find active group */ - Group *group; - GroupObject *go; - - G.scene->group= NULL; + Base *base; - if(BASACT) { - group= G.main->group.first; - while(group) { - go= group->gobject.first; - while(go) { - if(go->ob == OBACT) { - G.scene->group= group; - return; - } - go= go->next; - } - group= group->id.next; - } - } -} - - -void add_selected_to_group(void) -{ - Base *base= FIRSTBASE; - Group *group; - - if(BASACT==NULL) { - error("No active object"); - return; - } - - if(okee("Add selected to group")==0) return; - - if(G.scene->group==NULL) G.scene->group= add_group(); - - while(base) { + for(base=FIRSTBASE; base; base= base->next) { if TESTBASE(base) { - - /* each object only in one group */ - group= find_group(base->object); - if(group==G.scene->group); - else { - if(group) { - rem_from_group(group, base->object); - } - add_to_group(G.scene->group, base->object); - base->object->flag |= OB_FROMGROUP; - base->flag |= OB_FROMGROUP; - } + add_to_group(group, base->object); + base->object->flag |= OB_FROMGROUP; + base->flag |= OB_FROMGROUP; } - base= base->next; } allqueue(REDRAWVIEW3D, 0); @@ -121,52 +76,46 @@ void add_selected_to_group(void) void rem_selected_from_group(void) { - Base *base=FIRSTBASE; + Base *base; Group *group; - if(okee("Remove selected from group")==0) return; - - while(base) { + for(base=FIRSTBASE; base; base= base->next) { if TESTBASE(base) { - group= find_group(base->object); - if(group) { + while( (group = find_group(base->object)) ) { rem_from_group(group, base->object); - - base->object->flag &= ~OB_FROMGROUP; - base->flag &= ~OB_FROMGROUP; } + base->object->flag &= ~OB_FROMGROUP; + base->flag &= ~OB_FROMGROUP; } - base= base->next; } allqueue(REDRAWVIEW3D, 0); allqueue(REDRAWBUTSOBJECT, 0); } -void prev_group_key(Group *group) +void group_operation_with_menu(void) { - GroupKey *gk= group->active; - - if(gk) gk= gk->prev; - - if(gk==NULL) group->active= group->gkey.last; - else group->active= gk; - - set_group_key(group); -} - -void next_group_key(Group *group) -{ - GroupKey *gk= group->active; - - if(gk) gk= gk->next; + Base *base; + Group *group= NULL; + int mode; - if(gk==NULL) group->active= group->gkey.first; - else group->active= gk; + for(base=FIRSTBASE; base; base= base->next) { + if TESTBASE(base) { + group= find_group(base->object); + if(group) break; + } + } - set_group_key(group); + if(base) + mode= pupmenu("Groups %t|Add to current Group %x3|Add to New Group %x1|Remove from all Groups %x2"); + else + mode= pupmenu("Groups %t|Add to New Group %x1|Remove from all Groups %x2"); -} - - + if(mode>0) { + if(group==NULL) group= add_group(); + + if(mode==1 || mode==3) add_selected_to_group(group); + else if(mode==2) rem_selected_from_group(); + } +}
\ No newline at end of file diff --git a/source/blender/src/editipo.c b/source/blender/src/editipo.c index 34a6e2cfc69..c50597605d7 100644 --- a/source/blender/src/editipo.c +++ b/source/blender/src/editipo.c @@ -2352,7 +2352,6 @@ void common_insertkey(void) else if(ob->type==OB_LATTICE) strcat(menustr, "| %x6|Lattice%x7"); else if(ob->type==OB_CURVE) strcat(menustr, "| %x6|Curve%x7"); else if(ob->type==OB_SURF) strcat(menustr, "| %x6|Surface%x7"); - if(ob->flag & OB_FROMGROUP) strcat(menustr, "| %x6|Entire Group%x10"); } event= pupmenu(menustr); @@ -2363,14 +2362,6 @@ void common_insertkey(void) return; } - if(event==10) { - Group *group= find_group(ob); - if(group) { - add_group_key(group); - allqueue(REDRAWBUTSOBJECT, 0); - } - } - if (ob && (ob->flag & OB_POSEMODE)){ bPoseChannel *pchan; diff --git a/source/blender/src/editobject.c b/source/blender/src/editobject.c index da8dfc1d11b..894f787a2d2 100644 --- a/source/blender/src/editobject.c +++ b/source/blender/src/editobject.c @@ -62,6 +62,7 @@ #include "DNA_constraint_types.h" #include "DNA_curve_types.h" #include "DNA_effect_types.h" +#include "DNA_group_types.h" #include "DNA_image_types.h" #include "DNA_ipo_types.h" #include "DNA_key_types.h" @@ -102,6 +103,7 @@ #include "BKE_effect.h" #include "BKE_font.h" #include "BKE_global.h" +#include "BKE_group.h" #include "BKE_ipo.h" #include "BKE_key.h" #include "BKE_lattice.h" @@ -4184,6 +4186,7 @@ static void adduplicate__forwardModifierLinks(void *userData, Object *ob, Object { ID_NEW(*obpoin); } + void adduplicate(int noTrans) /* dtrans is 3 x 3xfloat dloc, drot en dsize */ { @@ -4219,7 +4222,14 @@ void adduplicate(int noTrans) BLI_addhead(&G.scene->base, basen); /* addhead: prevent eternal loop */ basen->object= obn; base->flag &= ~SELECT; - basen->flag &= ~OB_FROMGROUP; + + if(basen->flag & OB_FROMGROUP) { + Group *group; + for(group= G.main->group.first; group; group= group->id.next) { + if(object_in_group(ob, group)) + add_to_group(group, obn); + } + } if(BASACT==base) BASACT= basen; diff --git a/source/blender/src/editview.c b/source/blender/src/editview.c index 2376fe93619..458be9a0897 100644 --- a/source/blender/src/editview.c +++ b/source/blender/src/editview.c @@ -46,10 +46,11 @@ #include "DNA_action_types.h" #include "DNA_armature_types.h" -#include "DNA_meta_types.h" -#include "DNA_mesh_types.h" #include "DNA_curve_types.h" +#include "DNA_group_types.h" #include "DNA_lattice_types.h" +#include "DNA_meta_types.h" +#include "DNA_mesh_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" #include "DNA_screen_types.h" @@ -63,7 +64,9 @@ #include "BKE_armature.h" #include "BKE_depsgraph.h" #include "BKE_global.h" +#include "BKE_group.h" #include "BKE_lattice.h" +#include "BKE_main.h" #include "BKE_mesh.h" #include "BKE_utildefines.h" @@ -1034,8 +1037,6 @@ void set_active_base(Base *base) if(base) { /* signals to buttons */ redraw_test_buttons(base->object); - - set_active_group(); /* signal to ipo */ allqueue(REDRAWIPO, base->object->ipowin); @@ -1069,6 +1070,29 @@ void set_active_object(Object *ob) } } +static void select_all_from_groups(Base *basact) +{ + Group *group; + GroupObject *go; + int deselect= basact->flag & SELECT; + + for(group= G.main->group.first; group; group= group->id.next) { + if(object_in_group(basact->object, group)) { + for(go= group->gobject.first; go; go= go->next) { + if(deselect) go->ob->flag &= ~SELECT; + else go->ob->flag |= SELECT; + } + } + } + /* sync bases */ + for(basact= G.scene->base.first; basact; basact= basact->next) { + if(basact->object->flag & SELECT) + basact->flag |= SELECT; + else + basact->flag &= ~SELECT; + } +} + /* The max number of menu items in an object select menu */ #define SEL_MENU_SIZE 22 @@ -1342,6 +1366,9 @@ void mouse_select(void) deselectall_except(basact); basact->flag |= SELECT; } + else if(G.qual==(LR_SHIFTKEY|LR_ALTKEY)) { + select_all_from_groups(basact); + } else { if(basact->flag & SELECT) { if(basact==oldbasact) diff --git a/source/blender/src/filesel.c b/source/blender/src/filesel.c index 3b17f0c2c26..db4c981eba2 100644 --- a/source/blender/src/filesel.c +++ b/source/blender/src/filesel.c @@ -2534,7 +2534,7 @@ void main_to_filelist(SpaceFile *sfile) if( sfile->dir[0]==0) { /* make directories */ - sfile->totfile= 21; + sfile->totfile= 22; sfile->filelist= (struct direntry *)malloc(sfile->totfile * sizeof(struct direntry)); for(a=0; a<sfile->totfile; a++) { @@ -2545,24 +2545,25 @@ void main_to_filelist(SpaceFile *sfile) sfile->filelist[0].relname= BLI_strdup(".."); sfile->filelist[1].relname= BLI_strdup("."); sfile->filelist[2].relname= BLI_strdup("Scene"); - sfile->filelist[3].relname= BLI_strdup("Object"); - sfile->filelist[4].relname= BLI_strdup("Mesh"); - sfile->filelist[5].relname= BLI_strdup("Curve"); - sfile->filelist[6].relname= BLI_strdup("Metaball"); - sfile->filelist[7].relname= BLI_strdup("Material"); - sfile->filelist[8].relname= BLI_strdup("Texture"); - sfile->filelist[9].relname= BLI_strdup("Image"); - sfile->filelist[10].relname= BLI_strdup("Wave"); - sfile->filelist[11].relname= BLI_strdup("Lattice"); - sfile->filelist[12].relname= BLI_strdup("Lamp"); - sfile->filelist[13].relname= BLI_strdup("Camera"); - sfile->filelist[14].relname= BLI_strdup("Ipo"); - sfile->filelist[15].relname= BLI_strdup("World"); - sfile->filelist[16].relname= BLI_strdup("Screen"); - sfile->filelist[17].relname= BLI_strdup("VFont"); - sfile->filelist[18].relname= BLI_strdup("Text"); - sfile->filelist[19].relname= BLI_strdup("Armature"); - sfile->filelist[20].relname= BLI_strdup("Action"); + sfile->filelist[3].relname= BLI_strdup("Group"); + sfile->filelist[4].relname= BLI_strdup("Object"); + sfile->filelist[5].relname= BLI_strdup("Mesh"); + sfile->filelist[6].relname= BLI_strdup("Curve"); + sfile->filelist[7].relname= BLI_strdup("Metaball"); + sfile->filelist[8].relname= BLI_strdup("Material"); + sfile->filelist[9].relname= BLI_strdup("Texture"); + sfile->filelist[10].relname= BLI_strdup("Image"); + sfile->filelist[11].relname= BLI_strdup("Wave"); + sfile->filelist[12].relname= BLI_strdup("Lattice"); + sfile->filelist[13].relname= BLI_strdup("Lamp"); + sfile->filelist[14].relname= BLI_strdup("Camera"); + sfile->filelist[15].relname= BLI_strdup("Ipo"); + sfile->filelist[16].relname= BLI_strdup("World"); + sfile->filelist[17].relname= BLI_strdup("Screen"); + sfile->filelist[18].relname= BLI_strdup("VFont"); + sfile->filelist[19].relname= BLI_strdup("Text"); + sfile->filelist[20].relname= BLI_strdup("Armature"); + sfile->filelist[21].relname= BLI_strdup("Action"); qsort(sfile->filelist, sfile->totfile, sizeof(struct direntry), compare_name); } else { diff --git a/source/blender/src/header_oops.c b/source/blender/src/header_oops.c index 1da5dc6100f..a8f90b95ed8 100644 --- a/source/blender/src/header_oops.c +++ b/source/blender/src/header_oops.c @@ -1,20 +1,12 @@ /** - * header_oops.c oct-2003 - * - * Functions to draw the "OOPS Schematic" window header - * and handle user events sent to it. - * * $Id$ * - * ***** BEGIN GPL/BL DUAL LICENSE BLOCK ***** + * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. The Blender - * Foundation also sells licenses for use in proprietary software under - * the Blender License. See http://www.blender.org/BL/ for information - * about this. + * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -28,11 +20,11 @@ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. * - * The Original Code is: all of this file. + * The Original Code is: not all of this file anymore. * - * Contributor(s): none yet. + * Contributor(s): Blender Foundation. * - * ***** END GPL/BL DUAL LICENSE BLOCK ***** + * ***** END GPL LICENSE BLOCK ***** */ #include <stdlib.h> @@ -440,7 +432,7 @@ void oops_buttons(void) } #endif else { - uiDefButS(block, MENU, B_REDR, "Outliner Display%t|All Scenes %x0|Current Scene %x1|Visible Layers %x2|Same Types %x5|Selected %x3|Active %x4", xco, 0, 100, 20, &soops->outlinevis, 0, 0, 0, 0, ""); + uiDefButS(block, MENU, B_REDR, "Outliner Display%t|All Scenes %x0|Current Scene %x1|Visible Layers %x2|Groups %x6|Same Types %x5|Selected %x3|Active %x4", xco, 0, 100, 20, &soops->outlinevis, 0, 0, 0, 0, ""); } /* always do as last */ diff --git a/source/blender/src/header_view3d.c b/source/blender/src/header_view3d.c index 2b448348034..fbea7637dd1 100644 --- a/source/blender/src/header_view3d.c +++ b/source/blender/src/header_view3d.c @@ -742,7 +742,7 @@ void do_view3d_select_object_groupedmenu(void *arg, int event) case 2: /* Immediate Children */ case 3: /* Parent */ case 4: /* Objects on Shared Layers */ - select_group((short)event); + select_grouped((short)event); break; } allqueue(REDRAWVIEW3D, 0); diff --git a/source/blender/src/outliner.c b/source/blender/src/outliner.c index 76ab56fb574..c4c11a4c294 100644 --- a/source/blender/src/outliner.c +++ b/source/blender/src/outliner.c @@ -39,6 +39,7 @@ #include "DNA_camera_types.h" #include "DNA_image_types.h" #include "DNA_ipo_types.h" +#include "DNA_group_types.h" #include "DNA_key_types.h" #include "DNA_lamp_types.h" #include "DNA_material_types.h" @@ -65,6 +66,7 @@ #include "BKE_material.h" #include "BKE_modifier.h" #include "BKE_screen.h" +#include "BKE_scene.h" #include "BKE_utildefines.h" #include "BIF_butspace.h" @@ -768,6 +770,23 @@ static void outliner_build_tree(SpaceOops *soops) } outliner_make_hierarchy(soops, &soops->tree); } + else if(soops->outlinevis == SO_GROUPS) { + Group *group; + GroupObject *go; + + for(group= G.main->group.first; group; group= group->id.next) { + te= outliner_add_element(soops, &soops->tree, group, NULL, 0, 0); + tselem= TREESTORE(te); + + for(go= group->gobject.first; go; go= go->next) { + ten= outliner_add_element(soops, &te->subtree, go->ob, te, 0, 0); + ten->directdata= NULL; + } + outliner_make_hierarchy(soops, &te->subtree); + /* clear id.newid, to prevent objects be inserted in wrong scenes (parent in other scene) */ + for(go= group->gobject.first; go; go= go->next) go->ob->id.newid= NULL; + } + } else if(soops->outlinevis == SO_SAME_TYPE) { Object *ob= OBACT; if(ob) { @@ -1794,22 +1813,29 @@ static void object_select_cb(TreeElement *te, TreeStoreElem *tselem) { Base *base= (Base *)te->directdata; - base->flag |= SELECT; - base->object->flag |= SELECT; + if(base==NULL) base= object_in_scene((Object *)tselem->id, G.scene); + if(base) { + base->flag |= SELECT; + base->object->flag |= SELECT; + } } static void object_deselect_cb(TreeElement *te, TreeStoreElem *tselem) { Base *base= (Base *)te->directdata; - base->flag &= ~SELECT; - base->object->flag &= ~SELECT; + if(base==NULL) base= object_in_scene((Object *)tselem->id, G.scene); + if(base) { + base->flag &= ~SELECT; + base->object->flag &= ~SELECT; + } } static void object_delete_cb(TreeElement *te, TreeStoreElem *tselem) { Base *base= (Base *)te->directdata; + if(base==NULL) base= object_in_scene((Object *)tselem->id, G.scene); if(base) { // check also library later if(G.obedit==base->object) exit_editmode(2); @@ -2121,6 +2147,8 @@ static void tselem_draw_icon(float x, float y, TreeStoreElem *tselem, TreeElemen BIF_draw_icon(x, y, ICON_NLA); break; case ID_TXT: BIF_draw_icon(x, y, ICON_SCRIPT); break; + case ID_GR: + BIF_draw_icon(x, y, ICON_CIRCLE_DEHLT); break; } } } diff --git a/source/blender/src/previewrender.c b/source/blender/src/previewrender.c index 8604219387f..3667b170270 100644 --- a/source/blender/src/previewrender.c +++ b/source/blender/src/previewrender.c @@ -54,6 +54,7 @@ #include "render.h" #include "mydevice.h" +#include "DNA_group_types.h" #include "DNA_texture_types.h" #include "DNA_world_types.h" #include "DNA_camera_types.h" @@ -1186,9 +1187,9 @@ void BIF_previewrender(SpaceButs *sbuts) init_render_world(); preview_init_render_textures(la->mtex); - R.totlamp= 0; + RE_add_render_lamp(ob, 0); /* 0=no shadbuf or tables */ - lar= R.la[0]; + lar= ((GroupObject *)R.lights.first)->lampren; /* exceptions: */ lar->spottexfac= 1.0f; @@ -1361,11 +1362,10 @@ void BIF_previewrender(SpaceButs *sbuts) uiPanelPop(block); - if(la) { - if(R.totlamp) { - MEM_freeN(R.la[0]); - } - R.totlamp= 0; + if(lar) { + MEM_freeN(lar); + MEM_freeN(R.lights.first); + R.lights.first= R.lights.last= NULL; } } diff --git a/source/blender/src/space.c b/source/blender/src/space.c index 73552449fba..32c1feb9718 100644 --- a/source/blender/src/space.c +++ b/source/blender/src/space.c @@ -577,31 +577,10 @@ static void select_parent(void) /* Makes parent active and de-selected OBACT */ } } - -void select_group_menu(void) -{ - char *str; - short nr; - - /* make menu string */ - - str= MEM_mallocN(160, "groupmenu"); - strcpy(str, "Select Grouped%t|Children%x1|" - "Immediate Children%x2|Parent%x3|" - "Objects on Shared Layers%x4"); - - /* here we go */ - - nr= pupmenu(str); - MEM_freeN(str); - - select_group(nr); -} - -void select_group(short nr) +void select_grouped(short nr) { Base *base; - + if(nr==4) { base= FIRSTBASE; while(base) { @@ -623,6 +602,27 @@ void select_group(short nr) allqueue(REDRAWIPO, 0); } +static void select_grouped_menu(void) +{ + char *str; + short nr; + + /* make menu string */ + + str= MEM_mallocN(160, "groupmenu"); + strcpy(str, "Select Grouped%t|Children%x1|" + "Immediate Children%x2|Parent%x3|" + "Objects on Shared Layers%x4"); + + /* here we go */ + + nr= pupmenu(str); + MEM_freeN(str); + + select_grouped(nr); +} + + static unsigned short convert_for_nonumpad(unsigned short event) { if (event>=ZEROKEY && event<=NINEKEY) { @@ -1262,10 +1262,9 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt) break; case GKEY: - /* RMGRP if(G.qual & LR_CTRLKEY) add_selected_to_group(); - else if(G.qual & LR_ALTKEY) rem_selected_from_group(); */ - if((G.qual==LR_SHIFTKEY)) - select_group_menu(); + if(G.qual & LR_CTRLKEY) group_operation_with_menu(); + else if((G.qual==LR_SHIFTKEY)) + select_grouped_menu(); else if(G.qual==LR_ALTKEY) { if(okee("Clear location")) { clear_object('g'); |