Пример #1
0
static void SaveColorFile(HWND hWnd,TSTR &name)
   {
    MaxSDK::Util::TextFile::Writer file;	

   	Interface14 *iface = GetCOREInterface14();
	UINT codepage  = iface-> DefaultTextSaveCodePage(true); //dll\PaintLayerMod\ColorPaletteTool.cpp :: SaveColorFile, UTF8 allowed, keep to same.

   if(!file.Open(fname, false, MaxSDK::Util::TextFile::Writer::WRITE_BOM | codepage )){
      TSTR buf2 = GetString(IDS_RB_COLORCLIPBOARD);
      TSTR buf1;
      buf1.printf(GetString(IDS_RB_CANTOPENFILE),fname);       
      MessageBox(hWnd,buf1,buf2,MB_ICONEXCLAMATION);
      return;
      }

   for (int i=0; i<12; i++) {
      int r, g, b;
      IColorSwatch *cs = GetIColorSwatch(GetDlgItem(hWnd,csIDs[i]));
      COLORREF col = cs->GetColor();
      ReleaseIColorSwatch(cs);
      r = GetRValue(col); g = GetGValue(col); b = GetBValue(col);
      file.Printf(_T("%d %d %d\n"), r, g, b);
      }  

   for (int i=0; i<12; i++) {
      IColorSwatch *cs = GetIColorSwatch(GetDlgItem(hWnd,csIDs[i]));
      AColor col = cs->GetAColor();
      ReleaseIColorSwatch(cs);
      file.Printf(_T("%f %f %f %f\n"), col.r, col.g, col.b, col.a);
   }  

   SetupTitle(hWnd,name);
   file.Close();
   }
Пример #2
0
BOOL FaceDataExport::nodeEnum(INode* node,Interface *ip) {	
	if(!exportSelected || node->Selected()) {
		ObjectState os = node->EvalWorldState(ip->GetTime());

		IFaceDataMgr *pFDMgr = NULL;
		if (os.obj->IsSubClassOf(triObjectClassID)) {
			TriObject *tobj = (TriObject *)os.obj;
			Mesh* mesh = &tobj->GetMesh();
			pFDMgr = static_cast<IFaceDataMgr*>(mesh->GetInterface( FACEDATAMGR_INTERFACE ));
		} else if (os.obj->IsSubClassOf (polyObjectClassID)) {
			PolyObject *pobj = (PolyObject *)os.obj;
			MNMesh *mesh = &pobj->GetMesh();
			pFDMgr = static_cast<IFaceDataMgr*>(mesh->GetInterface( FACEDATAMGR_INTERFACE ));
		}
		if (pFDMgr == NULL) return FALSE;

		SampleFaceData* SampleDataChan = NULL; 
		IFaceDataChannel* fdc = pFDMgr->GetFaceDataChan( FACE_MAXSAMPLEUSE_CLSID );
		if ( fdc != NULL ) SampleDataChan = dynamic_cast<SampleFaceData*>(fdc);
		if ( SampleDataChan == NULL) {
			fileStream.Printf(_T("Node %s does not have our Face Data\n"),node->GetName());
			return false;
		}

		//OK so We have Face data lets dump it out..
		fileStream.Printf(_T("\nNode %s has %d faces with FaceFloats\n"),node->GetName(), SampleDataChan->Count());
		for(ULONG i=0;i<SampleDataChan->Count();i++) {
			float data = SampleDataChan->data[i];
			fileStream.Printf(_T("Face %d, float %f\n"),i,data);
		}
	}

	// Recurse through this node's children, if any
	for (int c = 0; c < node->NumberOfChildren(); c++) {
		if (!nodeEnum(node->GetChildNode(c), ip)) return FALSE;
	}

	return TRUE;
}
Пример #3
0
int FaceDataExport::DoExport(const TCHAR *name,ExpInterface *ei,Interface *i, BOOL suppressPrompts, DWORD options) {
	exportSelected = (options & SCENE_EXPORT_SELECTED) ? true : false;
	Interface14 *iface = GetCOREInterface14();
	UINT codepage  = iface-> DefaultTextSaveCodePage(true);
	if(!fileStream.Open(name, false, MaxSDK::Util::TextFile::Writer::WRITE_BOM | codepage )) return 0;
	fileStream.Printf(_T("FaceFloats Export 1.1\n\n"));
	int numChildren = i->GetRootNode()->NumberOfChildren();
	for (int idx=0; idx<numChildren; idx++) {
		nodeEnum(i->GetRootNode()->GetChildNode(idx), i);
	}
	fileStream.Close();

	return TRUE;
}