I don't yet fully understand how your code is designed to work, but are you sure the recursion bottoms out?
Basically, the recursion occurs in the functions StabilizeClockwise and StabilizeCounterclockwise:
Quote:
Originally Posted by Mini-Me
Code:
function StabilizeClockwise(clip currentandedgeswoven)
{ ...
# If current is not the best, recurse again using the best
return GScriptClip(currentandedgeswoven, """
return AverageLuma(currentandedgeswoven) == AverageLuma(bestandedgeswoven) ? currentandedgeswoven \
: StabilizeClockwise(currentandedgeswoven)
""", args = "currentandedgeswoven, bestandedgeswoven", local = True)
}
|
Perhaps it should be using
bestandedgeswoven on the recursive call?
Quote:
According to Gavino's GRunT thread, you should be able to call runtime functions within user functions called by runtime functions
|
What you are doing is slightly different, in that you are calling (G)ScriptClip itself recursively. I think this should work, but perhaps it's inefficient and unnecessary. Because of the ability to call runtime functions (eg AverageLuma) directly from a user function, you don't need to wrap the inner call inside ScriptClip or ConditionalFilter, as long as the function itself is called inside ScriptClip. But that would involve a redesign of your outer level function so that ScriptClip is called only once and all the recursion takes place inside it.