亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? max2nmo.cpp

?? 3dmax導出3d模型二次開發插件
?? CPP
?? 第 1 頁 / 共 3 頁
字號:
		char *fileNameExtension = splitter.GetExtension();
		if( strcmp(fileNameExtension, ".nmo") ){	// save the level only for ".cmo" and ".vmo"
			m_VirtoolsObjects->InsertFront( level );
		}

	}
#endif

	
	// Set Compression Level
	if( GetCompressionLevel() ){
		VirtoolsContext->SetFileWriteMode( CKFILE_WHOLECOMPRESSED );
		VirtoolsContext->SetCompressionLevel( GetCompressionLevel() );
	} else {
		VirtoolsContext->SetFileWriteMode( CKFILE_UNCOMPRESSED );
	}

	//Normalizing root anim Y orientation aligning it with the Z world
	if ((GetExportAsCharacter() || GetExportAsAnimationOnly())  && GetAlignAnimOnZ()) {
		CK_ID* pid = VirtoolsContext->GetObjectsListByClassID(CKCID_KEYEDANIMATION);
		CKKeyedAnimation* ka = (CKKeyedAnimation*) VirtoolsContext->GetObject(*pid);
		
		if (ka) {
			CKObjectAnimation* oa = ka->GetAnimation(ka->GetRootEntity()) ;
			if (oa) {
				CKAnimController* rctrl = oa->GetRotationController();
				int rkeycount=0;
				if (rctrl && (rkeycount=rctrl->GetKeyCount())) {
					VxQuaternion diffy,first,dest;
					CKRotationKey* rotkey = NULL;
					VxMatrix or0;
					
					rotkey = (CKRotationKey*) rctrl->GetKey(0);				
					first = rotkey->GetRotation();
					first.ToMatrix(or0);
					VxVector dir0(or0[0][2],or0[1][2],or0[2][2]);
					dir0.y = 0.0f;
					dir0.Normalize();
					float angle = acosf(DotProduct(dir0,VxVector::axisZ()));
					diffy.FromRotation(VxVector(0.0f,1.0f,0.0f),-(PI/2 - angle));
					
					for (int ki = 0; ki<rkeycount;ki++) {
						rotkey = (CKRotationKey*) rctrl->GetKey(ki);
						dest = rotkey->GetRotation();
						dest.Multiply(diffy);
						dest.Normalize();
						rotkey->SetRotation(dest);
					}
				}
			}
		}
	}

	// Write the file to hard drive
	CKERROR err = VirtoolsFile->StartSave((char *)name);
	if (err==CK_OK) {
		VirtoolsFile->SaveObjects(m_VirtoolsObjects);
		err = VirtoolsFile->EndSave();
	}
	if (err==CK_OK) {
		Report(REPORT_HLEVEL,"\r\n");
		Report(REPORT_HLEVEL,"File saved succesfully\r\n");
	} else {
		Report(REPORT_HLEVEL,"\r\n");
		Report(REPORT_HLEVEL,"Error while saving file: %s\r\n",CKErrorToString(err));
	}

	
	if (GetReportLevel())
	if (!DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_REPORT),
		ip->GetMAXHWnd(), ReportDlgProc, (LPARAM)this)) {
		return 1;
	}


// Clean Up
	DeleteCKObjectArray(m_VirtoolsObjects);
	m_VirtoolsObjects = NULL;
	VirtoolsContext->DeleteCKFile(VirtoolsFile);
	delete VirtoolsExporter;
	VirtoolsExporter = NULL;
	
	VirtoolsContext->ClearAll();

	return 1;
}

////////////////////////////////////
// Register All Special Parameters
////////////////////////////////////
BOOL Max2Nmo::RegisterAllSpecialParameters() {

	CKParameterManager* pm = VirtoolsContext->GetParameterManager();
#ifdef _USESCRIPTS_
	RegisterSpecialParameters( pm );
	RegisterSpecialParameters2( pm );
#endif	
	return TRUE;
}
	


BOOL Max2Nmo::SupportsOptions(int ext, DWORD options) {
	//assert(ext == 0);
	return(options == SCENE_EXPORT_SELECTED) ? TRUE : FALSE;
}

#ifdef _USESCRIPTS_

