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
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
- bottleofram
- Posts: 355
- Joined: 17 Aug 2010, 11: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, "")
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)
Who is online
Users browsing this forum: No registered users and 5 guests