Cut/Paste and Find/Replace |
Quake2 Demo Editing Tutorial |
Written 6/99 by Overman |
In this tutorial we will discuss two major timesaving features of Keygrip2, both of which you will use regularly if you plan to do much demo editing. First are the many uses of Cut & Paste, and second is the Find/Replace dialog.
Cut, Copy, and Paste - Filmstrip
Throughout this tutorial, it is helpful to be reminded of the near-universal Windows shortcut keys for the cut (CTRL-x), copy (CTRL-c), and paste (CTRL-v) commands that work in Keygrip2.
The first place where these commands are useful is on the filmstrip in Keygrip2. In a previous tutorial, we discussed how to zoom in/out, and select a range of blocks on this filmstrip, using the left and right mouse buttons. PLEASE NOTE: The Undo command does NOT function in Keygrip2, so if you are going to experiment around at all, always make sure you have a backup of your demo. Open a sample demo of your choice, select a range of blocks, and press CTRL-x for Cut. A confirmation dialog should appear, and once you click Yes, the blocks will be removed and placed on the clipboard. Use CTRL-c for Copy, and the blocks would be copied to the clipboard, leaving the original blocks as-is.
If you want to (CTRL-v) Paste the blocks at a new location, you first need to select a destination. If you want the blocks to simply be added on to the end of the demo, select Paste on End (CTRL-e) from the Edit drop-down menu. Otherwise, select the block on the filmstrip that you want the pasted blocks to be inserted in front of. For example, if you want the pasted blocks to be inserted before block 1000, then select block 1000 on the filmstrip and press CTRL-v. If you want the blocks to be inserted after block 475, then select block 476 and press CTRL-v, and they will be inserted between 475-476.
It is important to note that when you copy blocks, you are copying all information contained in those blocks. So, if you decide to copy one block over and over again for a few seconds (perhaps to do a Matrix-style freeze frame effect), be aware that any sounds that occur in that block will be copied too, and hence, be repeating. If the repeating sounds annoy you, it should be no trouble to fix using a bit of Find/Replace. If you are new to Find/Replace in Keygrip2, read on... we'll get there.
Cut, Copy, and Paste - Block Tree
The second place where these commands are extremely helpful is in the Block Tree window, where they can be extremely powerful. Crustar of P1mp Slap Productions is creating his next movie, "Rick Jones 2", almost exclusively using Block Tree editing functions (and Find/Replace).
Within the right window of the Block Tree, the left mouse button is used for selection, the right mouse button brings up the list of possible commands (and their shortcut keys). The Shift and CTRL keys work with the left mouse button as they do in Windows Explorer... CTRL will add units to your selection, one at a time, while Shift will allow you to select a starting and ending point to grab a consecutive range.
The rules for cutting and pasting blocks are the same as for the filmstrip... to choose the paste destination, select the block the pasted material should come before. You will also notice there are two "new" commands here. Delete allows you to remove blocks without copying them to the clipboard - when you know you want to get rid of them permanently. Insert allows you to (surprise) insert a new message into the demo and set up its parameters.
These same commands can be used on the next level of block tree editing... cutting, copying, and pasting the messages themselves. This is a far more detailed level of editing than is possible from the filmstrip. Messages can be moved around from block to block, or even demo to demo.
NOTE: There is one very important exception to the previous pasting rules that applies on the message level. When you want to paste a selected message (or group of messages), select the message that you want the pasted material to appear AFTER, not before.
When copying and moving messages around in the Block Tree, keep in mind the necessary order that certain messages must be in, or you will cause errors that will make your demo impossible to play back. As a reminder, all blocks must begin with a FRAME message, followed by PLAYERINFO, and then followed by PACKETENTITIES messages. All other message types should come after the packetentities. Sometimes you will see a situation where Quake2 appears to have broken these rules... but I would advise everyone to follow them and be on the safe side.
Finally, the clipboard commands are very useful when dealing with message parameter editing in the block tree, though for more repetitive tasks in this regard, it's really much more efficient to use the Find/Replace dialog, which we will now discuss.
The Find/Replace Dialog
This is one of the most powerful and time-saving editing features of Keygrip2, and with the latest (final) release of the program, it has been beefed up even more. It is essential to good demo editing to get to know this part of the program very well. Tasks that could take hours by manual editing can be completed in seconds.
The Keygrip2 Help file now has complete documentation on the Find/Replace dialog, including the new powerful features. You can locate this documentation under Help - Contents - Dialogs - Find Dialog. Effective use of this tool requires a good working knowledge of the structure of the different messages, as documented in the DemoSpecs. Be sure to consult the Specs for information on legal values for different parameters.
Rather than reiterate everything available in the help documentation, we will simply review the new features that were added in the latest version of Keygrip2. To reveal the new features, make sure the Find Type is set to Replace and Message Type is set to packetentities, and then press both of the + buttons located in the middle of the Find dialog.
First, notice that in the top half of the window (the Find Params), you can now enter two values for the Find operation. Pressing the upper + button will add a third column, for a total of three values. (You can actually add more than three values by pressing + again, but since the Find window cannot be resized, these columns are not visible without adjusting the size of other columns).
Let's say, for example, you would like to search all packetentities messages in the demo, and remove all references to the following Entities: 24, 36, and 100. Simply enter 24 into the Value box by Entity, 36 in the second column (Value2), and 100 into the third (Value3). Then check the Parameters box, and set the Find Type to Delete. You can now remove all of these packetentities messages at one time. This is just one example of this powerful feature. NOTE: It is important to only open up as many columns (using the + button) as you actually need; an extra column with no value can sometimes cause the Find engine to select ALL messages of any value, so be sure to use the - button to remove any unneeded columns for your operation.
The bottom half of the window has a different set of columns: Start, Reset To, End, and Increment. This interface allows you to perform incremental changes on a parameter. Where might this be useful? As you may or may not know, a player model cycles through numeric frames of animation, represented by the Frame parameter of the packetentities message. In some cases, you may wish to manipulate these frames.
For the purposes of our example, let's say that for blocks 0-100, you wish to have the player who is Entity 1 cycle through the standing animations for the player model. These are represented by frames 0-39. (Just trust me on this) Let's also say that you wish the player to begin cycling at frame number 14, and continue cycling after that point.
First, set Entity in the Find Params to 1. Next, we want to use the Reset To and End columns to set the range of our cycle; in the Frame row, set Reset To to 0 and End to 39. Next, we tell the Find window how fast to count by setting the Increment to 1; this will set it up to count up 1 number in our range for every message meeting our requirement of Entity 1. Finally, set the Start value to 14. It is important to set the Start value only after setting the other values in the row, as otherwise it may get blanked out and you'll have to enter it again.
Make sure the Find Type is Replace, and the Search on Selected Range box is checked (if you haven't already, make sure to define your range of blocks 0-100 by selecting those blocks on the filmstrip). Click Find FIrst, and All to confirm, and the operation is completed in seconds. Obviously, performing this same operation by manually editing the Block Tree would be very time consuming, but now is completed in seconds.
This only scratches the surface on the many uses of this new set of features. Their real power will only become evident when you use them to perform your own editing functions.
This concludes Tutorial 15. Next up, we discuss the different packaging options for distributing your project.