// This methode parse all the nodes (recursivly), and evaluates
// the user defined properties buffer to execute some function
// like: attaching a script, setting an attribute, setting a local parameter
BOOL Max2Nmo::evaluateNodeUserDefinedProperties( INode* node ){

	// Only export if exporting everything or it's selected
	if(!exportSelected || node->Selected()) {

		// Stop recursing if the user pressed Cancel 
		if (ip->GetCancel())
			return FALSE;
		
		// The ObjectState is a 'thing' that flows down the pipeline containing
		// all information about the object. By calling EvalWorldState() we tell
		// max to eveluate the object at end of the pipeline.
		ObjectState os = node->EvalWorldState(0); 
		
		// The obj member of ObjectState is the actual object we will export.
		if (os.obj) {
			
			// We look at the super class ID to determine the type of the object.
			switch(os.obj->SuperClassID()) {
			case GEOMOBJECT_CLASS_ID:
			case CAMERA_CLASS_ID:
			case LIGHT_CLASS_ID:
			case SHAPE_CLASS_ID:
			case HELPER_CLASS_ID:
				{
					PropertiesEvaluator pe( VirtoolsExporter, node, this, m_VirtoolsObjects );
				} break;
			}
		}
		
		// For each child of this node, we recurse into ourselves 
		// until no more children are found.
		for (int c = 0; c < node->NumberOfChildren(); c++) {
			if (!evaluateNodeUserDefinedProperties(node->GetChildNode(c)))
				return FALSE;
		}
		
	} else {
		// node is not selected but one of its child may
		// For each child of this node, we recurse into ourselves 
		// until no more children are found.
		for (int c = 0; c < node->NumberOfChildren(); c++) {
			if (!evaluateNodeUserDefinedProperties(node->GetChildNode(c)))
				return FALSE;
		}
	}
	
	return TRUE;
}
#endif


// This method is the main object exporter.
// It is called once of every node in the scene. The objects are
// exported as they are encoutered.

// Before recursing into the children of a node, we will export it.
// The benefit of this is that a nodes parent is always before the
// children in the resulting file. This is desired since a child's
// transformation matrix is optionally relative to the parent.

BOOL Max2Nmo::nodeEnum(INode* node) 
{
	// Only export if exporting everything or it's selected
	if(!exportSelected || node->Selected()) {
		nCurNode++;
		if( GetShowProgressionBar() ){
			ip->ProgressUpdate((int)((float)nCurNode/nTotalNodeCount*100.0f)); 
		}

		// Stop recursing if the user pressed Cancel 
		if (ip->GetCancel())
			return FALSE;
		
		// If this node is a group head, all children are 
		// members of this group. The node will be a dummy node and the node name
		// is the actualy group name.
		if (node->IsGroupHead()) {
			// TODO
			if (!GetGroupAsPlace()) {
				CKGroup* group = VirtoolsExporter->AddGroup(node->GetName(),node);
				// If there was a group being parsed : Add the newly created group
				CKGroup* PrevGroup = CKGroups.Size() ? CKGroups.Back() : NULL;
				if (PrevGroup) {
					PrevGroup->AddObject(group);
				}
				
				CKGroups.PushBack(group);
			}
		}
		
		// The ObjectState is a 'thing' that flows down the pipeline containing
		// all information about the object. By calling EvalWorldState() we tell
		// max to eveluate the object at end of the pipeline.
		ObjectState os  = node->EvalWorldState(0); 

		// The obj member of ObjectState is the actual object we will export.
		if (os.obj) {
			
			// We look at the super class ID to determine the type of the object.
			switch(os.obj->SuperClassID()) {
			case GEOMOBJECT_CLASS_ID: 
				ExportGeomObject(node); 
				break;
			case CAMERA_CLASS_ID:
				ExportCameraObject(node); 
				break;
			case LIGHT_CLASS_ID:
				ExportLightObject(node); 
				break;
			case SHAPE_CLASS_ID:
				ExportShapeObject(node); 
				break;
			case HELPER_CLASS_ID:
				ExportHelperObject(node); 
				break;
			}
		}

		// For each child of this node, we recurse into ourselves 
		// until no more children are found.
		for (int c = 0; c < node->NumberOfChildren(); c++) {
			if (!nodeEnum(node->GetChildNode(c)))
				return FALSE;
		}
		
		// If this is true here, it is the end of the group we started above.
		if (node->IsGroupHead()) {
			if (!GetGroupAsPlace()) {
				CKGroups.PopBack();
			}
			GroupIndent-=2;
		}
	} else {
		// node is not selected but one of its child may
		// For each child of this node, we recurse into ourselves 
		// until no more children are found.
		for (int c = 0; c < node->NumberOfChildren(); c++) {
			if (!nodeEnum(node->GetChildNode(c)))
				return FALSE;
		}
	}

	return TRUE;
}

