当前位置: 首页>>代码示例>>C++>>正文


C++ TSTR::ToCP方法代码示例

本文整理汇总了C++中TSTR::ToCP方法的典型用法代码示例。如果您正苦于以下问题:C++ TSTR::ToCP方法的具体用法?C++ TSTR::ToCP怎么用?C++ TSTR::ToCP使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TSTR的用法示例。


在下文中一共展示了TSTR::ToCP方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ExportAnimKeys

// Get hold of the transform controllers for the node... 
void AsciiExp::ExportAnimKeys(INode* node, int indentLevel) 
{
	TSTR indent = GetIndent(indentLevel);
	BOOL bPosAnim;
	BOOL bRotAnim;
	BOOL bScaleAnim;
	BOOL bDoKeys = FALSE;

	// We can only export keys if all TM controllers are "known" to us.
	// The reason for that is that some controllers control more than what
	// they should. Consider a path position controller, if you turn on
	// follow and banking, this position controller will also control
	// rotation. If a node that had a path position controller also had a
	// TCB rotation controller, the TCB keys would not describe the whole
	// rotation of the node.
	// For that reason we will only export keys if all controllers
	// position, rotation and scale are linear, hybrid (bezier) or tcb.

	if (!GetAlwaysSample()) {
		Control* pC = node->GetTMController()->GetPositionController();
		Control* rC = node->GetTMController()->GetRotationController();
		Control* sC = node->GetTMController()->GetScaleController();

		if (IsKnownController(pC) && IsKnownController(rC) && IsKnownController(sC)) {
			bDoKeys = TRUE;
		}
	}

	Interface14 *iface = GetCOREInterface14();
	UINT codepage  = iface-> DefaultTextSaveCodePage(true);
	TSTR nodeName = FixupName(node->GetName());
	const char* nodeName_locale = nodeName.ToCP(codepage);
	if (bDoKeys) {
		// Only dump the track header if any of the controllers have keys
		if (node->GetTMController()->GetPositionController()->NumKeys() ||
			node->GetTMController()->GetRotationController()->NumKeys() ||
			node->GetTMController()->GetScaleController()->NumKeys()) {

			_ftprintf(pStream, _T("%s\t%s {\n"), indent.data(), ID_TM_ANIMATION); 
			_ftprintf(pStream, _T("%s\t\t%s \"%hs\"\n"), indent.data(), ID_NODE_NAME,
				nodeName_locale);

			DumpPosKeys(node->GetTMController()->GetPositionController(), indentLevel);
			DumpRotKeys(node->GetTMController()->GetRotationController(), indentLevel);
			DumpScaleKeys(node->GetTMController()->GetScaleController(), indentLevel);

			_ftprintf(pStream, _T("%s\t}\n"), indent.data());
		}
	}
	else if (CheckForAnimation(node, bPosAnim, bRotAnim, bScaleAnim)) {
		_ftprintf(pStream, _T("%s\t%s {\n"), indent.data(), ID_TM_ANIMATION); 
		_ftprintf(pStream, _T("%s\t\t%s \"%hs\"\n"), indent.data(), ID_NODE_NAME,
			nodeName_locale);

		if (bPosAnim) {
			DumpPosSample(node, indentLevel);
		}
		if (bRotAnim) {
			DumpRotSample(node, indentLevel);
		}
		if (bScaleAnim) {
			DumpScaleSample(node, indentLevel);
		}

		_ftprintf(pStream, _T("%s\t}\n"), indent.data());
	}
}
开发者ID:innovatelogic,项目名称:ilogic-vm,代码行数:68,代码来源:animout.cpp

示例2: DumpFloatKeys

