1
$\begingroup$

I'm interested in animating the values of the Sun Beams compositing node based on the camera position. I've had success in the past following this tutorial

https://www.youtube.com/watch?v=6cOOEJ2p4ZM

Where you animate an image sequence of a dot where your sun is, import it as a movie clip and use it as a tracking marker to drive the values of the Sun Beam X/Y coordinates. Using

bpy.data.movieclips["ImageSequence"].tracking.tracks["TrackingPointName"].markers.find_frame(bpy.data.scenes["Scene"].frame_current).co.x

As a scripted expression.

I've had it work before, but now I can't get it to work at all. I even have it working on another older file (using Blender 3.0), but when I do the same thing in my current file (Blender 3.5), it fails to work.

I'm guessing there's something going on between the format of the code back in the 2.7x days where it was written, when I used the code in my own work, and now, but I don't know enough about scripting drivers to understand what. If anyone could provide some help as to how to get it working, I'd be grateful. Alternatively, a way to move the sun beams position based on the camera would be welcome too. As the movement is too complex to keyframe in by hand.

Here's a link to an example file (using Catbox since it has to include an image sequence/movie and you can't pack those into a Blend file, and Blend Exchange doesn't allow .zip files for some reason)

$\endgroup$
3
  • 1
    $\begingroup$ Hello. I think you should provide the blend file with all needed parts. One can download it via the video link, login etc. But you will attract much more people for your question if you provide it here yourself. $\endgroup$
    – lemon
    May 3, 2023 at 6:07
  • $\begingroup$ could it be your typo? You have "frame_curent" instead of "current" $\endgroup$
    – Black Fox
    May 4, 2023 at 3:47
  • $\begingroup$ That's just a typo in this post, not the actual file. Just gave a look and it's spelled correctly in the file. $\endgroup$
    – AxiDes
    May 4, 2023 at 7:09

1 Answer 1

1
$\begingroup$

From the file you provided, if you open the console window, you'll see:

Error in PyDriver: expression failed: bpy.data.movieclips["tracksequence"].tracking.tracks["TrackPoint"].markers.find_frame(bpy.data.scenes["Scene"].frame_current).co.y For target: (type=NodeTree, name="Compositing Nodetree", property=source, property_index=1)

Traceback (most recent call last): File "", line 1, in KeyError: 'bpy_prop_collection[key]: key "tracksequence" not found'

So simply replace:

bpy.data.movieclips["tracksequence"].tracking.tracks["TrackPoint"].markers.find_frame(bpy.data.scenes["Scene"].frame_current).co.y

by (.mp4 missing in the movie clip name):

bpy.data.movieclips["tracksequence.mp4"].tracking.tracks["TrackPoint"].markers.find_frame(bpy.data.scenes["Scene"].frame_current).co.y

And the driver works:

enter image description here

$\endgroup$
6
  • $\begingroup$ I'll concede that the code works in that file, meaning you found another typo. That typo doesn't exist in my main file, nor are there any typos. Yet it still doesn't work in my main file, despite copy/pasting the exact same code and replacing the names. In fact, it still doesn't work even when completely renaming the files (in windows) and tracking points to the ones in the above code. As a test, I brought the same files into a new .blend,used the same code and names and it worked just fine. I'm not sure where/how you're seeing that error in the console, but mine says nothing. $\endgroup$
    – AxiDes
    May 5, 2023 at 8:26
  • $\begingroup$ The code works just fine in new files, but refuses to work in my main one. So I'm not sure what's up. Can't really post the main file since it's too large, and I've already sent it for render, but I'd still like to figure out how to bring up the console to show the errors to try and figure out what's going on. When I bring up the console it says nothing, as said before. $\endgroup$
    – AxiDes
    May 5, 2023 at 8:28
  • $\begingroup$ How can we know in which aspects your main file differs from the file you provided? $\endgroup$
    – lemon
    May 5, 2023 at 9:44
  • $\begingroup$ Concerning the console, "window" menu then "toggle system console". $\endgroup$
    – lemon
    May 5, 2023 at 9:45
  • 1
    $\begingroup$ "It shouldn't differ at all.", ok, but most likely if one works and not the other, there is a difference somewhere. I think nobody can guess what is it without looking at the file (the error message is not accurate enough here). You should check all the names "tracksequence.mp4", "TrackPoint", "Scene" and make sure they are all defined in your main file. $\endgroup$
    – lemon
    May 6, 2023 at 7:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .