adamghering
08-16-2008, 02:11 AM
I am new to max script and I want to select a heirarchy of objects that have constraints on them....I have had some luck but have a problem that I can't quite resolve. Here is my script.
fn selectAllChildren =
(
for obj in selection do
(
if obj.children != undefined do
(
selectmore obj.children
)
)
)
selectAllChildren()
MyBones = selection
fn DelConstraint =
(
for each in selection do
(
each.pos.controller.delete 2
each.rotation.controller.delete 2
)
)
DelConstraint()
So if all the objects have *_list() controlllers it works great but if one of the objects in the heirarchy does not have constraints on it then the script throws and error.
I appended the script with an if statement like this
fn DelConstraint =
(
for each in selection do
(
if each.position.controller != Position_XYZ do
(
each.pos.controller.delete 2
each.rotation.controller.delete 2
)
)
)
DelConstraint()
But this does nothering to solve the problem. I am looking for a way to either cull any objects from my selection that do not have position or rotation constraints or those that do not have list controllers. any help would be appreciated.
Thanks
fn selectAllChildren =
(
for obj in selection do
(
if obj.children != undefined do
(
selectmore obj.children
)
)
)
selectAllChildren()
MyBones = selection
fn DelConstraint =
(
for each in selection do
(
each.pos.controller.delete 2
each.rotation.controller.delete 2
)
)
DelConstraint()
So if all the objects have *_list() controlllers it works great but if one of the objects in the heirarchy does not have constraints on it then the script throws and error.
I appended the script with an if statement like this
fn DelConstraint =
(
for each in selection do
(
if each.position.controller != Position_XYZ do
(
each.pos.controller.delete 2
each.rotation.controller.delete 2
)
)
)
DelConstraint()
But this does nothering to solve the problem. I am looking for a way to either cull any objects from my selection that do not have position or rotation constraints or those that do not have list controllers. any help would be appreciated.
Thanks
