ScriptSpot

Forum topic · General Scripting

Help Unselect Parent and(or) Children

By kredka · 2013-11-18

Description

Very simple questions:
I need two separate scripts with follow problems(things I dont know how to):
one)
How to deselect objects in my selection which are parents to any other objects

two)
How to deselect objects in my selection which are parents or children(just affected by any object)

I would be very gratefull for any help due to it's one of core elements in tool I'm working on

Comments (2)

kredka · 2013-11-18

Great, works fine. Thankyou.

miauu · 2013-11-18

Deselect all objects that are parent to any other objects. This includes objects that are children of other objects, but are parents of other objects.


(
	parentsArr = for o in selection where o.children.count != 0 collect o
	deselect parentsArr
)

Deselect all objects in selection that are parent or children of other object.


(
	parentsArr = for o in selection where (o.children.count != 0) or (o.parent != undefined) collect o
	deselect parentsArr
)