Example #1
0
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);
    }
}
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);
    }
}
Example #3
0
void ObjNameList::MakeUnique(TSTR &n)
{
    // First make it less than 10 chars.
    if( n.Length() > 10 )
        n.Resize(10);

    if( Contains(n) < 0 )
    {
        Append(n);
        return;
    }
    // Make it unique and keep it 10 chars or less
    for(int i = 0; i < 100000; ++i)
    {
        char buf[12];
        sprintf(buf,"%d",i);
        TSTR num(buf);
        TSTR work = n;
        int totlen = num.Length() + work.Length();
        if(totlen > 10)
            work.Resize(10 - (totlen - 10));
        work = work + num;
        if(Contains(work) < 0)
        {
            Append(work);
            n = work;
            return;
        }
    }
    // Forget it!
}
Example #4
0
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));
                     }
                  }
               }
            }
         }
      }
Example #5
0
BOOL TriObject::CheckObjectIntegrity()
	{
	for (int i=0; i<mesh.getNumFaces(); i++) {		
		for (int j=0; j<3; j++) {
			if (mesh.faces[i].v[j] >= (DWORD)mesh.getNumVerts()) {
				TSTR buf;
				buf.printf(GetResString(IDS_DB_TRIOBJ_DESC),
					i,j,mesh.faces[i].v[j],mesh.getNumVerts(), mesh.faces, mesh.getNumFaces());
				MessageBox(NULL,buf,GetResString(IDS_DB_INVALID_FACE),MB_ICONEXCLAMATION|MB_TASKMODAL|MB_OK);
				return FALSE;
				}
			}
		}
	
	if (mesh.tvFace) {
		for (int i=0; i<mesh.getNumFaces(); i++) {		
			for (int j=0; j<3; j++) {
				if (mesh.tvFace[i].t[j] >= (DWORD)mesh.numTVerts) {
					TSTR buf;
					buf.printf(GetResString(IDS_DB_TV_DESC), i,j,mesh.tvFace[i].t[j],mesh.numTVerts);
					MessageBox(NULL,buf,GetResString(IDS_DB_INVALID_TV_FACE),MB_ICONEXCLAMATION|MB_TASKMODAL|MB_OK);
					return FALSE;
					}
				}
			}
		}

	return TRUE;
	}
Example #6
0
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));
}
Example #7
0
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;
					}

				}
			}
		}
	}
}
Example #8
0
TSTR CompositeMatPBAccessor::GetLocalName(ReferenceMaker* owner, ParamID id, int tabIndex)
{
	CompositeMat* p = (CompositeMat*)owner;
	TSTR out;
	switch (id)
		{
		case compmat_amount:
			{
			out.printf(_T("%s %d"),GetString(IDS_PW_AMOUNT),tabIndex+1);
			break;
			}
		case compmat_mtls:
			{
			TSTR name;
			Mtl *sm1 = NULL;
			Interval iv;
			if ((p) && (p->pblock2)) p->pblock2->GetValue(compmat_mtls,0,sm1,iv,tabIndex);
			name = sm1->GetFullName();

			if (tabIndex == 0)
				{
				out.printf(_T("%s: %s"),GetString(IDS_PW_BASE),name);
				}
			else
				{
				out.printf(_T("%s %d: %s"),GetString(IDS_RB_MATERIAL2),tabIndex,name);
				}
			break;
			}
		}
	return out;

}
Example #9
0
TSTR CompositeMat::GetSubMtlSlotName(int i) {
	TSTR name;
	if (i== 0)
		name.printf(_T("%s"),GetString(IDS_PW_BASE));
	else name.printf(_T("%s %d"),GetString(IDS_PW_MAT),i);
	return name;
	}
Example #10
0
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()));
}
Example #11
0
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())
   {
      string line;
      istringstream istr(string(upb), ios_base::out);
      ostringstream ostr;
      while (!istr.eof()) {
         std::getline(istr, line);
         if (!line.empty() && 0 != line.compare(0, 3, "np_"))
            ostr << line << endl;
      }
      if (!ostr.str().empty())
      {
         NiStringExtraDataRef strings = CreateNiObject<NiStringExtraData>();	
         strings->SetName("UPB");
         strings->SetData(ostr.str());
         root->AddExtraData(DynamicCast<NiExtraData>(strings));
         ok = true;
      }
   }
   return ok;
}
Example #12
0
BOOL UnwrapMod::AddDefaultActionToBar(ICustToolbar *toolBar, int id)
{

	int numOps = NumElements(spActions)/3;
	UnwrapAction *wtActions = NULL;
	int ct = 0;
	for (int i =0; i < numOps; i++)
	{
		int testid, ids1, ids2;
		testid = spActions[ct++];
		ids1 = spActions[ct++];
		ids2 = spActions[ct++];
		if (testid == id)
		{
			TSTR name;
			name.printf(_T("%s"),GetString(ids2));
			int l = name.Length();
			toolBar->AddTool(ToolButtonItem(CTB_PUSHBUTTON,0, 0, 0, 0, 16, 15, l*8, 22, id));
			ICustButton *but  = toolBar->GetICustButton(id);
			but->SetHighlightColor(GREEN_WASH);
			but->SetTooltip(TRUE,GetString(ids1));
			but->SetImage(NULL,0,0,0,0,0,0);
			but->SetText(GetString(ids2));

			ReleaseICustButton(but);				
			i = numOps;
			return TRUE;
		}
	}

	return FALSE;
}
Example #13
0
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;
}
Example #14
0
void bgExporterMax::ExpScene()
{
	struct tm *newtime;
	time_t aclock;

	time(&aclock);
	newtime = localtime(&aclock);

	TSTR today = _tasctime(newtime);
	today.remove(today.length() - 1);

	_ftprintf(m_pStream, _T("%s\t%s\n"),
		_T("#BG3D_MODEL"),
		FixupName(today));		// 날짜

	_ftprintf(m_pStream, _T("%s\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\n"),
		_T("#SCENE_INFO"),
		m_Scene.iVersion,		// 버전
		m_Scene.iFirstFrame,	// 시작 프레임
		m_Scene.iLastFrame,		// 마지막 프레임
		m_Scene.iFrameSpeed,	// 프레임 스피드
		m_Scene.iTickPerFrame,	// 프레임당 틱
		m_Scene.iNumMesh,		// 메시 갯수
		m_Scene.iMaxWeight,		// 가중치
		m_Scene.iBindPose);		// 바인드포즈
}
Example #15
0
void BaseExposeControl::PopupErrorMessage()
{
	if(exposeTransform) //should exist if not and this message is popping up then we're scewed.
	{
		INode *expNode = exposeTransform->GetExposeNode();
		INode *node = exposeTransform->GetMyNode();
		if(expNode&&node)
		{
			TSTR msg; msg.printf(GetString(IDS_ILLEGAL_SELF_REFERENCE),expNode->GetName(),node->GetName(),node->GetName()); 
			if (GetCOREInterface()->GetQuietMode()) 
			{
				 GetCOREInterface()->Log()->LogEntry(SYSLOG_WARN,NO_DIALOG,GetString(IDS_ILLEGAL_CYCLE),msg);
			}	
			else
			{
				// beep or no??MessageBeep(MB_ICONEXCLAMATION); 
				MessageBox(GetCOREInterface()->GetMAXHWnd(),msg,GetString(IDS_ILLEGAL_CYCLE), 
				MB_ICONEXCLAMATION | MB_APPLMODAL | MB_OK);
			}

		}
		//suspend the hold
		BOOL resume =FALSE;
		if(theHold.Holding())
		{
			theHold.Suspend();
			resume =TRUE;
		}
		exposeTransform->SetExposeNode(NULL);
		if(resume)
			theHold.Resume();
	}
}
Example #16
0
void WeightTableWindow::PaintNameListLabel()
	{
	HDC hdc;
	PAINTSTRUCT		ps;
 
	BeginPaint(hNameListLabel,&ps);
	EndPaint(hNameListLabel,&ps);

	iNameListLabelBuf->Erase();
	hdc = iNameListLabelBuf->GetDC();
	HFONT hOldFont = (HFONT)SelectObject(hdc, hFixedFont);
	SelectObject(hdc,pTextPen);

	int x = 0;
	int y = 0;
	x = 0;
	y = 0;
	TSTR vertName;
	if (GetFlipFlopUI())
		{
		vertName.printf("%s",GetString(IDS_PW_BONEID));
		PaintCellName(hdc,x,y,buttonWidth,FALSE,TEXT_LEFT_JUSTIFIED,vertName);
		}
	else
		{
		vertName.printf("%s",GetString(IDS_PW_VERTEXID));
		PaintCellName(hdc,x,y,vertNameWidth,FALSE,TEXT_LEFT_JUSTIFIED,vertName);
		}

	SelectObject(hdc,GetStockObject(BLACK_PEN));
	SelectObject(hdc, hOldFont);
	iNameListLabelBuf->Blit();

	}
BOOL CMorphAnimationTimePage::OnInitDialog() 
{
	CPropertyPage::OnInitDialog();
	
	// set step and description text
	m_stepStatic.SetWindowText(m_strStep);
	CString str;
	str.LoadString(m_nDescriptionID);
	m_descriptionStatic.SetWindowText(str);

	// set the time values
	TSTR strValue;

	strValue.printf(_T("%d"), m_startFrame);
	m_startFrameEdit.SetWindowText(strValue);

	strValue.printf(_T("%d"), m_endFrame);
	m_endFrameEdit.SetWindowText(strValue);

	strValue.printf(_T("%d"), m_displacement);
	m_displacementEdit.SetWindowText(strValue);

	strValue.printf(_T("%d"), m_fps);
	m_fpsEdit.SetWindowText(strValue);

	return TRUE;
}
Example #18
0
HTREEITEM plComponentDlg::IAddComponent(HWND hTree, plMaxNode *node)
{
    plComponentBase *comp = node->ConvertToComponent();

    // Try and find the component category in the tree
    const char *category = comp->GetCategory();
    HTREEITEM hCat = IFindTreeItem(hTree, category, TVI_ROOT);
    // If it isn't there yet, add it
    if (!hCat)
        hCat = IAddLeaf(hTree, TVI_ROOT, category, 0);

    // Try and find the component type in the tree
    int idx = plComponentMgr::Inst().FindClassID(comp->ClassID());
    HTREEITEM hType = ISearchTree(hTree, idx+1, hCat);
    if (!hType)
    {
        // If it isn't there yet, add it
        TSTR type;
        comp->GetClassName(type);

        if (IIsHidden(comp->ClassID()))
            type.Append(" (Hidden)");

        hType = IAddLeaf(hTree, hCat, type, idx+1);
    }

    // Add the name of this component to this type
    return IAddLeaf(hTree, hType, node->GetName(), (LPARAM)node);
}
bool BakeRadiosity::CreateNewMesh (INode *orgNode, 
                                    Mesh *orgMesh, 
                                    Matrix3 orgMtx)
{
   if((orgNode == NULL)||(orgMesh == NULL)){
	   DebugPrint(_T("Mesh error\n"));
      return false;
   }
   // Creates an instance of a registered class.
   Object *newObj = (Object*)(ip->CreateInstance(
                                       GEOMOBJECT_CLASS_ID,
                                       Class_ID(TRIOBJ_CLASS_ID, 0)));
   if(newObj == NULL){
	   DebugPrint(_T("CreateInstance error\n"));
      return false;
   }
   // Creates a new node in the scene with the given object. 
   INode *newNode = ip->CreateObjectNode(newObj);
   if(newNode == NULL){
	   DebugPrint(_T("CreateObjectNode error\n"));
      return false;
   }
   // Sets the name of the node. 
   if(keepOrgFlag != true){
      newNode->SetName(orgNode->GetName());
   } else {
      TSTR newName;
      newName.printf(_T("%s_BAKED"), orgNode->GetName());
      newNode->SetName(newName);
   }
   // Sets the renderer material used by the node.
   newNode->SetMtl(orgNode->GetMtl());
   // Returns a reference to the mesh data member of new TriObject.
   TriObject *newTriObj = (TriObject *)newObj;
   Mesh &newMesh = newTriObj->GetMesh();
   // Returns the number of vertices from original mesh. 
   int nbVert = orgMesh->getNumVerts();
   // Sets the number of geometric vertices in the new mesh.
   newMesh.setNumVerts(nbVert);
   // The loop will continue until handling all vertices...
   for(int i=0; i<nbVert; i++) { 
      newMesh.verts[i] = orgMtx * orgMesh->verts[i];//Set new vertices
   }
   // Returns the number of faces in the original mesh.
   int nbFace = orgMesh->getNumFaces();
   // Sets the number of faces in the new mesh 
   // and previous faces are discarded.
   newMesh.setNumFaces(nbFace, FALSE);
   // The loop will continue until handling all faces...
   for(int i=0; i<nbFace; i++){ // Set new faces and Material id
      newMesh.faces[i] = orgMesh->faces[i];
      newMesh.faces[i].setMatID(orgMesh->faces[i].getMatID());
   }
   // Makes a complete copy of the specified channels 
   // of the original Mesh object into new Mesh.
   newMesh.DeepCopy(orgMesh, CNVERT_CHANNELS);

   return true;
}
Example #20
0
void ColorClip::Init(HWND hWnd)
   {
   for (int i=0; i<NUM_COLORS; i++) {
      TSTR name;
      name.printf(GetString(IDS_RB_COLORNUM),i);
      cs[i] = GetIColorSwatch(GetDlgItem(hWnd,csIDs[i]),colors[i],name);
      cs[i]->SetUseAlpha(TRUE);
      cs[i]->SetAColor(colors[i]);
      }
   }
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();
}
Example #22
0
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;
}
Example #23
0
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;
	}
}
Example #24
0
Point3*	UnwrapMod::fnGetNormal(int faceIndex)
	{
	//check for type
	ModContextList mcList;		
	INodeTab nodes;
	
	Point3 norm(0.0f,0.0f,0.0f);

	n = norm;
	if (!ip) return &n;
	ip->GetModContexts(mcList,nodes);

	int objects = mcList.Count();

	

	faceIndex--;


	if (objects != 0)
		{
		MeshTopoData *md = (MeshTopoData*)mcList[0]->localData;

		if (md == NULL) 
			{
			return NULL;
			}


		Tab<Point3> objNormList;
		BuildNormals(md,objNormList);
		if ((faceIndex >= 0) && (faceIndex < objNormList.Count()))
			norm = objNormList[faceIndex];
		else
			{
			faceIndex = 0;
			int ct = 1;
			for (int i =0; i < md->faceSel.GetSize(); i++)
				{
				if (md->faceSel[i])
					{
					faceIndex = i;
					norm = objNormList[faceIndex];
					TSTR normstr;
					normstr.printf("norm%d = Point3 %f %f %f",ct,norm.x,norm.y,norm.z);
					ct++;
					macroRecorder->ScriptString(normstr);
					macroRecorder->EmitScript();
					}
				}
			}
		}
	n = norm;
	return &n;
	}
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;
}
Example #26
0
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--)
			{
			TCHAR *t = &name[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++)
			{
			TCHAR *t = &name[i];
			int offset = textHeight/4;
			TextOut(hdc, x+offset,y,t,1);
			y += th;
			}

		}

	}
