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

		I3DShUtilities.h

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

		ISh3DUtilities definition                                                   

		Author:	Ray Dream
		Date:	3/2/98

		Revision History

		when		who			what & why
		==========	==========	======================================================
		11/2/99		David		Added an optional parameter to SelectRoom
		10/23/99	EricB		Added I3DDBActionServer::PostInsertTreeListAction.
		09/20/99	Yann		Added kChange_ActionBegin and kChange_ActionEnd for Immediate Channel
		09/12/99	Pierre		Added accesor for standard toolbars
		09/09/99	Guillaume	Changed the name of I3DShMotionLink to I3DShConstraint
		8/27/99		cph			Added facetmesh and scene primitiveIDs plus more comments
		8/24/99		cph			Added primitive IDs for CreatePrimitiveByID()
		8/22/99		Greg		implemented ChangeDataComponents action
		8/17/99		Greg		Beefed up ChangeTransformAction
		7/19/99		Alec		added G/SetAppColorPref
		7/19/99		EricB		Added change master shader (of instances) action..
		6/24/99		Greg		Added CreateObjectByKindAndID and PostChangeTransformAction
		6/7/99		Greg		Added PostInsertObjectAction
		5/31/99		Yann		Added 3DDB Editors calls. Removed IShLineArt stuff
		5/24/99		Greg		Added existence and shownness change actions
		05/19/99	Jerome		Added the forward decleration of TMCString
		5/6/99		Greg		Added PostChangeTweenerAction
		4/20/99		Yann		Added I3DShUtilities::RegisterNewKeyFrameType
		3/23/99		Greg		Added CreateSceneSelection
		3/3/99		Greg		Added 3DDBActionServer
		11/24/98	Greg		Added GetHierarchyWindow() to I3DShUtilities
		9/18/98		Greg		Added CreateModule() to I3DShUtilities
		8/5/98		Greg		Added GetModule calls to I3DShUtilities
		8/4/98		cph			moved IShMenuManager, IShAction, IShMouseAction, IShActionManager to IShUtilties

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

#ifndef __I3DSHUTILITIES__
#define __I3DSHUTILITIES__

#if CP_PRAGMA_ONCE
#pragma once
#endif

#include "ComTypes.h"
#include "APITypes.h"
#include "Transforms.h"
#include "I3DShInstance.h"
#include "3DConstants.h"
#include "ITranscoder.h"
#include "IMCFile.h"	//for MCFileTypeID
#include "TreeTypes.h"
#include "MFUnits.h"
#include <IMCFont.h>   // for MCFontStyle

struct IMFAction;
struct IMFDocument;
struct IMCFile;
struct IMFPart;
struct IMFWindow;
struct IMFToolGroup;

struct I3DImageDocument;
struct I3DShAnimationMethod;
struct I3DShInvisibleTree;
struct I3DShKeyFrame;
struct I3DShMasterShader;
struct I3DShModifier;
struct I3DShModule;
struct I3DShObject;
struct I3DShParamTimeLine;
struct I3DShPostRenderer;
struct I3DShScene;
struct I3DShShader;
struct I3DShTreeElement;
struct I3DShTweener;
struct I3DShTweenerChainLink;
struct I3DShMasterGroup;
struct IMFBrowserDialog;
struct I3DShShadableTree;
struct IShMasterSound;
struct IShParameterComponent;
struct IExSound;
struct IShSound;
struct IChangeChannel;
struct IComponentAnim;
struct IHierarchyWindow;
struct IPreviewMaker;
struct ISceneDocument;
struct ISceneSelection;
struct ITimeBased;
struct IShAction;
struct IShChannel;
struct IShTextureMap;
struct IShTokenStream;
struct IShComponent;
struct IShNetworkComponent;
struct THierarchyFilter;
struct I3DShAttributesSet;
struct I3DShAttributesSetControler;
struct I3DShMasterClip;
struct TAutoPlaceInfo;
struct IShTextureMapFile;

class TMCString;
class TMCPoint;
class TMCColorRGBA;
class TMCRect;
class TBrowserData;
class TTreeIdPathList;
class TMCPixelBucket;
class TTreeUndoInfo;

template<class T> class TMCArray;
template<class T> class TMCSmartPtr;
template<class T> class TMCPtrArray;
template<class T> class TMCCountedPtrArray; 
template<class T> class TMCClassArray;


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

MCDEFINE_GUID_H(IID_I3DShUtilities);
MCDEFINE_GUID_H(IID_I3DShUtilities80);
MCDEFINE_GUID_H(IID_I3DDBActionServer);

MCDEFINE_GUID_H(CLSID_StandardFacetMeshAccumulator);
MCDEFINE_GUID_H(CLSID_StandardFacetMeshIterator);

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



/************************************************************************************\
*  3D Database Editors                                                              *
*                                                                                   *
*  The following contants are used by the 3D Database to build the list             *
*  of available modelers for each type of primitives. This is the same information  *
*  as what modelers put in their 'mdlr' resources.                                  *
*                                                                                   *
*  You probably will never need to use this stuff.                                  *
*                                                                                   *
\************************************************************************************/

// kAnyFacetPrimitive and kAnyPatchPrimitive are used by the registration scheme
// of the 3D Database to state any type of primitive that can return facets
// and any type of primitive that can return patches
#define kAnyPatchPrimitive 'p***'
#define kAnyFacetPrimitive 'f***'
// Editing type constants: native, convert to facets, convert to patches, etc.
#define kAnyEditing 0
#define kNativeEditing 1
#define kConvertToOtherEditing 2
#define kConvertToPatchEditing 3
#define kConvertToFacetsEditing 4
#define kDefaultEditing 5

#define kPrimitiveMModeler			'mpmp'					// Default P-Map based primitives modeler
#define kModelerManagerModuleID		'modm'					// Primitives modeler chooser
#define kShaderManagerModuleID		'shdm'					// Shading module chooser 

/// Specifies for a primitive which editor should be used
///
struct SEditorCouple : public TMCObject    
{
	int32				fPrimitiveID;		// 4 letters class ID of the Primitive
	int32				fEditorID;			// 4 letters class ID of the Modeler
	TMCString31			fEditorName;		// Name of this Modeler
	boolean				fPreferredEditor;	// true if this is the Prefered modeler for this primitive
	int32				fEditingType;		// See kNativeEditing, kConvertToOther, etc. above
};

//RoomSwitcherChangeChannel
#define kChange_HideRoom				'HdRm'	// sent just before hidding a room
#define kChange_ShowRoom				'SoRm'	// sent just after entering a room

//ImmediateUpdateChannel change kinds

#define kChange_BeginImmediateUpdate	'BgnU'
#define kChange_ImmediateUpdate			'Updt'
#define kChange_EndImmediateUpdate		'EndU'

	// ActionBegin and ActionEnd are generic messages monitored by the
	// 3D View that you can use to **block** some other messages and invalidations. 
	// See T3DViewModule::DataChanged for its use.
#define kChange_ActionBegin				'BgnA'
#define kChange_ActionEnd				'EndA'

// Flags to enable the tracking optimization for the 3DView
#define kChange_TrackingBegin			'TraB'
#define kChange_TrackingEnd				'TraE'


//DocunentChangeChannel change kinds
#define kChange_OpenDocument			'OpnD'
#define kChange_ActiveDocument			'ActD'
#define kChange_ClosingDocument			'ClsD'

#define kChange_PrefsChanged			'PrCh'
#define kChange_PrefPreviewChanged      'Prvi'
#define kChange_PrefPreviewTextureDowngrade      'Prtg'

struct LeakStats
{
	LeakStats() {}

	void Init();
	void End();

	uint32  TreeCounter,Primitives,ShaderCounter,DataComponent,Component3DDB;
};

// IDs to be used with I3DShUtilities::CreatePrimitiveByID()
#define kBoundingBoxPrimitiveID			'bbox'
#define kConePrimitiveID				'co  '
#define kCloudsPrimitiveID				'clou'
#define kCubePrimitiveID				'cube'
#define kCylinderPrimitiveID			'cyli'
#define kDodecahedraPrimitiveID			'dode'	// hidden (not in UI)
#define kEarthPrimitiveID				'RfTG'
#define kFacetMeshPrimitiveID			'fmes'  // used to create an I3DShFacetMeshPrimitive
#define kFirePrimitiveID				'fire'
#define kFogPrimitiveID					'fogg'
#define kFormulaPrimitiveID				'scri'
#define kFountainPrimitiveID			'foun'
#define kFreeFormPrimitiveID			'IDff'	// hidden (not in UI)
#define kIcosahedronPrimitiveID			'icos'
#define kInfinitePlatePrimitiveID		'infp'
#define kMetaBallObjectPrimitiveID		'RfBP'
#define kNothingPrimitiveID				'noth'	// hidden (not in UI)
#define kOctohedraPrimitiveID			'octo'	// hidden (not in UI)
#define kParticleEmitterPrimitiveID		'emit'
#define kPatchArrayPrimitiveID			'pa  '  // maps to old CLSID_StandardPatchArray
#define kPatchListPrimitiveID			'pab '  // maps to old CLSID_StandardPatchList
#define kPlanePrimitiveID				'RfIP'
#define kPolygonListPrimitiveID			'im  '  // maps to old CLSID_StandardPolygonList
#define kPolygonArrayPrimitiveID		'po  '  // maps to old CLSID_StandardPolygonArray
#define kScenePrimitiveID				'sc  '  // used to create an I3DShScene
#define kSplineFormPrimitiveID			'IDsp'	// hidden (not in UI)
#define kSplineObjectPrimitiveID		'ex  '
#define kStandardPrimitiveID			'prim'	// maps to old CLSID_StandardExternalPrimitive
#define kTeapotPrimitiveID				'COtp'	// hidden (not in UI)
#define kTerrainPrimitiveID				'terr'
#define kTetrahedraPrimitiveID			'tetr'	// hidden (not in UI)
#define kTextPrimitiveID				'tx  '



enum EBrowserPreviewType
{
	kTextOnlyPreview,
	kSmallPreview32,
	kLargePreview64,
	kWidePreview86
};

/// \addtogroup Utilities
/// \{

