//------------------------------
	GenCamera* CameraImporter::createCamera( const COLLADAFW::Camera* camera )
	{
		// TODO TARGETED_CAMERA 
		GenCamera* maxCamera = getMaxImportInterface()->CreateCameraObject( FREE_CAMERA );

		float targetDistance = 100; // we don't have a target, therefore we need to set anything
		maxCamera->SetTDist(0, targetDistance);

		if (camera->getCameraType() == COLLADAFW::Camera::PERSPECTIVE)
		{
			// Perspective camera
			maxCamera->SetOrtho(FALSE);
			switch ( camera->getDescriptionType() )
			{
			case COLLADAFW::Camera::SINGLE_X:
			case COLLADAFW::Camera::X_AND_Y:
			case COLLADAFW::Camera::ASPECTRATIO_AND_X:
				maxCamera->SetFOVType(0);
				maxCamera->SetFOV(0, COLLADABU::Math::Utils::degToRadF( (float)camera->getXFov()));
				break;
			case COLLADAFW::Camera::SINGLE_Y:
			case COLLADAFW::Camera::ASPECTRATIO_AND_Y:
				{
					float aspectRatio = getMaxInterface()->GetRendImageAspect();
					maxCamera->SetFOVType(1);
					float yfov = COLLADABU::Math::Utils::degToRadF( (float)camera->getYFov());
					float xfov = 2 * atan( aspectRatio * tan(yfov/2));
					maxCamera->SetFOV(0, xfov);
					break;
				}
			}
		}
		else
		{
			// Orthographic camera
			maxCamera->SetOrtho(TRUE);

			// Consider only the correct magnification and the target distance,
			// which is kept constant, to calculate the FOV.
			switch ( camera->getDescriptionType() )
			{
			case COLLADAFW::Camera::SINGLE_X:
			case COLLADAFW::Camera::X_AND_Y:
			case COLLADAFW::Camera::ASPECTRATIO_AND_X:
				{
					maxCamera->SetFOVType(0);
					float fov = 2 * (float)atan( camera->getXMag()/targetDistance );
					maxCamera->SetFOV(0, fov);
					break;
				}
			case COLLADAFW::Camera::SINGLE_Y:
			case COLLADAFW::Camera::ASPECTRATIO_AND_Y:
				{
					float aspectRatio = getMaxInterface()->GetRendImageAspect();
					maxCamera->SetFOVType(1);
					float yfov = 2 * (float)atan( camera->getYMag()/targetDistance );
					float xfov = 2 * atan( aspectRatio * tan(yfov/2));
					maxCamera->SetFOV(0, xfov );
					break;
				}
			}
		}

		// Common camera parameters: nearZ, farZ
		// The "Far Clip " animatable parameter intentionally has an extra space in the definition.
		maxCamera->SetClipDist(0, CAM_HITHER_CLIP, (float)camera->getNearClippingPlane());
		maxCamera->SetClipDist(0, CAM_YON_CLIP, (float)camera->getFarClippingPlane());
		maxCamera->SetManualClip(TRUE);
		maxCamera->Enable(TRUE);
		
		return maxCamera;
	}
int AlembicImport_Camera(const std::string& path, AbcG::IObject& iObj,
                         alembic_importoptions& options, INode** pMaxNode)
{
    const std::string& identifier = iObj.getFullName();

    if (!AbcG::ICamera::matches(iObj.getMetaData())) {
        return alembic_failure;
    }
    AbcG::ICamera objCamera = AbcG::ICamera(iObj, Abc::kWrapExisting);
    if (!objCamera.valid()) {
        return alembic_failure;
    }
    bool isConstant = objCamera.getSchema().isConstant();

    TimeValue zero(0);

    INode* pNode = *pMaxNode;
    CameraObject* pCameraObj = NULL;
    if (!pNode) {
        // Create the camera object and place it in the scene
        GenCamera* pGenCameraObj =
            GET_MAX_INTERFACE()->CreateCameraObject(FREE_CAMERA);
        if (pGenCameraObj == NULL) {
            return alembic_failure;
        }
        pGenCameraObj->Enable(TRUE);
        pGenCameraObj->SetConeState(TRUE);
        pGenCameraObj->SetManualClip(TRUE);

        IMultiPassCameraEffect* pCameraEffect =
            pGenCameraObj->GetIMultiPassCameraEffect();
        const int TARGET_DISTANCE = 0;
        pCameraEffect->GetParamBlockByID(0)->SetValue(TARGET_DISTANCE, zero, FALSE);

        pCameraObj = pGenCameraObj;

        Abc::IObject parent = iObj.getParent();
        std::string name = removeXfoSuffix(parent.getName().c_str());
        pNode = GET_MAX_INTERFACE()->CreateObjectNode(
                    pGenCameraObj, EC_UTF8_to_TCHAR(name.c_str()));
        if (pNode == NULL) {
            return alembic_failure;
        }
        *pMaxNode = pNode;
    }
    else {
        Object* obj = pNode->EvalWorldState(zero).obj;

        if (obj->CanConvertToType(Class_ID(SIMPLE_CAM_CLASS_ID, 0))) {
            pCameraObj = reinterpret_cast<CameraObject*>(
                             obj->ConvertToType(zero, Class_ID(SIMPLE_CAM_CLASS_ID, 0)));
        }
        else if (obj->CanConvertToType(Class_ID(LOOKAT_CAM_CLASS_ID, 0))) {
            pCameraObj = reinterpret_cast<CameraObject*>(
                             obj->ConvertToType(zero, Class_ID(LOOKAT_CAM_CLASS_ID, 0)));
        }
        else {
            return alembic_failure;
        }
    }

    // Fill in the mesh
    //   alembic_fillcamera_options dataFillOptions;
    //   dataFillOptions.pIObj = &iObj;
    //   dataFillOptions.pCameraObj = pCameraObj;
    //   dataFillOptions.dTicks =  GET_MAX_INTERFACE()->GetTime();
    // AlembicImport_FillInCamera(dataFillOptions);

    // printAnimatables(pCameraObj);

    Interval interval = FOREVER;

    AlembicFloatController* pControl = NULL;
    {
        std::string prop("horizontalFOV");
        if (options.attachToExisting) {
            pControl = getController(pCameraObj, identifier, prop, 0, 0);
        }
        if (pControl) {
            pControl->GetParamBlockByID(0)->SetValue(
                GetParamIdByName(pControl, 0, "path"), zero,
                EC_UTF8_to_TCHAR(path.c_str()));
        }
        else if (assignController(createFloatController(path, identifier, prop),
                                  pCameraObj, 0, 0) &&
                 !isConstant) {
            std::stringstream controllerName;
            controllerName << GET_MAXSCRIPT_NODE(pNode);
            controllerName << "mynode2113.FOV.controller.time";
            AlembicImport_ConnectTimeControl(controllerName.str().c_str(), options);
        }
    }
    {
        std::string prop("FocusDistance");
        if (options.attachToExisting) {
            pControl = getController(pCameraObj, identifier, prop, 1, 0, 1);
        }
        if (pControl) {
            pControl->GetParamBlockByID(0)->SetValue(
                GetParamIdByName(pControl, 0, "path"), zero,
                EC_UTF8_to_TCHAR(path.c_str()));
        }
        else if (assignController(createFloatController(path, identifier, prop),
                                  pCameraObj, 1, 0, 1) &&
                 !isConstant) {
            std::stringstream controllerName;
            controllerName << GET_MAXSCRIPT_NODE(pNode);
            controllerName
                    << "mynode2113.MultiPass_Effect.focalDepth.controller.time";
            AlembicImport_ConnectTimeControl(controllerName.str().c_str(), options);
        }
    }
    {
        std::string prop("NearClippingPlane");
        if (options.attachToExisting) {
            pControl = getController(pCameraObj, identifier, prop, 0, 2);
        }
        if (pControl) {
            pControl->GetParamBlockByID(0)->SetValue(
                GetParamIdByName(pControl, 0, "path"), zero,
                EC_UTF8_to_TCHAR(path.c_str()));
        }
        else if (assignController(createFloatController(path, identifier, prop),
                                  pCameraObj, 0, 2) &&
                 !isConstant) {
            std::stringstream controllerName;
            controllerName << GET_MAXSCRIPT_NODE(pNode);
            controllerName << "mynode2113.nearclip.controller.time";
            AlembicImport_ConnectTimeControl(controllerName.str().c_str(), options);
        }
    }
    {
        std::string prop("FarClippingPlane");
        if (options.attachToExisting) {
            pControl = getController(pCameraObj, identifier, prop, 0, 3);
        }
        if (pControl) {
            pControl->GetParamBlockByID(0)->SetValue(
                GetParamIdByName(pControl, 0, "path"), zero,
                EC_UTF8_to_TCHAR(path.c_str()));
        }
        else if (assignController(createFloatController(path, identifier, prop),
                                  pCameraObj, 0, 3) &&
                 !isConstant) {
            std::stringstream controllerName;
            controllerName << GET_MAXSCRIPT_NODE(pNode);
            controllerName << "mynode2113.farclip.controller.time";
            AlembicImport_ConnectTimeControl(controllerName.str().c_str(), options);
        }
    }

    // if(assignControllerToLevel1SubAnim(createFloatController(path, identifier,
    // std::string("FocusDistance")), pCameraObj, 0, 1) && !isConstant){
    //	AlembicImport_ConnectTimeControl( "$.targetDistance.controller.time",
    // options );
    //}

    createCameraModifier(path, identifier, pNode);

    // Add the new inode to our current scene list
    SceneEntry* pEntry = options.sceneEnumProc.Append(
                             pNode, pCameraObj, OBTYPE_CAMERA, &std::string(iObj.getFullName()));
    options.currentSceneList.Append(pEntry);

    // Set the visibility controller
    AlembicImport_SetupVisControl(path, identifier, iObj, pNode, options);

    importMetadata(pNode, iObj);

    return 0;
}