示例#1
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;
	}
示例#2
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();

	}
示例#3
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;

}
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;
}
示例#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;
	}
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 ParticleMesherObject::UpdateUI()
{
   Point3 min,max;
   pblock2->GetValue(particlemesher_customboundsa,0,min,FOREVER);
   pblock2->GetValue(particlemesher_customboundsb,0,max,FOREVER);


   Box3 box;
   box.Init();
   box += min;
   box += max;

   
   TSTR text;
   BOOL useBounds;
   pblock2->GetValue(particlemesher_usecustombounds, 0, useBounds, FOREVER);

   if (useBounds)
      {
      if (box.IsEmpty())
         text.printf(_T("%s"),GetString(IDS_EMPTY));
      else 
         {
         text.printf(_T("(%0.0f,%0.0f,%0.0f)"),min.x,min.y,min.z);
         SetWindowText(GetDlgItem(hParams,IDC_BOUNDSTEXT),
            text);
         text.printf(_T("(%0.0f,%0.0f,%0.0f)"),max.x,max.y,max.z);
         SetWindowText(GetDlgItem(hParams,IDC_BOUNDSTEXT2),
            text);
         }

//make sure we only enable the button in the modify panel
// bug 257747 1/30/01 watje
      if (ip)
         {
         ICustButton *iBut = GetICustButton(GetDlgItem(hParams,IDC_PICKBB));
         if (ip->GetCommandPanelTaskMode()==TASK_MODE_MODIFY)
            {
            if (iBut) iBut->Enable(TRUE);
            }
         ReleaseICustButton(iBut);
         }

      }
   else
      {
      text.printf(_T(" "));
      SetWindowText(GetDlgItem(hParams,IDC_BOUNDSTEXT),
         text);
      text.printf(_T(" "));
      SetWindowText(GetDlgItem(hParams,IDC_BOUNDSTEXT2),
         text);
      ICustButton *iBut = GetICustButton(GetDlgItem(hParams,IDC_PICKBB));
      if (iBut) iBut->Enable(FALSE);
      ReleaseICustButton(iBut);

      }
   
}
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;
}
示例#9
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);
}
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;

}
示例#11
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();
	}
}
示例#12
0
void CMethodInfo::GetParamString(TSTR& str)
{
	str = _T("");
	int numParams = GetNumParams();
	CParamInfo  *pParamInfo = 0;

	if (m_invkind == INVOKE_FUNC)
	{
		for( int iParam = 0; iParam < numParams; iParam++ )
		{
			pParamInfo = m_apParamInfo[iParam];
			str += ((pParamInfo->m_flags & PARAMFLAG_FOUT) ? TSTR(_T(" &")) : TSTR(_T(" "))) +  
						pParamInfo->GetName() + _T(":") + pParamInfo->m_strType;
		}
	}
	else
	{
		TSTR buf(_T(" "));
		if (numParams > ((m_invkind == INVOKE_PROPERTYGET) ? 0 : 1))
		{
			pParamInfo = m_apParamInfo[0];
			buf.printf(_T("[%s:%s] "), pParamInfo->GetName(), pParamInfo->m_strType);
		}		
		str.printf(_T("%s: %s"), buf, 
			m_strReturn.isNull() ? m_apParamInfo[0]->m_strType : m_strReturn);
		
		if (m_dispid == DISPID_VALUE)	str += _T(", default");
		if (m_isHidden)
			str += _T(", hidden");		
	}
}
示例#13
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));
}
示例#14
0
void
SpotLightFalloffManipulator::UpdateShapes(TimeValue t, TSTR& toolTip)
{
    GenLight* pLight = (GenLight*) mhTarget;

    Matrix3 tm;
    tm = mpINode->GetObjectTM(t);

    Point3 pt;
    b = GetTargetPoint(t, pt);

    if (!b)
        return;

    float den = FLength(tm.GetRow(2));
    float dist = (den!=0) ? FLength(tm.GetTrans()-pt) / den : 0.0f;

    TSTR nodeName;
    nodeName = mpINode->GetName();

    tm = Inverse(tm);
    toolTip.printf("Falloff: %5.2f", (double) pLight->GetFallsize(t));

    SetGizmoScale(dist / kRingScaleFactor);

    ConeAngleManipulator::UpdateShapes(Point3(0,0,0),
                                       Point3(0,0,-1),
                                       dist,
                                       pLight->GetFallsize(t));
}
示例#15
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;
}
示例#16
0
void
SpotLightMultiplierManipulator::UpdateShapes(TimeValue t, TSTR& toolTip)
{
    GenLight* pLight = (GenLight*) mhTarget;

    Matrix3 tm;
    tm = mpINode->GetObjectTM(t);

    Point3 pt;
    b = GetTargetPoint(t, pt);

    if (!b)
        return;

    TSTR nodeName;
    nodeName = mpINode->GetName();

    float den = FLength(tm.GetRow(2));
    float targetDist = (den!=0) ? FLength(tm.GetTrans()-pt) / den : 0.0f;

    toolTip.printf("%s: %5.2f", "Multiplier", (double) pLight->GetIntensity(t));

    SetGizmoScale(targetDist / 40.0);

    float dist = (targetDist / 2.0) * pLight->GetIntensity(t);

    ConeDistanceManipulator::UpdateShapes(Point3(0,0,0),
                                          Point3(0,0,-1),
                                          dist,
                                          pLight->GetFallsize(t),
                                          true);
}
示例#17
0
void
SpotLightAttenuationManipulator::UpdateShapes(TimeValue t, TSTR& toolTip)
{
    GenLight* pLight = (GenLight*) mhTarget;

    Matrix3 tm;
    tm = mpINode->GetObjectTM(t);

    Point3 pt;
    b = GetTargetPoint(t, pt);

    if (!b)
        return;

    float dist = pLight->GetAtten(t, mAttenuationType);

    TSTR nodeName;
    nodeName = mpINode->GetName();

    float den = FLength(tm.GetRow(2));
    float targetDist = (den!=0) ? FLength(tm.GetTrans()-pt) / den : 0.0f;

    toolTip.printf("%s: %5.2f", mAttenName.data(), (double) dist);

    SetGizmoScale(targetDist / 40.0);

    ConeDistanceManipulator::UpdateShapes(Point3(0,0,0),
                                          Point3(0,0,-1),
                                          dist,
                                          pLight->GetFallsize(t),
                                          false);
}
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;
}
示例#19
0
void WeightTableWindow::PaintCellAttribute(HDC hdc, int x, int y, BOOL sel, int state)
	{
	HBRUSH textBackground;
	DWORD textColor;
	DWORD textBKColor;
	SIZE strSize;

	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);

	TSTR stateStr;
	if (state == STATE_CHECKED)
		stateStr.printf("X");
	else if (state == STATE_INDETERMIANT)
		stateStr.printf("-");
	else stateStr.printf(" ");

	int offset;
	GetTextExtentPoint32(hdc, (LPCTSTR) stateStr, stateStr.Length(), (LPSIZE) &strSize ); 
	if (GetFlipFlopUI())
		offset = vertNameWidth/2 - strSize.cx/2;
	else offset = textHeight/2 - strSize.cx/2;
	if (GetFlipFlopUI())
		Rectangle(hdc, x,  y,x+vertNameWidth+1,y+textHeight+1);
	else Rectangle(hdc, x,  y,x+textHeight+1,y+textHeight+1);

	TextOut(hdc, x+offset,y+1,stateStr,stateStr.Length());

	}