/// I3DShUtilies provides access to a number of utilities from the Shell.
///
struct I3DShUtilities: public IMCUnknown
{
	// ****************************************************************************
	//								CreateKeyFrame
	// 
	/// Creates a keyframe.
	/// 
	/// \param outKeyFrame  A pointer to the keyframe that is created.
	/// \param itsType      The type of keyframe we want to create.
	/// 
	virtual MCCOMErr MCCOMAPI CreateKeyFrame			(I3DShKeyFrame** outKeyFrame, int32 itsType) = 0;
	
	// ****************************************************************************
	//								CreateTweenerChainLink
	// 
	/// Creates a tweener chain link.
	/// 
	/// \param outTweenerChainLink  A pointer to the tweenerchainlink that is created.
	/// \param time                 The time associated with this link.
	/// \param fatherTL             The time line that contains this link.
	/// 
	virtual MCCOMErr MCCOMAPI CreateTweenerChainLink	(I3DShTweenerChainLink** outTweenerChainLink, int32 time, I3DShParamTimeLine* fatherTL) = 0;

	// 
	// ****************************************************************************
	//								RegisterNewKeyFrameType
	// 
	/// Use RegisterNewKeyFrameType to declare new types of animated data dynamically. 'inKeyFrameType' will be used as a template to create
	/// other keyframes of the same type, perform the interpolation, etc. Warning: 'inType' MUST BE UNIQUE, so register it with Eovia
	/// if you are using this procedure.
	/// 
	/// \param inKeyFrameType  The keyframe type that should be registered.
	/// 
	virtual MCCOMErr MCCOMAPI RegisterNewKeyFrameType	(I3DShKeyFrame* inKeyFrameType) = 0;

	// ****************************************************************************
	//								UnregisterNewKeyFrameType
	// 
	/// Counterpart of RegisterNewKeyFrameType
	/// 
	virtual MCCOMErr MCCOMAPI UnregisterNewKeyFrameType	(I3DShKeyFrame* inKeyFrameType) = 0;

	// ****************************************************************************
	//								ResetImportReport
	// 
	/// \deprecated Do not use
	/// 
	virtual MCCOMErr MCCOMAPI ResetImportReport			() = 0;
	
	// ****************************************************************************
	//								ResetImportReport
	// 
	/// \deprecated Do not use
	/// 
	virtual MCCOMErr MCCOMAPI AddImportProblem			(int16 msgIndex, TMCString& substitutionString, boolean allowMultipleEntries) = 0;

	// ****************************************************************************
	//								ShowImportReport
	// 
	/// \deprecated Do not use
	/// 
	virtual MCCOMErr MCCOMAPI ShowImportReport			(int16 dialogID,int16 strListID) = 0;

	// ****************************************************************************
	//								CalculateNormals
	// 
	/// Computes the normals of the facets and does smoothing if abs(smoothAngle) > 1E-5
	/// 
	/// \param facetList    A triangle mesh.
	/// \param smoothAngle  The smoothing angle.
	/// 
	virtual MCCOMErr MCCOMAPI CalculateNormals			(TMCArray<TFacet3D>* facetList, real smoothAngle)= 0;

	// ****************************************************************************
	//								BuildEdges
	// 
	/// Build the edge list for a facetMesh
	/// 
	/// \param mesh  The facet mesh.
	/// 
	virtual	MCCOMErr MCCOMAPI BuildEdges (FacetMesh& mesh) = 0;

	// ****************************************************************************
	//								CreateMasterShader
	// 
	/// Creates a master Shader, sets its shader and insert the master in the scene.
	/// 
	/// \param inShader         The shader tree to insert in the master shader.
	/// \param inScene          The scene in which the master shader should be added
	/// \param outMasterShader  The master shader that is created.
	/// 
	virtual MCCOMErr MCCOMAPI CreateMasterShader		(I3DShShader* inShader, I3DShScene* inScene, I3DShMasterShader** outMasterShader) = 0;

	// ****************************************************************************
	//								WriteMasterShaderToBrowserFile
	// 
	/// Writes a master shader to a browser file.
	/// 
	/// \param masterShader  A pointer to the master shader to write
	/// \param file       A pointer to the file where the master shader will be saved
	/// \see LoadMasterShaderFromBrowserFile
	///
	virtual void	MCCOMAPI WriteMasterShaderToBrowserFile(I3DShMasterShader* masterShader,IMCFile* file)=0;

	// ****************************************************************************
	//								LoadMasterShaderFromBrowserFile
	// 
	/// Loads a master shader from a browser file
	/// \see WriteComponentToBrowserFile
	/// \param masterShader       Returns a pointer to the master shader loaded
	/// \param file               A pointer to the file from which the master shader will be loaded
	///	 \return MC_S_OK if the file contained the right type of component
	/// \see WriteMasterShaderToBrowserFile
	///
	virtual MCCOMErr MCCOMAPI LoadMasterShaderFromBrowserFile(I3DShMasterShader** masterShader,IMCFile* file)=0;

	// ****************************************************************************
	//								CreateColorShader
	// 
	/// Creates a simple Color Shader
	/// 
	/// \param inColor    The color of the shader
	/// \param outShader  The shader that is created.
	/// 
	virtual MCCOMErr MCCOMAPI CreateColorShader			(TMCColorRGB& inColor, I3DShShader** outShader) =0;

	// ****************************************************************************
	//								CreateValueShader
	// 
	/// Creates a simple value Shader
	/// 
	/// \param inValue    The value
	/// \param outShader  The value shader.
	/// 
	virtual MCCOMErr MCCOMAPI CreateValueShader			(real inValue,I3DShShader** outShader) =0;

	// ****************************************************************************
	//								CreateTextureMapShader
	// 
	/// Creates a TextureMap Shader (IShTextureMap knows if its internal or external)
	/// 
	/// \param inTexture    A texture map.
	/// \param inMapParams  The parameter of the map.
	/// \param outShader    The shader that is created.
	/// 
	virtual MCCOMErr MCCOMAPI   CreateTextureMapShader	(IShTextureMap*  inTexture,     //IShTextureMap knows if its internal or external...
														 MapParams inMapParams,	I3DShShader** outShader) =0;

	// ****************************************************************************
	//								CreateMultiChannelShader
	// 
	/// Create a multichannel shader.
	/// If you don't want to define a channel just pass NULL
	/// 
	virtual MCCOMErr MCCOMAPI   CreateMultiChannelShader(I3DShShader* inColorShader, I3DShShader* inHighlightShader,
														 I3DShShader* inShininessShader, I3DShShader* inBumpShader,
														 I3DShShader* inReflectionShader, I3DShShader* inTransparencyShader,
														 I3DShShader* inRefractionShader, I3DShShader* inGlowShader,
														 I3DShShader** outShader, I3DShShader* inAlphaShader=NULL, real bumpAmplitude = 1) =0;

	// ****************************************************************************
	//								CreateMultiChannelShader
	// 
	/// Creates Multi Channel &/or insert a shader in a channel by index
	/// if inOutMultiChannelShader = Null, create the multi channel shader.
	/// 
	virtual MCCOMErr MCCOMAPI   CreateMultiChannelShader(I3DShShader* channelShader, uint32 index , I3DShShader** inOutMultiChannelShader) =0;
                
	// ****************************************************************************
	//								CreateLayerShader
	// 
	/// Creates a Layer Shader.
	/// 
	/// \param colorShader     The shader of the layer.
	/// \param maskShader      The opacity shader.
	/// \param layerKind       The classID of the layer
	/// \param position        The rectangle in texture coordinates of the layer.
	/// \param outLayerShader  The layer shader that is built.
	/// 
	virtual MCCOMErr MCCOMAPI   CreateLayerShader		(I3DShShader* colorShader, I3DShShader* maskShader, uint32 layerKind,
														 TMCRect& position, I3DShShader** outLayerShader) =0;

	// ****************************************************************************
	//								CreateLayersListShader
	// 
	/// Creates a Layers List Shader or
	/// adds a Shader To a LayerList Shader : needed for multiple UV spaces on a primitive
	/// 
	/// \param uvSpaceID    The UVSpace of the layer.
	/// \param mappingMode  The projection mapping
	/// \param inShader     The shader to be added
	/// \param inOutShader  The layer list shader that is created.
	/// 
	virtual MCCOMErr MCCOMAPI   CreateLayersListShader	(uint32 uvSpaceID, uint32 mappingMode, I3DShShader* inShader,
														 I3DShShader** inOutShader) =0;

	// ****************************************************************************
	//								CreateBinaryOperatorShader
	// 
	/// Creates a binary operator shader
	/// 
	/// \param inType		The operator type (kMulOperatorShdr, kAddOperatorShdr...)
	/// \param inShader1    The first operand.
	/// \param inShader2    The second operand.
	/// \param inOutShader  The shader that is created.
	/// 
	virtual MCCOMErr MCCOMAPI   CreateBinaryOperatorShader(IDType inType, I3DShShader* inShader1, I3DShShader* inShader2, I3DShShader** inOutShader) =0;

	// ****************************************************************************
	//								CreateTextureMapFile
	// 
	/// Create a texture map file.
	/// 
	virtual MCCOMErr MCCOMAPI	CreateTextureMapFile(IShTextureMapFile** textureMapFile, IMCFile* file, IDType format) = 0;

	// ****************************************************************************
	//								RemoveDuplicateTexturesInRAM
	// 
	/// Will remove duplicated Textures in ram.
	/// When 2 textures are similar, the 2 IShTextures will have a ptr to one IShchannel. And the duplicated IShChannel will be released.
	/// 
	virtual MCCOMErr MCCOMAPI   RemoveDuplicateTexturesInRAM(  TMCCountedPtrArray<IShTextureMap> &textures ) =0;

	// ****************************************************************************
	//								ReadTextureMap
	// 
	/// Reads a texture map from a token stream.
	/// 
	/// \param stream     The token stream.
	/// \param texture	  The texture that is created.
	/// 
	virtual MCCOMErr MCCOMAPI ReadTextureMap(IShTokenStream* stream, IShTextureMap** texturez) = 0;
	
	// ****************************************************************************
	//								WriteTextureMap
	// 
	/// Writes a texture map to a token stream (file).
	/// 
	/// \param stream     The token stream.
	/// \param keyword    The keyword that identify the texture map.
	/// \param texture	  The texture that is created.
	/// 
	virtual MCCOMErr MCCOMAPI WriteTextureMap(IShTokenStream* stream, IDType keyword, IShTextureMap* texture) = 0;

