#include "stdafx.h"
#include "fugen.h"
#include "fugenDoc.h"
#include "EvalTessWorld.h"

// MGEvalTessWorld

MGEvalTessWorld::MGEvalTessWorld(fugenDoc* pDoc)
	 : MGCommandBase(
		pDoc
		, ID_TESS_WORLD)
{
}

MGCommandBase* MGEvalTessWorld::initial_clone(fugenDoc* pDoc) const
{
	return new MGEvalTessWorld(pDoc);
}

bool MGEvalTessWorld::initiate_tool(){
	if(!MGCommandBase::initiate_tool()){
		if(current_objects().size() == 1){
			const MGGel* pGel = current_objects().front().top_object();
			if(pGel && pGel->type_is(mgAll_2Manifold) && !pGel->type_is(mgAll_Plane))
				document()->InitialUpdateFrame(theApp.m_pTessWorldTemplate);
			return OnCommandEnd(1);
		}
	}
	return OnCommandEnd(3);
}
