bpy.ops.object.select_gouped not playing nice

Now I do know 2.5 python stuff isn’t 100% ready for primetime quite yet but after trying it I just can’t go back to 2.49 no more.
At the moment i’m trying to write a script that does something with the siblings of a selected object. Unfortunately if i use;


bpy.ops.object.select_grouped(extend=True type="SIBLINGS") #(extend = False has the same result)

it doesn’t get the desired result. ( there is a change in that the object itself is now still selected but doesn’t have the big colored arrows showing anymore)

can’t find any examples online either… any help would be great!

Here is a section dealing with objects and parents from my 2.5 BlendText library.

Check out returnChildren, it might help you out…


############################################################################
# Code for returning objects, groups or meshes.
############################################################################
def fetchIfObject (passedName= ""):
    try:
        result = bpy.data.objects[passedName]
    except:
        result = None
    return result

def fetchIfMesh(passedName=""):
    try:
        result = bpy.data.meshes[passedName]
    except:
        result = None
    return result

def fetchIfCurve (passedCurveName):
    result = None
    try:
        result = bpy.data.curves[passedCurveName]
    except:
        pass
    return result
    
def fetchIfText3D (passedName):
    result = None
    tempCurve = fetchIfCurve(passedName)
    try:
        n = tempCurve.active_textbox
        #No error, this must be a font curve.
        result = tempCurve
    except:
        #Error, this is a non-font curve.
        pass
    return result

def fetchIfLight (passedLightName):
    result = None
    try:
        result = bpy.data.lamps[passedLightName]
    except:
        pass
    return result

def returnScene ():
    return bpy.context.scene

def returnChildren(ob):
    return [ob_child for ob_child in bpy.context.scene.objects if ob_child.parent == ob]

def isObjectLinkedToScene (passedObjectName):
    localScene = returnScene()
    result = False
    listOfNames = returnObjectsInScene(localScene)
    if passedObjectName in listOfNames:
        result = True
    return result

def returnObjectsInScene (passedScene):
    #Fetch a list with the name of all objects in the scene.
    try:
        obs = passedScene.objects
        result = [o.name for o in obs]
    except:
        result = None
    return result

Thanks but that doesn’t quite help me in what I was trying to do. returnchildren() will return the children of an object, but I was trying to find its siblings (other objects that are children of the same parent)

I ended up creating ‘groups’ with the siblings and that worked as i was able to call the fellow groupmembers with an easy method ( bpy.ops.object.select_grouped(extend=True, type=‘GROUP’) )
Not quite as elegant as I would like but it still works well enough.

:slight_smile:

D