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


C++ CGroupObject::RefName方法代码示例

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


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

示例1: SaveSelectedObject

void ESceneGroupTool::SaveSelectedObject()
{
	u32 scnt = SelectionCount(true);
	if(scnt==0)
    {
        ELog.DlgMsg(mtError,"No object(s) selected.");
        return;
    }else
	if(scnt>1)
    {
        if(mrYes != ELog.DlgMsg(mtConfirmation, TMsgDlgButtons() << mbYes << mbNo, "Process multiple objects?") )
        	return;
    }
    
	CGroupObject* obj	= 0;
	// find single selected object
    for(ObjectIt it=m_Objects.begin(); it!=m_Objects.end(); ++it)
    {
    	if((*it)->Selected())
        {
        	obj 		= dynamic_cast<CGroupObject*>(*it);
            
            xr_string fn;
            if(scnt==1)
            {
            	fn 					= obj->RefName();
                if( !EFS.GetSaveName(_groups_,fn) )
                    return;
            }else
            {
            	string_path 		S;
               FS.update_path		(S, _groups_, obj->RefName());
               fn 					= S;
               fn 					+= ".group";
            }
            
            IWriter* W 				= FS.w_open(fn.c_str());
            if (W)
            {
                obj->SaveStream		(*W);
                FS.w_close			(W);
            }else
                ELog.DlgMsg			(mtError, "Cant write file [%s]", fn.c_str());
      }          
    }
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:46,代码来源:ESceneGroupTools.cpp

示例2: MakeThumbnail

void ESceneGroupTool::MakeThumbnail()
{
	if (SelectionCount(true)==1)
    {
	    CGroupObject* object		= 0;
        for (ObjectIt it=m_Objects.begin(); it!=m_Objects.end(); it++)
        {
        	if ((*it)->Selected())
            {
	            object				= dynamic_cast<CGroupObject*>(*it);
                break;
            }
        }
        VERIFY						(object);
        object->Select				(false);
        // save render params
        Flags32 old_flag			= psDeviceFlags;
        // set render params
        psDeviceFlags.set			(rsStatistic|rsDrawGrid,FALSE);

        U32Vec pixels;
        u32 w=512,h=512;
        if (EDevice.MakeScreenshot	(pixels,w,h))
        {
            AnsiString tex_name		= ChangeFileExt(object->Name,".thm");
            SStringVec lst;

            ObjectList 				grp_lst;
            object->GetObjects		(grp_lst);
            
            for (ObjectIt it=grp_lst.begin(); it!=grp_lst.end(); ++it)
                lst.push_back		((*it)->Name);
                
            EGroupThumbnail 		tex	(tex_name.c_str(),false);
            tex.CreateFromData		(pixels.begin(),w,h,lst);
            string_path fn;
            FS.update_path			(fn,_groups_,object->RefName());
            strcat					(fn,".group");
            tex.Save				(FS.get_file_age(fn));
        }else
        {
            ELog.DlgMsg				(mtError,"Can't make screenshot.");
        }
        object->Select				(true);
        // restore render params
        psDeviceFlags 				= old_flag;
    }else
    {
    	ELog.DlgMsg		(mtError,"Select 1 GroupObject.");
    }
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:51,代码来源:ESceneGroupTools.cpp


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