The dirty count


You can read more about the dirty count in the Softimage KB article Scripting – Understanding the dirty count parameter.

This example JScript uses the dirty count to determine whether or not the current scene has been saved.

function IsSceneSaved()
{
	var dirtycount = Dictionary.GetObject( "Project.dirtycount" ).Value;
	var models = FindObjects( null, "{0496EAB0-0ECF-11d1-ABF1-00A02485CECB}" )
	 
	oEnum = new Enumerator( models ) ;
	for (;!oEnum.atEnd();oEnum.moveNext() )
	{
		var model = oEnum.item() ;
		dirtycount += Dictionary.GetObject( model.FullName + ".dirty_count" ).Value
	}

	LogMessage( dirtycount );
	return( dirtycount );
}
LogMessage( IsSceneSaved() == 0 ? "Scene is clean" : "Scene is dirty" );