PDA

View Full Version : Is it possible to make a shift camera script in python?



lertola2
02-17-2014, 06:53 PM
I asked on the lscript forum if it was possible to make a script the sets up a shift camera. (http://forums.newtek.com/showthread.php?140181-Help-with-creating-a-new-camera-script). xchrisx kindly pointed out two possible ways to achieve this but they both seem like workarounds and not how I imagined the script would work. Does any one know if it is possible in python to create a shift camera and directly set its parameters? I would like to write a script that reads a perspectives camera's limited region information and creates a matching shift camera. I have the math for this working in an Excel spread sheet.

Thanks for any help or advice,
-Joe

richhelvey
02-17-2014, 07:50 PM
You can make a camera through scripting, but I don't think there's any way to get at the parameters you want to access directly - unless you'd be OK with having the script write a new scene file for you that you could then load. Theoretically, you could write a script that would load the new scene for you, but then you run into issues of making sure all the objects are saved, etc, so it's probably best to do the loading manually.

Hmm, another potential option would be to have the script write anew scene file, that only includes a camera, and then loadFromScene the camera it just saved. I'll have to try that. It "should" work. If I get some free time, I'll try it and let you know.

sami
02-17-2014, 09:50 PM
Hmm, another potential option would be to have the script write anew scene file, that only includes a camera, and then loadFromScene the camera it just saved. I'll have to try that. It "should" work. If I get some free time, I'll try it and let you know.

Good idea. This is exactly what I was going to suggest. It might be "safe" since you aren't unloading anything without saving maybe, and it should be quick since you can create the scene file on disk quickly and then loadfromscene it. This might be fast enough to get the feel he is after. It should also be possible from Lscript too.

lertola2
02-18-2014, 06:16 PM
Good idea. This is exactly what I was going to suggest. It might be "safe" since you aren't unloading anything without saving maybe, and it should be quick since you can create the scene file on disk quickly and then loadfromscene it. This might be fast enough to get the feel he is after. It should also be possible from Lscript too.

Is it possible to load an item from a scene programmatically without the user having to choose anything?

xchrisx
02-18-2014, 06:33 PM
Is it possible to load an item from a scene programmatically without the user having to choose anything?

Some things you can load in without the user interaction (at least in Lscript via the LoadElementsFromScene). I believe lights cameras and models can be imported, however things like image filters, pixel filters, and textured environments I believe have to be manually selected in the normal loadfromscene prompt. Not sure what the equivalent is in python, but the command in Lscript to load the camera is :


AutoConfirm(1);
CommandInput("LoadElementsFromScene 4 temp.lws");
AutoConfirm(0);

-chris