	// ****************************************************************************
	//								OptimizeShader
	// 
	/// Optimizes the given shader, return true if something has been optimized
	/// 
	/// \param shader  The shader to optimize.
	/// 
	virtual boolean	 MCCOMAPI	OptimizeShader(	TMCCountedPtr<I3DShShader> &shader ) =0;

	// ****************************************************************************
	//								FindAllReferenceShaderDependencies
	// 
	/// Finds All Shaders in a scene that have a reference shader that have a pointer on it.
	/// (It's possible to give an Array of shader to not llok at)
	/// 
	/// \param scene                           The scene.
	/// \param inExcludedMasterShaders         
	/// \param outHostReferencedMasterShaders  
	/// 
	virtual MCCOMErr MCCOMAPI	FindAllReferenceShaderDependencies(  I3DShScene *scene , TMCCountedPtrArray<I3DShMasterShader> &inExcludedMasterShaders, TMCPtrArray<I3DShMasterShader> &outHostReferencedMasterShaders) =0;

	// ****************************************************************************
	//								FindReferenceShaders
	// 
	/// Adds in the list all host referenced shaders used by inMasterShader, does not duplicate MasterShaders in the list
	/// 
	/// \param inMasterShader  
	/// \param outFoundList    Returns the list of reference shaders contained in the master shader.
	/// 
	virtual MCCOMErr MCCOMAPI	FindReferenceShaders( I3DShMasterShader *inMasterShader  , TMCPtrArray<I3DShMasterShader>* outFoundList) =0;

	// ****************************************************************************
	//								FlattenReferenceShaders
	// 
	/// Copy the shaders that are referenced by a reference shader into the shading
	/// tree.
	/// 
	virtual MCCOMErr MCCOMAPI	FlattenReferenceShaders( I3DShMasterShader *inOutMasterShader) = 0;

	// ****************************************************************************
	//								CreateMasterSound
	// 
	/// Creates a Master Sound from the given Sound (only available in Pro version)
	/// 
	virtual MCCOMErr MCCOMAPI	CreateMasterSound	(IExSound* inSound,  I3DShScene* inScene,	IShMasterSound** outSound) = 0;


	// ****************************************************************************
	//								CreateModule
	// 
	/// Creates a new module of type inModuleID.
	/// 
	/// \param module      The module that is created.
	/// \param inModuleID  The Class ID of the module to create.
	/// \param inDocument  The document to which the module should be attached (NULL if this is a global module).
	/// 
	virtual void	 MCCOMAPI CreateModule				(I3DShModule** module,IDType inModuleID, IMFDocument* inDocument) = 0;

	// ****************************************************************************
	//								ActivateModule
	// 
	/// Activates a module (and deactivate any previously activated module)
	/// 
	virtual	void	 MCCOMAPI ActivateModule			(I3DShModule* inModule) = 0;

	// ****************************************************************************
	//								GetGlobalModuleCount
	// 
	/// Returns the number of global modules.
	/// 
	virtual uint32	 MCCOMAPI GetGlobalModuleCount		() = 0;
	
	// ****************************************************************************
	//								GetDocumentModuleCount
	// 
	/// Returns the number of modules attached to a document.
	/// 
	/// \param inDocument  The document.
	/// 
	virtual uint32	 MCCOMAPI GetDocumentModuleCount	(IMFDocument* inDocument) = 0;

	// ****************************************************************************
	//								GetGlobalModuleByIndex
	// 
	/// Returns a global module that is identified by an index.
	/// 
	/// \param module  A pointer to the module.
	/// \param index   The index of the module.
	/// 
	virtual void	 MCCOMAPI GetGlobalModuleByIndex	(I3DShModule** module,uint32 index) = 0;
	
	// ****************************************************************************
	//								GetDocumentModuleByIndex
	// 
	/// Returns a document module that is identified by an index.
	/// 
	/// \param module      A pointer to the module.
	/// \param inDocument  The document to which the module should be attached
	/// \param index       The index of the module.
	/// 
	virtual void	 MCCOMAPI GetDocumentModuleByIndex	(I3DShModule** module,IMFDocument* inDocument, uint32 index) = 0;

	// ****************************************************************************
	//								GetGlobalModule
	// 
	/// Returns a global module identified by its classID.
	/// 
	/// \param module      A pointer to the module.
	/// \param inModuleID  The class ID of the module.
	/// 
	virtual void	 MCCOMAPI GetGlobalModule			(I3DShModule** module,IDType inModuleID) = 0;
	
	// ****************************************************************************
	//								GetDocumentModule
	// 
	/// Returns a module attached to a document.
	/// 
	/// \param module      A pointer to the module.
	/// \param inDocument  The document to which the module should be attached
	/// \param inModuleID  The class ID of the module.
	/// 
	virtual void	 MCCOMAPI GetDocumentModule			(I3DShModule** module,IMFDocument* inDocument, IDType inModuleID) = 0;

	// ****************************************************************************
	//								LoadSceneDocument
	// 
	/// Loads a scene document from a file.
	/// 
	/// \param sceneDoc  The scene document that is created.
	/// \param file      The file from which we read.
	/// \param format    The format of the file.
	/// 
	virtual void	 MCCOMAPI LoadSceneDocument			(ISceneDocument** sceneDoc, IMCFile* file, int32 format) = 0;

	// ****************************************************************************
	//								OpenSceneFileDialog
	// 
	/// Opens the open scene file dialog. Will prompt the user to select the file.
	//
	/// \param file	                  The file that is created.
	/// \param outSelectedFileFormat  The type of the file selected by the user.
	//
	/// \return True if the user select a file
	/// 
	virtual boolean  MCCOMAPI OpenSceneFileDialog(IMCFile** file, IDType& outSelectedFileFormat) = 0;

	// ****************************************************************************
	//								SaveSceneFileDialog
	// 
	/// Display the save dialog. Will prompt the user to select the file.
	//
	/// \param file	                  The file that is created.
	/// \param outSelectedFileFormat  The type of the file selected by the user.
	//
	/// \return True if the user select a file
	/// 
	virtual boolean	 MCCOMAPI SaveSceneFileDialog(const TMCString& defaultFileName, IMCFile** file, IDType& outSelectedFileFormat)=0;
	
	// ****************************************************************************
	//								ChooseSelectionDialog
	// 
	/// Display a dialog with the scene hierarchy to make a multiple selection
	/// 
	/// \param selection         The selection returned by the dialog
	/// \param title            The title of the dialog
	/// \param filter	         The filter to hide some part of the hierarchy
	///                          if nil displays a combobox to choose default filters
	/// \param defaultSelection  The selection that is shown when the dialog opens
	//
	/// \return True if the user actually chose the Ok button
	/// 
	virtual boolean	 MCCOMAPI ChooseSelectionDialog(ISceneSelection** selection, const TMCString& title, const TMCString& inExplanation, THierarchyFilter* filter, const ISceneSelection* defaultSelection = nil) = 0;

	// ****************************************************************************
	//								ChooseTreeIdPathListDialog
	// 
	/// Display a dialog with the scene hierarchy to make a multiple selection
	/// 
	/// \param selection		The list of paths of the selection returned by the dialog  
	/// \param title            The title of the dialog
	/// \param inExplanation    An explanation displayed at the bottom of the dialog
	/// \param filter			The filter to hide some part of the hierarchy
	///                          if nil displays a combobox to choose default filters
	/// \param defaultSelection	The list of paths of the selection that is shown when the dialog opens
	/// 
	virtual boolean	 MCCOMAPI ChooseTreeIdPathListDialog(TTreeIdPathList& selection, const TMCString& title, const TMCString& inExplanation, THierarchyFilter* filter, const TTreeIdPathList* defaultSelection = nil) = 0;

	// ****************************************************************************
	//								ChooseTreeDialog
	// 
	/// Display a dialog with the scene hierarchy to make a single selection of a tree
	/// 
	/// \param selected			The tree selected by user
	/// \param title            The title of the dialog
	/// \param inExplanation    An explanation displayed at the bottom of the dialog
	/// \param filter           The filter to hide some part of the hierarchy
	///                          if nil displays a combobox to choose default filters
	/// \param defaultTree		The tree that is shown selected when the dialog opens
	//
	/// \return True if the user actually chose the Ok button
	/// 
	virtual boolean	 MCCOMAPI ChooseTreeDialog(I3DShTreeElement** selected, const TMCString& title, const TMCString& inExplanation, THierarchyFilter* filter, const I3DShTreeElement* defaultTree = nil, I3DShTreeElement* rootOverride = nil) = 0;

	// ****************************************************************************
	//								GetPropertiesWindow
	// 
	/// Returns a pointer to the properties window.
	/// 
	/// \param part  A pointer to the properties window.
	/// 
	virtual void	 MCCOMAPI GetPropertiesWindow		(IMFPart** part) = 0;
	
	// ****************************************************************************
	//								GetHierarchyWindow
	// 
	/// Returns a pointer to the hierarchy/sequencer window.
	///
	virtual IHierarchyWindow* MCCOMAPI GetHierarchyWindow	() = 0;

	// ****************************************************************************
	//								CreateImageDocument
	// 
	/// Creates a new image document.
	/// 
	virtual MCCOMErr MCCOMAPI CreateImageDocument		(I3DImageDocument** imageDocument) = 0;

	//
	//
	// ****************************************************************************
	//								CreateChannel
	// 
	/// Creates a channel.
	///
	/// Don't forget to set the channel's ID after creation:
	/// \code
	///	TChannelID newChannelID(TChannelID::eARGB_CHANNEL, 1);
	///	channel->SetID(newChannelID);
	/// \endcode
	///
	/// \param channel		The channel
	/// \param width		The width of the image in pixels.
	/// \param height		The height of the image in pixels.
	/// \param bitDepth		The bit depth of the image.
	/// \param supportUndo	Undo support on the channel.
	/// 
	virtual void	 MCCOMAPI CreateChannel		(IShChannel** channel,uint32 width,uint32 height,uint32 bitDepth,boolean supportUndo=false)=0;

	// ****************************************************************************
	//								GetImmediateUpdateChannel
	// 
	/// Returns a pointer to the immediate update channel.
	/// 
	/// \param channel  A pointer to the immediate update channel.
	/// 
	virtual void	 MCCOMAPI GetImmediateUpdateChannel	(IChangeChannel**channel) = 0;

