Select linked particles (Shift+L)
authorCampbell Barton <ideasman42@gmail.com>
Thu, 24 Jan 2008 21:32:36 +0000 (21:32 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 24 Jan 2008 21:32:36 +0000 (21:32 +0000)
source/blender/src/editobject.c

index 2e96ea464faf348e9518b38f3b63b4fe781fe2c4..4e90fbac5acd12758b930ffe4d9683a5f344ca11 100644 (file)
@@ -5142,7 +5142,7 @@ void selectlinks_menu(void)
        /* If you modify this menu, please remember to update view3d_select_linksmenu
         * in header_view3d.c and the menu in toolbox.c
         */
-       nr= pupmenu("Select Linked%t|Object Ipo%x1|ObData%x2|Material%x3|Texture%x4|DupliGroup%x5");
+       nr= pupmenu("Select Linked%t|Object Ipo%x1|ObData%x2|Material%x3|Texture%x4|DupliGroup%x5|ParticleSystem%x6");
        
        if (nr <= 0) return;
        
@@ -5165,6 +5165,7 @@ void selectlinks(int nr)
         * Current Material: 3
         * Current Texture: 4
         * DupliGroup: 5
+        * PSys: 6
         */
        
        
@@ -5190,6 +5191,9 @@ void selectlinks(int nr)
        else if(nr==5) {
                if(ob->dup_group==NULL) return;
        }
+       else if(nr==6) {
+               if(ob->particlesystem.first==NULL) return;
+       }
        else return;
        
        base= FIRSTBASE;
@@ -5218,6 +5222,7 @@ void selectlinks(int nr)
                                                                if(tex==mat1->mtex[b]->tex) {
                                                                        base->flag |= SELECT;
                                                                        changed = 1;
+                                                                       break;
                                                                }
                                                        }
                                                }
@@ -5230,6 +5235,25 @@ void selectlinks(int nr)
                                         changed = 1;
                                }
                        }
+                       else if(nr==6) {
+                               /* loop through other, then actives particles*/
+                               ParticleSystem *psys;
+                               ParticleSystem *psys_act;
+                               
+                               for(psys=base->object->particlesystem.first; psys; psys=psys->next) {
+                                       for(psys_act=ob->particlesystem.first; psys_act; psys_act=psys_act->next) {
+                                               if (psys->part == psys_act->part) {
+                                                       base->flag |= SELECT;
+                                                       changed = 1;
+                                                       break;
+                                               }
+                                       }
+                                       
+                                       if (base->flag & SELECT) {
+                                               break;
+                                       }
+                               }
+                       }
                        base->object->flag= base->flag;
                }
                base= base->next;