Esempio n. 1
0
void ESceneGroupTools::ReloadRefsSelectedObject()
{
    ObjectList lst 	= m_Objects;
    int sel_cnt		= 0;
    if (!lst.empty()){
    	bool bModif	= false;
        for (ObjectIt it=lst.begin(); it!=lst.end(); it++){
        	if ((*it)->Selected()){
			    sel_cnt++;
            	CGroupObject* obj 	= dynamic_cast<CGroupObject*>(*it); VERIFY(obj);
                if (obj->UpdateReference()){
                    bModif			= true;
                }else{
                    ELog.Msg		(mtError,"Can't reload group: '%s'.",obj->Name);    
                }
            }
        }
	    if (bModif) Scene->UndoSave();
    }
    if (0==sel_cnt)	ELog.Msg		(mtError,"Nothing selected.");
}
Esempio n. 2
0
void ESceneGroupTool::ReloadRefsSelectedObject()
{
    ObjectList lst 				= m_Objects;
    int sel_cnt					= 0;
    if (!lst.empty())
    {
        string_path				temp_file_name_sector,temp_file_name_portal;
        GetTempFileName			( FS.get_path(_temp_)->m_Path, "tmp_sector", 0, temp_file_name_sector );
        Scene->SaveToolLTX		(OBJCLASS_SECTOR, temp_file_name_sector);

        GetTempFileName			( FS.get_path(_temp_)->m_Path, "tmp_portal", 0, temp_file_name_portal );
        Scene->SaveToolLTX		(OBJCLASS_PORTAL, temp_file_name_portal);

   		bool bModif	= false;
        for (ObjectIt it=lst.begin(); it!=lst.end(); ++it)
		{
        	if ((*it)->Selected())
            {
			    sel_cnt++;
            	CGroupObject* obj 	= dynamic_cast<CGroupObject*>(*it); 
                VERIFY				(obj);
                if (obj->UpdateReference(true))
                {
                    bModif		= true;
                }else
                {
                    ELog.Msg	(mtError,"Can't reload group: '%s'.",obj->Name);
                }
            }
        }
	    if(bModif) 
        	Scene->UndoSave		();

		Scene->LoadToolLTX		(OBJCLASS_SECTOR, temp_file_name_sector);
		Scene->LoadToolLTX		(OBJCLASS_PORTAL, temp_file_name_portal);
    }
    if (0==sel_cnt)	
    	ELog.Msg	(mtError,"Nothing selected.");
}