Exemple #1
0
MStatus CXRayObjectExport::writer ( const MFileObject& file, const MString& options, FileAccessMode mode )
{
	MStatus status= MS::kFailure;

	//move default extesion here..
	MString mname = file.fullName()+".object";
	LPCSTR	fname = mname.asChar();

	Log("Export object: ",fname);
	CEditableObject* OBJECT = new CEditableObject(fname);
	OBJECT->SetVersionToCurrent(TRUE,TRUE);
	if((mode==MPxFileTranslator::kExportAccessMode)||(mode==MPxFileTranslator::kSaveAccessMode)){
		status = ExportAll(OBJECT)?MS::kSuccess:MS::kFailure;
	}else if(mode==MPxFileTranslator::kExportActiveAccessMode){
		status = ExportSelected(OBJECT)?MS::kSuccess:MS::kFailure;
	}
	if (MS::kSuccess==status){ 
		OBJECT->Optimize	();
		OBJECT->SaveObject	(fname);
		Log("Object succesfully exported.");
		Msg("%d vertices, %d faces", OBJECT->GetVertexCount(), OBJECT->GetFaceCount());
	}else{
		Log("! Export failed.");
	}
	xr_delete(OBJECT);

	return status;
}
Exemple #2
0
/*
====================
ExportSelected
====================
*/
void G3DMExport::ExportSelected( INode* i_node )
{
	if(i_node->Selected() && i_node->Renderable())
	{
		// gather the mesh data
		GatherMesh(i_node);
	}

	// process the child node
	for(int i = 0; i < i_node->NumberOfChildren(); i++)
	{
		ExportSelected(i_node->GetChildNode(i));
	}
}
Exemple #3
0
/*
====================
DoExport
====================
*/
int G3DMExport::DoExport(const TCHAR *name, ExpInterface *ei, Interface *i, BOOL suppressPrompts, DWORD options)
{
	// clear the old data
	mMeshes.clear();
	mSkins.clear();

	// normalize the file path
	Str path = UnifySlashes(name);

	// get the export dir
	mPath = UnifySlashes(i->GetDir(APP_EXPORT_DIR));
	mPath += '/';
	if( !strstr( path.c_str(), mPath.c_str() ) )
	{
		G3DAssert("The export path(%s) is illegal!",name);
		return 1;
	}

	// this has to be done for edit normals modifier to work properly
	i->SetCommandPanelTaskMode(TASK_MODE_MODIFY);

	// get the animation range
	Interval inter = i->GetAnimRange();
	mTime = i->GetTime();

	// recursive export all of the mesh node
	if(options == SCENE_EXPORT_SELECTED)
	{
		ExportSelected(i->GetRootNode());
	}
	else
	{
		ExportVisible(i->GetRootNode());
	}	

	// save the mesh file
	if(Save(path) == 0) { G3DAssert("Fail to save the G3DM file : %s!", path.c_str() ); return 1; }

	// clear the old data
	mMeshes.clear();
	mSkins.clear();

	return 1;
}
Exemple #4
0
/*
====================
ExportSelected
====================
*/
void G3DSExport::ExportSelected( INode* i_node )
{
	if(i_node->Selected() && i_node->Renderable())
	{
		Modifier *modifier = GetModifier(i_node,SKIN_CLASSID);
		if(modifier)
		{
			// disables the modifier in the viewports 
			modifier->DisableMod();

			// gather the skin data
			GatherSkin(i_node);

			// enables the modifier in the history browser 
			modifier->EnableMod();
		}
	}

	// process the child node
	for(int i = 0; i < i_node->NumberOfChildren(); i++)
	{
		ExportSelected(i_node->GetChildNode(i));
	}
}