	// ****************************************************************************
	//								WriteTimeBased
	// 
	/// Writes a time based.
	/// 
	/// \param stream     
	/// \param keyword    
	/// \param timeBased  
	/// 
	virtual MCCOMErr MCCOMAPI WriteTimeBased			(IShTokenStream* stream, IDType keyword, ITimeBased* timeBased) = 0;
	
	// ****************************************************************************
	//								ReadTimeBased
	// 
	/// Reads a timebased.
	/// 
	/// \param stream     
	/// \param timeBased  
	/// 
	virtual MCCOMErr MCCOMAPI ReadTimeBased				(IShTokenStream* stream, ITimeBased* timeBased) = 0;

	// ****************************************************************************
	//								SelectRoom
	// 
	// -Description:
	//
	// change the current room of the application
	//
	// -Parameters:
	//
	// roomID	: the ID of the room that should become the current room
	//
	// ****************************************************************************
	//								SelectRoom
	// 
	/// Change the current room.
	/// 
	/// \param roomID                  The ID of the room (see RoomID)
	/// \param dontPostUndoableAction  True if no undoable action should be posted.
	/// 
	virtual void	 MCCOMAPI SelectRoom				(RoomID roomID, boolean dontPostUndoableAction = false) = 0;
	
	// ****************************************************************************
	//								GetCurrentRoom
	// 
	/// Returns the ID of the current room.
	/// 
	virtual RoomID	 MCCOMAPI GetCurrentRoom			() = 0;

	// ****************************************************************************
	//								CurrentRoomWantsWireFrameActivation
	// 
	/// True if we need to active the wireframes.
	/// 
	virtual boolean	 MCCOMAPI CurrentRoomWantsWireFrameActivation() = 0;

	// ****************************************************************************
	//								GetDocumentChangeChannel
	// 
	/// Returns the document change channel.
	///
	virtual void	 MCCOMAPI GetDocumentChangeChannel	(IChangeChannel** channel) = 0;

	// ****************************************************************************
	//								GetPreferencesChangeChannel
	// 
	/// Returns the preference change channel.
	/// 
	virtual void	 MCCOMAPI GetPreferencesChangeChannel(IChangeChannel** channel) = 0;

	// ****************************************************************************
	//								CreatePreviewMaker
	// 
	/// Creates a preview maker.
	/// 
	virtual void 	 MCCOMAPI CreatePreviewMaker		(IPreviewMaker** previewmaker) = 0;

	// ****************************************************************************
	//								CreateEmptyScene
	// 
	/// Create an empty scene
	/// 
	virtual void	 MCCOMAPI CreateEmptyScene			(I3DShScene** scene) = 0;
	
	// ****************************************************************************
	//								CreateScene
	// 
	/// Create a basic scene and add one instance
	/// 
	/// \param scene         
	/// \param primitive     
	/// \param masterShaders  Array with the Master Shader at the index 0 following by the UV Space Shaders (UVSpaceShader[i] at the index i+1)
	/// 
	virtual void	 MCCOMAPI CreateScene				(I3DShScene** scene,I3DShObject *primitive=NULL, const TMCCountedPtrArray<I3DShMasterShader>* masterShaders=NULL) = 0;

	// ****************************************************************************
	//								GetEditorsList
	// 
	/// Get the list of all the 3D Database entries for modelers
	/// 
	/// 
	virtual TMCArray<SEditorCouple>* MCCOMAPI	GetEditorsList		() = 0;

	// ****************************************************************************
	//								GetEditor
	// 
	/// Gets the default modeler for a given primitive. Will return the "preferred" one if any was set.
	/// (there may be several native modelers for the same primitive).
	/// 
	/// \param primitiveID  The class ID of the primitive.
	/// 
	virtual int32 	MCCOMAPI					GetEditor			(int32 primitiveID) = 0;

	// ****************************************************************************
	//								GetPreferredEditor
	// 
	/// Gets the prefered modeler for a given primitive. Return 0 if none was set explicitely
	/// 
	/// \param primitiveID  The class ID of the primitive.
	/// 
	virtual int32 	MCCOMAPI					GetPreferredEditor	(int32 primitiveID) = 0;

	// ****************************************************************************
	//								SetPreferredEditor
	// 
	/// Sets the prefered modeler for a given primitive. This becomes the one that GetEditor() will return
	/// 
	/// \param primitiveID  The classID of the primitive
	/// \param editorID     The classID of the module (modeler)
	/// 
	virtual void 	MCCOMAPI					SetPreferredEditor	(int32 primitiveID, int32 editorID) = 0;

	// ****************************************************************************
	//								GetPrimitiveEditorsList
	// 
	/// Gets the list of modelers for this primitive. (You must create and provide the list)
	/// 
	/// \param inPrimitiveID  The classID of the primitive
	/// \param inEditingType  
	/// \param outList        The list of the modelers for this primitive.
	/// 
	virtual void	MCCOMAPI					GetPrimitiveEditorsList(int32 inPrimitiveID, int32 inEditingType, TMCArray<SEditorCouple>* outList) = 0;


	/// Opens the appropriate editors for the objects in the current selection
	/// Returns true if the selection was handled
	virtual boolean	MCCOMAPI					EditSelection	(ISceneDocument* sceneDoc) = 0;

	/// Given a tree, returns wich one is supposed to be edited (used to edit figure instances instead of their attribute set)
	virtual I3DShTreeElement* MCCOMAPI			GetTreeToEdit		(I3DShTreeElement* tree) = 0;

	// Returns the tree element of the controlling attributes set
	virtual I3DShTreeElement* MCCOMAPI          GetControllingAttributeSet(I3DShTreeElement* tree) = 0;

	// ****************************************************************************
	//								ActivateDocument
	// 
	/// Activates a document.
	/// 
	/// \param inDoc  
	/// 
	virtual	void	MCCOMAPI ActivateDocument	(IMFDocument* inDoc) = 0;
	
	// ****************************************************************************
	//								GetActiveDocument
	// 
	/// Returns the active document.
	/// 
	virtual	void	MCCOMAPI GetActiveDocument	(IMFDocument** inDoc) = 0;

	// ****************************************************************************
	//								GetAppColorPref
	// 
	/// Gets a color preference.  kAppColorPref colorID constants are found in 3DPublicDefs.h.
	/// 
	/// \param colorID  The ID of the color to get.
	/// \param color    The color that is returned.
	/// 
	virtual void MCCOMAPI GetAppColorPref(const IDType colorID, TMCColorRGBA& color) = 0;
	
	// ****************************************************************************
	//								SetAppColorPref
	// 
	/// Sets a color preference.  kAppColorPref colorID constants are found in 3DPublicDefs.h.
	/// 
	/// \param colorID  The ID of the color to get.
	/// \param color    The color.
	/// 
	virtual void MCCOMAPI SetAppColorPref(const IDType colorID, const TMCColorRGBA& color) = 0;

	// ****************************************************************************
	//								GetMouseScreenPosition
	// 
	/// Obtains the current mouse location.
	/// 
	/// \param mouseLocation  The current mouse location.
	/// 
	virtual void MCCOMAPI GetMouseScreenPosition(TMCPoint& mouseLocation ) = 0;

	// ****************************************************************************
	//								CreatePrimitiveByID
	// 
	/// Creates a primitive by its class ID. This is a convenient routine, because it hides the complexity of juggling
	/// between I3DShExternalPrimitive, IShComponent, I3DShPrimitiveComponent, I3DShObject, etc.
	/// It can return any of the following interfaces (when they make sense) : I3DShExternalPrimitive, IShComponent,
	/// I3DShPrimitiveComponent, I3DShObject, I3DShMaster, I3DShPrimitive, I3DShScene (if it is a scene),
	/// and any other primitive interface. Note : 'sc  ' stands for scenes
	/// 
	/// \param primID    4 letters ID of the primitive (=classID for External ones)
	/// \param shObject  The primitive is always returned as a I3DShObject
	/// \param riid      Additionnal interface you can ask for
	/// \param ppvObj    Returned interface, or NULL if not found
	/// 
	virtual void	MCCOMAPI CreatePrimitiveByID	(IDType primID,
													I3DShObject** shObject,
													const MCIID& riid,
													void** ppvObj) = 0;
	
	// ****************************************************************************
	//								PostSceneCommand
	// 
	/// Post a scene command
	/// 
	/// \param inClassID        The class ID of the scene command.
	/// \param inSceneDocument  The scene document.
	/// 
	virtual void MCCOMAPI PostSceneCommand(IDType inClassID, ISceneDocument* inSceneDocument) = 0;

	// ****************************************************************************
	//								InitLeakStats
	// 
	/// Internal use only.
	/// 
	virtual void MCCOMAPI InitLeakStats()=0;
	// ****************************************************************************
	//								EndLeakStats
	// 
	/// Internal use only.
	/// 
	virtual void MCCOMAPI EndLeakStats()=0;

	// ****************************************************************************
	//								GetTimeDisplayMode
	// 
	/// Returns the time display mode (time or frame). See EETDisplayMode
	/// 
	virtual int32 MCCOMAPI GetTimeDisplayMode()=0;
	
	// ****************************************************************************
	//								SetTimeDisplayMode
	// 
	/// Sets the time display mode (time or frame). See EETDisplayMode
	/// 
	virtual	void  MCCOMAPI SetTimeDisplayMode(int32 inMode) = 0;

	// ****************************************************************************
	//								GetCreatorString
	// 
	/// \deprecated
	/// 
	virtual void  MCCOMAPI GetCreatorString(TMCString& creator)=0;		

	// ****************************************************************************
	//								GetBasicToolGroup
	// 
	/// Returns a pointer to the basic tool group (move, scale, rotate).
	/// 
	/// \param outToolGroup  A pointer to the basic tool group.
	/// 
	virtual MCCOMErr		MCCOMAPI GetBasicToolGroup			(IMFToolGroup** outToolGroup) = 0;
	
	// ****************************************************************************
	//								GetCameraToolGroup
	// 
	/// Returns a pointer to the camera tool group .
	/// 
	/// \param outToolGroup  A pointer to the camera tool group.
	/// 
	virtual MCCOMErr		MCCOMAPI GetCameraToolGroup			(IMFToolGroup** outToolGroup) = 0;
	
