Excessive activity of a new AI scraper (ClaudeBot) has basically DOS'ed this forum during the recent weeks. We're trying to find ways to ban it somehow to get the forum working better again. Expect some more slowdowns in the meantime.

current camera scripting line

Discussions concerning programming of SOFTIMAGE©
Post Reply
User avatar
Maximus
Posts: 1105
Joined: 09 Jun 2009, 15:45

current camera scripting line

Post by Maximus » 10 Feb 2012, 19:14

Hey guys, i need help with a stupid thing!
i've created a button to swtich on and off the backface cull on camera, problem is it reads only the camera name so if i have multiple cameras with different names it doesnt work.
The camera must have the name "Camera" to work. I'd like it to work with other names too, just based on the active camera i'm using.

I've used this JScript:

SetValue "Camera.camdisp.culbackface", True

i was wondering if there was a method to set the script to read the current active camera or something, any ideas?

thanks a lot!

Max

User avatar
bottleofram
Posts: 355
Joined: 17 Aug 2010, 11:21

Re: current camera scripting line

Post by bottleofram » 10 Feb 2012, 21:44

Hi Max

I was looking into something similar myself recently and i (shamelessly) used Stefan Kubicek's QMenu to figure out how you get the active camera. Heres his code adjusted for your case:

Code: Select all

xsi = Application

oVM = xsi.Desktop.ActiveLayout.Views.Find( "View Manager" )
oView = oVM.GetAttributeValue("focusedviewport")
viewIndices = dict (A = 0, B = 1, C = 2, D = 3)
oCam = xsi.GetViewCamera(viewIndices[oView])

xsi.SetValue(oCam.FullName + ".camdisp.culbackface", True, "")
Python, btw

User avatar
myara
Posts: 403
Joined: 28 Sep 2011, 10:33

Re: current camera scripting line

Post by myara » 15 Feb 2012, 09:44

You can use the GetFocusedViewport command.

In JScript:

Code: Select all

var vw = GetFocusedViewport()
switch(vw){
   case "A": var mCamera = GetViewCamera(0);break;
   case "B": var mCamera = GetViewCamera(1);break;
   case "C": var mCamera = GetViewCamera(2);break;
   case "D": var mCamera = GetViewCamera(3);break;
}
ToggleValue("culbackface", mCamera + ".camdisp")
Since JScript doesn't have a dictionary like Python (not that I'm aware) I use switch to convert the GetFocusedViewport result to indices.

And used ToggleValue command to toggle it ON / OFF with one button.
M.Yara
Character Modeler | Softimage Generalist (sort of)

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests