#ifndef __I3DEXIMPORTEXPORT__
#define __I3DEXIMPORTEXPORT__
/****************************************************************************************

		I3DExImportExport.h

		Copyright: (c) 2001 Eovia Corp. All rights reserved.

		I3DExImportFilter definition                                              
		I3DExExportFilter definition                                              

		Author:	Ray Dream
		Date:	3/2/98

		Revision History

		when		who					what & why
		==========	================	======================================================
		08/26/99	cph					Added family ids
		08/11/99	Guillaume&Christy	Added inheritance to all the Basic* classes

*****************************************************************************************/

#if CP_PRAGMA_ONCE
#pragma once
#endif

#include "IExtension.h"
#include "InterfaceIDs.h"

struct IMCFile;
struct I3DShScene;
struct I3DShTreeElement;
class TMCPixelBucket;
struct TImportInfo;


//****** Globally Unique Ids *************************************************

MCDEFINE_GUID_H(IID_I3DExImportFilter);
MCDEFINE_GUID_H(IID_I3DExExportFilter);

//****** Family Id *************************************************

const FourCharT kImportFilterFamilyID = kRID_ImportFilterFamilyID;
const FourCharT kExportFilterFamilyID = kRID_ExportFilterFamilyID;

/*****************************************************************************\
*  I3DExImportFilter                                                          *
*                                                                             *
*  3D Importer                                                                *
*                                                                             *
\*****************************************************************************/

/// \addtogroup ExternalInterface
/// \{

/// An import filter is a plugin that can open a file (with Open) or import a file into a scene (with Import).
///
struct I3DExImportFilter: public IMCUnknown
{
	// ****************************************************************************
	//								Prepare
	//
	/// Is called before the actual import starts. Usually you do not need to implement this method.
	///
	/// \param file The file that is imported.
	/// \param scene The scene into which we import.
	/// \param fatherTree A pointer to the tree element under which the imported objects should be inserted.
	///
	virtual boolean MCCOMAPI Prepare(IMCFile * file, I3DShScene* scene, I3DShTreeElement* fatherTree) = 0;


	// ****************************************************************************
	//								WantsOptionDialog
	//
	/// Returns true if an option dialog should be opened.
	///
	virtual boolean MCCOMAPI WantsOptionDialog() = 0;
	
	
	// ****************************************************************************
	//								DoImport
	// 
	/// Imports a file into a scene. It is called either by using the File->Open or
	/// File->Import.
	///
	/// \param file				file that is imported
	/// \param scene			the scene in which you want to add the content of the file
	/// \param fatherTree		is the root of the imported scene. You should add all the imported instances/groups as child of it.
	///							If fatherTree is NULL, then you should import everything in the Universe of the scene.
	///	\param ioImportInfo		Info for positioning the imported data in the scene (NULL for default placement)
	///
	virtual MCCOMErr MCCOMAPI DoImport(	IMCFile *			file, 
										I3DShScene*			scene, 
										I3DShTreeElement*	fatherTree, 
										TImportInfo*		ioImportInfo) = 0;
	
	// ****************************************************************************
	//								WantsTopScene
	// 
	/// Called by the shell to determine if objects should placed directly in the scene
	/// or in a Master Group.
	///
	/// \note This call is only used for "import"and not for "open".
	///
	/// \return True if the imported objects should be placed in the main scene.
	/// False if the imported objects should be placed in a master group.
	///
	virtual boolean MCCOMAPI WantsTopScene() = 0;
};
/// \}


/*****************************************************************************\
*  I3DExExportFilter                                                          *
*                                                                             *
*  3D Exporter                                                                *
*                                                                             *
\*****************************************************************************/

#ifndef qDemoVersion //regular interface

/// \addtogroup ExternalInterface
/// \{

/// An export filter is a plugin that can save a scene or part of a scene to a file format different from the Carrara file format.
///
struct I3DExExportFilter: public IMCUnknown
{
	/// Is called before the actual export starts. Usually you do not need to implement this method.
	///
	/// \param scene The scene from which we export.
	/// \param fatherTree A pointer to the top of the tree that should be exported.
	virtual boolean MCCOMAPI Prepare(I3DShScene* scene, I3DShTreeElement* fatherTree) = 0;

	/// Returns true if an option dialog should be opened.
	///
	virtual boolean MCCOMAPI WantsOptionDialog() = 0;

	/// Returns the amount of disk space that is necessary to perform the export. This method is not used at this point.
	///
	virtual MCCOMErr MCCOMAPI NeededDiskSpace(IMCFile * file, I3DShScene* scene, I3DShTreeElement* fatherTree, uint32* diskSpace) = 0;

	/// Exports the subtree pointed by fatherTree into a file.
	///
	/// \param file A pointer to the file that should be written
	/// \param scene The scene that contains the geometry that will be exported.
	/// \param fatherTree The root of the sub tree that needs to be exported. (It should never be NULL)
	///	
	virtual MCCOMErr MCCOMAPI DoExport(IMCFile * file, I3DShScene* scene, I3DShTreeElement* fatherTree) = 0;

	/// Returns true if the exporter wants a preview of the scene included in the file. If you return true,
	/// then the Shell calls SetPreview with the corresponding image.
	///
	virtual boolean MCCOMAPI WantsPreview() = 0;

	/// Returns the size of the preview.
	///
	/// \param sizeh Horizontal size of the preview in pixels
	/// \param sizev Vertical size of the preview in pixels
	///
	virtual MCCOMErr MCCOMAPI GetPreviewSize(int16* sizeh, int16* sizev) = 0;


	/// Sets the rendered preview of the scene. The Shell will call this method if WantsPreview() returned true.
	///
	/// \param preview A pointer to a pixelBucket that contains the rendered preview of the scene.
	///
	virtual MCCOMErr MCCOMAPI SetPreview(TMCPixelBucket* preview) = 0;

	/// <P>Returns true if the you want to use a temporary file, false otherwise.</P>
	///
	/// <P>When you use a temporary file, the Shell will pass a file finishing '.tmp' to DoExport and then rename
	/// that file will the correct extension specified by your exporter resource. This is done so that you do not
	/// corrupt a preexisting file if there is an error during the export.</P>
	///
	virtual boolean  MCCOMAPI WantsTempFile() = 0;

	// ****************************************************************************
	//								WantSaveParameters
	//
	/// Return true if you want the parameters of this exporter to be saved in the
	/// Carrara scene file.
	///
	virtual boolean	 MCCOMAPI WantToSaveParameters() = 0;
};

/// \}

#else 	//(qDemoVersion) begin scrambled interface

struct I3DExExportFilter: public IMCUnknown
{
	virtual boolean	MCCOMAPI WantToSaveParameters() = 0;
	virtual boolean MCCOMAPI WantsOptionDialog() = 0;
	virtual boolean MCCOMAPI Prepare(I3DShScene* scene, I3DShTreeElement* fatherTree) = 0;	
	virtual MCCOMErr MCCOMAPI NeededDiskSpace(IMCFile * file, I3DShScene* scene, I3DShTreeElement* fatherTree, uint32* diskSpace) = 0;
	virtual MCCOMErr MCCOMAPI GetPreviewSize(int16* sizeh, int16* sizev) = 0;	
	virtual MCCOMErr MCCOMAPI SetPreview(TMCPixelBucket* preview) = 0;
	virtual MCCOMErr MCCOMAPI DoExport(IMCFile * file, I3DShScene* scene, I3DShTreeElement* fatherTree) = 0;	
	virtual boolean MCCOMAPI WantsPreview() = 0;	
};
#endif	//(qDemoVersion) end scrambled

#endif
