11
$\begingroup$

just want to discuss the better way to filter certain object(s) (either by types or by names, etc) based on a rough selection. For example, I got a crowded downtown scene, there are meshes, lamps, cameras, speakers along the street, and I want to select all the lamps and cameras for further editing. Is there a better way to filter them after a rough selection?

PS: Some solutions are not ideal for the certain case:

1> Cannot use "Hide". This works with simple one, however, some things have been hidden before, and I don't want to show them back together after this.)

2> Cannot filter by moving to a single/empty scene, This works with simple projects, but all objects within the rough selection came from multiple scenes, it would be not easy to bring them back to their individual scenes after this.

3> Cannot use "Local View", since I'm already in it.

$\endgroup$
  • $\begingroup$ Thanks guys, I think we've already had so many tricks and solutions for various of cases, not just the specific one I took for instance. Conclusion: It seems that a "sub-level type filter" system for existing selection, or either in Outliner, would be quite straight-forward and useful in cases like this. $\endgroup$ – Leon Cheung Aug 7 '13 at 17:02
5
$\begingroup$

You may be in Local View but each 3D View can have it's own. So…

  1. Split 3D View.
  2. View | View Global/Local (Numpad /).

    This will limit your view and selections operations the those included in the initial selection.

  3. Select desired objects:

  4. Rejoin frames.
$\endgroup$
  • $\begingroup$ Could you please combine your two answers? $\endgroup$ – CharlesL Aug 7 '13 at 20:37
  • $\begingroup$ See here for why I'm not going to. I had planned on removing the other one though. ;) $\endgroup$ – Aldrik Aug 7 '13 at 21:19
  • $\begingroup$ Ah, now it's crystal clear. I'll change my mind to choose your answer. But I have to say that both yours and zeffii's way are really nice to meet my needs. But I bet yours work nicely with both names and types (although I believe coding way can certainly wotk this out, too). It's a tough decision to make. lol Thanks a lot for your image. $\endgroup$ – Leon Cheung Aug 8 '13 at 13:58
6
$\begingroup$

Use the Outliner area to filter by type:

  1. Change the Outliner's display type to Same Types, to filter by type similar to last selected object,
  2. Press A to highlight all items, or LMB on empty part of a line to highlight individual item.
  3. Press RMB on the Outliner, then click Select to select all highlighted items. You can also directly select/deselect an item by clicking LMB or Shift-LMB on its icon.

Use the Outliner's live search feature to filter by name. Even though a little trickier because it also matches object data, vertex groups, etc., selection using it can still be made easier if combined with some Outliner display types like Visible Layers, Selected, or Same Types.

Use the Outliner's Selected display type to prune existing selections.

Maybe those solutions aren't quite what you're looking for, but it's easy enough to try and still very useful to manage complex scenes.

$\endgroup$
  • $\begingroup$ Yep, Adhi, they are all useful tricks for selection, but as you said, not quite meet my needs. Except one thing: I bet the first one is suitable to do exclusive selection, which would possibly useful if one or two types needs to be excluded from the current selection. $\endgroup$ – Leon Cheung Aug 7 '13 at 16:41
5
$\begingroup$

If you have more elaborate filter criteria than the Outliner can handle, then perhaps a script is needed. The core of the working code would be, for one scene:

import bpy

# if you have a rough selection
for obj in bpy.context.selected_objects:
    if obj.type not in {'CAMERA', 'LAMP'}:
        obj.select = False

but if you have multiple scenes going on, something like this may be useful.

for scene in bpy.data.scenes:
    for obj in scene.objects:
        if obj.type not in {'CAMERA', 'LAMP'}:
            obj.select = False        

Those two snippets will de-select only those objects that are not of type CAMERA or LAMP. It is possible to subscript bpy.data.scenes if you have 6 scenes but want to focus only on two you might write:

import bpy

for scene in bpy.data.scenes:

    # we skip scenes if they are not in this set
    if scene.name not in {'Scene', 'Scene.001'}:
        continue

    for obj in scene.objects:
        if obj.type not in {'CAMERA', 'LAMP'}:
            obj.select = False  
$\endgroup$
  • $\begingroup$ Thanks, zeffii, I have to admit that the first one is exactly what I want to accompolish. So, the best way finally leads to coding, huh? :). I bet your way is the perfect one. Thanks for your comprehensive solutions. (although less fun for those who are not familiar with coding. :P). $\endgroup$ – Leon Cheung Aug 7 '13 at 16:39
  • $\begingroup$ If all the other UI methods aren't doing it for you, and you know you understand them -- then yeah, it might be time to write the occasional script. That's how it starts. $\endgroup$ – zeffii Aug 7 '13 at 16:55
2
$\begingroup$

My current solution (without coding) is:

  1. Make the rough selection (it doesn't matter whether the last selected one is the type you want to filter);
  2. Ctrl G twice to create two "temp" groups based on the selection, name them as "temp_lamp_filter" and "temp_camera_filter" or whatever you want, of course;
  3. Press A to deselect all, then select any lamp in the scene (needn't be within that group), Shift G > "Type", then Ctrl I, then Ctrl Alt G > "temp_lamp_filter";
  4. Repeat last step for cameras;
  5. In Outliner, change filter to "Groups", hold down Shift and select both groups, which will form the final filtered result. Keep or delete them after editing as you wish.

Advantage: Can be universal to solve my case (or any case); Nice for those who know little about coding.

Disadvantage: Less effective (e.g. than the coding way suggested by zeffii).

$\endgroup$
0
$\begingroup$

You can use the shortcut ShiftG. Despite it's name is Select Grouped, it actually will select similar objects (in object mode) or similar vertices/edges/faces in edit mode based upon the criteria you select.

To do what you are asking:

  1. Do your rough selection (making sure to make a lamp the active object)
  2. Press ShiftG and select Type
$\endgroup$
  • $\begingroup$ Sorry but I'm afraid Shift G work for all objects within the scene, not just for the rough selection, even for the hidden ones. Correct me if I'm wrong. Thanks CharlesL :) $\endgroup$ – Leon Cheung Aug 7 '13 at 16:46
  • $\begingroup$ Ah, you're right. However, there is another option to select by Lamp Type if that is any use. $\endgroup$ – CharlesL Aug 7 '13 at 16:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.