//
// Tools_Mode_PFX.h
//
// Created by KOR - 01/03/2004 15:48:38
//
// Copyright (C) 2004 Rebellion, All Rights Reserved.
//

#ifdef ASURA_USE_PRAGMA_ONCE
	#pragma once
#endif

#ifndef __TOOLS_MODE_PFX_H__
#define __TOOLS_MODE_PFX_H__


// Asura includes
#include "Core/Asura_Handle.h"
#include "Core/Asura_Hash.h"
#include "Core/Asura_String.h"
#include "Misc/Tools_MessageLog.h"
#include "Network/Asura_Guid.h"
#include "SpecialFX/PFX/Asura_PFX_System.h"
#include "SpecialFX/PFX/Asura_PFX_Templates.h"
#include "Interface/Asura_Graph_Dialog.h"

#include "Tools_Mode.h"
//#include "Objects/Tools_Object.h"

// Forward defines
class Asura_Dialog;
class Asura_Tabs_Dialog;
class Asura_List_Dialog;
class Asura_DropDown_List_Dialog;
class Asura_PFX_Particle_Template;
class Asura_PFX_Source_Template;
class Asura_PFX_Effect_Template;
class Asura_Vector_2;
class Tools_PFX_Vector_Object;
class Tools_PFX_SourceVolume_Object;
class Tools_UV_Editor;

enum Tools_Mode_PFX_Template_Type 
{
	Tools_Mode_PFX_Template_None,
	Tools_Mode_PFX_Template_Particle,
	Tools_Mode_PFX_Template_Source,
	Tools_Mode_PFX_Template_Effect,
};

enum TOOLS_MODE_PFX_SAVE_TYPE
{
	TOOLS_MODE_PFX_SAVE_NORMAL,
	TOOLS_MODE_PFX_SAVE_EXPORT,
	TOOLS_MODE_PFX_SAVE_AUTO,
};

#define TOOLS_PFX_MAX_SOURCES_PER_EFFECT 99 //somewhat arbitrary limit... just effects the list of strings of source indeces used in tools

//Maximum number for particles that can be set on a burst particle source
#ifndef TOOLS_PFX_MAX_BURST_PARTICLES
#define TOOLS_PFX_MAX_BURST_PARTICLES 128
#endif

//If maximum particles is greater than this then warnings will appear at various points
#ifndef TOOLS_PFX_MAX_PARTICLE_WARNING_LEVEL
#define TOOLS_PFX_MAX_PARTICLE_WARNING_LEVEL 300
#endif

// KOR - 01/03/2004 15:54:45 - Cheerfully stolen from Tools_Mode_Particles 
class Tools_Mode_PFX : public Tools_Mode
{
		friend class Tools_Entity_PFX_Effect;
		friend class Tools_MessageLogAction_PFXEffect;
	public:
		Tools_Mode_PFX()
		{
			s_pxThis = this;
			Initialise();
		}
		~Tools_Mode_PFX()
		{
			Shutdown();
			s_pxThis = 0;
		}


		void Initialise(void);
		void Shutdown(void);
		void Update(void);
		void RenderWorld_PostToneMap(void);
		void RenderUI(void);
 		virtual bool IsModified();
		static bool IsPFXModified();

		static void RenderUIExMode();

		static void SetParticleEffectBeingRenderedIsSelected(bool bSet);
		static void AddToParticlesRendered(u_int uNumParticles);

#ifdef ASURA_USING_ALL_LEVEL_EXPORT
		static bool AddPFXToIgnoreList(const Asura_Hash_ID uPFXToIgnore);
		static void StartExport() { m_pxPFXToIgnoreList = new Asura_HashTree; }
		static void EndFileExport() 
		{
			delete m_pxPFXToIgnoreList;
			m_pxPFXToIgnoreList = 0;
		}
#endif

		static bool AddSourceTemplateToExportListByHash( List<Asura_String>* pxList, Asura_Hash_ID uSourceTemplateHashID, Asura_Guid uGUID, const bool bTexturesOnly );

		static bool AddParticleTemplateToExportListByHash(List<Asura_String>* pxList, Asura_Hash_ID uHash, const bool bTexturesOnly);
		static bool AddTemplateToExportListByHash(List<Asura_String>* pxList, Asura_Hash_ID uHash, Asura_Guid uGuid);

		static void AddAlwaysExportParticleTemplates(List<Asura_String>* pxList);
		// For testing sound parameters
		static bool IsEditingThisEffectTemplate(Asura_PFX_Effect_Template* pxTemplate) { return pxTemplate == s_pxCurrentEffectTemp; }

		
		static u_int SaveAllTemplates(TOOLS_MODE_PFX_SAVE_TYPE eSaveType = TOOLS_MODE_PFX_SAVE_NORMAL, bool bForceSaveAll = false );
		// KOR - this can be removed once all projects are using the new format
		static void ConvertToNewFormat();
		static void LoadFromOldFormat();
		//Gets the platform whose pfx effects are being tested
		static int GetPreviewPlatform(){return s_iPreviewPlatform;}

		static void SetDontIncludePFXInExport(bool bDontInclude) { s_bDontIncludePFXInExport = bDontInclude; }

		static void SetProjectTextureFlags(int iFlags) { s_iProjectTextureFlags = iFlags; }

		static void SetModified(Asura_PFX_Effect_Template* pxEffectTemplate);
		static void SetModified(Asura_PFX_Source_Template* pxSourceTemplate);
		static void SetModified(Asura_PFX_Particle_Template* pxParticleTemplate);

		static void Verify(bool bAutomatic);
		static void Verify_Manual()	{Verify(false);}

protected:

	static void Static_AddItemsToEffectOtherTab(Asura_Tabs_Dialog* pxTab, Asura_Vector_2& xOffset, Asura_PFX_Effect_Template* pxCurrentEffectTemp);

	virtual void AddItemsToEffectOtherTab(Asura_Tabs_Dialog* pxTab, Asura_Vector_2& xOffset, Asura_PFX_Effect_Template* pxCurrentEffectTemp);
	virtual void ProjectUpdateEditEffectTemplate(Asura_PFX_Effect_Template* pxCurrentEffectTemp) {}

#ifdef ASURA_USING_ALL_LEVEL_EXPORT
	static Asura_HashTree* m_pxPFXToIgnoreList;
#endif //ASURA_USING_ALL_LEVEL_EXPORT

private:
		static void TransferModeData(int mode);

		static void TogglePFXOverlay(void);
		static bool PFXOverlayIsOn(void);

		static void HandleKeyboard();


		// Dialog operations
		// Creates a new PFX effect entity
		static void NewPFXEffect();
		// Allows PFX to be imported from other projects.
		static void ImportPFXEffect();

		static void AddParticleTemplateOverlayControls(class Asura_Tabs_Dialog* pxTabs, class Asura_Vector_2& xOffset, Asura_Hash_ID uTemplateNameHash);
		static void AddSourceTemplateOverlayControls(class Asura_Tabs_Dialog* pxTabs, class Asura_Vector_2& xOffset, Asura_Hash_ID uTemplateNameHash);
		static void AddEffectTemplateOverlayControls(class Asura_Tabs_Dialog* pxTabs, class Asura_Vector_2& xOffset, Asura_Hash_ID uTemplateNameHash);
		// Closes the edit template overlays
		static void CloseEditParticleTemplate();
		static void CloseEditSourceTemplate();
		static void CloseEditEffectTemplate();
		// Saves the current template to disk
//		static void SaveCurrentParticleTemplate();
//		static void SaveCurrentSourceTemplate();
//		static void SaveCurrentEffectTemplate();
		// Saves template with child templates
//		static void SaveCurrentSourceTemplateWithChildren();
//		static void SaveCurrentEffectTemplateWithChildren();
		static void SaveCurrentTemplate();
		// Updates chosen attribute graph
		static void UpdateEditParticleTemplate();
		static void UpdateEditSourceTemplate();
		static void UpdateEditEffectTemplate();
		// Creates a new template
		static void CreateNewSourceTemplate();
		static Asura_PFX_Effect_Template* CreateNewEffectTemplate();
		// Copies the selected template
		static void CopySourceTemplate();
		static Asura_PFX_Effect_Template* CopyEffectTemplate();
		// Renames the selected template
		static void RenameSourceTemplate();
		static Asura_PFX_Effect_Template* RenameEffectTemplate();
		//Cancels changes to templates
		static void CancelParticleTemplateChanges();
		static void CancelSourceTemplateChanges();
		static void CancelEffectTemplateChanges();
		// Reloads from disk
		static void ReloadCurrentParticleTemp();
		static void ReloadCurrentSourceTemp();
		static void ReloadCurrentEffectTemp();
		static void ReloadSourceTempFull(Asura_Hash_ID uHashID);
		static void ReloadCurrentSourceTempFull();
		static void ReloadCurrentEffectTempFull();
		static void ReloadParticleTemplate(Asura_Hash_ID uHash);
		static void ReloadSourceTemplate(Asura_Hash_ID uHash);
		static void ReloadEffectTemplate(Asura_Hash_ID uHash);
		static void ReloadAllTemplates();

		void QuickSave();
		void AutoSave();
		static void SaveParticleTempByHash(Asura_Hash_ID uHash, TOOLS_MODE_PFX_SAVE_TYPE eSaveType = TOOLS_MODE_PFX_SAVE_NORMAL);
		static void SaveSourceTempByHash(Asura_Hash_ID uHash, TOOLS_MODE_PFX_SAVE_TYPE eSaveType = TOOLS_MODE_PFX_SAVE_NORMAL);
		static void SaveEffectTempByHash(Asura_Hash_ID uHash, TOOLS_MODE_PFX_SAVE_TYPE eSaveType = TOOLS_MODE_PFX_SAVE_NORMAL);
		static bool SaveTemplateByHash(Asura_Hash_ID uEffectHash, TOOLS_MODE_PFX_SAVE_TYPE eSaveType = TOOLS_MODE_PFX_SAVE_NORMAL);
		
		static void BackupTemplateFileIfRequired(Asura_PFX_Effect_Template* pxTemplate);
		static void RenameTemplateAutosaveFiles(Asura_PFX_Effect_Template* pxTemplate);
		
		static bool CanSaveParticleTempByHash(Asura_Hash_ID uHash,bool bDisplayMessage,bool bAsError = false);
		static bool CanSaveSourceTempByHash(Asura_Hash_ID uHash,bool bDisplayMessage,bool bAsError = false);
		static bool CanSaveEffectTempByHash(Asura_Hash_ID uHash,bool bDisplayMessage,bool bAsError = false);
		static bool CanSaveTemplateByHash(Asura_Hash_ID uEffectHash,bool bDisplayMessage,bool bAsError = false);
		
		// Helper functions
		static void CreatePFXOverlay();
		static bool GetNewEffectTemplateName(Asura_String& xName);
		static bool GetNewSourceTemplateName(Asura_String& xName);
		static bool GetNewParticleTemplateName(Asura_String& xName);
		static void GetUniqueParticleTempName(const Asura_String& xBaseName, Asura_String& xUniqueName);
		static void GetUniqueSourceTempName(const Asura_String& xBaseName, Asura_String& xUniqueName);
		static void GetUniqueEffectTempName(const Asura_String& xBaseName, Asura_String& xUniqueName);

		static bool GetCopyEffectTemplateName(Asura_String& xCopyName);
		static bool GetCopySourceTemplateName(Asura_String& xCopyName);
		static bool GetCopyParticleTemplateName(Asura_String& xCopyName);

		static void StripTemplateNameSuffix(Asura_String& xName);
		static void GetTemplateFileName(const Asura_String* pxTempName, Asura_String* pxFileName, TOOLS_MODE_PFX_SAVE_TYPE eSaveType = TOOLS_MODE_PFX_SAVE_NORMAL);
		static void GetParticleTempFileName(const Asura_String* pxTempName, Asura_String* pxFileName, TOOLS_MODE_PFX_SAVE_TYPE eSaveType = TOOLS_MODE_PFX_SAVE_NORMAL);
		static void GetSourceTempFileName(const Asura_String* pxTempName, Asura_String* pxFileName, TOOLS_MODE_PFX_SAVE_TYPE eSaveType = TOOLS_MODE_PFX_SAVE_NORMAL);
		static void GetEffectTempFileName(const Asura_String* pxTempName, Asura_String* pxFileName, TOOLS_MODE_PFX_SAVE_TYPE eSaveType = TOOLS_MODE_PFX_SAVE_NORMAL);
		static bool CloseEditParticleTempIfNecessary(Asura_Hash_ID uHash);
		static bool CloseEditSourceTempIfNecessary(Asura_Hash_ID uHash);
		static bool CloseEditEffectTempIfNecessary(Asura_Hash_ID uHash);
		static void UpdateSourceChooser();
		static void UpdateSourceProperties();
		static void SetEffectRange();

		//For use as an Enabled() callback function on the overlays
		static bool CanEditParticleTextureFrameTime();
		static bool CanEditParticleTextureFrame();
		// Edit gravity for source template
		static void EditGravity();
		// Edit source offset/orientation for effect template
		static void EditSourceVector();
		// Reset source offset/orientation for effect template
		static void ResetSourceVector();
		// Edit source movement vector for effect template
		static void EditSourceMovementVector();
		// Remove current source from effect.
		static void RemoveCurrentSource();
		static bool CanRemoveCurrentSource();
		// Edit effect's current source template
		static void EditEffectSourceTemplate();
		//add a new platform override to current effect
		static void AddEffectPlatformOverride();
		// Edit source's current particle template
		static void EditSourceParticleTemplate();
		static void RefreshParticleTemplateList();
		static void RefreshSourceTemplateList();
		// Scaling
		static void ScaleEffectTime();
		static void ScaleEffectPreserve() { ScaleEffect(true); }
		static void ScaleEffectChange() { ScaleEffect(false); }
		static void ScaleEffect(bool bPreserve);
		static void ScaleSourcePreserve() { ScaleSource(true, s_pxCurrentSourceTemp, s_uEditingSourceTempHash); }
		static void ScaleSourceChange() { ScaleSource(false, s_pxCurrentSourceTemp, s_uEditingSourceTempHash); }
		static void ScaleSource(bool bPreserve, Asura_PFX_Source_Template* pxTemplate, Asura_Hash_ID uHash, bool bScaleParticle = true);
		// UV edit
		static void StartUVEdit();
		static void FinishUVEdit();
		static void UpdateUVEdit();
		static void RenderUVEdit();
		static void ReloadParticleTexture();
		static void ChooseParticleTexture();
		//Edit number of frames of UV coordinates
		static void EditNumParticleTextureFrames();
		//Texture anim creation
		static void InitialiseParticleTextureAnim();
		static void TextureAnimOverlay_Okay();
		static void TextureAnimOverlay_Cancel();

		// Reorder sources
		static void MoveSourceUp();
		static void MoveSourceDown();
		static bool CanMoveSourceUp();
		static bool CanMoveSourceDown();
		// Dialog enabled callbacks
		static bool ParticleIsUsingNearCameraFade()	{ return s_bParticleNearCameraFade; }
		static bool ParticleIsUsingFarCameraFade()	{ return s_bParticleFarCameraFade; }
		static bool ParticleIsUsingRandomLifetime()	{ return s_bParticleRandomLifetime; }
		static bool ParticleIsUsingFPS()			{ return s_bParticleUseFPS && CanEditParticleTextureFrame(); }
		static bool ParticleIsNotUsingFPS()			{ return !s_bParticleUseFPS && CanEditParticleTextureFrame(); }
		static bool ParticleIsNotLooping()			{ return !s_bParticleLoopAnimation && CanEditParticleTextureFrame(); }
		static bool ParticleIsUsingLighting()		{ return s_bParticleUseLighting; }
		static bool SourceIsBurst()					{ return s_bSrcBurst; }
		static bool SourceIsUsingRange()			{ return s_bSrcUseRange; }
		static bool SourceIsUsingAirResistance()	{ return (s_bSrcARPTS || s_bSrcFixedAirResistance); }
		static bool SourceIsSpawningFromParticles()	{ return s_bSrcSpawnFromParticles; }
		static bool EffectIsUsingCodeOrient()		{ return s_bEffectUseCodeOrient; }
		static bool	EffectIsUsingRange()			{ return s_bEffectUseRange; }
		static bool EffectHasPhoton()				{ return s_bEffectHasPhoton; }
		static bool EffectHasPhotonPerParticle()	{ return s_bEffectHasPhoton && s_bEffectParticlePhotons; }

		static void UpdateSourceTempList();
		static void DeleteSourceTempList();
		static void UpdateSourceTempListSelection(Asura_Hash_ID uSourceHash);


		//Set maximum particles for template automatically
		static void CalculateMaxParticles(Asura_PFX_Source_Template* pxSourceTemp,bool bQuiet);
		static void DetermineParticleCountsByTime(const Asura_PFX_Effect_Template* pxEffectTemp,const Asura_PFX_Source_Template* pxSourceTemp,const float fSimInterval,const int iSimSteps,float* pfParticleCounts,int iRecursionCount=0);

		static Asura_Handle		s_iMenuHandle;
		static bool				s_bPFXOverlayOpen;
		static Asura_Vector_2	s_xPFXOverlayPosition;
		static Asura_Vector_2	s_xEditParticleTempPos;
		static Asura_Vector_2	s_xEditSourceTempPos;
		static Asura_Vector_2	s_xEditEffectTempPos;
		static Asura_Vector_2	s_xEditTextureAnimPos;
		static Tools_Mode_PFX*	s_pxThis;
		static u_int			s_uTotalParticlesRendered;
		static u_int			s_uEffectParticlesRendered;
		static bool				s_bParticleEffectBeingRenderedIsSelected;
		static bool				s_bShowParticleCount;
		static bool				s_bHideIcons;
		static bool				s_bHideNonPFX;
		static float			s_fTimeSinceAutosave;

		static bool				s_bParticleTempChanged;
		static bool				s_bSourceTempChanged;
		static bool				s_bEffectTempChanged;
		static bool				s_bEffectPhotonPropertiesChanged;
		static bool				s_bEffectMinChanged;
		static bool				s_bEffectMaxChanged;


		static u_int			s_uLastParticleEditUpdate;
		static u_int			s_uLastSourceEditUpdate;
		static u_int			s_uLastEffectEditUpdate;

		// Edit Particle Template members
		static Asura_Hash_ID	s_uEditingParticleTempHash;
		static Asura_Graph_Dialog<Asura_RGBA>*	s_pxParticleColourGraph;
		static Asura_Dialog*	s_pxParticleSizeGraph;
		static Asura_Dialog*	s_pxParticleRotationGraph;
		static Asura_Dialog*	s_pxParticleSizeVariationGraph;
		static Asura_Dialog*	s_pxBlurLengthDialog;
		static Asura_Dialog*	s_pxFixedRotationDialog;
		static Asura_Dialog*	s_pxNumFixedRotationsDialog;
		static Asura_Dialog*	s_pxLightingScaleDialog;
		static Asura_Tabs_Dialog* s_pxParticleTabs;
		static int				s_iParticleTempAttrib;
		static u_int			s_uParticleCurrentTextureFrame;
		static bool				s_bParticleCurrentTextureFrameChanged;
		static float			s_afParticleTextureUVs[4];
		static bool				s_bUseUVAsAspect;
		static float			s_fParticleTextureFrameTime;
		static bool				s_bParticleTextureFrameTimeChanged;
		static float			s_fParticleMaxLifetime;
		// Flags
		static bool				s_bParticleUseLighting;
		static bool				s_bParticlePreLighting;
		static bool				s_bParticleUseFogging;
		static bool				s_bParticleUseMotionBlur;
		static bool				s_bParticleUseRandRot;
		static bool				s_bParticleSpriteRotation;
		static bool				s_bParticleRandomTextureOrient;
		static bool				s_bParticle3DRotation;
		static bool				s_bParticleMirrorRotation;
		static bool				s_bParticleAlignEffectX;
		static bool				s_bParticleAlignEffectY;
		static bool				s_bParticleAlignEffectZ;
		static bool				s_bParticleBillboardJustX;
		static bool				s_bParticleBillboardJustY;
		static bool				s_bParticleFixedRotation;
		static bool				s_bParticleNearCameraFade;
		static bool				s_bParticleFarCameraFade;
		static bool				s_bParticleRandomLifetime;
		static bool				s_bParticleUseSizeScale;
		static bool				s_bParticleCanUseExpensiveClipping;
		static bool				s_bParticleUseFPS;
		static bool				s_bParticleCrossfadeTextureFrames;
		static bool				s_bParticleLoopAnimation;
		static bool				s_bParticleLooped;
		static bool				s_bParticleRenderEarly;
		static int				s_iParticleTranslucency;
		static Tools_UV_Editor* s_pxParticleTextureEdit;

