I love the smell of UnrealEd crashing in the morning. – tarquin

User:Eliot/EditPackagesCommandlet

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search

This is a simple commandlet to add and remove a specified editpackage for the use in Batch files when you are not using an IDE.

Source

// Coded by Eliot Van Uytfanghe.
Class EditPackagesCommandlet Extends Commandlet;
 
event int Main( string Parms )
{
	local bool bAdd;
	local string PackageName;
	local int i;
 
	Log( Parms, Name );
	bAdd = Left( Parms, 1 ) == "1";
	PackageName = Mid( Parms, 2 );
	if( bAdd )
	{
		Log( "Adding" @ PackageName, Name );
		Class'EditorEngine'.Default.EditPackages[Class'EditorEngine'.Default.EditPackages.Length] = PackageName;
		Class'EditorEngine'.Static.StaticSaveConfig();
	}
	else
	{
		Log( "Removing" @ PackageName, Name );
		for( i = 0; i < Class'EditorEngine'.Default.EditPackages.Length; ++ i )
		{
			if( Class'EditorEngine'.Default.EditPackages[i] ~= PackageName )
			{
				Class'EditorEngine'.Default.EditPackages.Remove( i, 1 );
				break;
			}
		}
		Class'EditorEngine'.Static.StaticSaveConfig();
	}
}

Usage

@echo off
title Compiling %1%
cd..
cd System
echo ----------------------------------------------------
echo Deleting compiled files of %1%
echo ----------------------------------------------------
del %1%.u
del %1%.ucl
del %1%.int
echo ----------------------------------------------------
echo Compiling!
echo ----------------------------------------------------
ucc.exe EditPackagesCommandlet 1 %1%
ucc.exe MakeCommandlet -EXPORTCACHE
ucc.exe EditPackagesCommandlet 0 %1%
ucc.exe DumpIntCommandlet %1%.u
pause