	// ****************************************************************************
	//								Get2DToolGroup
	// 
	/// Returns a pointer to the 2D tool group (zoom, pan...).
	/// 
	/// \param outToolGroup  A pointer to the 2D tool group.
	/// 
	virtual MCCOMErr		MCCOMAPI Get2DToolGroup				(IMFToolGroup** outToolGroup) = 0;


	// ****************************************************************************
	//								GetLastImageOpenPath
	// 
	/// Returns the path to the folder of the last opened image.
	/// 
	/// \param path  The path to the folder of the last opened image.
	/// 
	virtual void			MCCOMAPI GetLastImageOpenPath		(TMCString& path)		= 0;
	
	// ****************************************************************************
	//								GetLastImageSavePath
	// 
	/// Returns the path to the folder of the last saved image.
	/// 
	/// \param path  The path to the folder of the last saved image.
	/// 
	virtual void			MCCOMAPI GetLastImageSavePath		(TMCString& path)		= 0;
	
	// ****************************************************************************
	//								SetLastImageOpenPath
	// 
	/// Sets the path to the folder of the last opened image.
	/// 
	/// \param path  The path to the folder of the last opened image.
	/// 
	virtual void			MCCOMAPI SetLastImageOpenPath		(const TMCString& path)	= 0;
	
	// ****************************************************************************
	//								SetLastImageSavePath
	// 
	/// Sets the path to the folder of the last saved image.
	/// 
	/// \param path  The path to the folder of the last saved image.
	/// 
	virtual void			MCCOMAPI SetLastImageSavePath		(const TMCString& path)	= 0;

	// ****************************************************************************
	//								GetLastSoundOpenPath
	// 
	/// Returns the path to the folder of the last opened sound file.
	/// 
	/// \param path  The path to the folder of the last opened sound  file.
	/// 
	virtual void			MCCOMAPI GetLastSoundOpenPath		(TMCString& path)		= 0;
	
	// ****************************************************************************
	//								SetLastSoundOpenPath
	// 
	/// Sets the path to the folder of the last opened sound file.
	/// 
	/// \param path  The path to the folder of the last opened sound  file.
	/// 
	virtual void			MCCOMAPI SetLastSoundOpenPath		(const TMCString& path)	= 0;

	// ****************************************************************************
	//								GetLastActiveSceneDoc
	// 
	/// Returns the scene doc that was the last one to be the current doc.
	/// Returns NULL if there is no opened scene doc.
	/// 
	virtual ISceneDocument*	MCCOMAPI GetLastActiveSceneDoc		()= 0;
	
	// ****************************************************************************
	//								GetDefaultInteractiveRendererID
	// 
	/// Gets the id of the default Interactive Renderer of the preferences
	/// (the classID of one component of the I3DExRendererBox ('RndB') family
	/// 
	virtual IDType		MCCOMAPI GetDefaultInteractiveRendererID() = 0;

	// ****************************************************************************
	//								SetDefaultInteractiveRendererID
	// 
	/// Sets the id of the default Interactive Renderer of the preferences
	/// 
	/// \param rendererID  The classID of the default Interactive Renderer
	/// 
	virtual void		MCCOMAPI SetDefaultInteractiveRendererID(IDType rendererID) = 0;

	// ****************************************************************************
	//								GetPreferedFrameRate
	// 
	/// Returns the default frame rate.
	/// 
	virtual real32		MCCOMAPI GetPreferedFrameRate() = 0;
	
	// ****************************************************************************
	//								SetPreferedFrameRate
	// 
	/// Sets the default frame rate.
	/// 
	/// \param fps  The default frame rate.
	/// 
	virtual void		MCCOMAPI SetPreferedFrameRate(real32 fps) = 0;

	// ****************************************************************************
	//								GetPreferedTweenerID
	// 
	/// Returns the class ID of the default tweener type.
	/// 
	virtual IDType		MCCOMAPI GetPreferedTweenerID() = 0;
	
	// ****************************************************************************
	//								GetPreferedTweenerID
	// 
	/// Sets the class ID of the default tweener type.
	/// 
	/// \param tweenID  The class ID of the default tweener type.
	/// 
	virtual void		MCCOMAPI GetPreferedTweenerID(IDType tweenID) = 0;

	// ****************************************************************************
	//								CreateInvisibleTree
	// 
	/// Creates an object that has no geometry but is visible in the scene hierarchy.
	/// This is used for the VET export (animator, interactor...)
	/// 
	/// \param ppvTree               The object created.
	/// \param inMasterGroupContext  The master group in which it should be inserted.
	/// 
	virtual void		MCCOMAPI CreateInvisibleTree(I3DShInvisibleTree** ppvTree, I3DShMasterGroup* inMasterGroupContext) = 0;

	// -Description:	
	//
	// ****************************************************************************
	//								WantsTexture
	// 
	/// Increments the number of waiters in the IncrementalTexturer so this one knows
	/// that some needs it.
	/// 
	virtual void		MCCOMAPI WantsTexture()=0;

	// ****************************************************************************
	//								WantsNoTexture
	// 
	/// Decrement the number of waiters in the IncrementalTexturer. If the number
	/// of waiters reach 0, the computation will be aborted ( noone needs it anymore ). 
	/// 
	virtual void		MCCOMAPI WantsNoTexture()=0;

	// ****************************************************************************
	//								SetIncrementalTexturerFlags
	// 
	/// Set options ( swap V axis, render only 2D textures ) on the 
	/// incremental texturer.
	/// 
	/// \param flags  The flags.
	/// 
	virtual void		MCCOMAPI SetIncrementalTexturerFlags( uint32 flags)=0;

	// ****************************************************************************
	//								GetIncrementalTexturerFlags
	// 
	/// Get options ( swap V axis, render only 2D textures ) on the 
	/// incremental texturer.
	/// 
	/// \param flags  The flags.
	/// 
	virtual void		MCCOMAPI GetIncrementalTexturerFlags( uint32& flags)=0;

	// ****************************************************************************
	//								LoadScene
	// 
	// -Description:
	//
	// 
	//
	// -Parameters:
	//
	// scene:		returns a pointer to the scene that was loaded
	// file:		the file that contains the scene
	// format:		the format of the file (ex: IDTYPE('C','A','R','F') for a .car file)
	//
	// ****************************************************************************
	//								LoadScene
	// 
	/// Loads a scene from a file. Note that this will not create a scene document. If
	/// you want to access a scene document, you should use LoadSceneDocument().
	/// 
	/// \param scene   The scene that was loaded.
	/// \param file    The file from which we read the scene.
	/// \param format  The format of the file.
	/// 
	virtual void		MCCOMAPI LoadScene(I3DShScene** scene,IMCFile * file, int32 format)=0;

	// ****************************************************************************
	//								ReplaceBrowserName
	// 
	/// Replace all the instances of \<BrowserName\> in the name of the scene by inName
	/// 
	/// \param inScene  the scene to change
	/// \param inName   the new name to set
	/// 
	virtual uint32		MCCOMAPI ReplaceBrowserName(I3DShScene* inScene, const TMCString& inName)=0;


	/// Creates a drop data out of the content of a scene
	/// Returns true if the flavor/type is supported and outData was filled
	/// Supported flavors are: 
	///		kDragFlavor_TreeElementNoChangeParent
	///		kDragFlavor_TreeElementList
	///		kDragFlavor_MasterObjectList
	///		kDragFlavor_MasterShaderList
	///
	virtual boolean		MCCOMAPI GetDropDataFromScene(	I3DShScene*		inScene,
														IDType			requestedType,
														void**			outData) = 0;

	// ****************************************************************************
	//								SaveScene
	// 
	/// Save a scene to a file.
	//
	/// \param scene		The scene.
	/// \param file			The file to which we write.
	/// \param format		The type of the file.
	/// \param inPreview	Optional preview
	//
	/// \return True if no error
	/// 
	virtual boolean		MCCOMAPI SaveScene(I3DShScene* scene, IMCFile* file, IDType format, TMCPixelBucket* inPreview = NULL)=0;

	// ****************************************************************************
	//								GetScenePreviewPart
	// 
	/// Do not call if you don't know what you're doing!
	/// (There is only one single preview part so don't try showing two at the same time!)
	/// 
	virtual IMFPart*	MCCOMAPI GetScenePreviewPart()=0;

	// ****************************************************************************
	//								GetBrowserPart
	// 
	/// Do not call if you don't know what you're doing!
	/// (There is only one single browser part so don't try showing two at the same time!)
	/// 
	virtual IMFPart*	MCCOMAPI GetBrowserPart()=0;

	// ****************************************************************************
	//								GetIconChangeChannel
	// 
	/// Returns the icon change channel.
	/// 
	virtual void		MCCOMAPI GetIconChangeChannel (IChangeChannel** channel) = 0;


	// ****************************************************************************
	//								GetOpenglUseOneWindowPerView
	// 
	/// Preference to fix some opengl problems with ati cards
	/// 
	virtual boolean		MCCOMAPI GetOpenglUseOneWindowPerView	()	= 0;

	// ****************************************************************************
	//								GetOpenglUseDisplayLists
	// 
	/// True if OpenGL uses display lists.
	/// 
	virtual boolean		MCCOMAPI GetOpenglUseDisplayLists		()	= 0;

	// ****************************************************************************
	//								GetFileFormatDefaultEncoding
	// 
	/// Returns the language of the default file encoding to be used with opening files
	/// 
	virtual TranscoderType	MCCOMAPI GetFileFormatDefaultEncoding	()	= 0;

	// ****************************************************************************
	//								IsRenderingNode
	// 
	/// Returns true if the application is a rendering node (for network rendering)
	/// 
	virtual boolean		MCCOMAPI IsRenderingNode()=0;

	// ****************************************************************************
	//								GetAppKind
	// 
	/// Internal use only
	/// 
	virtual int16		MCCOMAPI GetAppKind()=0;

	// ****************************************************************************
	//								GetAppMode
	// 
	/// Internal use only
	/// 
	virtual int16		MCCOMAPI GetAppMode()=0;

	// ****************************************************************************
	//								GetFileForReading
	// 
	/// Opens a file for reading. If we are in a rendering node, the file is fetched
	/// on the network and the IMCFile points to a copy of the file on the local
	/// machine.
	/// 
	/// This call should be used to read any file that can be accessed during a network
	/// rendering.
	///
	/// \param filePtr       A pointer to a IMCFile that reference the local copy of the file
	/// \param fullPathName  The full path of the file including name and extension
	/// \param format        File format that we are looking for (for instance 'jpeg' for an jpeg image)
	/// \param fileFamily    File family that we are looking for (for instance 'imag' for an image)
	/// 
	virtual boolean	MCCOMAPI GetFileForReading(IMCFile** filePtr,const TMCString& fullPathName,IDType format,IDType fileFamily)=0;

