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:
Diffstat (limited to 'source/blender/src/editgroup.c')
-rw-r--r--source/blender/src/editgroup.c115
1 files changed, 32 insertions, 83 deletions
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