Local time / timelines

psonice's picture

Is there a sane way to manipulate the composition time or to change the start of timelines?

I have a case where I want to animate a camera path around some 3d (just cubes, don't get too excited ;) but this animation can be triggered at any time. I want the animation to start when the macro that contains it is enabled, which makes sense.. but it actually starts when the composition starts, and the timeline has therefore ended before it's supposed to start.

So is it possible to trigger the timeline patch at all? Or is there another way of using spline based animation (without coding splines in javascript if possible!) If not, is it possible to somehow control the time within a macro, so it effectively gets a local time when the macro gets enabled?

cwright's picture
not sure

I don't think the timeline patch can get manipulated externally without some hacks in place. It provides a pretty simple interface programatically, so I considered making a SuperTimeLine patch that would expose that interface, but I never got around to doing it. Without that, I think you're stuck with javascript for a while. Or you could make the timeline timebase external, and do some control that way (simpler js, if the curves are all constant).

smokris's picture
external timebase + stop watch

Yeah, I think the combination of setting "External Timebase" on the Timeline patch (right click on the patch to set this) and feeding the "Stop Watch" patch into it should do what you've described. (see attachment)

PreviewAttachmentSize
wow.qtz4.49 KB

yanomano's picture
Timed timeline done :)

I wanted to do that like you psonice but haven't take the time to do it... now it's done !...:)

Space bar : play /pause N : goto zero Drag mouse on X to forward or rewind

enjoy !

yanomano

PreviewAttachmentSize
timed timeline.qtz12.77 KB

psonice's picture
Thanks... yet again!

I'd totally forgotten about the patch time. Which is amazing thinking about it, because my composition is huge, heavily nested, with lots of split inputs, so I must have spent a LOT of time looking at that right-click menu!

Actually the local timebase works perfectly, as i'm using timelines on a 3d transform inside a lighting patch. Enabling/disabling the lighting patch (or the macro it's in, or any higher level macro) starts or resets the timer. This is perfect where you have a number of effects you want to stop and start - just put them in macros, turn them on and off, and you have nice easy fade in/out, animation, and all the rest!

Now, the big question - should I go back and redo the huge javascript timer thing with a huge number of IF statements turning on and of a big pile of stopwatches?

franz's picture
Having any logic in a patch

Having any logic in a patch is pain in the ass (for me) You end up with a ton of Conditional patches all around, and things get messy very quickly. I would personnally love to see an example javascript (as i'm no JS inclined) used as a logical brain. If you ever got the time to quickly code an example....

btw-- i just discovered that MaxMsp has a NeuralNetwork node... still exploring this hidden world, but i'm looking forward to use it as a brain controller.... any ideas or link or anything is welcome. (esp. QC related)

psonice's picture
Javascript is easier than you might think...

If you're just after a bit of logic, javascript is usually better, and if you just learn the 'relevant' bits, it's not hard to learn too. The main bits that are most useful are "if" and the operators (<, >, =, combinations of those and also with ! (not, as in != means not equal)).

It's mainly figuring out the logic in the first place that's hard I think. I'll see if I can tweak one of my nasty JS controllers into a decent example later, although it may be tomorrow as I have to interview people today.

franz's picture
thxx...

thx. There's no hurry tho', but it'll be interesting.

tobyspark's picture
my best friend: 'mathematical expression' patch.

franz - check out the sanity restoring 'mathematical expression' patch/node. its great because - you can name your inputs and it displays the equation in the titlebar thus making your patch readable - it supports boolean logic and the ternary operator

ie rather than having the logic patch for a not, get that node, type "!not" into its setting pane, and you've got a compact, readable boolean not node.

or try "(small < big)? 1 : 0" for a conditional to boolean. you'll get orange cords instead of yellow, but you'll actually be able to read your patch =]

toneburst's picture
How Useful...

Thanks for the tip Toby. Sounds like it could be really useful. I used to make logic-processing macros with Math patches, but this seems a much better way.

alx

Quartz Composer Blog: http://machinesdontcare.wordpress.com

Music Site: http://www.toneburst.net

psonice's picture
Quick + dirty javascript example

This is a quick example i made for experimenting with time. Hold the left mouse button down, and you can scratch the record (this would work a bit better with sound, feel free to try it if you have time) by moving the mouse up + down.

The javascript generates the time signal, which increments normally until you hold down the mouse button. Then it freezes time, and increment/decrements it as you move the mouse.

PreviewAttachmentSize
scratch.zip18.88 KB

cwright's picture
deja vu

That's pretty slick :) A few months ago, I did something similar, but attached to the wiimote's tilt value, so you could pause, rewind, and fastforward just by rotating the remote. Such an intuitive interface!

I also can't wait for sound support.. unfortunately, it's a lot of code, and some crazy stuff to get sound to not skip when the QC framerate jitters...