	// ****************************************************************************
	//								CreateNetworkComponent
	// 
	/// Creates a remote component in the main application. This function should
	/// only be called if you are in a rendering node. Remote components are used
	/// to access data that can only be accessed through the network.
	///
	/// If the component cannot be instantiated (for instance if it is not installed
	/// on the main application) the pointer is set to NULL.
	///
	/// Note that the network connection will remain open as long as the component
	/// exists. So you should destroy it as soon as you are done getting the data
	/// from the network.
	///
	/// \param classID          The class ID of the component to create
	/// \param remoteComponent  A pointer to the remote component
	/// 
	virtual void	MCCOMAPI CreateNetworkComponent(IDType classID,IShNetworkComponent** remoteComponent)=0;

	// ****************************************************************************
	//								ConvertToOtherModeler
	// 
	/// Launch the convert to other modeler dialog on the active submodule.
	/// 
	/// \param sourceModule  the module of the primitive to convert
	/// 
	virtual void	MCCOMAPI ConvertToOtherModeler(I3DShModule* sourceModule) = 0;

	// ****************************************************************************
	//								LoadMasterClipDialog
	// 
	/// Open a dialog to load a clip for a given attributes set. The clip can be a
	/// cbr file as well as some other format supported by the attributes set.
	/// 
	/// \param attributesSet	The attributes set
	/// \param clip				The created clip (NOTE: the clip is not added to the scene)
	/// 
	virtual MCCOMErr	MCCOMAPI LoadMasterClipDialog(I3DShAttributesSet* attributesSet, I3DShMasterClip** clip) = 0;

	/// Sets the unit used to display lengths in the application
	virtual void		MCCOMAPI Set3DUnit	(EUnits inUnit) = 0;

	/// Gets the unit used to display lengths in the application
	virtual EUnits 		MCCOMAPI Get3DUnit	() = 0;
	
	/// Resolve possible master editing ambiguity (if needed)
    virtual boolean         MCCOMAPI ResolveMasterAmbiguity() = 0;

	/// Returns all content runtimes stored by the browser
	virtual void		MCCOMAPI GetContentRuntimes(TMCClassArray<TMCDynamicString>& runtimes) = 0;

	/// Adds a content folder to the browser
	virtual void		MCCOMAPI AddContentRuntimeFolder(const TMCDynamicString& runtimeFolder) = 0;

	// ****************************************************************************
	//								GetShouldConsolidateShadersOnLoad
	// 
	/// return true iff the shaders should be consolidated automaticlly on load
    virtual boolean MCCOMAPI GetShouldConsolidateShadersOnLoad() const = 0;

	// ****************************************************************************
	//								GetNetworkFont
	// 
	/// Get a network font.
	///
	/// \param fontPtr       A pointer to a IMCFont that reference the local copy of the font
	/// \param fontName      The name of the font
	/// \param fontStyle     The style of the font
	/// \return true iff found the font with matching style. Note that fontPtr would be set even if only font with 
	/// 
	virtual boolean	MCCOMAPI GetNetworkFont(IMCFont** fontPtr,const TMCString& fontName, MCFontStyle fontStyle)=0;

	// ****************************************************************************
	//								CreateSceneDocument
	// 
	/// Creates a new scene document.
	/// 
	virtual MCCOMErr MCCOMAPI CreateSceneDocument		(ISceneDocument** sceneDocument) = 0;
};

/// \}


enum EInsertTreePos
{
	kInsertFirst,
	kInsertLast,
	kInsertLeft,
	kInsertRight,
};

/// \addtogroup Utilities
/// \{

// ****************************************************************************
//								I3DDBActionServer
// 
/// Utility functions for making changes to the 3D database as a result of user
/// interaction.  Do not use these functions for simply altering the 3D database (e.g.,
/// importing a file format)---they should be used only when the user changes something in
/// the UI to make a change (e.g., selects a new component in the properties module).
/// All actions are undoable and properly restore the selection during undo and redo.
/// They generally take a list of target objects in order to facilitate drag and drop
/// onto a multiple selection. If only a single target object is desired, simply make
/// a list with one element.
///
/// <P>Actions are important because they are the base of the undo</P>
///
/// <P>It is important to understand that an action is not synchonous. The functions
/// post the action in the action queue but they do not execute the action right away.
/// The action is executed next time the application goes through its main loop.</P>
///
struct I3DDBActionServer : public IMCUnknown
{
	/// Creates an object.
	///
	/// \param outTree A point to the object that is returned.
	/// \param inKind The family ID of the object ('prim' for primitive, 'came' for camera, 'lite' for lights, 'data' for a helper objects)
	/// \param inID The class ID of the object.
	/// \param inSceneContext Used only to generate a unique name.
	///
	virtual MCCOMErr MCCOMAPI	CreateObjectByKindAndID(
									I3DShTreeElement**				outTree,
									IDType							inKind,
									IDType							inID,
									I3DShScene*						inSceneContext) = 0;
	
	//_________________________________________ tree methods __________________________________________

	/// Posts an action that creates a new object in the scene.
	///
	/// \param inDocument The document in which the action is performed.
	/// \param inKind The family ID of the object ('prim' for example).
	/// \param inID The class ID of the object
	/// \param inRoot The tree under which the object is inserted.
	/// \param inInsertTreePos The position in the tree.
	/// \param inTransform The position of the inserted object.
	/// \param inAutoPlace True if the object should be automatically place.
	///
	virtual MCCOMErr MCCOMAPI	PostInsertObjectAction		(ISceneDocument* inDocument, IDType inKind, IDType inID,
															 I3DShTreeElement* inRoot, EInsertTreePos inInsertTreePos,
															 const TTreeTransform& inTransform, boolean	inAutoPlace) = 0;

	/// Posts an action that creates a new instance of the object (which must already be in the scene).
	///
	/// \param inDocument The document in which the action is performed.
	/// \param inObject The object to instanciate (must already be in the scene).
	/// \param inRoot The tree under which the object is inserted.
	/// \param inInsertTreePos The position in the tree.
	/// \param inTransform The position of the inserted object.
	/// \param inAutoPlace True if the object should be automatically place.
	///
	virtual MCCOMErr MCCOMAPI	PostInsertObjectAction		(ISceneDocument* inDocument, I3DShObject* inObject, I3DShTreeElement* inRoot,
															 EInsertTreePos inInsertTreePos, const TTreeTransform&	inTransform,
															 boolean inAutoPlace) = 0;

	/// Posts an action that imports a file in the given scene document
	///
	/// \param inDocument			The document in which the action is performed.
	/// \param inImportRoot			The tree under which the imported data is inserted.
	/// \param inFile				The file to import
	/// \param inFileFormat			The id of the import format to use
	/// \param inFromNativeBrowser	True if the file to import is a Carrara Browser file
	/// \param inFromNativeBrowser	True if the path should be added to the recent files list
	///	\param inAutoPlaceInfo		Info for positioning the imported data in the scene (NULL for default placement)
	/// 
	///
	virtual MCCOMErr MCCOMAPI	PostImportFileAction		(	ISceneDocument*			inDocument,
																I3DShTreeElement*		inImportRoot,
																IMCFile*				inFile,
																MCFileTypeID			inFileFormat,
																boolean					inFromNativeBrowser,
																boolean					inRememberPath,
																TAutoPlaceInfo*			inAutoPlaceInfo= NULL) = 0;

	/// Posts an action that inserts a list of tree elements in the scene, with their master objects and master shaders.
	/// If outAction is not null, the action is not posted and you'll have to delete it (used to delegate functionality from another action)
	/// If the action is canceled, the resulting action will be null
	///
	/// \param inDocument The document in which the action is performed.
	/// \param inTreeList The list of tree that should be inserted.
	/// \param inRoot The tree under which the object is inserted.
	/// \param inInsertTreePos The position in the tree.
	/// \param inTransform The position of the inserted object.
	/// \param inAutoPlace True if the object should be automatically place.
	/// \param fromScene The scene where the trees come from.
	/// \param outAction A pointer to the action that is created.
	///
	virtual MCCOMErr MCCOMAPI	PostInsertTreeListAction	(	ISceneDocument*								inDocument, 
																const TMCCountedPtrArray<I3DShTreeElement>& inTreeList,
																I3DShTreeElement*							inRoot,
																EInsertTreePos								inInsertTreePos,
																const TTreeTransform&						inTransform, 
																boolean										inAutoPlace,
																I3DShScene*									fromScene,
																TMCSmartPtr<IMFAction>*						outAction= NULL) = 0;

	/// Posts an action that inserts a master object in the scene and creates a new instance of it.
	/// Also adds the shader and uses it on the new instance.
	///
	/// \param inDocument The document in which the action is performed.
	/// \param inObject The master object that should be inserted.
	/// \param inShader The master shader that should be inserted.
	/// \param inRoot The tree under which the object is inserted.
	/// \param inTransform The position of the inserted object.
	/// \param inAutoPlace True if the object should be automatically place.
	/// \param inAutoSwitchToModeler False if the action should not switch to the modeler
	///
	virtual MCCOMErr MCCOMAPI	PostInsertMasterObjectAction(ISceneDocument* inDocument, I3DShObject* inObject, I3DShMasterShader* inShader,
															 I3DShTreeElement* inRoot, const TTreeTransform& inTransform, 
															 boolean inAutoPlace, boolean inAutoSwitchToModeler=true) = 0;

	/// Posts an action that inserts the object in the scene and creates a new instance of it.
	/// Also adds the shader and uses it on the new instance.
	///
	/// \param inDocument The document in which the action is performed.
	/// \param inObject The master object that should be inserted.
	/// \param inShader The master shader that should be inserted.
	///
	virtual MCCOMErr MCCOMAPI	PostInsertMasterObjectAction(ISceneDocument* inDocument, I3DShObject* inObject,
															 I3DShMasterShader*	inShader) = 0;

