示例#1
0
void CSurfaceDlg::SetTexMods() {
	UpdateData(TRUE);
	m_strMaterial = g_qeglobals.d_texturewin.texdef.name;
	patchMesh_t *p = SinglePatchSelected();
	if (p) {
		m_subdivide = p->explicitSubdivisions;
		m_strMaterial = p->d_texture->GetName();
	} else {
		m_subdivide = false;
	}

	int faceCount = g_ptrSelectedFaces.GetSize();
	face_t *selFace = NULL;
	if (faceCount) {
		selFace = reinterpret_cast < face_t * > (g_ptrSelectedFaces.GetAt(0));
	} else {
		if (selected_brushes.next != &selected_brushes) {
			brush_t *b = selected_brushes.next; 
			if (!b->pPatch) {
				selFace = b->brush_faces;
			}
		}
	}

	if (selFace) {
		float rot;
		Face_GetScale_BrushPrimit(selFace, &m_horzScale, &m_vertScale, &rot);	
	} else {
		m_horzScale = 1.0f;
		m_vertScale = 1.0f;
	}

	UpdateData(FALSE);
}
void CSurfaceDlg::GetPatchInfo( void ) {
	m_Patch = SinglePatchSelected();
	if ( m_Patch != NULL ) {
		CString str;
		int i;
		m_wndRows.ResetContent();
		for ( i = 0; i < m_Patch->height; i++ ) {
			str.Format( "%i", i );
			  m_wndRows.AddString( str );
		}
		m_wndRows.SetCurSel(0);
		m_wndCols.ResetContent();
		for ( i = 0; i < m_Patch->width; i++ ) {
			str.Format( "%i", i );
			m_wndCols.AddString( str );
		}
		m_wndCols.SetCurSel( 0 );
	}
	UpdateRowColInfo();
}