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
current camera scripting line
-
bottleofram
- Posts: 355
- Joined: 17 Aug 2010, 09:21
Re: current camera scripting line
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:
Python, btw
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, "")
-
myara
- Posts: 406
- Joined: 28 Sep 2011, 08:33
Re: current camera scripting line
You can use the GetFocusedViewport command.
In JScript:
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.
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")And used ToggleValue command to toggle it ON / OFF with one button.
M.Yara
Character Modeler | Softimage Generalist (sort of)
Character Modeler | Softimage Generalist (sort of)