コード例 #1
0
	virtual MStatus undoIt()
	{
		MFnCamera fnCamera( camera );
		double fl = fnCamera.focalLength();
		fnCamera.setFocalLength( fl / 2.0 );
		return MS::kSuccess;
	}
コード例 #2
0
ファイル: octreeVizNode.cpp プロジェクト: saggita/makoto
void parseCamera(const MDagPath& camera, MATRIX44F& mat, double& clipnear, double& clipfar, double& fov, int& ispersp)
{
	MFnCamera fnCamera( camera );

	clipnear = fnCamera.nearClippingPlane();
	clipfar = fnCamera.farClippingPlane();
	
	MVector viewDir = fnCamera.viewDirection( MSpace::kWorld );
	MPoint eyePos = fnCamera.eyePoint ( MSpace::kWorld );
	MVector rightDir = fnCamera.rightDirection( MSpace::kWorld );
	MVector upDir = fnCamera.upDirection( MSpace::kWorld );
	
	mat.setIdentity ();
	mat.v[0][0] = -rightDir.x;
	mat.v[0][1] = -rightDir.y;
	mat.v[0][2] = -rightDir.z;
	mat.v[1][0] = upDir.x;
	mat.v[1][1] = upDir.y;
	mat.v[1][2] = upDir.z;
	mat.v[2][0] = viewDir.x;
	mat.v[2][1] = viewDir.y;
	mat.v[2][2] = viewDir.z;
	mat.v[3][0] = eyePos.x;
	mat.v[3][1] = eyePos.y;
	mat.v[3][2] = eyePos.z;
	
	fov = fnCamera.horizontalFieldOfView();
	fov = fov/PI*180;
	ispersp = 1;
	
	if(fnCamera.isOrtho()) {
		ispersp = 0;
		fov = fnCamera.orthoWidth();
	}
}
コード例 #3
0
ファイル: MDtCamera.cpp プロジェクト: OpenXRay/xray
//  ========== DtCameraGetPosition ==========
//
//  SYNOPSIS
//	Return the camera position.
//
int DtCameraGetPosition( int cameraID,
						 float* xTran,
						 float* yTran,
						 float* zTran )
{
    // Check for error.
    //
	if( (cameraID < 0) || (cameraID >= local->camera_ct ) )
	{
		*xTran = 0.0;
		*yTran = 0.0;
		*zTran = 0.0;
		return( 0 );
	}

	MStatus stat = MS::kSuccess;

    MFnDagNode fnDagNode( local->cameras[cameraID].transformNode, &stat );
    MDagPath aPath;
    stat = fnDagNode.getPath( aPath );
	
    // Get the global transformation matrix of the camera node.
    //
    MMatrix globalMatrix = aPath.inclusiveMatrix();

	MFnCamera fnCamera( local->cameras[cameraID].cameraShapeNode, &stat );

	MPoint eyePt;
    double eyePos[4]; 

	if( MS::kSuccess == stat )
	{
	    eyePt = fnCamera.eyePoint( MSpace::kObject, &stat );

		if( DtExt_Debug() & DEBUG_CAMERA )
		{
			cerr << "eye point is at " 
				 << eyePt.x << " " << eyePt.y << " " << eyePt.z << endl;
		}

	    eyePt *= globalMatrix;
	    eyePt.get( eyePos );

	}
	else
	{
		DtExt_Err( "Error in getting the camera function set\n" );
	}

    // Return values:
    //
	*xTran = eyePos[0];
	*yTran = eyePos[1];
	*zTran = eyePos[2];

	return( 1 );
}  // DtCameraGetPosition //
コード例 #4
0
ファイル: MDtCamera.cpp プロジェクト: OpenXRay/xray
//  ========== DtCameraGetHeight ==========
//
//  SYNOPSIS
//	Returns the height of the camera view volume. This is
//	only applicable to orthographic cameras.
//
int DtCameraGetHeight( int cameraID, float* height )
{
    // Initialize return values.
    //
	*height = 0.0;

    // Check for error.
    //
	if( ( cameraID < 0 ) || ( cameraID >= local->camera_ct ) ) 
	{
		return(0);
	}
	if( DtExt_Debug() & DEBUG_CAMERA )
	{
		cerr << "In DtCameraGetHeight\n";		
	}
	MStatus returnStatus = MS::kSuccess;
	MFnCamera fnCamera( local->cameras[cameraID].cameraShapeNode, &returnStatus );

	if( MS::kSuccess == returnStatus )
	{		
		// Make sure camera is of a valid type for this attribute.
		//
		switch( local->cameras[cameraID].type )
		{
			// Valid types:
			//
			case DT_ORTHOGRAPHIC_CAMERA:	
				// For Maya ortho camera, height = width?
				// 
				*height = fnCamera.orthoWidth( &returnStatus );
				cerr << "height (width of orthographic camera ) is " << *height << endl;
				break;
				// Invalid types:
				//
			default:	
				return(0);
		}
	}
	else
	{
		DtExt_Err( "Error in getting the camera function set\n" );
	}

    // Set the valid flag.
    //
	// local->cameras[cameraID].valid_bits|=(DT_VALID_BIT_MASK&DT_CAMERA_HEIGHT);

    // PA comments: For now return 0
    //
	*height = 0.0;
	return(1);
}  // DtCameraGetHeight //
コード例 #5
0
ファイル: MDtCamera.cpp プロジェクト: OpenXRay/xray
//  ========== DtCameraGetInterest ==========
//
//  SYNOPSIS
//  Return the camera position.
//
int DtCameraGetInterest(int cameraID,float* xTran,float* yTran,float* zTran)
{
	// check for error
	//

	if ( (cameraID < 0) || (cameraID >= local->camera_ct) )
	{
		*xTran = 0.0;
		*yTran = 0.0;
		*zTran = 0.0;
		return(0);
	}
 
	// return values
	//
	
    MStatus stat = MS::kSuccess;

    MFnDagNode fnDagNode( local->cameras[cameraID].transformNode, &stat );
    MDagPath aPath;
    stat = fnDagNode.getPath( aPath );

    // Get the global transformation matrix of the camera node.
    //
    MMatrix globalMatrix = aPath.inclusiveMatrix();

    MFnCamera fnCamera( local->cameras[cameraID].cameraShapeNode, &stat );

    // Center of interest point: view node point.
    //
    MPoint coiPoint = fnCamera.centerOfInterestPoint( MSpace::kObject, &stat );
    double coiPos[4]; 
    if( DtExt_Debug() & DEBUG_CAMERA )
    {
        coiPoint.get( coiPos );
        cerr << "local center of interest( view point position ) is " <<
            coiPos[0] << " " << coiPos[1] << " " << coiPos[2] << " "  
             << coiPos[3] << endl;
    }        
    coiPoint *= globalMatrix;
    coiPoint.get( coiPos );

	*xTran = coiPos[0];
	*yTran = coiPos[1];
	*zTran = coiPos[2];
 
	return(1);

}  // DtCameraGetInterest //
コード例 #6
0
ファイル: MDtCamera.cpp プロジェクト: OpenXRay/xray
//  ========== DtCameraGetNearClip ==========
//
//  SYNOPSIS
//	Return the camera new clip distance.
//
int DtCameraGetNearClip( int cameraID,
						 float* lnear )
{
	double	nclip = 0.0;
	MStatus returnStatus = MS::kSuccess;

	if( DtExt_Debug() & DEBUG_CAMERA )
	{
		cerr << "In DtCameraGetNearClip\n";
		cerr << "cameraID is " << cameraID << endl;	
		cerr << "local->camera_ct is " << local->camera_ct << endl;
	}

    // Check for error.
    //
	if( ( cameraID < 0 ) || ( cameraID >= local->camera_ct ) )
	{
		*lnear = 1.0;
		return(0);
	}

    // Set the valid flag.
    //
	// local->cameras[cameraID].valid_bits|=(DT_VALID_BIT_MASK&DT_CAMERA_NEAR_CLIP);

    // Return values:
    //
	MFnCamera fnCamera( local->cameras[cameraID].cameraShapeNode, &returnStatus );

	if( MS::kSuccess == returnStatus )
	{
		nclip = fnCamera.nearClippingPlane( &returnStatus );

		if( DtExt_Debug() & DEBUG_CAMERA )
		{
			cerr << "nclip is " << nclip << endl;
		}
	}
	else
	{
		DtExt_Err( "Error in getting the camera function set\n" );
	}
	
	*lnear = (float)nclip;

	return(1);
}  // DtCameraGetNearClip //
コード例 #7
0
ファイル: moveTool.cpp プロジェクト: BigRoy/Maya-devkit
MStatus moveContext::doPress( MEvent & event )
{
	MStatus stat = MPxSelectionContext::doPress( event );
	MSpace::Space spc = MSpace::kWorld;

	// If we are not in selecting mode (i.e. an object has been selected)
	// then set up for the translation.
	//
	if ( !isSelecting() ) {
		event.getPosition( startPos_x, startPos_y );
		view = M3dView::active3dView();

		MDagPath camera;
		stat = view.getCamera( camera );
		if ( stat != MS::kSuccess ) {
			cerr << "Error: M3dView::getCamera" << endl;
			return stat;
		}
		MFnCamera fnCamera( camera );
		MVector upDir = fnCamera.upDirection( spc );
		MVector rightDir = fnCamera.rightDirection( spc );

		// Determine the camera used in the current view
		//
		if ( fnCamera.isOrtho() ) {
			if ( upDir.isEquivalent(MVector::zNegAxis,kVectorEpsilon) ) {
				currWin = TOP;
			} else if ( rightDir.isEquivalent(MVector::xAxis,kVectorEpsilon) ) {
				currWin = FRONT;
			} else  {
				currWin = SIDE;
			}
		}
		else {
			currWin = PERSP;
		}

		// Create an instance of the move tool command.
		//
		cmd = (moveCmd*)newToolCommand();

		cmd->setVector( 0.0, 0.0, 0.0 );
	}
	return stat;
}
コード例 #8
0
ファイル: MDtCamera.cpp プロジェクト: OpenXRay/xray
//  ========== DtCameraGetAspect ==========
//
//  SYNOPSIS
//	Return the camera aspect ratio.
//
//  From PA DT:
//  Not implemented: always sets aspect value to 1.0.
//
int DtCameraGetAspect( int cameraID,
					   float* aspect )
{

	if( DtExt_Debug() & DEBUG_CAMERA )
	{
		cerr << "In DtCameraGetAspect\n";
		cerr << "cameraID is " << cameraID << endl;	
		cerr << "local->camera_ct is " << local->camera_ct << endl;
	}
    // Check for error.
    //
	if( ( cameraID < 0) || ( cameraID >= local->camera_ct ) )
	{
		*aspect = 1.0;
		return(0);
	}

	double ar = 0.0;

    // Set the valid flag.
    //
	// local->cameras[cameraID].valid_bits|=(DT_VALID_BIT_MASK&DT_CAMERA_ASPECT);

	MStatus returnStatus = MS::kSuccess;
	MFnCamera fnCamera( local->cameras[cameraID].cameraShapeNode, &returnStatus );

	if( MS::kSuccess == returnStatus )
	{
		ar = fnCamera.aspectRatio( &returnStatus );

		if( DtExt_Debug() & DEBUG_CAMERA )
		{
			cerr << "aspect ratio is " << ar << endl;
		}
	}

	*aspect = (float)ar;

	return(1);
}  // DtCameraGetAspect //
コード例 #9
0
ファイル: MDtCamera.cpp プロジェクト: OpenXRay/xray
//  ========== DtCameraGetFocalDistance ==========
//
//  SYNOPSIS
//	Return the distance from the camera viewpoint to
//	the point of focus.
//
int DtCameraGetFocalDistance( int cameraID,
							  float* focal )
{
	*focal = 1.0;

    // Check for error.
    //
	if( ( cameraID < 0) || ( cameraID >= local->camera_ct ) )
	{
		return(0);
	}

	if( DtExt_Debug() & DEBUG_CAMERA )
	{
		cerr << "In DtCameraGetFocalDistance\n";		
	}
	MStatus returnStatus = MS::kSuccess;
	MFnCamera fnCamera( local->cameras[cameraID].cameraShapeNode, &returnStatus );
	if( MS::kSuccess == returnStatus )
	{	
		*focal = fnCamera.focalLength( &returnStatus );
		if( DtExt_Debug() & DEBUG_CAMERA )
		{
			cerr << "focal length is " << *focal << endl;
		}
	}
	else
	{
		DtExt_Err( "Error in getting the camera function set\n" );
	}

    // Set the valid flag.
    //
	// local->cameras[cameraID].valid_bits|=(DT_VALID_BIT_MASK&DT_CAMERA_FOCAL_DISTANCE);

	return(1);
}  // DtCameraGetFocalDistance //
コード例 #10
0
ファイル: MDtCamera.cpp プロジェクト: OpenXRay/xray
//  ========== DtCameraGetHeightAngle ==========
//
//  SYNOPSIS
//	Returns the camera vertical angle in radians of the
//	camera view volume. This is only applicable to 
//	perspective cameras.
//
int DtCameraGetHeightAngle( int cameraID,
							float* angle )
{
    // Initialize return values.
    //
	*angle = 0.0;

    // Check for error.
    //
	if( ( cameraID < 0 ) || ( cameraID >= local->camera_ct ) ) 
	{
		return(0);
	}

	if( DtExt_Debug() & DEBUG_CAMERA )
	{
		cerr << "In DtCameraGetHeightAngle\n";		
	}
	MStatus returnStatus = MS::kSuccess;
	MFnCamera fnCamera( local->cameras[cameraID].cameraShapeNode, &returnStatus );
	double focal;
	double horiz;
	
	if( MS::kSuccess == returnStatus )
	{	
		// Make sure camera is of a valid type for this attribute.
		//
		switch( local->cameras[cameraID].type )
		{
			// Valid types:
			//
			case DT_PERSPECTIVE_CAMERA:
				// Changed the following to match that of the Mel 
				// scripts which shows the field of view to the user.
				
				//*angle = fnCamera.verticalFieldOfView( &returnStatus );
				
				focal = fnCamera.focalLength( &returnStatus );
				horiz = fnCamera.horizontalFilmAperture( &returnStatus );

				*angle = 2.0 * RADIAN_TO_DEGREE * 
									atan( 0.5*horiz / ( 0.03937 * focal ));

				if( DtExt_Debug() & DEBUG_CAMERA )
				{
					cerr << "height angle (vertical field of view) is " << *angle << endl;
				}
				break;

				// Invalid types
				//
			default:	
				return(0);
		}
	}
	else
	{
		DtExt_Err( "Error in getting the camera function set\n" );
	}

    // Set the valid flag.
    //
	// local->cameras[cameraID].valid_bits|=(DT_VALID_BIT_MASK&DT_CAMERA_HEIGHT_ANGLE);

	return(1);
}  // DtCameraGetHeightAngle //
コード例 #11
0
ファイル: MDtCamera.cpp プロジェクト: OpenXRay/xray
//  ========== DtCameraGetOrientation ==========
//
//  SYNOPSIS
//	Return the camera orientation as x,y,z 
//	Euler angles.
//
int DtCameraGetOrientation(	int cameraID,
							float* xRot,
							float* yRot,
							float* zRot )
{

	float	LRotX, LRotY, LRotZ;

	double	LX = 0.0;
	double  LY = 0.0;
	double  LZ = 0.0;
	double	LXV = 0.0;
	double  LYV = 0.0;
	double  LZV = 0.0;
	double	LXUp = 0.0;
	double  LYUp = 0.0;
	double  LZUp = 0.0;

	MMatrix	LMatrix;

    // Check for error.
    //
	if( (cameraID<0) || (cameraID>=local->camera_ct) )
	{
		*xRot=0.0;
		*yRot=0.0;
		*zRot=0.0;
		return( 0 );
	}

	MStatus returnStatus = MS::kSuccess;
	MFnCamera fnCamera( local->cameras[cameraID].cameraShapeNode, &returnStatus );

	if( MS::kSuccess == returnStatus )
	{
		MPoint eyePt = fnCamera.eyePoint( MSpace::kObject, &returnStatus );

		LX = eyePt.x;
		LY = eyePt.y;
		LZ = eyePt.z;

		if( DtExt_Debug() & DEBUG_CAMERA )
		{
			cerr << "eye point is at " 
				 << LX << " " << LY << " " << LZ << endl;
		}
		
		MVector upDir = fnCamera.upDirection( MSpace::kObject, &returnStatus );
		if( DtExt_Debug() & DEBUG_CAMERA )
		{
			cerr << "up direction is " 
				 << upDir.x << " " << upDir.y << " " << upDir.z << endl;
		}

		LXUp = upDir.x;
		LYUp = upDir.y;
		LZUp = upDir.z;

		
		MVector viewDir = fnCamera.viewDirection( MSpace::kObject, &returnStatus );
		if( DtExt_Debug() & DEBUG_CAMERA )
		{
			cerr << "view direction is " 
				 << viewDir.x << " " << viewDir.y << " " << viewDir.z << endl;
		}	
		LXV = -viewDir.x;
		LYV = -viewDir.y;
		LZV = -viewDir.z;
	}
	else
	{
		DtExt_Err( "Error in getting the camera function set\n" );
		return 0;
	}


// If the up-vector is a null-vector (a problem), set it to 0,1,0

    if ( (LXUp == 0) && (LYUp == 0) && (LZUp == 0) )
    {
        LXUp=0.0;
        LYUp=1.0;
        LZUp=0.0;
    }   

// Compute camera orbital angles LXV, LYV, LZV: direction vector of the camera

    LRotX = DtGetAngle2D( LYV, sqrt(LXV*LXV + LZV*LZV) );
    LRotY = DtGetAngle2D(LZV, LXV);
    if ( LRotY < 0.0 ) LRotY += 360.0;
   
	
    LX=0.0;
	LY=1.0;
	LZ=0.0;   // Unit-length up-vector
    
//	Create the inverse camera rotation matrix and transform the 
//	default up-vector with it

	MVector	vec( LX, LY, LZ );
	vec.rotateBy( MVector::kXaxis, LRotX-90.0 );
	vec.rotateBy( MVector::kYaxis, LRotY );

	LX = vec.x;
	LY = vec.y;
	LZ = vec.z;

#if 0
    LMatrix  = LMatrix.rotateX((LRotX-90.0)*DEGREE_TO_RADIAN);
    LMatrix *= LMatrix.rotateY(LRotY*DEGREE_TO_RADIAN);
    LMatrix.transVector(LX,LY,LZ);
#endif

    LRotZ = acos((LXUp*LX + LYUp*LY + LZUp*LZ) / 
				sqrt(LXUp*LXUp + LYUp*LYUp + LZUp*LZUp)) * RADIAN_TO_DEGREE;

    *xRot = LRotX;
	*yRot = LRotY;
	*zRot = LRotZ;

	return(1);
}  // DtCameraGetOrientation //
コード例 #12
0
ファイル: MDtCamera.cpp プロジェクト: OpenXRay/xray
//  ========== DtCameraGetUpPosition ==========
//
//  SYNOPSIS
//  Return the camera Up position.
//
int DtCameraGetUpPosition( int cameraID,
                         float* xTran,
                         float* yTran,
                         float* zTran )
{                        
    // Check for error.  
    //
    if( (cameraID < 0) || (cameraID >= local->camera_ct ) )
    {
        *xTran = 0.0;
        *yTran = 0.0;
        *zTran = 0.0;
        return( 0 );
    }   
    
    MStatus stat = MS::kSuccess;
    
    MFnDagNode fnDagNode( local->cameras[cameraID].transformNode, &stat );
    MDagPath aPath;
    stat = fnDagNode.getPath( aPath );
    
    // Get the global transformation matrix of the camera node.
    //
    MMatrix globalMatrix = aPath.inclusiveMatrix();
    
    MFnCamera fnCamera( local->cameras[cameraID].cameraShapeNode, &stat );
    
    MPoint eyePt;
    double eyePos[4];
    double upPos[4];
    
    if( MS::kSuccess == stat )
    {
        eyePt = fnCamera.eyePoint( MSpace::kObject, &stat );
        
        eyePt *= globalMatrix;
        eyePt.get( eyePos );

	    MVector upVec = fnCamera.upDirection( MSpace::kObject, &stat );
		upVec *= globalMatrix;
		
	    if( DtExt_Debug() & DEBUG_CAMERA )
	    {
	        double up[3];
	        upVec.get( up );
	        cerr << "local up vector is " << up[0] << " " 
										<< up[1] << " " << up[2] << endl; 
    	}

    	MPoint upPoint = eyePt + upVec;
    	upPoint.get( upPos );
    	if( DtExt_Debug() & DEBUG_CAMERA )
    	{
    	    cerr << "global up point position is " 
						<< upPos[0] << " " << upPos[1]
            			<< " " << upPos[2] << " " << upPos[3] << endl;
    	}        
    	
    }   
    else
    {
        DtExt_Err( "Error in getting the camera function set\n" );
    }   

    *xTran = upPos[0];
    *yTran = upPos[1];
    *zTran = upPos[2];

	return(1);

}
コード例 #13
0
ファイル: MDtCamera.cpp プロジェクト: OpenXRay/xray
int addTransformCamera( MObject transformNode,
						MObject cameraShapeNode )
{
	if( !DtExt_outputCameras() ) 
	{
		return 0;
	}
	
	if( DtExt_Debug() & DEBUG_CAMERA )
	{
		cerr << "In addTransformCamera\n";
	}
	local->cameras =	
		(CameraStruct*)realloc(local->cameras,(1+local->camera_ct)*sizeof(CameraStruct));
	memset( &local->cameras[local->camera_ct], 0, sizeof(CameraStruct) );

	local->cameras[local->camera_ct].cameraShapeNode = cameraShapeNode;
	local->cameras[local->camera_ct].transformNode = transformNode;

	MStatus returnStatus = MS::kSuccess;
	MFnCamera fnCamera( cameraShapeNode );

	if( false == fnCamera.isOrtho( &returnStatus ) )
	{	
		if( DtExt_Debug() & DEBUG_CAMERA )
		{
			cerr << "perspective camera\n"; 
		}
		local->cameras[local->camera_ct].type = DT_PERSPECTIVE_CAMERA;
	}
	else
	{
		if( DtExt_Debug() & DEBUG_CAMERA )
		{
			cerr << "ortho camera\n";
		}
		local->cameras[local->camera_ct].type = DT_ORTHOGRAPHIC_CAMERA;
	}

	local->camera_ct++;


	// For testing purpose:
	//
	if( DtExt_Debug() & DEBUG_CAMERA )
	{

		float v = 0.0;
		
		cerr << "Calling DtCameraGetNearClip\n";
		DtCameraGetNearClip( local->camera_ct-1, &v );

		cerr << "Calling DtCameraGetFarClip\n";
		DtCameraGetFarClip( local->camera_ct-1, &v );

		float p[3];
		cerr << "Calling DtCameraGetPosition\n";
		DtCameraGetPosition( local->camera_ct-1, &p[0], &p[1], &p[2] );

		float o[3];
		cerr << "Calling DtCameraGetOrientation\n";
		DtCameraGetOrientation( local->camera_ct-1, &o[0], &o[1], &o[2] );

		float matrix[4][4];
		cerr << "Calling DtCameraGetMatrix\n";
		DtCameraGetMatrix( local->camera_ct-1, (float ** )matrix );

		float aspect = 0.0;
		cerr << "Calling DtCameraGetAspect\n";
		DtCameraGetAspect( local->camera_ct-1, &aspect );

		float focal = 0.0;
		cerr << "Calling DtCameraGetFocalDistance\n";
		DtCameraGetFocalDistance( local->camera_ct-1, &focal );
	}

	return 1;
}
コード例 #14
0
void AbcWriteJob::setup(double iFrame, MayaTransformWriterPtr iParent, GetMembersMap& gmMap)
{
    MStatus status;

    // short-circuit if selection flag is on but this node isn't actively
    // selected
    if (mArgs.useSelectionList && !mSList.hasItem(mCurDag))
        return;

    MObject ob = mCurDag.node();

    // skip all intermediate nodes (and their children)
    if (util::isIntermediate(ob))
    {
        return;
    }

    // skip nodes that aren't renderable (and their children)
    if (mArgs.excludeInvisible && !util::isRenderable(ob))
    {
        return;
    }

    // look for riCurves flag for flattening all curve objects to a curve group
    MFnDependencyNode fnDepNode(ob, &status);
    MPlug riCurvesPlug = fnDepNode.findPlug("riCurves", &status);
    bool riCurvesVal = riCurvesPlug.asBool();
    bool writeOutAsGroup = false;
    if (riCurvesVal)
    {
        writeOutAsGroup = checkCurveGrp();
        if (writeOutAsGroup == false)
        {
            MString msg = "Curves have different degrees or close ";
            msg += "states, not writing out as curve group";
            MGlobal::displayWarning(msg);
        }
    }
    if ( status == MS::kSuccess && riCurvesVal && writeOutAsGroup)
    {
        MayaNurbsCurveWriterPtr nurbsCurve;
        if (iParent == NULL)
        {
            Alembic::Abc::OObject obj = mRoot.getTop();
            nurbsCurve = MayaNurbsCurveWriterPtr(new MayaNurbsCurveWriter(
                mCurDag, obj, mShapeTimeIndex, true, mArgs));
        }
        else
        {
            Alembic::Abc::OObject obj = iParent->getObject();
            nurbsCurve = MayaNurbsCurveWriterPtr(new MayaNurbsCurveWriter(
                mCurDag, obj, mShapeTimeIndex, true, mArgs));
        }

        if (nurbsCurve->isAnimated() && mShapeTimeIndex != 0)
        {
            mCurveList.push_back(nurbsCurve);
            mStats.mCurveAnimNum++;
            mStats.mCurveAnimCurves += nurbsCurve->getNumCurves();
            mStats.mCurveAnimCVs += nurbsCurve->getNumCVs();
        }
        else
        {
            mStats.mCurveStaticNum++;
            mStats.mCurveStaticCurves += nurbsCurve->getNumCurves();
            mStats.mCurveStaticCVs += nurbsCurve->getNumCVs();
        }

        AttributesWriterPtr attrs = nurbsCurve->getAttrs();
        if (mShapeTimeIndex != 0 && attrs->isAnimated())
            mShapeAttrList.push_back(attrs);
    }
    else if (ob.hasFn(MFn::kTransform))
    {
        MFnTransform fnTrans(ob, &status);
        if (status != MS::kSuccess)
        {
            MString msg = "Initialize transform node ";
            msg += mCurDag.fullPathName();
            msg += " failed, skipping.";
            MGlobal::displayWarning(msg);
            return;
        }

        MayaTransformWriterPtr trans;

        // parented to the root case
        if (iParent == NULL)
        {
            Alembic::Abc::OObject obj = mRoot.getTop();
            trans = MayaTransformWriterPtr(new MayaTransformWriter(
                obj, mCurDag, mTransTimeIndex, mArgs));
        }
        else
        {
            trans = MayaTransformWriterPtr(new MayaTransformWriter(
                *iParent, mCurDag, mTransTimeIndex, mArgs));
        }

        if (trans->isAnimated() && mTransTimeIndex != 0)
        {
            mTransList.push_back(trans);
            mStats.mTransAnimNum++;
        }
        else
            mStats.mTransStaticNum++;

        AttributesWriterPtr attrs = trans->getAttrs();
        if (mTransTimeIndex != 0 && attrs->isAnimated())
            mTransAttrList.push_back(attrs);

        // loop through the children, making sure to push and pop them
        // from the MDagPath
        unsigned int numChild = mCurDag.childCount();
        for (unsigned int i = 0; i < numChild; ++i)
        {
            if (mCurDag.push(mCurDag.child(i)) == MS::kSuccess)
            {
                setup(iFrame, trans, gmMap);
                mCurDag.pop();
            }
        }
    }
    else if (ob.hasFn(MFn::kLocator))
    {
        MFnDependencyNode fnLocator(ob, & status);
        if (status != MS::kSuccess)
        {
            MString msg = "Initialize locator node ";
            msg += mCurDag.fullPathName();
            msg += " failed, skipping.";
            MGlobal::displayWarning(msg);
            return;
        }

        if (iParent != NULL)
        {
            Alembic::Abc::OObject obj = iParent->getObject();
            MayaLocatorWriterPtr locator(new MayaLocatorWriter(
                mCurDag, obj, mShapeTimeIndex, mArgs));

            if (locator->isAnimated() && mShapeTimeIndex != 0)
            {
                mLocatorList.push_back(locator);
                mStats.mLocatorAnimNum++;
            }
            else
            {
                mStats.mLocatorStaticNum++;
            }

            AttributesWriterPtr attrs = locator->getAttrs();
            if (mShapeTimeIndex != 0 && attrs->isAnimated())
                mShapeAttrList.push_back(attrs);
        }
        else
        {
            MString err = "Can't translate ";
            err += fnLocator.name() + " since it doesn't have a parent.";
            MGlobal::displayError(err);
        }
    }
    else if (ob.hasFn(MFn::kParticle))
    {
        MFnParticleSystem mFnParticle(ob, &status);
        if (status != MS::kSuccess)
        {
            MString msg = "Initialize particle system ";
            msg += mCurDag.fullPathName();
            msg += " failed, skipping.";
            MGlobal::displayWarning(msg);
            return;
        }

        if (iParent != NULL)
        {
            Alembic::Abc::OObject obj = iParent->getObject();
            MayaPointPrimitiveWriterPtr particle(new MayaPointPrimitiveWriter(
                iFrame, mCurDag, obj, mShapeTimeIndex, mArgs));

            if (particle->isAnimated() && mShapeTimeIndex != 0)
            {
                mPointList.push_back(particle);
                mStats.mPointAnimNum++;
                mStats.mPointAnimCVs += particle->getNumCVs();
            }
            else
            {
                mStats.mPointStaticNum++;
                mStats.mPointStaticCVs += particle->getNumCVs();
            }

            AttributesWriterPtr attrs = particle->getAttrs();
            if (mShapeTimeIndex != 0 && attrs->isAnimated())
                mShapeAttrList.push_back(attrs);
        }
        else
        {
            MString err = "Can't translate ";
            err += mFnParticle.name() + " since it doesn't have a parent.";
            MGlobal::displayError(err);
        }
    }
    else if (ob.hasFn(MFn::kMesh))
    {
        MFnMesh fnMesh(ob, &status);
        if (status != MS::kSuccess)
        {
            MString msg = "Initialize mesh node ";
            msg += mCurDag.fullPathName();
            msg += " failed, skipping.";
            MGlobal::displayWarning(msg);
            return;
        }

        if (iParent != NULL)
        {
            Alembic::Abc::OObject obj = iParent->getObject();
            MayaMeshWriterPtr mesh(new MayaMeshWriter(mCurDag, obj,
                mShapeTimeIndex, mArgs, gmMap));

            if (mesh->isAnimated() && mShapeTimeIndex != 0)
            {
                mMeshList.push_back(mesh);
                if (mesh->isSubD())
                {
                    mStats.mSubDAnimNum++;
                    mStats.mSubDAnimCVs += mesh->getNumCVs();
                    mStats.mSubDAnimFaces += mesh->getNumFaces();
                }
                else
                {
                    mStats.mPolyAnimNum++;
                    mStats.mPolyAnimCVs += mesh->getNumCVs();
                    mStats.mPolyAnimFaces += mesh->getNumFaces();
                }
            }
            else
            {
                if (mesh->isSubD())
                {
                    mStats.mSubDStaticNum++;
                    mStats.mSubDStaticCVs += mesh->getNumCVs();
                    mStats.mSubDStaticFaces += mesh->getNumFaces();
                }
                else
                {
                    mStats.mPolyStaticNum++;
                    mStats.mPolyStaticCVs += mesh->getNumCVs();
                    mStats.mPolyStaticFaces += mesh->getNumFaces();
                }
            }

            AttributesWriterPtr attrs = mesh->getAttrs();
            if (mShapeTimeIndex != 0 && attrs->isAnimated())
                mShapeAttrList.push_back(attrs);
        }
        else
        {
            MString err = "Can't translate ";
            err += fnMesh.name() + " since it doesn't have a parent.";
            MGlobal::displayError(err);
        }
    }
    else if (ob.hasFn(MFn::kCamera))
    {
        MFnCamera fnCamera(ob, &status);
        if (status != MS::kSuccess)
        {
            MString msg = "Initialize camera node ";
            msg += mCurDag.fullPathName();
            msg += " failed, skipping.";
            MGlobal::displayWarning(msg);
            return;
        }

        if (iParent != NULL)
        {
            Alembic::Abc::OObject obj = iParent->getObject();
            MayaCameraWriterPtr camera(new MayaCameraWriter(
                mCurDag, obj, mShapeTimeIndex, mArgs));

            if (camera->isAnimated() && mShapeTimeIndex != 0)
            {
                mCameraList.push_back(camera);
                mStats.mCameraAnimNum++;
            }
            else
                mStats.mCameraStaticNum++;

            AttributesWriterPtr attrs = camera->getAttrs();
            if (mShapeTimeIndex != 0 && attrs->isAnimated())
                mShapeAttrList.push_back(attrs);
        }
        else
        {
            MString err = "Can't translate ";
            err += fnCamera.name() + " since it doesn't have a parent.";
            MGlobal::displayError(err);
        }
    }
    else if (ob.hasFn(MFn::kNurbsSurface))
    {
        MFnNurbsSurface fnNurbsSurface(ob, &status);
        if (status != MS::kSuccess)
        {
            MString msg = "Initialize nurbs surface ";
            msg += mCurDag.fullPathName();
            msg += " failed, skipping.";
            MGlobal::displayWarning(msg);
            return;
        }

        if (iParent != NULL)
        {
            Alembic::Abc::OObject obj = iParent->getObject();
            MayaNurbsSurfaceWriterPtr nurbsSurface(new MayaNurbsSurfaceWriter(
                mCurDag, obj,  mShapeTimeIndex, mArgs));

            if (nurbsSurface->isAnimated() && mShapeTimeIndex != 0)
            {
                mNurbsList.push_back(nurbsSurface);
                mStats.mNurbsAnimNum++;
                mStats.mNurbsAnimCVs += nurbsSurface->getNumCVs();
            }
            else
            {
                mStats.mNurbsStaticNum++;
                mStats.mNurbsStaticCVs += nurbsSurface->getNumCVs();
            }

            AttributesWriterPtr attrs = nurbsSurface->getAttrs();
            if (mShapeTimeIndex != 0 && attrs->isAnimated())
                mShapeAttrList.push_back(attrs);
        }
        else
        {
            MString err = "Can't translate ";
            err += fnNurbsSurface.name() + " since it doesn't have a parent.";
            MGlobal::displayError(err);
        }
    }
    else if (ob.hasFn(MFn::kNurbsCurve))
    {
        MFnNurbsCurve fnNurbsCurve(ob, &status);
        if (status != MS::kSuccess)
        {
            MString msg = "Initialize curve node ";
            msg += mCurDag.fullPathName();
            msg += " failed, skipping.";
            MGlobal::displayWarning(msg);
            return;
        }

        if (iParent != NULL)
        {
            Alembic::Abc::OObject obj = iParent->getObject();
            MayaNurbsCurveWriterPtr nurbsCurve(new MayaNurbsCurveWriter(
                mCurDag, obj, mShapeTimeIndex, false, mArgs));

            if (nurbsCurve->isAnimated() && mShapeTimeIndex != 0)
            {
                mCurveList.push_back(nurbsCurve);
                mStats.mCurveAnimNum++;
                mStats.mCurveAnimCurves++;
                mStats.mCurveAnimCVs += nurbsCurve->getNumCVs();
            }
            else
            {
                mStats.mCurveStaticNum++;
                mStats.mCurveStaticCurves++;
                mStats.mCurveStaticCVs += nurbsCurve->getNumCVs();
            }

            AttributesWriterPtr attrs = nurbsCurve->getAttrs();
            if (mShapeTimeIndex != 0 && attrs->isAnimated())
                mShapeAttrList.push_back(attrs);
        }
        else
        {
            MString err = "Can't translate ";
            err += fnNurbsCurve.name() + " since it doesn't have a parent.";
            MGlobal::displayError(err);
        }
    }
    else
    {
        MString warn = mCurDag.fullPathName() + " is an unsupported type of ";
        warn += ob.apiTypeStr();
        MGlobal::displayWarning(warn);
    }
}