-
JayG 1,164 posts
Any idea if it's possible to find the pixel (horizontal) position of a frame/number in the timeline?
This cool idea I have in mind requires finding the above stated information. For instance, say my frame range is set to 0-100 and I want to find the horizontal pixel position of frame 50.
The script emulates the "marker" system in after effects. I have everything working but there is no visual representation of the markers, just what's listed in a small UI I made. I'm okay with how it works now, and the visual markers are kind of a long-shot, but it would be cool to make if it's possible.
I'd probably create a dynamic rollout system that creates a little borderless rollout at the location of the frame.
I'm fighting against screen resolution, UI setup, frame range, multiple monitors, etc. Probably not worth it, but it's a cool idea.
-
ivanisavich 4,196 posts
Not sure I understand....horizontal pixel position of what?
-
JayG 1,164 posts
Trying to find the pos of any given frame on the timeline. So if I wanted to create a rollout positioned relative to where say f50 was. Ideally I could calculate it and figure out something like, okay this frame on the timeline is located at pos:[876, 1200] and place my marker there.
It's a pretty ridiculous thing to try and do really, but man it would be so sweet if it worked.
-
JayG 1,164 posts
This is what I'd ideally like to be able to accomplish, something along those lines.
-
ivanisavich 4,196 posts
Ooooooooh...haha. Yea...only way to do that would be to do the following, I guess:
a) measure position of timeline on screen (literally, count pixels from left/top of screen to timeline)
b) measure # of pixels between ticks
c) get start frame range, end frame range
d) find position of desired tick based on position of timeline and frame# * pixels between ticks
Not something you're going to be able to accomplish, I think...for many reasons. One would be that when you change the timeline duration, the space between ticks changes. So as soon as you change the frame range, that whole system goes out the window :/
-
JayG 1,164 posts
Right, I had the same thoughts. I could set it up easily for personal use I think, but to create it dynamically based on a users personal setup is probably out of the question.
I had a thought last night that I could create a dummy object or a hidden piece of geometry and just use keyframes. Have the dummy linked to the tool so that it places a keyframe on each "marker". But still it doesn't solve the problem of having something visual there for you while you're working with other objects.
-
JayG 1,164 posts
Well I created a dummy object, and tied it into the script so that when a marker is added it adds a keyframe to the dummy at that frame. The dummy is then hidden and frozen so it can't be accidentally selected. You then have a button on the rollout to "toggle markers" which selects the dummy object to show you (as keyframes) where your markers are on the timeline. The entire point was to get a visual representation of a marker instead of having to think in numbers and frames. As an artist for me I like to look the entire timeline and break it down into chunks and sections based on things other than just frames, so having these visual cues helps a lot.
Anyway, it works. =) Got a few more tweaks and tests to do then I'll post what I have so far.