Exec Directive (UT)
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!
snip from the scale page:
When importing a mesh into the engine with an exec directive, you can specify a rotation for the mesh during import ('# EXEC MESH ORIGIN MESH=Blablabla YAW=..PITCH=..YAW=...) . In this case the rotation unit is a byte: a full circle is 255.
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
- 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
Packages
Loading Other Packages
You can use the OBJ LOAD parameters to load a specific file at compile time, so that you can reference objects in that package at compile time. For example, say you want to store a bunch of textures in a seperate .utx so that you don't necessarily have to re-compile the package everytime you want to update/change/add/remove textures, 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).
PACKAGE 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.
Oh yes, here's a little something I learned the hard way...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). Simple work-around is to just name them like MyModWeaponsSkins.utx and MyModWeaponsSounds.uax. Sigh. Maybe I'm just an idiot, but it took me 10 minutes to figure that out. Hopefully this will save someone else that trouble.
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
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
Category Class (UT)
Category To Do
Refactor Me - What is UT2003 and which is UT?