	/// Posts an action that inserts a Master Shader in the scene.
	///
	/// \param inDocument The document in which the action is performed.
	/// \param inMaster The master shader that should be inserted.
	///
	virtual MCCOMErr MCCOMAPI	PostInsertMasterShaderAction(ISceneDocument* inDocument, I3DShMasterShader*	inMaster) = 0;

	/// Posts an action that inserts a Master Clip in the scene.
	///
	/// \param inDocument The document in which the action is performed.
	/// \param inMaster The master clip that should be inserted.
	///
	virtual MCCOMErr MCCOMAPI	PostInsertMasterClipAction(ISceneDocument* inDocument, I3DShMasterClip*	inMaster) = 0;

	/// Posts an action that inserts the specified master sound in the scene.
	///
	/// \param inDocument The document in which the action is performed.
	/// \param inMaster The master sound that should be inserted.
	///
	virtual MCCOMErr MCCOMAPI	PostInsertMasterSoundAction(ISceneDocument* inDocument, IShMasterSound* inMaster) =0;

	/// Posts an action that creates a new sound track (channel) in the scene.
	///
	/// \param inDocument The document in which the action is performed.
	virtual MCCOMErr MCCOMAPI	PostInsertSoundChannelAction(ISceneDocument* inDocument) =0;

	/// Posts an action that removes a new sound track (channel) from the scene.
	///
	/// \param inDocument The document in which the action is performed.
	/// \param inChannel the index of the channel that should be removed.
	///
	virtual MCCOMErr MCCOMAPI	PostRemoveSoundChannelAction(ISceneDocument* inDocument, uint32 inChannel) =0;
	
	/// Posts an action that removes the specified master sound from the scene.
	///
	/// \param inDocument The document in which the action is performed.
	/// \param inMaster The master sound that should be removed.
	///
	virtual MCCOMErr MCCOMAPI	PostRemoveMasterSoundAction(ISceneDocument* inDocument, IShMasterSound* inMaster) =0;

	/// Changes the transform of one or more trees.  
	/// If inIsGlobal is true, then the transforms are set as global transforms, otherwise as local.
	/// If inRemoveConstraints is true (and inCheckForConstraints false), the user is not asked, but the constraints (if any) are overriden.
	///
	/// <P>If inHotPoints has data in it (i.e., the array has the same number of elements as the inTransforms), 
	/// then the corresponding hot point is set AFTER the transform is set:</P>
	///
	/// \code
	///   tree->SetHotPoint(zeroVec);
	///   tree->SetTransform(t[i]);
	///   tree->SetHotPoint(hp[i]);
	/// \endcode
	///
	/// \param inDocument The document in which the action is performed.
	/// \param inTrees The trees whose transform should be changed.
	/// \param inTransforms The new transform for each tree.
	/// \param inHotPoints The new hotpoints for each tree.
	/// \param inIsGlobal True if we are setting a global transform.
	/// \param inRemoveConstraints True if constraints should be removed.
	/// \param inCheckForConstraints If true and if there is a constraint on one of the trees, the user is asked whether he/she wants to use or override the constraint.
	/// \param inNotifyAboutModifiers If true and if there is a space modifier (behavior) on a tree, then the user is warned that the transform may be altered to fit the behavior.
	/// \param inLockChildren True if the position of the children of the tree
	///						  elements need to be corrected to lock their positions
	///						  in global space.
	///
	virtual MCCOMErr MCCOMAPI	PostChangeTransformAction	(	ISceneDocument*					inDocument, 
																TMCPtrArray<I3DShTreeElement>&	inTrees,
																TMCArray<TTreeTransform>&		inTransforms, 
																TMCArray<TVector3>&				inHotPoints,
																boolean							inIsGlobal, 
																boolean							inRemoveConstraints,
																boolean							inCheckForConstraints,
																boolean							inNotifyAboutModifiers,
																boolean							inLockChildren) = 0;
	
	/// Posts an action that changes the name of a tree element.
	///
	/// \param inDocument The document in which the action is performed.
	/// \param inTree The tree element whose name should be changed.
	/// \param inNewName The new name of the tree element.
	///
	virtual MCCOMErr MCCOMAPI	PostChangeNameAction		(ISceneDocument* inDocument, I3DShTreeElement* inTree,
															 const TMCString& inNewName) = 0;


	/// Posts an action that changes the name of a master object.
	///
	/// \param inDocument The document in which the action is performed.
	/// \param inObject The master object whose name should be changed.
	/// \param inNewName The new name of the master object.
	///
	virtual MCCOMErr MCCOMAPI	PostChangeNameAction		(ISceneDocument* inDocument, I3DShObject* inObject,
															 const TMCString& inNewName) = 0;


	/// Posts an action that changes the name of a master shader.
	///
	/// \param inDocument The document in which the action is performed.
	/// \param inMasterShader The master shader whose name should be changed.
	/// \param inNewName The new name of the master shader.
	///
	virtual MCCOMErr MCCOMAPI	PostChangeNameAction		(ISceneDocument* inDocument, I3DShMasterShader*	inMasterShader,
															 const TMCString& inNewName) = 0;
	
	/// Posts an action that changes the name of a master clip.
	///
	/// \param inDocument The document in which the action is performed.
	/// \param inMasterClip The master clip whose name should be changed.
	/// \param inNewName The new name of the master shader.
	///
	virtual MCCOMErr MCCOMAPI	PostChangeNameAction		(ISceneDocument* inDocument, I3DShMasterClip* inMasterClip, const TMCString& inNewName) = 0;
	
	// ****************************************************************************
	//								PostChangeDisplacementMappingAction
	// 
	/// Posts an action that enables/disables the displacement mapping on an instance.
	/// 
	/// \param inDocument The document in which the action is performed.
	/// \param inTree      The tree element on which the action is performed.
	/// \param enable      The new state of the displacement mapping (enabled/disabled).
	/// 
	//virtual MCCOMErr MCCOMAPI	PostChangeDisplacementMappingAction(ISceneDocument* inDocument,I3DShTreeElement* inTree,boolean enable) = 0;
	
	/// Posts an action that changes the Exists (visible) flag on a tree.
	///
	/// \param inDocument The document in which the action is performed.
	/// \param inTree The tree element on which the action is performed.
	/// \param inExists The new state of the Exists flag.
	///
	virtual MCCOMErr MCCOMAPI	PostChangeExistsAction		(ISceneDocument* inDocument, 
															 TMCPtrArray<I3DShTreeElement>&	inTrees,
															 boolean inExists) = 0;


	/// Posts an action that changes the Shown (visible in 3D view) flag on a tree.
	///
	/// \param inDocument The document in which the action is performed.
	/// \param inTree The tree element on which the action is performed.
	/// \param inShown The new state of the Shown flag.
	///
	virtual MCCOMErr MCCOMAPI	PostChangeShownAction		(ISceneDocument* inDocument, 
															 TMCPtrArray<I3DShTreeElement>&	inTrees,
															 boolean inShown) = 0;


	/// Posts an action that changes the cast shadow flag on a tree.
	///
	/// \param inDocument The document in which the action is performed.
	/// \param inTree The tree on which the action is performed.
	/// \param inShadowCasting The new state of the cast shadow flag.
	///
	virtual MCCOMErr MCCOMAPI	PostChangeShadowCastingAction(ISceneDocument* inDocument, 
															  TMCPtrArray<I3DShTreeElement>& inTrees,
															  boolean inShadowCasting) = 0;

	/// Posts an action that changes the receive shadow flag on a tree.
	///
	/// \param inDocument The document in which the action is performed.
	/// \param inTree The tree on which the action is performed.
	/// \param inShadowCatching The new state of the receive shadow flag.
	///
	virtual MCCOMErr MCCOMAPI	PostChangeReceiveShadowAction(ISceneDocument* inDocument, 
															  TMCPtrArray<I3DShTreeElement>& inTrees,
															  boolean inShadowCatching) = 0;

	/// Posts an action that changes the (uniform) scaling propagation flag on a tree.
	///
	/// \param inDocument			The document in which the action is performed.
	/// \param inTree				The tree on which the action is performed.
	/// \param inPropagateScaling	The new state of the (uniform) scaling propagation flag.
	///
	virtual MCCOMErr MCCOMAPI	PostChangePropagateScalingAction(	ISceneDocument* inDocument, 
																	TMCPtrArray<I3DShTreeElement>& inTrees,
																	boolean inPropagateScaling) = 0;

	/// Posts an action that changes the scaling LockMode on a tree.
	///
	/// \param inDocument			The document in which the action is performed.
	/// \param inTree				The tree on which the action is performed.
	/// \param inScalingLockMode	The new value of the lockmode.
	///
	virtual MCCOMErr MCCOMAPI	PostChangeScalingLockModeAction(	ISceneDocument* inDocument, 
																	TMCPtrArray<I3DShTreeElement>& inTrees,
																	const EScalingLockMode&	inScalingLockMode) = 0;

	/// Posts an action that changes the SelectChildrenWhenClosed flag on a group.
	///
	/// \param inDocument The document in which the action is performed.
	/// \param inTree The tree element on which the action is performed.
	/// \param inShown The new state of the Shown flag.
	///
	virtual MCCOMErr MCCOMAPI	PostChangeSelectChildrenWhenClosedAction
															(ISceneDocument* inDocument, 
															 TMCPtrArray<I3DShTreeElement>&	inTrees,
															 boolean inSelectChildrenWhenClosed) = 0;

	// ****************************************************************************
	//								PostChangeURLAction
	// 
	/// Posts an action that changes the url associated with an instance.
	///
	/// \param inDocument The document in which the action is performed.
	/// \param inInstance  The instance to modify.
	/// \param inURLName   The new URL.
	/// \param inURLKind   The URL kind.
	/// 
	virtual MCCOMErr MCCOMAPI	PostChangeURLAction			(ISceneDocument* inDocument, I3DShInstance*	inInstance,
															 const TMCString& inURLName, int16 inURLKind) = 0;


	/// Posts an action when a component is changed on a tree element
	///
	/// \param inDocument The document in which the action is performed.
	/// \param inTrees The list of trees on which the component should be changed.
	/// \param inComponent The new component
	/// \param family The family ID of the component.
	/// \param canUndo True if the action should be undoable.
	/// \param isNewComponent True if you change the component, False if it is only the values that change
	///
	virtual MCCOMErr MCCOMAPI	PostChangeComponentAction	(ISceneDocument* inDocument,TMCPtrArray<I3DShTreeElement>& inTrees,
															 IShParameterComponent* inComponent,IDType family,boolean canUndo,boolean isNewComponent) = 0;

