PDA

View Full Version : accessing doc from Xpresso Coffee node


C.Smith
11-20-2007, 05:59 PM
I'm trying to pass the global position of the active camera to a node in Xpresso.

I'm using:
var cam;
cam=doc->GetRenderBaseDraw()#BASEDRAW_DATA_CAMERA;

Then getting the matrix and position from var cam.

However, in Xpresso it won't see the document. I tried adding doc (and even op) in the main() but that just gets an error.

Is it even possible to get the active camera whithin the Xpresso coffee node?

tcastudios
11-20-2007, 06:50 PM
Hi.

main()
{
var doc = GetActiveDocument();// <- You need to call the Active Document
// Also, the View must be Active
var cam = doc->GetRenderBaseDraw()#BASEDRAW_DATA_CAMERA;

var camm = cam->GetMg();
var campos = camm->GetV0();
var camrot = camm->GetHPB();

println(campos);
println(camrot);

Output1 = camm; // Make sure the COFFEE node output is a Matrix type
Output2 = campos;// Make sure the COFFEE node output is a Vector type
Output3 = camrot;// Make sure the COFFEE node output is a Vector type

}


Cheers
Lennart

C.Smith
11-20-2007, 07:16 PM
Jesus, Lennart. That's fantastic. That's twice you've solved me huge headaches. HUGE thanks. Yet again you'll be credited with crucial help with a CSTool ;)

CGTalk Moderation
11-20-2007, 07:16 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.