示例#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]);
      }
   }
示例#21
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;
	}
示例#22
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);

}
示例#23
0
BOOL CBoneAssignmentPage::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_maxBoneCount);
	m_maxBoneCountEdit.SetWindowText(strValue);

	strValue.printf(_T("%f"), m_weightThreshold);
	m_weightThresholdEdit.SetWindowText(strValue);

	return TRUE;
}
示例#24
0
/*===========================================================================*\
 | 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 PFOperatorInstanceShapeDlgProc::UpdateParticleShapeDlg( HWND hWnd, const Tab<Mesh*>& meshList )
{
	int numVerts, numFaces, numShapes;

	numShapes = meshList.Count();
	numVerts = numFaces = 0;
	if (numShapes > 0) {
		for (int i = 0; i < numShapes; i++) {
			numVerts += meshList[i]->getNumVerts();
			numFaces += meshList[i]->getNumFaces();
		}
		numVerts /= numShapes;
		numFaces /= numShapes;
	}
	
	TSTR buf;
	buf.printf(_T("%d"), numVerts);
	SetDlgItemText( hWnd, IDC_VERTICES, buf );
	buf.printf(_T("%d"), numFaces);
	SetDlgItemText( hWnd, IDC_FACES, buf );
	buf.printf(_T("%d"), numShapes);
	SetDlgItemText( hWnd, IDC_SHAPES, buf );
}
示例#26
0
// ============================================================================
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;
}
void Unreal3DExport::ExportNode( IGameNode * child )
{
    DebugPrint( _T("ExportNode: %s\n"), child->GetName() );
    CheckCancel();

    ProgressMsg.printf(GetString(IDS_INFO_ENUM_OBJ),NodeIdx,NodeCount,TSTR(child->GetName()));
    pInt->ProgressUpdate(Progress+((float)NodeIdx/NodeCount*U3D_PROGRESS_ENUM), FALSE, ProgressMsg.data());
    ++NodeIdx;
    
    if( child->IsGroupOwner() )
    {
        // do nothing
    }
    else
    {
        IGameObject * obj = child->GetIGameObject();

        switch(obj->GetIGameType())
        {
            case IGameObject::IGAME_MESH:
            { 
                if( !bIgnoreHidden || !child->IsNodeHidden() )
                {
                    Nodes.Append(1,&child);
                }
                break;
            }
			case IGameObject::IGAME_HELPER:
            {
                if( !bIgnoreHidden || !child->IsNodeHidden() )
                {
                    TrackedNodes.Append(1,&child);
                }
            }
            break;
        }

        child->ReleaseIGameObject();
    }   
    
    for( int i=0; i<child->GetChildCount(); ++i )
    {
        IGameNode * n = child->GetNodeChild(i);
        ExportNode(n);
    }
}
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);
}
示例#29
0
文件: composit.cpp 项目: 2asoft/xray
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);
		}
	}
示例#30
0
文件: composit.cpp 项目: 2asoft/xray
void CompositeDlg::LoadDialog(BOOL draw) 
	{	
	if (theTex) {		
		theTex->ClampOffset();
		
		SetScrollRange(hScroll,SB_CTL,0,theTex->subTex.Count()-NDLG,FALSE);
		SetScrollPos(hScroll,SB_CTL,theTex->offset,TRUE);
		EnableWindow(hScroll,theTex->NumSubTexmaps()>NDLG);

		if (theTex->subTex.Count()>NDLG) {
			EnableWindow(GetDlgItem(hPanel,IDC_COMP_UP),theTex->offset>0);
			EnableWindow(GetDlgItem(hPanel,IDC_COMP_PAGEUP),theTex->offset>0);
			EnableWindow(GetDlgItem(hPanel,IDC_COMP_DOWN),theTex->offset+NDLG<theTex->subTex.Count());
			EnableWindow(GetDlgItem(hPanel,IDC_COMP_PAGEDOWN),theTex->offset+NDLG<theTex->subTex.Count());
		} else {
			EnableWindow(GetDlgItem(hPanel,IDC_COMP_UP),FALSE);
			EnableWindow(GetDlgItem(hPanel,IDC_COMP_PAGEUP),FALSE);
			EnableWindow(GetDlgItem(hPanel,IDC_COMP_DOWN),FALSE);
			EnableWindow(GetDlgItem(hPanel,IDC_COMP_PAGEDOWN),FALSE);
			}

		Interval valid;
		theTex->Update(ip->GetTime(),valid);		
		UpdateSubTexNames();
		TSTR buf;
		buf.printf(_T("%d"),theTex->subTex.Count());
		SetDlgItemText(hPanel,IDC_COMP_NUMMAPS,buf);
		for (int i=0; i<min(theTex->subTex.Count(),NDLG); i++) {
			ShowWindow(GetDlgItem(hPanel,mapIDs[i]),SW_SHOW);
			ShowWindow(GetDlgItem(hPanel,labelIDs[i]),SW_SHOW);
			ShowWindow(GetDlgItem(hPanel,mapOnIDs[i]),SW_SHOW);
//			SetCheckBox(hPanel, mapOnIDs[i], theTex->mapOn[i+theTex->offset]);
			}
		for (; i<NDLG; i++) {
			ShowWindow(GetDlgItem(hPanel,mapIDs[i]),SW_HIDE);
			ShowWindow(GetDlgItem(hPanel,labelIDs[i]),SW_HIDE);
			ShowWindow(GetDlgItem(hPanel,mapOnIDs[i]),SW_HIDE);
			}
		}
	}