//
// Tools_VertexMove_Object.h
//
// Created by Richard Rice - 27/01/04
// 
// Copyright (C) 2004 Rebellion, All Rights Reserved.
//

#ifdef ASURA_USE_PRAGMA_ONCE
    #pragma once
#endif

#ifndef __TOOLS_VERTEXMOVE_OBJECT_H__
#define __TOOLS_VERTEXMOVE_OBJECT_H__

#include "Objects/Tools_Object.h"
#include "MeshEdit/Tools_Mode_MeshEdit.h"
#include "Misc/Tools_Vertex_Selection.h"



class Tools_VertexMove_Object : public Tools_Object
{
public :
	Tools_VertexMove_Object(const List<ModuleVertexPair>& xVertexList);
	~Tools_VertexMove_Object();

	virtual void UpdatePositionInAsuraData(bool /*bUpdateLinkedObjects*/);

	virtual const char* GetName(){return "Vertex Movement";}
	virtual const char* GetTypeDescription(){return "Vertex Movement";}

	virtual void OnSelection();
	virtual void OnDeselection();
	virtual bool IsHidden(){return false;}
	virtual void Update();


	static void DeleteAll();

	virtual Asura_Vector_3 GetSnapPoint(const Asura_Vector_3& xPos) const;

	//for mesh edit modes flatten polygons option
	void SetYPositionForVertices(float fY);


private :
	void CreateOverlay();
	void DeleteOverlay();

	void UnmergePolygonsIfNeeded();
	void InvalidateMeshes();


	int m_iNumVertices;
	ModuleVertexPair* m_pxVertexList;

	int m_iNumMeshes;
	int* m_piMeshList;

	Asura_Vector_3 m_xPreviousPosition;
	Asura_Matrix_3x3 m_xPreviousOrientation;

	bool m_bUseOrientation;
	bool m_bUnmerged;

	static bool s_bDontUpdateMeshes;
	bool m_bMeshesNeedToBeInvalidated;

	static List<Tools_VertexMove_Object*> s_xList;

};


#endif