		//Particle texture anim overlay members
		static float			s_fTextureAnim_U;
		static float			s_fTextureAnim_V;
		static float			s_fTextureAnim_Width;
		static float			s_fTextureAnim_Height;
		static u_int			s_uTextureAnim_Frames;
		static int				s_iTextureAnim_TextureWidth;
		static int				s_iTextureAnim_TextureHeight;
		
		// Edit Source Template members
		static Asura_Hash_ID	s_uEditingSourceTempHash;
		static Asura_Dialog*	s_pxSpeedGraph;
		static Asura_Dialog*	s_pxAngleGraph;
		static Asura_Dialog*	s_pxSpeedSpreadGraph;
		static Asura_Dialog*	s_pxAngleSpreadGraph;
		static Asura_Dialog*	s_pxReleaseRateGraph;
		static Asura_Dialog*	s_pxReleaseRandGraph;
		static Asura_Dialog*	s_pxGravityGraph;
		static Asura_Dialog*	s_pxTurbulenceGraph;
		static Asura_Dialog*	s_pxTurbulenceDialog;
		static Asura_Dialog*	s_pxTimeScaleDialog;
		static Asura_Dialog*	s_pxInheritVelocityDialog;
		static Asura_Dialog*	s_pxParticleBounceDialog;
		static Asura_Dialog*	s_pxParticleFrictionDialog;
		static Asura_Dialog*	s_pxSourceBounceDialog;
		static Asura_Dialog*	s_pxEditGravityDialog;
		static Asura_Dialog*	s_pxSourceEditPcleTempDialog;
		static Asura_Dialog*	s_pxSourceTextureNameDialog;
		static Asura_Tabs_Dialog* s_pxSourceTabs;
		static int				s_iSrcTempAttrib;
		static int				s_iSrcSpawnIndex;
		// Flags
		static bool				s_bSrcUseWind;
		static bool				s_bSrcUseParticleDynamics;
		static bool				s_bSrcUseSourceDynamics; 
		static bool				s_bSrcUseTimeScale;
		static bool				s_bSrcMovePclesWithSource;
		static bool				s_bSrcRotatePclesWithSource;
		static bool				s_bSrcBurst;
		static bool				s_bSrcUseTurbulence;
		static bool				s_bSrcARPTS;
		static bool				s_bSrcFixedAirResistance;
		static bool				s_bSrcDirectionalGravity;
		static bool				s_bSrcPointGravity;
		static bool				s_bSrcInheritVelocity;
		static bool				s_bSrcUseRange;
		static bool				s_bSrcUseSpeedScale;
		static bool				s_bSrcStopInstantly;
		static bool				s_bSrcSpawnFromParticles;
		static bool				s_bSrcScaleReleaseRateWithVolume;
		static bool				s_bSrcUseSourceBBForVisibility;
		static Asura_DropDown_List_Dialog* s_pxSourcePcleTempDialog;
		static int				s_iSourcePcleTemp;
		static const char**		s_pszPcleTempList;
		static Tools_PFX_Vector_Object* s_pxSourceGravityObject;
		// Not changed directly to avoid memory problems
		static int				s_iMaximumParticles;
		static bool				s_bMaxParticlesChanged;