XString Max2Nmo::StrGroupIndent() 
{
	XString str = "";
	for (int i=0;i<GroupIndent;++i)
		str << " ";
	return str;
}

void Max2Nmo::PreProcess(INode* node, int& nodeCount)
{
	nodeCount++;
	
	
	// Add the nodes material to out material list
	// Null entries are ignored when added...
	if (!exportSelected || (node->Selected() == TRUE))
		mtlList.AddMtl(node->GetMtl());

	// For each child of this node, we recurse into ourselves 
	// and increment the counter until no more children are found.
	for (int c = 0; c < node->NumberOfChildren(); c++) {
		PreProcess(node->GetChildNode(c), nodeCount);
	}
}

void Max2Nmo::PostProcess(INode* node)
{
	if(!exportSelected || node->Selected()) {
		ExportAnimMesh(node);
	}

// For each child of this node, we recurse into ourselves 
	for (int c = 0; c < node->NumberOfChildren(); c++) {
		PostProcess(node->GetChildNode(c));
	}
}
/****************************************************************************

 Configuration.
 To make all options "sticky" across sessions, the options are read and
 written to a configuration file every time the exporter is executed.

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

TSTR Max2Nmo::GetCfgFilename()
{
	TSTR filename;
	
	filename += ip->GetDir(APP_PLUGCFG_DIR);
	filename += "\\";
	filename += CFGFILENAME;

	return filename;
}

// NOTE: Update anytime the CFG file changes
#define CFG_BEFORECOMPRESSVERSION		0x02
#define CFG_VERSION						0x02

BOOL Max2Nmo::ReadConfig()
{
	TSTR filename = GetCfgFilename();
	FILE* cfgStream;
	
	cfgStream = fopen(filename, "rt");
	if (!cfgStream)
		return FALSE;
	int version;
	char CharacterName[256];
	char AnimationName[256];
	
	//---- read Version 
	fscanf(cfgStream,"%d",&version);

	//---- read settings
	if (version < CFG_BEFORECOMPRESSVERSION) {
		nCompressionLevel = 0;
		fscanf(cfgStream,"%d %d %d %d %d %d %d %d %d %s %s %d %d\n",
			&bExportAsObjects,
			&bExportAsCharacter,
			&bExportAsAnimationOnly,
			&bConvertPhysiqueToSkin,
			&bStoreOnlyTextureFilenames,
			&bRescaleScene,
			&nReportLevel,
			&nMeshFrameStep,
			&nKeyFrameStep,
			CharacterName,
			AnimationName,
			&bGroupAsPlace,
			&bSaveBipedGeom);

	} else {
		fscanf(cfgStream,"%d %d %d %d %d %d %d %d %d %s %s %d %d %d %d\n",
			&bExportAsObjects,
			&bExportAsCharacter,
			&bExportAsAnimationOnly,
			&bConvertPhysiqueToSkin,
			&bStoreOnlyTextureFilenames,
			&bRescaleScene,
			&nReportLevel,
			&nMeshFrameStep,
			&nKeyFrameStep,
			CharacterName,
			AnimationName,
			&bGroupAsPlace,
			&bSaveBipedGeom,
			&nCompressionLevel,
			&bAlignAnimOnZ);

	}
	fclose(cfgStream);

	SetCharacterName(CharacterName);
	SetAnimationName(AnimationName);
	

	return TRUE;
}

void Max2Nmo::WriteConfig()
{
	TSTR filename = GetCfgFilename();
	FILE* cfgStream;

	cfgStream = fopen(filename, "wt");
	if (!cfgStream)
		return;

	fprintf(cfgStream,"%d %d %d %d %d %d %d %d %d %d %s %s %d %d %d %d\n",
		CFG_VERSION,
		GetExportAsObjects(),
		GetExportAsCharacter(),
		GetExportAsAnimationOnly(),
		GetConvertPhysiqueToSkin(),
		GetStoreOnlyFilenames(),
		GetRescaleScene(),
		GetReportLevel(),
		GetMeshFrameStep(),
		GetKeyFrameStep(),
		(char *)GetCharacterName(),
		(char *)GetAnimationName(),
		bGroupAsPlace,
		bSaveBipedGeom,
		GetCompressionLevel(),
		bAlignAnimOnZ);

	fclose(cfgStream);
}




void Max2Nmo::RescaleScene()
{
int type;
float scale;
float convertFactor=1.0f;

if (UNITDISP_GENERIC != GetUnitDisplayType()) {
	GetMasterUnitInfo(&type, &scale);
	convertFactor=scale;
	switch(type) {
		case UNITS_INCHES:	convertFactor*=0.0254f;	break;
		case UNITS_FEET:	convertFactor*=0.3048f;	break;
		case UNITS_MILES:	convertFactor*=1609.344f;	break;
		case UNITS_MILLIMETERS:		convertFactor*=0.001f;	break;
		case UNITS_CENTIMETERS:		convertFactor*=0.01f;	break;
		case UNITS_METERS:			convertFactor*=1.0f;	break;
		case UNITS_KILOMETERS:		convertFactor*=1000;	break;
	}
}

if(convertFactor!=1.0f)
{
	ip->RescaleWorldUnits(convertFactor, FALSE);
	SetMasterUnitInfo(UNITS_METERS,1.0f);
	ip->ForceCompleteRedraw();
}
}


BOOL MtlKeeper::AddMtl(Mtl* mtl)
{
	if (!mtl) {
		return FALSE;
	}

	int numMtls = mtlTab.Count();
	for (int i=0; i<numMtls; i++) {
		if (mtlTab[i] == mtl) {
			return FALSE;
		}
	}
	mtlTab.Append(1, &mtl, 25);

	return TRUE;
}

int MtlKeeper::GetMtlID(Mtl* mtl)
{
	int numMtls = mtlTab.Count();
	for (int i=0; i<numMtls; i++) {
		if (mtlTab[i] == mtl) {
			return i;
		}
	}
	return -1;
}

int MtlKeeper::Count()
{
	return mtlTab.Count();
}

Mtl* MtlKeeper::GetMtl(int id)
{
	return mtlTab[id];
}


?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久九九全国免费| 六月丁香婷婷久久| 精品一区二区三区在线播放| 成人av免费在线播放| 欧美日本在线观看| 亚洲欧美一区二区三区久本道91| 麻豆91在线播放| 欧美日韩精品福利| 亚洲日本一区二区三区| 丰满亚洲少妇av| 欧美成人猛片aaaaaaa| 亚洲国产乱码最新视频| 色婷婷av一区二区三区gif | 色综合久久天天| 久久精品一区二区三区四区| 免费一区二区视频| 欧美精品在线观看播放| 亚洲欧美电影一区二区| 国产成人免费9x9x人网站视频| 精品成人一区二区三区| 日韩高清一区在线| 欧美精品日韩综合在线| 性做久久久久久| 欧美色图激情小说| 亚洲精品精品亚洲| 色综合一区二区| ...av二区三区久久精品| 成人听书哪个软件好| 久久久久久久久一| 国产精品12区| 国产精品久久久久久久裸模| 粉嫩aⅴ一区二区三区四区| 国产免费观看久久| 丁香网亚洲国际| 国产精品女人毛片| 日本精品一区二区三区四区的功能| 亚洲欧美视频一区| 欧美无砖砖区免费| 免费在线观看不卡| 欧美精品一区二区三区蜜桃 | 欧美日韩综合在线免费观看| 亚洲国产成人porn| 日韩一区二区麻豆国产| 国产伦精品一区二区三区免费| 久久这里只有精品6| 成人午夜伦理影院| 亚洲日本在线看| 7777女厕盗摄久久久| 久久国产日韩欧美精品| 久久久精品欧美丰满| 丁香婷婷深情五月亚洲| 中文字幕综合网| 91精品欧美综合在线观看最新 | 亚洲黄色av一区| 欧美欧美欧美欧美| 国产精品一区久久久久| 亚洲色图色小说| 91精品国产91久久久久久一区二区| 狠狠色丁香久久婷婷综| 国产精品久久久99| 欧美肥胖老妇做爰| 国产99久久久精品| 亚洲精品你懂的| 精品处破学生在线二十三| 99久久综合国产精品| 午夜视频在线观看一区二区| 国产肉丝袜一区二区| 欧美性大战久久| 国产美女久久久久| 亚洲一区二区三区视频在线 | 一区二区三区在线免费视频| 日韩一区二区三| 色婷婷激情综合| 国产一区二三区好的| 亚洲一区自拍偷拍| 久久精品人人做人人综合| 欧美亚一区二区| 成人免费毛片高清视频| 麻豆91小视频| 亚洲国产精品自拍| 国产精品久久二区二区| 欧美成人福利视频| 欧美天天综合网| 成人av网址在线| 久久99久久久久| 亚洲成人动漫精品| 中文字幕一区视频| 久久先锋影音av| 91精品国产综合久久精品麻豆| 成人深夜视频在线观看| 国内外成人在线| 亚洲成人动漫在线免费观看| 日韩理论片一区二区| 国产欧美精品国产国产专区| 精品欧美久久久| 337p亚洲精品色噜噜| 色先锋资源久久综合| 国产福利视频一区二区三区| 精品一区二区三区在线观看| 日韩精品一区第一页| 亚洲午夜一区二区| 亚洲天堂免费看| 国产精品色在线观看| 精品成人在线观看| 日韩视频免费观看高清完整版| 欧美区一区二区三区| 欧美日韩高清影院| 在线精品视频一区二区| 色屁屁一区二区| 欧美中文字幕不卡| 欧洲一区在线电影| 在线免费观看视频一区| 91免费视频网址| 色综合久久综合网97色综合| 色综合视频在线观看| 在线观看亚洲专区| 色噜噜狠狠色综合中国| 97久久超碰精品国产| 色综合久久66| 欧美色图在线观看| 欧美日韩小视频| 精品视频一区 二区 三区| 精品污污网站免费看| 欧美三级日韩在线| 欧美疯狂做受xxxx富婆| 欧美一区二区三区视频免费播放| 欧美日本乱大交xxxxx| 欧美二区在线观看| 精品国精品国产尤物美女| 久久先锋影音av| 日韩一区欧美小说| 亚洲成人免费观看| 麻豆国产欧美日韩综合精品二区| 激情综合网av| 国产黄色精品视频| 日本精品视频一区二区| 欧美一区二区在线不卡| 国产三区在线成人av| 18成人在线观看| 日本视频在线一区| 国产成人综合亚洲91猫咪| 色天使色偷偷av一区二区| 538在线一区二区精品国产| 26uuu国产电影一区二区| 中文字幕在线观看不卡视频| 亚洲18女电影在线观看| 国产乱码字幕精品高清av| 91麻豆视频网站| 精品日韩在线一区| 综合久久国产九一剧情麻豆| 日韩精品久久理论片| 成人性视频免费网站| 在线免费不卡电影| 久久九九国产精品| 亚洲1区2区3区视频| 国产91精品久久久久久久网曝门 | 亚洲成人av免费| 国产精品影视天天线| 欧美日韩一本到| 国产精品的网站| 六月婷婷色综合| 欧美性大战久久久久久久蜜臀| 久久精品视频在线免费观看| 亚洲图片欧美一区| 福利一区福利二区| 欧美一二三四在线| 亚洲女人小视频在线观看| 国产主播一区二区| 欧美日韩成人综合天天影院| 自拍偷拍国产精品| 国产一区二区三区在线观看免费 | 欧美在线观看视频一区二区| 国产欧美日韩精品在线| 毛片一区二区三区| 欧美日韩国产高清一区二区三区| 欧美经典三级视频一区二区三区| 视频一区二区三区入口| 色综合天天综合在线视频| 中文字幕不卡一区| 国产精品77777竹菊影视小说| 日韩一级高清毛片| 视频一区在线视频| 欧美日韩亚洲国产综合| 一区二区三区日韩欧美精品| 99久久婷婷国产综合精品电影| 久久免费看少妇高潮| 美国毛片一区二区| 日韩精品综合一本久道在线视频| 亚洲18影院在线观看| 欧美日韩在线观看一区二区| 亚洲免费在线视频一区 二区| 北条麻妃一区二区三区| 久久久久久久久久久电影| 久久99久久99精品免视看婷婷 | 欧美中文字幕不卡| 亚洲第一av色| 在线精品亚洲一区二区不卡| 一区二区三区欧美亚洲| 色视频一区二区| 亚洲午夜三级在线|