Switch cameras

Discussions concerning programming of SOFTIMAGE©
User avatar
Boris
Posts: 67
Joined: 25 May 2012, 14:35
Location: R&M

Switch cameras

Post by Boris » 06 Jul 2012, 20:46

Hi guys , tell me how to make the switch button for camera, so the camera switched to the upper left screen !?
Oops ,something went wrong :D

User avatar
Hirazi Blue
Administrator
Posts: 5113
Joined: 04 Jun 2009, 10:15

Re: Switch cameras

Post by Hirazi Blue » 06 Jul 2012, 20:55

Could you please try to explain a little better, what you mean by "the camera switched to the upper left screen"? At the moment this is unclear to me, making it very hard to help...
:-?
Stay safe, sane & healthy!

User avatar
Boris
Posts: 67
Joined: 25 May 2012, 14:35
Location: R&M

Re: Switch cameras

Post by Boris » 06 Jul 2012, 21:00

Hirazi Blue wrote:Could you please try to explain a little better, what you mean by "the camera switched to the upper left screen"? At the moment this is unclear to me, making it very hard to help...
:-?
I want to create a camera and attach them to objects and then switch between the cameras and so it was the upper-left viewport / i hope you understand me /
Oops ,something went wrong :D

User avatar
Hirazi Blue
Administrator
Posts: 5113
Joined: 04 Jun 2009, 10:15

Re: Switch cameras

Post by Hirazi Blue » 06 Jul 2012, 21:04

So you define two cameras beforehand and want a button to switch between them in the upper-left viewport? A script button like that obviously will have to know which cameras (names) to switch between.
Stay safe, sane & healthy!

User avatar
Boris
Posts: 67
Joined: 25 May 2012, 14:35
Location: R&M

Re: Switch cameras

Post by Boris » 06 Jul 2012, 21:07

Hirazi Blue wrote:So you define two camera beforehand and want a button to switch between them in the upper-left viewport?
Yeah, exactly !
Oops ,something went wrong :D

User avatar
Hirazi Blue
Administrator
Posts: 5113
Joined: 04 Jun 2009, 10:15

Re: Switch cameras

Post by Hirazi Blue » 06 Jul 2012, 21:08

If I find the time, I will look into it over the weekend... (but I can't promise I'll find the time) ;)
Stay safe, sane & healthy!

User avatar
Boris
Posts: 67
Joined: 25 May 2012, 14:35
Location: R&M

Re: Switch cameras

Post by Boris » 06 Jul 2012, 21:10

Hirazi Blue wrote:If I find the time, I will look into it over the weekend... (but I can't promise I'll find the time) ;)
ok, I hope you can help me, thank you for your attention
Oops ,something went wrong :D

User avatar
Hirazi Blue
Administrator
Posts: 5113
Joined: 04 Jun 2009, 10:15

Re: Switch cameras

Post by Hirazi Blue » 06 Jul 2012, 21:28

Try this very quickly made, untested little script. Replace the strings after CameraName1 and CameraName2 with the strings for the actual names of your cameras. Create a toolbar, drag the script unto it, to make a button.

Code: Select all

CameraName1 = "Camera"
CameraName2 = "Camera1"
camthis = Application.GetViewCamera(0)
if str(camthis) == str(CameraName1):
	Application.SetViewCamera(str(CameraName2), 0)
else:
	Application.SetViewCamera(str(CameraName1), 0)
It's Python, by the way. Look out for the tabs (the lines after if and else should be indented by one tab... ;)
For this to work, one of your two camera has to already be selected in Viewport A.
Stay safe, sane & healthy!

User avatar
Boris
Posts: 67
Joined: 25 May 2012, 14:35
Location: R&M

Re: Switch cameras

Post by Boris » 06 Jul 2012, 22:28

Hirazi Blue wrote:Try this very quickly made, untested little script. Replace the strings after CameraName1 and CameraName2 with the strings for the actual names of your cameras. Create a toolbar, drag the script unto it, to make a button.

Code: Select all

CameraName1 = "Camera"
CameraName2 = "Camera1"
camthis = Application.GetViewCamera(0)
if str(camthis) == str(CameraName1):
	Application.SetViewCamera(str(CameraName2), 0)
else:
	Application.SetViewCamera(str(CameraName1), 0)
It's Python, by the way. Look out for the tabs (the lines after if and else should be indented by one tab... ;)
For this to work, one of your two camera has to already be selected in Viewport A.

this is what I need , Man , i love you ! :) Thank you for your help !!!
Oops ,something went wrong :D

User avatar
FXDude
Posts: 1145
Joined: 19 Jun 2012, 19:59

Re: Switch cameras

Post by FXDude » 07 Jul 2012, 00:11

Hirazi is da man \m/