示例#1
0
CCommandVar CParticleTools::CommandReload(CCommandVar p1, CCommandVar p2)
{
    if (!IfModified()) 	return FALSE;
    Reload				();
    ExecCommand(COMMAND_UPDATE_CAPTION);
    return TRUE;
}
示例#2
0
//---------------------------------------------------------------------------
// actor commands
//---------------------------------------------------------------------------
CCommandVar CActorTools::CommandLoad(CCommandVar p1, CCommandVar p2)
{
    xr_string temp_fn	= p1.IsString()?xr_string(p1):xr_string(""); 
    if(!p1.IsString()){
        temp_fn			= ChangeFileExt(m_LastFileName,"").c_str();
        if (!EFS.GetOpenName	( _objects_, temp_fn ))
        	return  	FALSE;
    }
    if( temp_fn.size() ){
		xr_strlwr				(temp_fn);
        if (!IfModified())		return FALSE;

        if (!FS.exist(temp_fn.c_str())){
            Msg					("#!Can't load file: %s",temp_fn.c_str());
        	return FALSE;
        }
        
        
        ExecCommand				(COMMAND_CLEAR);
        
        BOOL bReadOnly 			= !FS.can_modify_file(temp_fn.c_str());
        m_Flags.set				(flReadOnlyMode,bReadOnly);
        
        if (bReadOnly || EFS.CheckLocking(temp_fn.c_str(),false,true))
            Msg					("#!Object '%s' opened in readonly mode.",temp_fn.c_str());

/*        
        shared_str locker;
        if ((false==bReadOnly) && EFS.CheckLocking(_objects_,temp_fn.c_str(),false,true,&locker)){
            Log					("#!Object opened in readonly mode. Locked by user:"******"#!You don't have permisions to modify object:",temp_fn.c_str());
        }
*/        
        // set enable ...
		m_Props->SetReadOnly	(bReadOnly);
        fraLeftBar->SetReadOnly	(bReadOnly);
        
        CTimer T;
        T.Start();     
        if (!Load(temp_fn.c_str())){
            return FALSE;
        }
        m_LastFileName 			= temp_fn.c_str();
        ELog.Msg(mtInformation,"Object '%s' successfully loaded. Loading time - %3.2f(s).",m_LastFileName.c_str(),T.GetElapsed_sec());
        EPrefs->AppendRecentFile(m_LastFileName.c_str());
        ExecCommand	(COMMAND_UPDATE_CAPTION);
        ExecCommand	(COMMAND_UPDATE_PROPERTIES);
        // lock
        if (!bReadOnly)			EFS.LockFile(m_LastFileName.c_str());
        UndoClear();
        UndoSave();
    }
    return TRUE;
}
示例#3
0
CCommandVar CActorTools::CommandClear(CCommandVar p1, CCommandVar p2)
{
    if (!IfModified())	return FALSE;
    // unlock
    EFS.UnlockFile	(m_LastFileName.c_str());
    m_LastFileName	= "";
    Device.m_Camera.Reset();
    Clear			();
    ExecCommand		(COMMAND_UPDATE_CAPTION);
    ExecCommand		(COMMAND_UPDATE_PROPERTIES);
    UndoClear		();
    return TRUE;
}