		// Edit Effect Template members
		static Asura_Hash_ID	s_uEditingEffectTempHash;
		static Asura_Dialog*	s_pxPhotonColourGraph;
		static Asura_Dialog*	s_pxPhotonRadiusGraph;
		static int				s_iEffectPhotonPerParticleSource;
		static Asura_Tabs_Dialog* s_pxEffectTabs;
		static Asura_DropDown_List_Dialog* s_pxEffectAttribDialog;
		static int				s_iEffectAttrib;
		static Asura_DropDown_List_Dialog* s_pxEffectSourceNumDialog;
		static int				s_iEffectSourceNum;
		static int				s_iEffectCurrentSourceNum;
		static Asura_DropDown_List_Dialog* s_pxEffectSourceTempDialog;
		static int				s_iEffectSourceTemp;
		static bool				s_bEffectSourceChanged;
		static char*			s_aszSourceList[TOOLS_PFX_MAX_SOURCES_PER_EFFECT];
		static const char**		s_pszSourceTempList;
		static int				s_iSourceTempListSize;
		static Asura_Dialog*	s_pxEffectEditSourceMovement;
		static float			s_fEffectSrcSpeed;
		static bool				s_bEffectSrcSpeedChanged;
		static float			s_fEffectSrcTimeOffset;
		static bool				s_bEffectSrcTimeOffsetChanged;
		static bool				s_bEffectSrcDisabled;
		static Asura_Dialog*	s_pxEffectEditSourceTempDialog;
		static float			s_fScalingFactor;
		static bool				s_bIsolateSource;
		static Asura_Hash_ID	s_uEffectSoundEvent;
		static Asura_Hash_ID	s_uParticleSoundEvent;

		static bool				s_bEffectUseRange;
		static float			s_fEffectRangeDelayTime;
		static float			s_fEffectRangeMin;
		static float			s_fEffectRangeMax;
		// Not changed directly to avoid memory problems
		static int				s_iNumberOfSources;
		static bool				s_bNumSourcesChanged;
		static bool				s_bSourceRemoved;
		// Flags
		static bool				s_bEffectHasPhoton;
		static bool				s_bEffectLooping;
		static bool				s_bEffectOrderedRender;
		static bool				s_bEffectMoveWithEffect;
		static bool				s_bEffectAlwaysOnTop;
		static bool				s_bEffectHudEffect;
		static bool				s_bEffectPregenerate;
		static bool				s_bEffectParticlePhotons;
		static bool				s_bForceRenderOnMainThread;
			
		// Code orientation
		static bool				s_bEffectUseCodeOrient;
		static int				s_iEffectSrcOrientID;
		static bool				s_bEffectSrcOrientIDChanged;
		// Vector edit objects
		static Tools_PFX_SourceVolume_Object* s_pxEffectSrcOffsetObject;
		static Tools_PFX_Vector_Object* s_pxEffectSrcMovementObject;


		// Members for choosing template
		static Asura_Vector_2	s_xChooseTemplatePosition;
		static const char**		s_pszChooseTemplateNameList;
		static Asura_Hash_ID	s_uChooseTemplateHash;
		static bool				s_bAutoCreateTemplates;
		static bool				s_bAutoCopyTemplates;
		static bool				s_bAutoDeleteTemplates;
		static Tools_Mode_PFX_Template_Type s_eChooseTemplateType;

		static Asura_PFX_Particle_Template* s_pxCurrentParticleTemp;
		static Asura_PFX_Particle_Template* s_pxSavedParticleTemp;

		static Asura_PFX_Source_Template* s_pxCurrentSourceTemp;
		static Asura_PFX_Source_Template* s_pxSavedSourceTemp;

		static Asura_PFX_Effect_Template* s_pxCurrentEffectTemp;
		static Asura_PFX_Effect_Template* s_pxSavedEffectTemp;

		static int s_iPreviewPlatform;//platform for which pfx effects should be shown
		static bool s_bPreviewPlatformChanged;

		static bool s_bDontIncludePFXInExport;

		static int s_iProjectTextureFlags;

		static u_int s_uSelectedTab_Effects;
		static u_int s_uSelectedTab_Particles;
		static u_int s_uSelectedTab_Source;
};


class Tools_MessageLogAction_PFXEffect : public Tools_MessageLogAction
{
public :
	Tools_MessageLogAction_PFXEffect(Asura_Hash_ID uHashID) {m_uHashID = uHashID;}
	virtual void Execute();

	Asura_Hash_ID m_uHashID;

	static Asura_Guid s_uLastTimeUsedPFXGuid;
};

#endif//__TOOLS_MODE_PFX_H__