// Output float keys if this is a known float controller that
// supports key operations. Otherwise we will sample the controller 
// once for each frame to get the value.
void AsciiExp::DumpFloatKeys(Control* cont, int indentLevel) 
{
	if (!cont)
		return;
	
	int i;
	TSTR indent = GetIndent(indentLevel);
	IKeyControl *ikc = NULL;

	// If the user wants us to always sample, we will ignore the KeyControlInterface
	if (!GetAlwaysSample())
		ikc = GetKeyControlInterface(cont);
	
	// TCB float
	if (ikc && cont->ClassID() == Class_ID(TCBINTERP_FLOAT_CLASS_ID, 0)) {
		_ftprintf(pStream, _T("%s\t\t%s {\n"), indent.data(), ID_CONTROL_FLOAT_TCB); 
		for (i=0; i<ikc->GetNumKeys(); i++) {
			ITCBFloatKey key;
			ikc->GetKey(i, &key);
			_ftprintf(pStream, _T("%s\t\t\t%s %d\t%s"),
				indent.data(),
				ID_TCB_FLOAT_KEY,
				key.time,
				Format(key.val));
			_ftprintf(pStream, _T("\t%s\t%s\t%s\t%s\t%s\n"), Format(key.tens), Format(key.cont), Format(key.bias), Format(key.easeIn), Format(key.easeOut));
		}
		_ftprintf(pStream, _T("%s\t\t}\n"), indent.data());
	}
	// Bezier float
	else if (ikc && cont->ClassID() == Class_ID(HYBRIDINTERP_FLOAT_CLASS_ID, 0)) {
		_ftprintf(pStream, _T("%s\t\t%s {\n"), indent.data(), ID_CONTROL_FLOAT_BEZIER); 
		for (i=0; i<ikc->GetNumKeys(); i++) {
			IBezFloatKey key;
			ikc->GetKey(i, &key);
			_ftprintf(pStream, _T("%s\t\t\t%s %d\t%s"),
				indent.data(),
				ID_BEZIER_FLOAT_KEY,
				key.time, 
				Format(key.val));
			_ftprintf(pStream, _T("\t%s\t%s\t%d\n"), Format(key.intan), Format(key.outtan), key.flags);
		}
		_ftprintf(pStream, _T("%s\t\t}\n"), indent.data());
	}
	else if (ikc && cont->ClassID() == Class_ID(LININTERP_FLOAT_CLASS_ID, 0)) {
		_ftprintf(pStream, _T("%s\t\t%s {\n"), indent.data(), ID_CONTROL_FLOAT_LINEAR); 
		for (i=0; i<ikc->GetNumKeys(); i++) {
			ILinFloatKey key;
			ikc->GetKey(i, &key);
			_ftprintf(pStream, _T("%s\t\t\t%s %d\t%s\n"),
				indent.data(),
				ID_FLOAT_KEY,
				key.time,
				Format(key.val));
		}
		_ftprintf(pStream, _T("%s\t\t}\n"), indent.data());
	}
	else {
		
		// Unknown controller, no key interface or sample on demand -
		// This might be a procedural controller or something else we
		// don't know about. The last resort is to get the value from the 
		// controller at every n frames.
		
		TSTR name;
		cont->GetClassName(name);
		TSTR className = FixupName(name);
		Interface14 *iface = GetCOREInterface14();
		UINT codepage  = iface-> DefaultTextSaveCodePage(true);
		const char* className_locale = className.ToCP(codepage);
		_ftprintf(pStream, _T("%s\t\t%s \"%hs\" {\n"), indent.data(), ID_CONTROL_FLOAT_SAMPLE,
			className_locale);
		
		// If it is animated at all...
		if (cont->IsAnimated()) {
			// Get the range of the controller animation 
			Interval range; 
			// Get range of full animation
			Interval animRange = ip->GetAnimRange(); 
			TimeValue t = cont->GetTimeRange(TIMERANGE_ALL).Start();
			float value;
			
			// While we are inside the animation... 
			while (animRange.InInterval(t)) {
				// Sample the controller
				range = FOREVER;
				cont->GetValue(t, &value, range);
				
				// Set time to start of controller validity interval 
				t = range.Start();
				
				// Output the sample
				_ftprintf(pStream, _T("%s\t\t\t%s %d\t%s\n"),
					indent.data(),
					ID_FLOAT_KEY,
					t,
					Format(value));
				
//.........这里部分代码省略.........
开发者ID:innovatelogic,项目名称:ilogic-vm,代码行数:101,代码来源:animout.cpp

示例3: if


//.........这里部分代码省略.........
		case MAT_MAP_GCOL:
		case MAT_MAP_BCOL:
			c24=(Color_24 *)data;
			WRTERR(c24,3);
			break;
		case MAT_MAP_ANG:
 			{
			MapParams *mp = (MapParams *)data;
			float ang,dang;
 			ang = (float)atan2(mp->ang_sin,mp->ang_cos);
			dang = RadToDeg(ang);
#if 0
			printf("Saving MAT_MAP_ANG sin = %.4f , cos = %.4f, ang = %.4f \n",
				mp->ang_sin, mp->ang_cos, ang);
#endif
			WRTERR(&dang,4);
			}
			break;
	
		case COLOR_F:
			cf=(Color_f *)data;
			WRTERR(cf,12);
			break;
		case COLOR_24:
			c24=(Color_24 *)data;
			WRTERR(c24,3);
			break;
		case LIN_COLOR_24:
			c24 = (Color_24 *)data;
			WRTERR(c24,3);
			break;
		case MAT_NAME:  /* Simple strings */
			tName = (TCHAR *)data;
			cName =  tName.ToCP(codePage).data();
			if(cName.Length()>16)
				cName.Resize(16);
			WRTERR(cName.data(),(size_t)( cName.Length()+1));
			break;
		case MAT_MAPNAME:
			tName = (TCHAR *)data;
			// convert to 8.3 filename format
			EightDotThreeName( tName, false );
			cName =  tName.ToCP(codePage).data();
			if(cName.Length()>12)
				cName.Resize(12);
			WRTERR( cName.data(),(size_t)( cName.Length()+1));
			break;

		case MAT_BUMP_PERCENT:
		case INT_PERCENTAGE:
			WRTERR(data,2);
			break;
		case MAT_WIRESIZE:
			WRTERR(data,4);
			break;
		case MAT_TWO_SIDE:
		case MAT_SUPERSMP:
		case MAT_ADDITIVE:
		case MAT_WIRE:
		case MAT_FACEMAP:
		case MAT_XPFALLIN:
		case MAT_USE_XPFALL:
		case MAT_USE_REFBLUR:
		case MAT_PHONGSOFT:
		case MAT_WIREABS:
		case DUMMY:
开发者ID:innovatelogic,项目名称:ilogic-vm,代码行数:67,代码来源:savemli.cpp


注:本文中的TSTR::ToCP方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。