PDA

View Full Version : Filtering animated objects.....


Fabiomussarela
07-25-2011, 03:17 PM
oh man, Iīm rusted......

I canīt figure an easy way to filter animated objects

I just want to select a bunch of objects and then filter the animated ones.....

Doesnīt matter which controller has the animation.... if the object has a key whenever it is, I need to filter it.

Thanks in advance :)

denisT
07-25-2011, 03:46 PM
a node is animated if any sub anim of this node has a key. go recursively trough all subs and check key existence.

fn isNodeAnimated node =
(
local animated = off
if iskindof node SubAnim and iscontroller (c = node.controller) do animated = (c.keys.count > 0)
if not animated do for k=1 to node.numsubs while not animated do animated = isNodeAnimated node[k]
animated
)
for node in selection where isNodeAnimated node collect node

Fabiomussarela
07-25-2011, 08:14 PM
Hi Denis, thanks a lot man :)

I thought something like that, using the has key logic, but I was wondering if there was an easyer way to do it cause I still donīt understand recursive functions...

Anyway thanks a lot :)

PEN
07-26-2011, 12:13 PM
Fabio, here is a brief description of recursion that might help as it is a simple example using hierarchies of objects.

http://www.penproductions.ca/tutorials/dotNet/treeView/dotNetTreeView.htm#recursiveFunctions

In a nut shell, a recursive function is a function that calls it self.

CGTalk Moderation
07-26-2011, 12:13 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.