psonice's picture
Incorrect assumptions...

I'd assumed that you could pass the same time output to the movie downloader to control the audio. And yes, you can, but you get no audio until async mode is turned on. And that turns off the timebase options.. Boo!

yanomano's picture
Audio in QC

http://www.qcplugins.com/

have released Audio patches for reading audio (local or streaming) Didn't they work in leopard ?

yanomano.

cwright's picture
no idea

It looks like they stopped testing around 10.4.8 (my first ever mac came with that, so that was about a year ago ;), so I'm not sure if they work on Leopard.

I'm pretty sure they don't allow scratching and mixing and AU's/VST's, which is a shame (this is the functionality I'm aiming for before I consider QC audio usable).

yanomano's picture
Not on leopard...

You are right , it don't work on leopard... yanomano.

franz's picture
they don't allow scratching,

they don't allow scratching, they just allow to replay an audio file, exactly the same way you would do it under leopard with a movie (with embeded audio). No scratching, no external timebase.

This said, i'm pretty glad to know that we share the same opinion about QC audio.

franz's picture
thxx toby

thxx toby, i somehow managed to miss your post...

extremely useful, readable and compact. (too bad some nodes are so underdocumented..)

tobyspark's picture
undocumented...

...it was worse, in tiger that patch was a private one. ffs!

franz's picture
private category

btw, do you think there's any risk in using private patches ? I'm making a project (commercial) where i do make extensive use of the Hit Test patch, that is tagged as private. I could easily do a macro that does the same, but why hassle when there's already a node around. Do you think that private patches are tagged so because they tend to be unstable (or memory leaks.... that sort of stuff)... ?

cwright's picture
risks

I've found bugs in non-private patches, and haven't seen any private patches that are more unstable than normal ones. I think they're private for two reasons:

1) Apple likes to have a small advantage with QC over ordinary users.

2) Apple doesn't like the design of the private patches, and they're subject to change in the future, so people depending on them may find problems (just like with the unofficial API I guess) with future updates. I've not seen any huge problems with this between Leopard and Tiger so far, but some patches changed between the two in weird ways (javascript changed a lot, CI Filter changed a lot, some others).

You should be fine as far as stability and memory usage goes; structure sort leaks like a seive, and that's not even a private patch :) But when an update happens, you might need to redesign some parts.

I, personally, am a big fan of private patches :)

tobyspark's picture
ditto all that.

i simply couldn't live without 'signal' or 'log' either, they haven't made the jump to public with leopard.

psonice's picture
Ditto ditto

I really hope there's no major reason for keeping them private.. i'm using a lot of them in my current project, and it's going to get released.

Just out of interest, what's the biggest QC project done so far, in terms of complexity + number of patches? And is there any real limit on that? I'm using a pretty big amount of stuff, and I've not noticed any real issue with speed, although I'm making sure stuff that isn't needed is disabled until it's required. I've worked on it on a g4 powerbook while i was away, and i was surprised about how well it ran even there :)

franz's picture
sssig

signal is a godsend. never used log however : where's the QC log window ?

cwright's picture
complexity

QC's pretty good about skipping "dead" portions of the graph, so even very huge graphs can be quickly evaluated when large chunks are turned off.

itsthejayj, a few months back, mentioned having a composition on Tiger that took minutes to load, due to the number of nodes etc. I don't have a patch count for that composition, but I imagine it's several hundred.

With the diverse nature of QC's patches, the number of patches depends heavily on which ones you're using. chaining a few complex CIFilters on large images will kill performance, but at the opposite extreme you can have dozens of math and logic patches chained together without a noticeable performance hit.

psonice's picture
Patch count

There's a patch count in the performance graph panel of the viewer.

According to that though, my current composition has 1212 patches, so I'm not totally convinced it's accurate ;) It's certainly in the hundreds though. It only takes a second or two to load, even on my old 1.5ghz g4, although it then takes a few more seconds to generate textures and stuff before the action starts.

tobyspark's picture
ooh. that sounds like a challenge =]

that patch count is just active patches? maybe there's an xml way of reading the patches from the file. anyway, i have a heavyweight contender of a patch in the ford vj one =]

tobyspark's picture
omg...

omg. the log patch logs to both the console and to the log drawer thats revealed if you put the viewer window into debug mode (check the toolbar). same goes for the javascript log function - i just can't imagine writing serious javascript patches without it.

psonice's picture
Total patches.. maybe more ;)

The count in the performance pane is total patches, and I'm not convinced that it's not counting some patches twice. Either way, it now says I'm up to 1,481 patches. I've got a lot left to do yet too :) Then again, there's probably a lot I've added then changed my mind on that could be taken out.

We should have some challenges: most complex composition, slowest rendering, most unstable... =)