[Closed] Script Controller Evaluation Time
I have a simple script that checks if the viewport being rendered is from a certain camera. If it is, the script changes the material ID of an object. That works fine. The trouble is the script only evaluates when the frame changes while rendering. So if I’m working in a file and switch to the camera to render frames 1-10, the first frame will have the wrong ID. When the animation moves on to frame 2, the script evaluates and the ID is right for the rest of the animation.
If I’m thinking ahead, I can just toggle between frames while looking through the camera to make sure the script evaluates, then send the render. I’d rather it be fool proof, though, and just run every time I send an animation. I’ve been trying to use #prerender, but I can’t seem to get it to work in the script controller. I think it could also work if the script would run every time the viewport changes, but I can’t figure out how to do that.
Any advice would be greatly appreciated. Thanks in advance.
Oh, and if it helps, here is the script where “cam” is the specific camera.
if viewport.getCamera() == cam then Material_ID = 1 else Material_ID = 2