	/// Posts an action when a component is changed on several tree elements
	///
	/// \param inDocument		The document in which the action is performed.
	/// \param inTrees			The list of trees on which the component should be changed.
	/// \param inComponents		The new components (must have the same elemcount than inTrees)
	/// \param family			The family ID of the component.
	/// \param canUndo			True if the action should be undoable.
	/// \param isNewComponent	True if you change the component, False if it is only the values that change
	///
	virtual MCCOMErr MCCOMAPI	PostChangeComponentAction	(
									ISceneDocument*								inDocument,
									TMCPtrArray<I3DShTreeElement>&				inTrees,
									TMCCountedPtrArray<IShParameterComponent>&	inComponents,
									IDType										family,
									boolean										canUndo,
									boolean										isNewComponent) = 0;

	/// Posts an action that inserts a modifier on a tree element
	///
	/// \param inDocument The document in which the action is performed.
	/// \param inTrees The list of trees on which the modifier should be inserted.
	/// \param inComponent The new component
	///
	virtual MCCOMErr MCCOMAPI	PostInsertModifierAction	(ISceneDocument* inDocument,TMCPtrArray<I3DShTreeElement>& inTrees,
															 I3DShModifier* inComponent) = 0;

	/// Posts an action that change the animation method of several trees
	///
	/// \param inDocument The document in which the action is performed.
	/// \param inTrees The list of trees on which the animation method should be changed.
	/// \param inComponent The new animation method
	/// \param inConvertOldData True if the old animation data should be converted to the new animation method.
	///
	virtual MCCOMErr MCCOMAPI	PostChangeAnimationMethodAction(ISceneDocument* inDocument,TMCPtrArray<I3DShTreeElement>& inTrees,
																I3DShAnimationMethod* inComponent,boolean inConvertOldData = true) = 0;

	/// Posts an action that change the animation method of several trees
	///
	/// \param inDocument The document in which the action is performed.
	/// \param inTrees The list of trees on which the animation method should be changed.
	/// \param inComponents The new animation methods (must have the same elemcount than inTrees
	/// \param inConvertOldData True if the old animation data should be converted to the new animation method.
	///
	virtual MCCOMErr MCCOMAPI	PostChangeAnimationMethodAction(
									ISceneDocument*								inDocument,
									TMCPtrArray<I3DShTreeElement>&				inTrees,
									TMCCountedPtrArray<I3DShAnimationMethod>&	inComponents,
									boolean										inConvertOldData = true) = 0;

	/// Posts an action that change a tweener
	///
	/// \param inDocument The document in which the action is performed.
	/// \param inLinks The links where the tweener is changed.
	/// \param inComponent The new tweener.
	///
	virtual MCCOMErr MCCOMAPI	PostChangeTweenerAction		(ISceneDocument* inDocument,TMCPtrArray<I3DShTweenerChainLink>&	inLinks,
															 I3DShTweener* inComponent) = 0;

	/// Posts an action that changes the modifiers of a tree
	///
	/// \param inDocument The document in which the action is performed.
	/// \param inTrees The list of trees on which the modifier list should be changed.
	/// \param modifierList The new modifier list.
	///
	virtual MCCOMErr MCCOMAPI	PostChangeModifierList		(ISceneDocument* inDocument,I3DShTreeElement* inTrees,
															 TMCPtrArray<I3DShModifier>& modifierList) = 0;

	/// Posts an action that changes the controlers of an attributes set
	///
	/// \param inDocument The document in which the action is performed.
	/// \param inAttributesSet The attributes set on which the controler list should be changed.
	/// \param controlerList The new controler list.
	///
	virtual MCCOMErr MCCOMAPI	PostChangeAttributesSetControlerList(ISceneDocument* inDocument,I3DShAttributesSet* inAttributesSet,
																	 TMCPtrArray<I3DShAttributesSetControler>& controlerList,
																	 boolean localControllers) = 0;

	// ****************************************************************************
	//							PostApplyShaderToChildrenAction	
	// 
	/// Posts an undoable action that apply the shader of a tree to all its children
	///
	/// \param inDocument The document in which the action is performed.
	/// \param inTreeElement	The tree element
	///
	virtual MCCOMErr MCCOMAPI	PostApplyShaderToChildrenAction(ISceneDocument*		inDocument, 
																TMCPtrArray<I3DShShadableTree>& inShadableTrees,
																I3DShMasterShader*	inShader) =0;

	/// Posts an action that modifies the shader applied to a number of tree elements.
	///
	/// \param inDocument The document in which the action is performed.
	/// \param inShadableTrees The tree elements where the the new master shader will be applied.
	/// \param inComponent The Master Shader that will be applied.
	///
	virtual MCCOMErr MCCOMAPI	PostChangeMasterShaderAction(ISceneDocument*	inDocument,
															 TMCPtrArray<I3DShShadableTree>& inShadableTrees,
															 I3DShMasterShader*	inComponent) = 0;

	/// Posts an action that modifies the shader applied to a uv space of an instance.
	///
	/// \param inDocument The document in which the action is performed.
	/// \param inInstance  The tree elements where the the new master shader will be applied.
	/// \param uvSpace	   The uv space id.
	/// \param inComponent The Master Shader that will be applied.
	///
	virtual MCCOMErr MCCOMAPI	PostChangeUVSpaceMasterShaderAction(ISceneDocument* inDocument, I3DShInstance* inInstance,
																	int32 uvSpace, I3DShMasterShader* inComponent) = 0;
	
	/// Posts an action that modifies all the shaders applied to an instance.
	///
	/// \param inDocument The document in which the action is performed.
	/// \param inInstance  The tree elements where the the new master shader will be applied.
	/// \param inComponent List of Master Shaders that will be applied (it must contains uvSpaceCount+1 element).
	///
	virtual MCCOMErr MCCOMAPI	PostChangeInstanceMasterShadersAction(ISceneDocument* inDocument, I3DShInstance* inInstance,
																	  const TMCPtrArray<I3DShMasterShader>& inComponent) = 0;

	/// Posts an action that changes a component on the scene.
	///
	/// \param inDocument The document in which the action is performed.
	/// \param inComponent The new component
	/// \param familyID The family ID of the component.
	/// \param canUndo True if the action is undoable.
	///
	virtual MCCOMErr MCCOMAPI	PostChangeSceneComponentAction(ISceneDocument* inDocument,IShParameterComponent* inComponent,
															   IDType familyID, boolean canUndo)=0;

	/// Posts an action that changes the list of postrender filters.
	///
	/// \param inDocument The document in which the action is performed.
	/// \param postRendererList The list of postrender filters.
	/// \param canUndo True if the action is undoable.
	///
	virtual MCCOMErr MCCOMAPI	PostChangePostRendererList	(ISceneDocument* inDocument, TMCCountedPtrArray<I3DShPostRenderer> &postRendererList,
															 boolean canUndo)=0;

	// ****************************************************************************
	//								PostChangeMoveTree
	// 
	/// Posts an action that moves trees under a new tree
	/// 
	/// \param inDocument The document in which the action is performed.
	/// \param treeList   The trees to move.
	/// \param insertionTree  The tree where to inserted the others.
	/// \param insertTreePos  The position where to insert the trees relative to the insertionTree.
	/// \param canUndo True if the action is undoable.

	virtual MCCOMErr MCCOMAPI	PostChangeMoveTree(
									ISceneDocument*							inDocument,
									TMCCountedPtrArray<I3DShTreeElement>*	treeList,
									I3DShTreeElement*						insertionTree,
									EInsertTreePos							insertTreePos,
									boolean									canUndo) = 0;

	/// Changes the transform of one or more trees.  
	/// If inIsGlobal is true, then the transforms are set as global transforms, otherwise as local.
	/// If inRemoveConstraints is true (and inCheckForConstraints false), the user is not asked, but the constraints (if any) are overriden.
	///
	/// <P>If inHotPoints has data in it (i.e., the array has the same number of elements as the inTransforms), 
	/// then the corresponding hot point is set AFTER the transform is set:</P>
	///
	/// \code
	///   tree->SetHotPoint(zeroVec);
	///   tree->SetTransform(t[i]);
	///   tree->SetHotPoint(hp[i]);
	/// \endcode
	///
	/// \param inDocument The document in which the action is performed.
	/// \param inTrees The trees whose transform should be changed.
	/// \param inOldTransforms Transforms for undo.
	/// \param inTransforms The new transform for each tree.
	/// \param inHotPoints The new hotpoints for each tree.
	/// \param inIsGlobal True if we are setting a global transform.
	/// \param inRemoveConstraints True if constraints should be removed.
	/// \param inCheckForConstraints If true and if there is a constraint on one of the trees, the user is asked whether he/she wants to use or override the constraint.
	/// \param inNotifyAboutModifiers If true and if there is a space modifier (behavior) on a tree, then the user is warned that the transform may be altered to fit the behavior.
	/// \param inLockChildren True if the position of the children of the tree
	///						  elements need to be corrected to lock their positions
	///						  in global space.
	///
	virtual MCCOMErr MCCOMAPI	PostChangeTransformAction2(
									ISceneDocument* 				inDocument,
									TMCPtrArray<I3DShTreeElement>&	inTrees,
									TMCPtrArray<TTreeUndoInfo>&		inOldTransforms,
									TMCArray<TTreeTransform>&		inTransforms,
									TMCArray<TVector3>&				inHotPoints,
									boolean							inIsGlobal,
									boolean							inRemoveConstraints,
									boolean							inCheckForConstraints,
									boolean							inNotifyAboutModifiers,
									boolean							inLockChildren,
									TMCPtrArray<TMCClassArray<TTreeUndoInfo> >*		inChildrenOldTransforms) = 0;
    
	/// Posts an action that change a few tweeners
	///
	/// \param inDocument The document in which the action is performed.
	/// \param inLinks The links where the tweener is changed.
	/// \param inComponents The new tweeners.
	///
	virtual MCCOMErr MCCOMAPI	PostChangeTweenerAction		(ISceneDocument* inDocument,TMCPtrArray<I3DShTweenerChainLink>&	inLinks,
															 TMCPtrArray<I3DShTweener>&	inComponents) = 0;
};


/// \}

#endif