Example #27
0
void EditFaceDataMod::UpdateDialog () {	
	TSTR buf;
	int numFaces=0, whichFace=0;
	float value = 1.0f;
	bool valueDetermined = true;

	if (!hParams) return;

	ModContextList mcList;
	INodeTab nodes;
	ip->GetModContexts(mcList,nodes);

	if (selLevel) {
		for (int i = 0; i < mcList.Count(); i++) {
			EditFaceDataModData *meshData = (EditFaceDataModData*)mcList[i]->localData;
			if (!meshData) continue;
			int numSelectedHere;
			meshData->DescribeSelection (numSelectedHere, whichFace, value, valueDetermined);
			numFaces += numSelectedHere;
		}
	}

	ISpinnerControl *spin = GetISpinner (GetDlgItem (hParams, IDC_VALUE_SPIN));
	ICustButton *but = GetICustButton (GetDlgItem (hParams, IDC_RESET_SELECTION));

	switch (selLevel) {
	case SEL_FACE:
		if (numFaces==1) {
			buf.printf (GetString(IDS_FACE_SELECTED), whichFace+1);
		} else {
			if (numFaces) buf.printf (GetString (IDS_FACES_SELECTED), numFaces);
			else buf = GetString (IDS_NO_FACE_SELECTED);
		}
		but->Enable (numFaces);
		spin->Enable (numFaces);
		if (numFaces && valueDetermined) {
			spin->SetIndeterminate (false);
			spin->SetValue (value, FALSE);
		} else {
			spin->SetIndeterminate (true);
		}
		break;

	case SEL_OBJECT:
		buf = GetString (IDS_OBJECT_SELECTED);
		spin->Disable();
		but->Disable ();
		break;
	}

	SetDlgItemText(hParams,IDC_FACE_SELECTED,buf);
	ReleaseISpinner (spin);
	ReleaseICustButton (but);
}
Example #28
0
void PatchDeformPW::BeginEditParams( IObjParam *ip, ULONG flags,Animatable *prev )
{
	this->ip = ip;
	PatchDeformPWDesc.BeginEditParams(ip, this, flags, prev);
	patchdeformpw_param_blk.SetUserDlgProc(new PatchDeformParamsMapDlgProc(this));

	TSTR name;
	name.printf(_T("%s"),GetString(IDS_PICK));
	SetWindowText(GetDlgItem(hWnd,IDC_STATUS),name);

}
Example #29
0
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;
}
Example #30
0
bool bgGlobalMax::CheckFile(Interface* p3DMax)
{
	TSTR strCurrentFileName = FixupName(p3DMax->GetCurFileName());
	if (strCurrentFileName.isNull() == false && m_strCurrentFileName == strCurrentFileName)
		return false;

	m_MatrixMap.Release();
	m_pMtlList.clear();

	m_strCurrentFileName = strCurrentFileName;

	return true;
}