Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk® Softimage® / XSI SDK / Access camera object in the current pass
  RSS 2.0 ATOM  

Access camera object in the current pass
Rate this thread
 
30108
 
Permlink of this thread  
avatar
  • Total Posts: 2
  • Joined: 23 September 2008 02:35 AM

Hello,

I’m using JavaScript and Object model to get current pass and its camera:

var pass Application.ActiveProject.ActiveScene.ActivePass;
LogMessage(pass.Camera.type); 
LogMessage(pass.NestedObjects("Camera").type;

Result:
// INFO : Parameter
// INFO : Parameter

I can’t access the camera as an object! It is a string - name of the camera…

But I see, that there are two items with the key “camera” nested:

var pass.NestedObjects;
var 
i;
for(
0n.count; ++i)
{
    
if(n.item(i).name == "Camera"LogMessage(" " n.item(i).name " " n.item(i).type);
}

Result:
// INFO : 6 Camera Parameter
// INFO : 56 Camera camera

How is it possible, that there are two items with the same key?
I need the second one…

Now I’m using following walkaround, but I’m still interested in…

var pass Application.ActiveProject.ActiveScene.ActivePass;
 var 
cam ActiveSceneRoot.FindChildren([URL="http://pass.camera.name/"]pass.Camera.Name[/URL]);
LogMessage(cam.item(0).type);

Thanks for help.



Replies: 0
avatar

How about this,

var pass Application.ActiveProject.ActiveScene.ActivePass;
LogMessage(pass.NestedObjects(pass.camera.Value).type);

I think the first camera object in Pass.NestedObjects is a parameter for the pass.
The second object is the camera itself, if you change the camera name instead of default “Camera” probably it’s clearer.

The problem is with default name, it always give you the first object unless you check the nestedObjects type. It’s “camera” vs “Camera”, maybe Softimage need to consider changing default camera name to something else.



Replies: 0
avatar

// INFO : Parameter

String again for the default “Camera”. But it works for different camera’s name, for example “Camera2”.
IMHO Softimage is not case sensitive…

pass.Camera

I wonder why this returns string, not the camera object…



Replies: 0
avatar
  • sfu_toma
  • Posted: 23 September 2008 07:17 PM

You have to find the camera in the scene, the “Camera” parameter of the pass is just the camera’s fullName…

var oScene Application.ActiveProject.ActiveScene
var oRoot oScene.root

var oPass  oScene.ActivePass
var oCamP oPass.Parameters("Camera").value

var oCam oRoot.findChild(oCamP)
var 
oCamSpot oCam.interest

logmessage 
("Current Pass Camera -> "oCam +" :: "oCamSpot)

edit (oups! you’ve already done this… sorry)



Replies: 0
avatar

[quote=rivierakid;11669]
I wonder why this returns string, not the camera object...

Because it used in Combo box for the PPG.



Replies: 0