Notifications
Clear all
[Closed] find specific controller in a node
Oct 26, 2012 5:02 pm
I need to know if an object has applied a path controller and its position among all other tracks.
What is the fastest and safest way to do this?
Thanks in advance
6 Replies
2 Replies
not sure that it’s a fastest way but most informative:
getclassinstances PathConstarint astrackviewpick:on
Oct 26, 2012 5:02 pm
if classof $.position.controller == Path_Constraint do messagebox “ahoi”
1 Reply
To collect all scene objects with assigned PathConstraint controller you can use this
(
PathConstraintObjArr = #()
for obj in objects where classof obj[3].track == prs do
(
case classof obj[3][1].track of
(
(position_list): for i = 1 to obj[3][1].count where classof obj[3][1][i].track == path_constraint do append PathConstraintObjArr obj
(path_constraint): append PathConstraintObjArr obj
)
)
PathConstraintObjArr
)
Or if you want to check single object then
fn checkForPC obj = if classof obj[3].track != prs then false else
(
case classof obj[3][1].track of
(
(position_list):
(
tempArr = (for i = 1 to obj[3][1].count where classof obj[3][1][i].track == path_constraint collect i)
if tempArr.count != 0 then true else false
)
(path_constraint): true
default:false
)
)
Oct 26, 2012 5:02 pm
You can do this too.
Select all the objects that might have a path constraint and this script will keep in your selection only the objects that have somewhere a path constraint. It loops it self until it pass all the objects or untill it finds a path constraint.
pathCollection = #()
fn checkForPathConstraint myController isTrue myObj =
(
if not isTrue AND classof myController == path_Constraint then
(
isTrue = true; appendifunique pathCollection myObj
)
else if not isTrue AND classof myController == position_list then
(
for i=1 to myController.count do checkForPathConstraint myController[i].controller false myObj
)
)
for o in selection where classof o.transform.controller == prs do (checkForPathConstraint o.position.controller false o )
select pathCollection