当前位置: 首页>>代码示例>>C++>>正文


C++ MaterialDoc::SetMaterialName方法代码示例

本文整理汇总了C++中MaterialDoc::SetMaterialName方法的典型用法代码示例。如果您正苦于以下问题:C++ MaterialDoc::SetMaterialName方法的具体用法?C++ MaterialDoc::SetMaterialName怎么用?C++ MaterialDoc::SetMaterialName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MaterialDoc的用法示例。


在下文中一共展示了MaterialDoc::SetMaterialName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: RenameMaterial

/**
* Handles all of the little problems associated with renaming a folder.
*/
void MaterialTreeView::RenameMaterial( HTREEITEM item, const char *originalName ) {
	CTreeCtrl &tree = GetTreeCtrl();
	const idMaterial *material = declManager->FindMaterial( originalName );
	MaterialDoc *pMaterial;
	//pMaterial = materialDocManager->GetInProgressDoc(material);
	//if(!pMaterial) {
	pMaterial = materialDocManager->CreateMaterialDoc( const_cast<idMaterial *>( material ) );
	//}
	//Remove our old quick lookup value
	materialToTree.Remove( originalName );
	//Generate the new name
	idStr materialName;
	HTREEITEM parent = tree.GetParentItem( item );
	DWORD parentType = tree.GetItemData( parent );
	if( parentType == TYPE_MATERIAL_FOLDER ) {
		//Need to include the material folder
		materialName = GetMediaPath( parent, TYPE_MATERIAL_FOLDER );
		materialName += "/";
	}
	materialName += tree.GetItemText( item );
	//Add it to our quick lookup
	materialToTree.Set( materialName, item );
	//Finally make the change
	internalChange = true;
	pMaterial->SetMaterialName( materialName, false );
	internalChange = false;
}
开发者ID:revelator,项目名称:Revelation,代码行数:30,代码来源:MaterialTreeView.cpp

示例2: OnTvnEndlabeledit

/**
* Makes sure that a rename operation can be performed after a label edit is complete and
* performs the folder or material rename.
*/
void MaterialTreeView::OnTvnEndlabeledit( NMHDR *pNMHDR, LRESULT *pResult ) {
	LPNMTVDISPINFO pTVDispInfo = reinterpret_cast<LPNMTVDISPINFO>( pNMHDR );
	*pResult = 0;
	if( pTVDispInfo->item.pszText ) {
		//Convert any edited text to lower case to keep the name canonical
		idStr newLabel = pTVDispInfo->item.pszText;
		newLabel.ToLower();
		strncpy( pTVDispInfo->item.pszText, newLabel.c_str(), pTVDispInfo->item.cchTextMax );
		CTreeCtrl &tree = GetTreeCtrl();
		DWORD type = tree.GetItemData( pTVDispInfo->item.hItem );
		if( type == TYPE_MATERIAL ) {
			MaterialDoc *pMaterial = materialDocManager->GetCurrentMaterialDoc();
			//Remove our old quick lookup value
			materialToTree.Remove( pMaterial->name.c_str() );
			//Generate the new name
			idStr material;
			HTREEITEM parent = tree.GetParentItem( pTVDispInfo->item.hItem );
			DWORD parentType = tree.GetItemData( parent );
			if( parentType == TYPE_MATERIAL_FOLDER ) {
				//Need to include the material folder
				material = GetMediaPath( parent, TYPE_MATERIAL_FOLDER );
				material += "/";
			}
			material += pTVDispInfo->item.pszText;
			if( declManager->FindMaterial( material, false ) ) {
				//Can't rename because it conflicts with an existing file
				MessageBox( "Unable to rename material because it conflicts with another material", "Error" );
			} else {
				//Add it to our quick lookup
				materialToTree.Set( material, pTVDispInfo->item.hItem );
				//Finally make the change
				internalChange = true;
				pMaterial->SetMaterialName( material );
				internalChange = false;
				renamedFolder = pTVDispInfo->item.hItem;
				PostMessage( MSG_RENAME_MATERIAL_COMPLETE );
				*pResult = 1;
			}
		} else if( type == TYPE_MATERIAL_FOLDER ) {
			//Clean up the quicktree with the current tree before we allow the edit to commit
			CleanLookupTrees( pTVDispInfo->item.hItem );
			//Store some data so the we can make the appropriate changes after the commit
			renamedFolder = pTVDispInfo->item.hItem;
			affectedMaterials.Clear();
			GetMaterialPaths( renamedFolder, &affectedMaterials );
			PostMessage( MSG_RENAME_FOLDER_COMPLETE );
			RenameMaterialFolderModifier *mod = new RenameMaterialFolderModifier( materialDocManager, pTVDispInfo->item.pszText, this, pTVDispInfo->item.hItem, tree.GetItemText( pTVDispInfo->item.hItem ) );
			materialDocManager->AddMaterialUndoModifier( mod );
			*pResult = 1;
		}
	}
}
开发者ID:revelator,项目名称:Revelation,代码行数:56,代码来源:MaterialTreeView.cpp

示例3: Redo

/**
* Performs a redo operation of a renamed material.
*/
void RenameMaterialModifier::Redo()
{

	MaterialDoc *material = manager->CreateMaterialDoc(oldName);
	material->SetMaterialName(materialName, false);
}
开发者ID:AreaScout,项目名称:dante-doom3-odroid,代码行数:9,代码来源:MaterialModifier.cpp


注:本文中的MaterialDoc::SetMaterialName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。