Notifications
Clear all

[Closed] Select objects with scripted controllers

I am getting some script controller errors but cant find the object containing them. So I was thinking if I can select all the objects containing scripted controllers I would be able to find out which ones are throwing the errors or at least narrow it down. Anybody know how to select objects with scripted controllers?

8 Replies
1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

this function returns list of all script controllers grouped by class and list of dependent nodes for every script controller. Select dependent nodes is an option. List of script controller classes is an option…


fn scriptedControllers list: selectnodes:off =
(
 script_controllers = #(float_script, point3_script, position_script, rotation_script, scale_script, transform_script)
 if list == unsupplied do list = script_controllers
 track_data = for class in list where (tracks = getclassinstances class).count > 0 collect 
 (
  data = for c in tracks collect 
  (
   nodes = refs.dependentnodes c
   if selectnodes do selectmore nodes
   #(c, nodes)
  )
  #(class, data)
 )
 track_data
)
 
[i]-- all script controllers in scene, select nodes OFF[/i]
scriptedControllers()
 
[i]-- only position script controllers, select nodes ON[/i]
scriptedControllers list:#(position_script) selectnodes:on
 

You’ll have to loop through the objects in the scene and in that loop find out if the object contains a script controller:

e.g.

Objs = for o in objects where o.position.controller == position_Script collect o
select Objs

BUT: Every keyable property of an object can be controlled by a script and there are six different script controllers (Position, Rotation, Scale, Point3, Float and Transform), so you’ll have many properties to check and to choose the correct controller for each…depending on your scene it might be faster to go through the curve editor and look for them there…

If you have max 2008 you can try this out. It loops through every script controller type and grabs nodes that are dependent on it (normally the ones that have the script controller). If I missed any script controller classes, you can just append it to the array. The main issue with Piflik’s code is that it won’t get anything that’s under list controllers.

(
  	objectsWithScripts = #()
  	scriptClasses = #(position_script, rotation_script, float_script, scale_script, transform_script)
  	for scr in scriptClasses do
  	(
  		scriptCons = (getClassInstances scr)
  		for n in scriptCons do
  		(
  			nodes = (refs.dependentNodes n)
  			for obj in nodes do appendIfUnique objectsWithScripts obj
  		)
  	)
  	
  	format "There are % objects with script controllers 
" objectswithScripts.count
  	select objectsWithScripts
  )

Sweet works perfectly thanks. Still didnt find my problem though. I am starting to think that the scripts are in a phatom controller or somthing any ideas on how I can find them?

 PEN

PEN Rigging Utils will find controllers of any type, it will not work in 64 bit machines how ever as it is still using active x.

PEN, I downloaded and installed you rigging utils. but the Edit Controllers section keeps throwing up an error when I try to use it.

the error states – Unknown property: “controller” in undefined. with this section of code highlighted if (findItem (getTypesFn()) (classOf search.controller)) != 0 then

Any idea of what I am doing wrong?

Ah looks like I spoke too soon. It was the daylight system and a photometric light in my scene that where throwing the errors. I hid them and used selected instead of scene and I got the list of controllers.

I have become pretty dependent and on these tools since I first heard of them on this thread. I have since moved to 64bit and can no longer use them. Any plan for a 64 bit version soon?