Heres what I need help with.

Say I have an Object in the Outliner, it has children. Some of the children in the outliner have the pointer (object is selectable/non) turned off. I need some of the objects selectable and some not for animation purposes

Right click>Select Hierarchy only selects the children objects that have "selectability" turned on. Same for Shift-G

When Duplicating the parent object, I want a way to have ALL of the children involved in the duplication, without having to go in and manually turn on "selectability" for the children objects who have it turned off. (and then have to manually revert all the ones who need to be reverted.)

I often forget that there are children objects and sometimes end up with duplicated objects that are missing some pieces...

Does this make sense?

thanks! jd

  • $\begingroup$ If you had a script turn on all the items to be selectable, would you need to disable them after duplication, both in the original and in the duplicated set? $\endgroup$ Jul 22, 2015 at 4:56

1 Answer 1


Here's my solution. The script starts with the selected item and iterates over each child object (recursively to include children of children). If the child object is set to non-selectable, it changes the object to selectable, adds a flag to the object for later, and also adds the object to the current selection.

After duplication of the group, the script iterates through both groups and checks for the flag set earlier. If it finds the flag, it make the object non-selectable again.

import bpy

def CheckSelectStatus(p):
    for c in p.children:
        c['hideSelectWasTrue'] = False
        if bpy.data.objects[c.name].hide_select == True:
            bpy.data.objects[c.name].hide_select = False
            c['hideSelectWasTrue'] = True
        c.select = True

def RestoreSelectStatus(p):
    for c in p.children:
        if c['hideSelectWasTrue'] == True:
            bpy.data.objects[c.name].hide_select = True


#get our selected parent object
p1 = bpy.context.active_object

#iterate through children and make selectable and select them                


p2Name = ""

#iterate through selected objects to find duplicated parent object
for obj in bpy.context.selected_objects:
    if obj.parent is None:
        p2Name = obj.name

#iterate through original group and disable selection

#iterate through duplicated group and disable selection       
p2 = bpy.data.objects[p2Name]
  • $\begingroup$ You are my hero!! $\endgroup$
    – jdjd
    Jul 23, 2015 at 3:23
  • $\begingroup$ To paraphrase Jack Nicholson in that movie.. "You make me wanna be a better scripter" This works perfectly. Have been knee deep in my project all day and your script has come in handy 20+ times already and saved me at leeasst a hour. How do we get this into the next version of Blender as a standard tool called "SuperDuperlicator"? thank much again Mr Todd. you the ant! $\endgroup$
    – jdjd
    Jul 23, 2015 at 3:27
  • $\begingroup$ Your welcome. Never been called "the ant" before! : ) $\endgroup$ Jul 23, 2015 at 3:52
  • $\begingroup$ Is a reference to a movie, (" Ants " I thiiink ) $\endgroup$
    – jdjd
    Jul 24, 2015 at 21:12
  • $\begingroup$ Is a line form that movie, (I think) All the kids I work with use it $\endgroup$
    – jdjd
    Jul 24, 2015 at 21:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .