Code:
class ExampleScreen extends Actor placeable ClassGroup(Example); /** This will be the flash movie that this actor plays. */ var() noclear SwfMovie ScreenMovie; /** This will be the green screen texture onto which the ScreenMovie projects. */ var ExampleTextureRenderTarget2D ScreenTexture; /** The flash player to play the flash movie. */ var ExampleScreenPlayer ESP; // Extends from GFxMoviePlayer, just has an extra function that overrides Start() to call both super.Start() and Advance(0). /** The static mesh actor which will have the flash movie playing on it. */ var StaticMeshComponent EScreen; /** To be able to add the flash movie to the actor, I have to be able to manipulate the material interface. */ var MaterialInstanceConstant EMIC; event PostBeginPlay() { super.PostBeginPlay(); ESP = new class'ExampleScreenPlayer'; ESP.SetMovieInfo(ScreenMovie); // This is a wrapper class to TextureRenderTarget2D to change RT's SizeX and SizeY each to 512 (because they're both "const"), as well as changing the Format enum default to PF_Format=A8R8G8B8 (I'm trying to recreate the "green screen" render targets you see when they're created in the editor.) ScreenTexture = new class'ExampleTextureRenderTarget2D'; // Adopting the same method in Uscript that Matt Doyle does via kismet and the editor in his videos. // Except using unrealscript instead of "Open GFx Movie" kismet. ESP.RenderTexture = ScreenTexture; ESP.RenderTextureMode = RTM_AlphaComposite; EMIC = new class'MaterialInstanceConstant'; EMIC.SetParent(EScreen.GetMaterial(0)); EScreen.SetMaterial(0, EMIC); // The material is only a texture parameter node that plugs directly into the emissive slot. // The material uses the AlphaComposite opacity setting, just like the video tutorial. EMIC.SetTextureParameterValue('Emissive', ScreenTexture); ESP.Init(); } defaultproperties { // Native. // Custom. ScreenMovie=SwfMovie'ExampleSWF' begin Object Name="Screen" Class="StaticMeshComponent" StaticMesh=StaticMesh'ExampleMeshes.ExampleActor' Scale=2.f end Object Components.add(Screen); EScreen=Screen }
Ideally I would like to avoid having to use kismet to have a flash material playing on my actor. So any help would be welcome and appreciated.
Comment