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

Legacy:Exec Directive (UT)

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

For UT2003 Imports see : Exec Directive

"#exec" directives execute console commands at compile time. Every "#exec" directive can be executed in UnrealEd's console bar. (without the "#exec") Currently in the newer engine builds, they are the only method of importing vertex meshes (think .3ds). They are also useful for keeping content closely coupled with the code that uses it (textures/sounds), or for referenced seperate content packages for organizational purposes.

Look for lines in Editor.log that start with "Cmd:" to find out about more possibly interesing exec directives.

See UnrealEd Console for more information on this fun stuff!

Textures

Import

Textures may also be imported upon compilation of a class or series of classes into a .u package. This is done using the #exec preprocessing directive.

Syntax:

#exec TEXTURE IMPORT NAME=NameForTextureToImportAs FILE=PATH\TO\SomeTexture.pcx GROUP=SomeGroup MIPS=OFF FLAGS=2 PALETTE=SomeTexPalette LODSET=2
NAME 
Name the texture is imported as.
FILE 
Path to the texture being imported. Paths are local to the root of the package directory.
GROUP 
(optional) Name of the group the texture is classified under (used in, for example, the UEd Texture browser.)
MIPS 
(optional) OFF or ON. Generate MipMaps.
FLAGS 
(optional) Numerical value. Assigns the texture rendering style. Valid styles are:
1
  • Normal
  • 2: 2-sided (Use this if importing for use as a sprite)
  • 3: Translucent 2-sided
  • 4: Masked 2-sided
  • 5: Modulated 2-sided
PALETTE 
(optional) Color palette to use if not default.
LODSET 
(optional) Numerical value. Level of detail. Homologous to the LODSet Texture property in UEd. Affects texture clarity as dictated by the user's settings.
0
  • no detail settings applied.
  • 1: LODSET_World – affected by user's World Texture Detail setting.
  • 2: LODSET_Skin

Context:

class SomeClass extends SomeActor;
 
#exec TEXTURE IMPORT NAME=SomeTex1 FILE=Textures\SomeTexture.pcx GROUP=Skins FLAGS=2
#exec TEXTURE IMPORT NAME=SomeTex2 FILE=Textures\AnotherTexture.pcx GROUP=Skins FLAGS=2
#exec TEXTURE IMPORT NAME=SomeTex3 FILE=Textures\StillAnotherTexture.pcx GROUP=Skins FLAGS=2

Imported textures are addressed as PackageName.Texturename, and available via UnrealEd after PackageName is loaded in the Actor browser.

See also Texture Import And Export

Sounds

Import

Sounds can be imported in a similar way to textures. Imported sounds must be no higher quality than 22,050 Hz, 16 bit mono, and must be uncompressed PCM WAV.

Syntax:

#exec AUDIO IMPORT NAME=NameForSoundToImportAs FILE=PATH\TO\SomeSound.wav GROUP=SomeGroup
NAME 
Name the sound is imported as.
FILE 
Path to the sound being imported. Paths are local to the root of the package directory.
GROUP 
(optional) Name of the group the sound is classified under (used in, for example, the UEd Sound browser.)

Imported sounds are addressed as PackageName.GroupName.SoundName, and are available via UnrealEd after PackageName is loaded in the Actor browser.

See also Importing_Sounds

Packages

Loading Other Packages

You can use the OBJ LOAD parameters to load a specific package at compile time to allow specific objects in that package to be referenced if they're not already loaded in the compilation sequence (via prior inclusion or EditPackages listing).

For example, say you have a bunch of textures in a seperate .utx so that you don't necessarily have to re-compile a .u package everytime you want to update/change/add/remove textures; to insure a class accessing the .utx package compiles, you could do something like:

#exec OBJ LOAD FILE="..\Textures\MyTextures.utx"
 
var Texture SomeTexture;
 
defaultproperties
{
    SomeTexture=Texture'MyTextures.SomeCoolTexture_A'
}

You can use OBJ LOAD to load any sort of Unreal package, be it for textures, sounds, animations, or even other script packages. Useful sometimes for bypassing annoying dependency issues as well (although you should probably just design your code not to have these in the first place).

The PACKAGE flag specifies the package which the referenced FILE is compiled into. Setting it equal to the package in which the calling class resides will compile the loaded package into the compiled package. For example, with a texture package called MyTextures.utx and a script MyScript.uc in package MyPackage:

#exec OBJ LOAD FILE="..\Textures\MyTextures.utx" PACKAGE=MyPackage
 
var Texture SomeTexture;
 
defaultproperties
{
    SomeTexture=Texture'MyPackage.SomeCoolTexture_A'
}

SomeCoolTexture can then be referenced through MyPackage instead of MyTextures, eliminating the need for a separate texture package when MyPackage is distributed.

If you want to EXEC OBJ LOAD files, make certain they have different names (i.e., it doesn't like having MyModWeapons.utx and MyModWeapons.uax – it's a circular reference and the compiler will hang as it tries to load a package into itself). Simple work-around is to just name them like MyModWeaponsSkins.utx and MyModWeaponsSounds.uax.

Position, Rotation and Scale

#exec MESH  ORIGIN MESH=Weapon_1st X=0 Y=0 Z=0 YAW=0 PITCH=0 ROLL=0
#exec MESHMAP   SCALE MESHMAP=Weapon_1st X=1.0 Y=1.0 Z=1.0

In this case the rotation unit is a byte: a full circle is 255.

Assign Animations and Textures

#exec MESH  DEFAULTANIM MESH=Weapon_1st ANIM=WeaponAnim
#exec MESHMAP SETTEXTURE MESHMAP=Weapon_1st NUM=0 TEXTURE=WeaponTex
NUM 
Material number the texture is assigned to on the mesh.

Animations

Import

You can import .PSA files obtained from the ActorX utility, that are placed in the /models folder of your package directory.

#exec ANIM  IMPORT ANIM=WeaponAnim ANIMFILE=models\WeaponAnim.PSA COMPRESS=1 MAXKEYS=999999 IMPORTSEQS=1
ANIM 
Name that the animations are imported as.
ANIMFILE 
Path to the animations being imported. Paths are local to the root of the package directory.
GROUP 
(optional) Name of the group that the mesh is classified under.
COMPRESS 
Compresses the animations. 1 is normal, uncompressed, lower numbers are more compressed.
MAXKEYS 
not sure
IMPORTSEQS 
not sure

Fonts

Import

Fonts can be created using the TrueTypeFontFactory, you can import any truetype font on the machine doing the compilation.

Basic Syntax:

#exec NEW TRUETYPEFONTFACTORY NAME=SomeName FONTNAME="SomeFont" HEIGHT=SomeSize
NAME 
Name the font is imported as.
FONTNAME 
Name of the font to be imported, such as "Arial" or "Times New Roman".
HEIGHT
Height of the characters in the font - think 'font size'.

Many other parameters for this exist, see TrueTypeFontFactory.

Imported fonts are addressed as PackageName.FontName, and will show up in UnrealEd but seem to show every single currently loaded texture (akin to Engine.*Font groups).

See also TrueTypeFontFactory


Draconx: Perhaps readability of this page could be improved by breaking it into subpages for each type of import? This whole page really looks like a mess. I'll take a look at doing just that tomorrow I suppose, as a comprehensive reference to the #exec imports is HIGHLY useful.


Category:Legacy Class (UT)
Category:Legacy To Do – What is UT2003 and which is UT? Remove UT2003 stuff from this page