/*===========================================================================*\ | Dialog Procs and related functions \*===========================================================================*/ void FormatObjectDisplay(int i, ReferenceMaker* rm, bool showaddress, TSTR& buf) { TSTR str; if (rm) { rm->GetClassName(str); buf.printf(_T("%d: %s (0x%08x) "), i, str.data(), rm->SuperClassID()); if (str == _T("Node")) { INode* node = (INode*)rm; str = buf; buf.printf(_T("%s \"%s\""), str.data(), node->GetName()); } else { str = buf; if (rm->ClassID() == Class_ID(0,0)) buf.printf(_T("%s (0,0)"), str.data()); else buf.printf(_T("%s (0x%08x, 0x%08x)"), str.data(), rm->ClassID().PartA(), rm->ClassID().PartB()); } if (showaddress) { str = buf; buf.printf(_T("%s at 0x%08x"), str.data(), rm); } } else buf.printf(_T("%d: NULL"), i); }
void Unreal3DExport::WriteModel() { // Progress pInt->ProgressUpdate(Progress, FALSE, GetString(IDS_INFO_WRITE)); // Open data file fMesh = _tfopen(ModelFileName,_T("wb")); if( !fMesh ) { ProgressMsg.printf(GetString(IDS_ERR_FMODEL),ModelFileName); throw MAXException(ProgressMsg.data()); } // Open anim file fAnim = _tfopen(AnimFileName,_T("wb")); if( !fAnim ) { ProgressMsg.printf(GetString(IDS_ERR_FANIM),AnimFileName); throw MAXException(ProgressMsg.data()); } // data headers hData.NumPolys = Tris.Count(); hData.NumVertices = VertsPerFrame; // anim headers hAnim.FrameSize = VertsPerFrame * sizeof(FMeshVert); hAnim.NumFrames = FrameCount; // Progress CheckCancel(); pInt->ProgressUpdate(Progress, FALSE, GetString(IDS_INFO_WMESH)); // Write data fwrite(&hData,sizeof(FJSDataHeader),1,fMesh); if( Tris.Count() > 0 ) { fwrite(Tris.Addr(0),sizeof(FJSMeshTri),Tris.Count(),fMesh); } Progress += U3D_PROGRESS_WMESH; // Progress CheckCancel(); pInt->ProgressUpdate(Progress, FALSE, GetString(IDS_INFO_WANIM)); // Write anim fwrite(&hAnim,sizeof(FJSAnivHeader),1,fAnim); if( Verts.Count() > 0 ) { fwrite(Verts.Addr(0),sizeof(FMeshVert),Verts.Count(),fAnim); } Progress += U3D_PROGRESS_WANIM; }
void WeightTableWindow::PaintCellNameVertically(HDC hdc, int x, int y, int height, BOOL sel, TSTR name) { HBRUSH textBackground; DWORD textColor; DWORD textBKColor; if (sel) { textBackground = GetSysColorBrush(COLOR_HIGHLIGHT); textColor = GetSysColor(COLOR_HIGHLIGHTTEXT) ; textBKColor = GetSysColor(COLOR_HIGHLIGHT) ; SelectObject(hdc, hFixedFontBold); } else { textBackground = ColorMan()->GetBrush(kWindow ); textColor = ColorMan()->GetColor(kWindowText ) ; textBKColor = ColorMan()->GetColor(kWindow ) ; SelectObject(hdc, hFixedFont); } SetTextColor(hdc, textColor); SelectObject(hdc, textBackground); SetBkColor(hdc, textBKColor); SelectObject(hdc,pBackPen); Rectangle(hdc, x, y,x+textHeight+1,y+height+1); int th = textHeight -4; if ((th * name.Length()) <= height) { y = height - textHeight+1; for (int i= (name.Length()-1); i >= 0 ; i--) { const TCHAR *t = &name.data()[i]; int offset = textHeight/4; TextOut(hdc, x+offset,y,t,1); y -= th; } } else { y = 1; for (int i= 0 ; i < name.Length() ; i++) { const TCHAR *t = &name.data()[i]; int offset = textHeight/4; TextOut(hdc, x+offset,y,t,1); y += th; } } }
int MarketDefaultTest::Tester::testFilePresent(const TCHAR* file) { mStatus.message(kInfoMessage, _T("Starting testFilePresent %s\r\n"), file); // Now try again with a file that should exist TSTR path = getFactoryDefaultFilePath(file); DeleteFile(path); TSTR expected = getDefaultFilePath(file); DeleteFile(expected); if (!createFile(expected, &file1)) return 1; char* valueSrc; long lengthSrc; int foundSrc = getFileContents(expected, valueSrc, lengthSrc); int errors = 0; // Now copy it to the defaults directory TSTR newPath = GetMarketDefaultsFileName(file); if (newPath != expected) { mStatus.message(kErrorMessage, _T("%s was copied to the wrong file\r\n") _T(" Expected: %s\r\n") _T(" Got: %s\r\n"), path.data(), expected.data(), newPath.data()); ++errors; } char* valueDst; long lengthDst; int foundDst = getFileContents(expected, valueDst, lengthDst); if (!filesAreEqual(foundSrc, valueSrc, lengthSrc, foundDst, valueDst, lengthDst)) { mStatus.message(kErrorMessage, _T("%s was changed by copy\r\n"), expected.data()); ++errors; } // Clean up delete[] valueSrc; delete[] valueDst; DeleteFile(path); DeleteFile(expected); DeleteFile(newPath); mStatus.message(kInfoMessage, _T("Finished testFilePresent %s - %d error(s)\r\n\r\n"), file, errors); return errors; }
void Unreal3DExport::ShowSummary() { // Progress pInt->ProgressUpdate(Progress); // Display Summary if( bShowPrompts ) { ProgressMsg.printf(GetString(IDS_INFO_SUMMARY) , hAnim.NumFrames , hData.NumPolys , hData.NumVertices); if( bMaxResolution ) { TSTR buf; buf.printf(GetString(IDS_INFO_DIDPRECISION) , FileName); ProgressMsg += buf; } MaxMsgBox(pInt->GetMAXHWnd(),ProgressMsg.data(),ShortDesc(),MB_OK|MB_ICONINFORMATION); } }
void plMultipassMtlDlg::UpdateLayerDisplay() { int numlayers = fPBlock->GetInt(kMultCount); fNumTexSpin->SetValue(numlayers, FALSE); int i; for (i = 0; i < numlayers && i < NSUBMTLS; i++) { Mtl *m = fPBlock->GetMtl(kMultPasses, curTime, i); TSTR nm; if (m) nm = m->GetName(); else nm = "None"; fLayerBtns[i]->SetText(nm.data()); ShowWindow(GetDlgItem(fhRollup, kLayerID[i].layerID), SW_SHOW); ShowWindow(GetDlgItem(fhRollup, kLayerID[i].activeID), SW_SHOW); SetCheckBox(fhRollup, kLayerID[i].activeID, fPBlock->GetInt(kMultOn, curTime, i)); } for (i = numlayers; i < NSUBMTLS; i++) { ShowWindow(GetDlgItem(fhRollup, kLayerID[i].layerID), SW_HIDE); ShowWindow(GetDlgItem(fhRollup, kLayerID[i].activeID), SW_HIDE); } }
static void FillBoneController(Exporter* exporter, NiBSBoneLODControllerRef boneCtrl, INode *node) { for (int i=0; i<node->NumberOfChildren(); i++) { INode * child = node->GetChildNode(i); FillBoneController(exporter, boneCtrl, child); TSTR upb; child->GetUserPropBuffer(upb); if (!upb.isNull()) { // Check for bonelod and add bones to bone controller stringlist tokens = TokenizeString(upb.data(), "\r\n", true); for (stringlist::iterator itr = tokens.begin(); itr != tokens.end(); ++itr) { string& line = (*itr); if (wildmatch("*#", line)) { // ends with # stringlist bonelod = TokenizeString(line.c_str(), "#", true); for (stringlist::iterator token = bonelod.begin(); token != bonelod.end(); ++token) { if ( wildmatch("??BoneLOD", (*token).c_str())) { if (++token == bonelod.end()) break; if (strmatch("Bone", (*token).c_str())) { if (++token == bonelod.end()) break; int group = 0; std::stringstream str (*token); str >> group; boneCtrl->AddNodeToGroup(group, exporter->getNode(child)); } } } } } }
bool Exporter::exportUPB(NiNodeRef &root, INode *node) { bool ok = false; if (!mUserPropBuffer) return ok; // Write the actual UPB sans any np_ prefixed strings TSTR upb; node->GetUserPropBuffer(upb); if (!upb.isNull()) { tstring line; tistringstream istr(upb.data(), ios_base::out); tostringstream ostr; while (!istr.eof()) { std::getline(istr, line); if (!line.empty() && 0 != line.compare(0, 3, TEXT("np_"))) ostr << line << endl; } if (!ostr.str().empty()) { NiStringExtraDataRef strings = CreateNiObject<NiStringExtraData>(); strings->SetName("UPB"); strings->SetData(T2AString(ostr.str()).c_str()); root->AddExtraData(DynamicCast<NiExtraData>(strings)); ok = true; } } return ok; }
void XsiExp::ExportNodeHeader( INode * node, TCHAR * type, int indentLevel) { TSTR indent = GetIndent(indentLevel); // node header: object type and name fprintf(pStream,"%s%s frm-%s {\n\n", indent.data(), type, FixupName(node->GetName())); }
void DxStdMtl2::PatchInLightNodes() { for(int i = 0; i< sceneLights.Count(); i++) { int curLightIndex = -1; for(int j=0; j<elementContainer.NumberofElementsByType(EffectElements::kEleLight);j++) { LightElement * le = static_cast<LightElement*>(elementContainer.GetElementByType(j, EffectElements::kEleLight)); TSTR paramName = le->GetParameterName(); int actualLength = paramName.first('_'); for(int k=0; k<actualLength;k++) { if(isdigit(paramName[k])) { TSTR numChar = paramName.Substr(k,actualLength-k); int index = atoi(numChar.data()); if(index == i) { le->AddLight(sceneLights[i]->GetLightNode()); break; } } } } } }
void SpotLightFalloffManipulator::UpdateShapes(TimeValue t, TSTR& toolTip) { GenLight* pLight = (GenLight*) mhTarget; Matrix3 tm; tm = mpINode->GetObjectTM(t); Point3 pt; float dist; BOOL b = GetTargetPoint(t, pt); if (!b) { dist = pLight->GetTDist(t); } else { float den = FLength(tm.GetRow(2)); dist = (den!=0) ? FLength(tm.GetTrans()-pt) / den : 0.0f; } TSTR nodeName; nodeName = mpINode->GetName(); toolTip.printf("%s [Falloff: %5.2f]", nodeName.data(), (double) pLight->GetFallsize(t)); SetGizmoScale(dist / kRingScaleFactor); ConeAngleManipulator::SetValues(Point3(0,0,0), Point3(0,0,-1), dist, DegToRad(pLight->GetFallsize(t)), pLight->GetSpotShape() == RECT_LIGHT, pLight->GetAspect(t)); }
ActionTable* UnwrapClassDesc::GetActions() { TSTR name = GetString(IDS_RB_UNWRAPMOD); ActionTable* pTab; pTab = new ActionTable(kUnwrapActions, kUnwrapContext, name); int numOps = NumElements(spActions)/3; UnwrapAction *wtActions = NULL; int ct = 0; for (int i =0; i < numOps; i++) { wtActions = new UnwrapAction(); int id, ids1, ids2; id = spActions[ct++]; ids1 = spActions[ct++]; ids2 = spActions[ct++]; wtActions->Init(id,GetString(ids1),GetString(ids2), GetString(IDS_RB_UNWRAPMOD), GetString(IDS_RB_UNWRAPMOD) ); pTab->AppendOperation(wtActions); } GetCOREInterface()->GetActionManager()->RegisterActionContext(kUnwrapContext, name.data()); return pTab; }
int RefCheckDepEnumProc::proc(ReferenceMaker *rmaker) { if (rmaker != rtarg) { TSTR buf; FormatObjectDisplay(*count, rmaker, showaddress, buf); SendMessage(hWnd, LB_ADDSTRING, 0, (LPARAM)(LPCTSTR)buf.data()); *count += 1; } return DEP_ENUM_CONTINUE; }
const MCHAR* HLSLShaderMaterialClassDesc::GetEntryCategory() const { static TSTR s_categoryInfo; if( s_categoryInfo.length()==0 ) { s_categoryInfo = GetString( IDS_CATEGORY_MPOOL_PREFIX ); s_categoryInfo += _T("\\"); s_categoryInfo += GetString( IDS_CATEGORY_MPOOL ); } return s_categoryInfo.data(); }
void CityList::initializeList() { mNumCities = 0; delete[] mpCityList; mpCityList = NULL; delete[] mpCityNames; mpCityNames = NULL; mCityNameSize = 0; Interface* ip = GetCOREInterface(); TSTR cityFile = ip->GetDir(APP_PLUGCFG_DIR); cityFile += "\\sitename.txt"; // Open the city file. FILE* fp = fopen(cityFile.data(), "r"); if (fp == NULL) return; // No file, return with no cities // First count the cities in the file. UINT count = 0; UINT nameSize = 0; { Entry temp; while (!feof(fp)) { UINT namePos = 0; if (parseLine(fp, temp, namePos)) { ++count; nameSize += namePos; } } } if (count <= 0) return; // No Cities mpCityList = new Entry[count]; mCityNameSize = nameSize; mpCityNames = static_cast<TCHAR*>(realloc(mpCityNames, mCityNameSize * sizeof(TCHAR))); UINT namePos = 0; fseek(fp, 0L, SEEK_SET); for (UINT i = 0; i < count && !feof(fp); ) { i += parseLine(fp, mpCityList[i], namePos); } fclose(fp); count = i; for (i = 0; i < count; ++i) mpCityList[i].name = mpCityNames + mpCityList[i].nameOff; if (count > 0) { qsort(mpCityList, count, sizeof(mpCityList[0]), byname); mNumCities = count; } }
void XsiExp::ExportNodeTM( INode * node, int indentLevel) { // dump the full matrix Matrix3 matrix = node->GetNodeTM(GetStaticFrame()); TSTR indent = GetIndent(indentLevel); fprintf(pStream,"%s\t%s {\n\n", indent.data(), "FrameTransformMatrix"); Object * obj = node->EvalWorldState(0).obj; BOOL isBone = obj && obj->ClassID() == Class_ID(BONE_CLASS_ID, 0) ? TRUE : FALSE; if (node->GetParentNode() && node->GetParentNode()->IsRootNode()) { // bone chains get grafted into the hierarchy tree // if (!isBone) { // root mesh oTopMatrix = matrix; AffineParts ap; decomp_affine( matrix, &ap); topMatrix.Set( Point3( ap.k.x,0.0f,0.0f), Point3( 0.0f,ap.k.z,0.0f), Point3(0.0f,0.0f,ap.k.y), Point3(0,0,0)); // root transform is controlled by the engine matrix.IdentityMatrix(); } } else { matrix = matrix * Inverse(node->GetParentTM(GetStaticFrame())); if (!isBone) { matrix.SetRow( 3, topMatrix * matrix.GetRow(3)); } } // write the matrix values DumpMatrix3( &matrix, indentLevel+2); // transform close brace fprintf(pStream,"%s\t}\n", indent.data()); }
void XsiExp::DumpMatrix3( Matrix3 * m, int indentLevel) { Point3 row; TSTR indent = GetIndent(indentLevel); // swap y and z; max to soft correction decomp_affine( *m, &affine); // translate float temp = affine.t.z; affine.t.z = -affine.t.y; affine.t.y = temp; // rotate AngAxis aa( affine.q); temp = aa.axis.z; aa.axis.z = -aa.axis.y; aa.axis.y = temp; affine.q.Set(aa); // scale aa.Set( affine.u); temp = aa.axis.z; aa.axis.z = -aa.axis.y; aa.axis.y = temp; affine.u.Set( aa); temp = affine.k.z; affine.k.z = affine.k.y; affine.k.y = temp; Matrix3 matrix(1); matrix.PreTranslate(affine.t); PreRotateMatrix(matrix, affine.q); row = matrix.GetRow(0); fprintf(pStream,"%s %.6f,%.6f,%.6f,0.000000,\n", indent.data(), row.x, row.y, row.z); row = matrix.GetRow(1); fprintf(pStream,"%s %.6f,%.6f,%.6f,0.000000,\n", indent.data(), row.x, row.y, row.z); row = matrix.GetRow(2); fprintf(pStream,"%s %.6f,%.6f,%.6f,0.000000,\n", indent.data(), row.x, row.y, row.z); row = matrix.GetRow(3); fprintf(pStream,"%s %.6f,%.6f,%.6f,1.000000;;\n", indent.data(), row.x, row.y, row.z); }
void AsciiExp::DumpRotSample(INode* node, int indentLevel) { TSTR indent = GetIndent(indentLevel); _ftprintf(pStream, _T("%s\t\t%s {\n"), indent.data(), ID_ROT_TRACK); TimeValue start = ip->GetAnimRange().Start(); TimeValue end = ip->GetAnimRange().End(); TimeValue t; int delta = GetTicksPerFrame() * GetKeyFrameStep(); Matrix3 tm; AffineParts ap; Quat prevQ; prevQ.Identity(); for (t=start; t<=end; t+=delta) { tm = node->GetNodeTM(t) * Inverse(node->GetParentTM(t)); decomp_affine(tm, &ap); // Rotation keys should be relative, so we need to convert these // absolute samples to relative values. Quat q = ap.q / prevQ; prevQ = ap.q; if (q.IsIdentity()) { // No point in exporting null keys... continue; } // Output the sample _ftprintf(pStream, _T("%s\t\t\t%s %d\t%s\n"), indent.data(), ID_ROT_SAMPLE, t, Format(q)); } _ftprintf(pStream, _T("%s\t\t}\n"), indent.data()); }
BOOL XsiExp::nodeEnumBone( INode * node, int indentLevel) { if(exportSelected && node->Selected() == FALSE) { return TREE_CONTINUE; } nCurNode++; ip->ProgressUpdate( (int)((float)nCurNode/nTotalNodeCount*100.0f) ); // Stop recursing if the user pressed Cancel if (ip->GetCancel()) { return FALSE; } // Only export if exporting everything or it's selected if(!exportSelected || node->Selected()) { // 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 HELPER_CLASS_ID: ExportBoneObject(node, indentLevel); break; default: return FALSE; } } } // 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 (!nodeEnumBone(node->GetChildNode(c), indentLevel+1)) { return FALSE; } } TSTR indent = GetIndent(indentLevel); fprintf(pStream,"%s}\n\n", indent.data()); return TRUE; }
bool HLSLShaderMaterial::UpdateHLSLMaterial(const TimeValue t, MaxSDK::Graphics::GraphicFeatureLevel featureLevel) { HLSLMaterialHandle handle = GetHLSLMaterialHandle(featureLevel); handle.SetFloat4Parameter(_M("k_d"), Point4(0, 1, 0, 1)); handle.SetBoolParameter(_M("g_TopDiffuseEnable"), TRUE); TSTR pRootDir = GetCOREInterface()->GetDir(APP_MAX_SYS_ROOT_DIR); TSTR texturePath = pRootDir + TSTR(_T("maps\\mental_mill\\default.dds")); m_diffuseTexture.Initialize(texturePath.data()); handle.SetTextureParameter(_M("g_TopTexture"), m_diffuseTexture); return true; }
int MarketDefaultTest::Tester::testFileCopy(const TCHAR* file) { mStatus.message(kInfoMessage, _T("Starting testFileCopy %s\r\n"), file); // First create a file in the factory defaults TSTR path = getFactoryDefaultFilePath(file); if (!createFile(path, &file1)) return 1; TSTR expected = getDefaultFilePath(file); DeleteFile(expected); int errors = 0; // Now copy it to the defaults directory TSTR newPath = GetMarketDefaultsFileName(file); if (newPath != expected) { mStatus.message(kErrorMessage, _T("%s was copied to the wrong file\r\n") _T(" Expected: %s\r\n") _T(" Got: %s\r\n"), path.data(), expected.data(), newPath.data()); ++errors; } if (!filesAreEqual(path, newPath)) { mStatus.message(kErrorMessage, _T("%s was copied incorrectly\r\n"), newPath.data()); ++errors; } // Clean up DeleteFile(path); DeleteFile(expected); DeleteFile(newPath); mStatus.message(kInfoMessage, _T("Finished testFileCopy %s - %d error(s)\r\n\r\n"), file, errors); return errors; }
void Unreal3DExport::GetAnim() { // Export vertex animation int lastvert = 0; FMeshVert nullvert = FMeshVert(); Points.SetCount(VertsPerFrame*FrameCount,TRUE); for( int t=0; t<FrameCount; ++t ) { // Progress CheckCancel(); ProgressMsg.printf(GetString(IDS_INFO_ANIM),t+1,FrameCount); pInt->ProgressUpdate(Progress+((float)t/FrameCount*U3D_PROGRESS_ANIM), FALSE, ProgressMsg.data()); // Set frame int frameverts = 0; int curframe = FrameStart + t; pScene->SetStaticFrame(curframe); // Write mesh verts for( int n=0; n<Nodes.Count(); ++n ) { CheckCancel(); IGameMesh * mesh = (IGameMesh*)Nodes[n]->GetIGameObject(); if( mesh->InitializeData() ) { int vertcount = mesh->GetNumberOfVerts(); for( int i=0; i<vertcount; ++i ) { Point3 p; if( mesh->GetVertex(i,p) ) { Points[lastvert++] = p; } } frameverts += vertcount; } Nodes[n]->ReleaseIGameObject(); } // Check number of verts in this frame if( frameverts != VertsPerFrame ) { ProgressMsg.printf(GetString(IDS_ERR_NOVERTS),curframe,frameverts,VertsPerFrame); throw MAXException(ProgressMsg.data()); } } Progress += U3D_PROGRESS_ANIM; }
void AsciiExp::DumpPosSample(INode* node, int indentLevel) { TSTR indent = GetIndent(indentLevel); _ftprintf(pStream, _T("%s\t\t%s {\n"), indent.data(), ID_POS_TRACK); TimeValue start = ip->GetAnimRange().Start(); TimeValue end = ip->GetAnimRange().End(); TimeValue t; int delta = GetTicksPerFrame() * GetKeyFrameStep(); Matrix3 tm; AffineParts ap; Point3 prevPos; for (t=start; t<=end; t+=delta) { tm = node->GetNodeTM(t) * Inverse(node->GetParentTM(t)); decomp_affine(tm, &ap); Point3 pos = ap.t; if (t!= start && EqualPoint3(pos, prevPos)) { // Skip identical keys continue; } prevPos = pos; // Output the sample _ftprintf(pStream, _T("%s\t\t\t%s %d\t%s\n"), indent.data(), ID_POS_SAMPLE, t, Format(pos)); } _ftprintf(pStream, _T("%s\t\t}\n"), indent.data()); }
// ============================================================================ TOOLINFO* AngleControl::GetToolInfo() { static TOOLINFO ti; static TSTR str; str.printf(_T("%f%s"), m_degrees, MaxSDK::GetResourceStringAsMSTR(IDS_DEGREE_SYMBOL)); memset(&ti, 0, sizeof(TOOLINFO)); ti.cbSize = sizeof(TOOLINFO); ti.hwnd = m_hWnd; ti.uId = TOOLTIP_ID; ti.lpszText = const_cast<TCHAR*>(str.data()); GetClientRect(m_hWnd, &ti.rect); return &ti; }
static void SaveAsColorFile(HWND hWnd) { TSTR *fileName = DLGetWindowLongPtr<TSTR*>(hWnd); if (fileName) _tcscpy(fname,fileName->data()); // RB 10/15/2000: Init directory string if (fdir[0]==_T('\0')) { _tcscpy(fdir, GetCOREInterface()->GetDir(APP_IMAGE_DIR)); } OPENFILENAME ofn; memset(&ofn,0,sizeof(ofn)); FilterList fl; fl.Append(GetString(IDS_RB_COLORCLIPFILES)); fl.Append(_T("*.ccb")); TSTR title = GetString(IDS_RB_SAVECOLOR); ofn.lStructSize = sizeof(OPENFILENAME); // No OFN_ENABLEHOOK ofn.hwndOwner = hWnd; ofn.lpstrFilter = fl; ofn.lpstrFile = fname; ofn.nMaxFile = 256; ofn.lpstrInitialDir = fdir; ofn.Flags = OFN_HIDEREADONLY|OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST; ofn.FlagsEx = OFN_EX_NOPLACESBAR; ofn.lpstrDefExt = _T("ccb"); ofn.lpstrTitle = title; tryAgain: if (GetSaveFileName(&ofn)) { if (DoesFileExist(fname)) { TSTR buf1; TSTR buf2 = GetString(IDS_RB_SAVECOLOR); buf1.printf(GetString(IDS_RB_FILEEXISTS),fname); if (IDYES!=MessageBox( hWnd, buf1,buf2,MB_YESNO|MB_ICONQUESTION)) { goto tryAgain; } } if (!fileName) fileName = new TSTR; *fileName = fname; DLSetWindowLongPtr(hWnd, fileName); SaveColorFile(hWnd,*fileName); } }
void Unreal3DExport::Init() { // Init CheckCancel(); pScene = GetIGameInterface(); GetConversionManager()->SetUserCoordSystem(UnrealCoords); if( bExportSelected ) { Tab<INode*> selnodes;; for( int i=0; i<pInt->GetSelNodeCount(); ++i ) { INode* n = pInt->GetSelNode(i); selnodes.Append(1,&n); } if( !pScene->InitialiseIGame(selnodes,false) ) throw MAXException(GetString(IDS_ERR_IGAME)); } else { if( !pScene->InitialiseIGame() ) throw MAXException(GetString(IDS_ERR_IGAME)); } // Enumerate scene NodeCount = pScene->GetTotalNodeCount(); for( int i=0; i<pScene->GetTopLevelNodeCount(); ++i ) { IGameNode * n = pScene->GetTopLevelNode(i); ExportNode(n); } Progress += U3D_PROGRESS_ENUM; // Get animation info FrameStart = pScene->GetSceneStartTime() / pScene->GetSceneTicks(); FrameEnd = pScene->GetSceneEndTime() / pScene->GetSceneTicks(); FrameCount = FrameEnd - FrameStart+1; if( FrameCount <= 0 || FrameEnd < FrameStart ) { ProgressMsg.printf(GetString(IDS_ERR_FRAMERANGE),FrameStart,FrameEnd); throw MAXException(ProgressMsg.data()); } pScene->SetStaticFrame(FrameStart); }
void CompositeDlg::UpdateSubTexNames() { for (int i=theTex->offset; i<theTex->subTex.Count(); i++) { if (i-theTex->offset>=NDLG) break; Texmap *m = theTex->subTex[i]; TSTR nm; if (m) nm = m->GetFullName(); else nm = GetString(IDS_DS_NONE); TSTR buf; buf.printf(_T("%s %d:"),GetString(IDS_RB_MAP2),i+1); iBut[i-theTex->offset]->SetText(nm.data()); SetDlgItemText(hPanel, labelIDs[i-theTex->offset], buf); // SetCheckBox(hPanel, mapOnIDs[i-theTex->offset], theTex->mapOn[i]); int on; Interval iv; theTex->pblock->GetValue(comptex_ons,0,on,iv,i); SetCheckBox(hPanel, mapOnIDs[i-theTex->offset], on); } }
void AppDataTest::GetAppData() { Animatable *anim = PickAnim(); if (!anim) return; // XRef stuff 020416 --prs. if (s_through_xref) { RefTargetHandle rth = (RefTargetHandle)anim; IXRefItem* xi = NULL; while (rth != NULL && (xi = IXRefItem::GetInterface(*rth)) != NULL) rth = xi->GetSrcItem(); if (rth != NULL) anim = rth; } // Grab the app data chunk from the anim AppDataChunk *ad = anim->GetAppDataChunk( APPDATA_TEST_CLASS_ID, UTILITY_CLASS_ID, spin->GetIVal()); if (ad && ad->data) { // Fill the edit field with the text. TSTR data; const char* raw_string = (const char*)ad->data; if (strncmp(raw_string, "\xef\xbb\xbf", 3) == 0) data = TSTR::FromUTF8(raw_string+3); else { DbgAssert(!_T("Should always convert appdata in UpdateAppDataLoadProc")); Interface14 *iface = GetCOREInterface14(); LANGID langID = iface->LanguageToUseForFileIO(); UINT codePage = iface->CodePageForLanguage(langID); data = TSTR::FromCP(codePage, raw_string); } SetDlgItemText(hPanel,IDC_APPDATA_EDIT,data.data()); } else { // Not found! MessageBox(hPanel,_T("No app data found"),_T("App Data Tester"),MB_OK); } }
int TrueTypeImport::OpenFont(TSTR name, DWORD flags, DllData *dllData) { // build a TrueType font. static LOGFONT lf; // GetObject(GetStockObject(SYSTEM_FONT), sizeof(lf), &lf); lf.lfHeight = 1000; lf.lfWidth = 0; lf.lfEscapement = 0; lf.lfOrientation = 0; lf.lfWeight = 0; lf.lfItalic = FALSE; lf.lfUnderline = FALSE; lf.lfStrikeOut = FALSE; lf.lfCharSet = DEFAULT_CHARSET; // lf.lfCharSet = SHIFTJIS_CHARSET; lf.lfOutPrecision = OUT_DEFAULT_PRECIS; lf.lfClipPrecision = CLIP_DEFAULT_PRECIS; lf.lfQuality = DEFAULT_QUALITY; lf.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE; _tcsncpy((TCHAR *)&lf.lfFaceName, name.data(), LF_FACESIZE); hFont = CreateFontIndirect(&lf); return(hFont ? 1 : 0); }
void XsiExp::ExportMaterial( INode * node, int indentLevel) { Mtl * mtl = node->GetMtl(); TSTR indent = GetIndent(indentLevel+1); // If the node does not have a material, export the wireframe color if (mtl) { int mtlID = mtlList.GetMtlID(mtl); if (mtlID >= 0) { DumpMaterial( mtl, mtlID, 0, indentLevel); } } else { DWORD c = node->GetWireColor(); fprintf(pStream,"%sSI_Material {\n", indent.data()); fprintf(pStream,"%s\t%.6f;%.6f;%.6f;%.6f;;\n", indent.data(), GetRValue(c)/255.0f, GetGValue(c)/255.0f, GetBValue(c)/255.0f, 1.0f); // diffuse fprintf(pStream,"%s\t%.6f;\n", indent.data(), 0.0f ); // specular power fprintf(pStream,"%s\t%.6f;%.6f;%.6f;;\n", indent.data(), 0.0f, 0.0f, 0.0f); // specular fprintf(pStream,"%s\t%.6f;%.6f;%.6f;;\n", indent.data(), 0.0f, 0.0f, 0.0f); // emissive fprintf(pStream,"%s\t%.6f;\n", indent.data(), 0.0f ); // ? fprintf(pStream,"%s\t%.6f;%.6f;%.6f;;\n", // ambient indent.data(), 0.0f, 0.0f, 0.0f); fprintf(pStream,"%s}\n", indent.data()); } }