Prefab Last edited 3 weeks ago2025-03-04 12:58:12 UTC

A prefabricated object or group of objects that can be inserted quickly into maps. Common prefab types include lights, furniture, office objects and small structures.
Hammer Editor's Prefab Factory (Tools menu) can be used to organize a collection of prefabs that can then be inserted into maps with a couple of clicks. It is packed into .ol files.

J.A.C.K. on the other hand doesn't support Hammer's .ol files, thus most prefabs today come in .rmf or .jmf files, which has one added benefit of simply being able to review the objects visually before inserting it into your own maps.

TrenchBroom uses none of the above map formats, using the .map file format natively instead.

Copying and pasting prefabs

In J.A.C.K./Hammer

Both J.A.C.K. and Hammer do not implement proper clipboard support. The copied brushwork/entity instead resides in the program's memory. Therefore, for copy and paste to work across different maps/files, the maps need to be opened in the same instance of the program.

A step-by-step guide on how to do this:
  1. Close all instance of the editor.
  2. Start the editor program directly (i.e. by not double-clicking the project files in the file explorer).
  3. Go to Menu > File > Open... (or press Ctrl+O) and open the map file.
  4. Go to Menu > File > Open... (or press Ctrl+O) again and open the prefab map file.
  5. Select the desired prefab in the prefab map.
  6. Press Ctrl+C to copy the prefab.
  7. Switch to the target map via Menu > Window > <your map name> (or Ctrl+Tab).
  8. Paste the prefab by pressing Ctrl+V.
  9. Switch back to the prefab map via Menu > Window > <the prefab map name> (or Ctrl+Tab) and repeat as needed.
  10. Save the project file when done.

In TrenchBroom

TrenchBroom (TB), unlike the previous two editors, do support copy and pasting entities across multiple instances of the program. In fact, it is a single document interface (SDI) program meaning a program instance can only open one file at a time. Copy and paste works across TB instances by virtue of TB using the .map file format (which is a human-readable text format) as its only native project file format, so copying entities simply put a fragment of a .map file into the clipboard, and pasting inserts valid .map file fragments in the clipboard into the project file. You can even copy prefabs directly from an online prefab page (e.g. https://spacehare.github.io/prefabs) because again, TB properly uses the operating system's clipboard.

Copying and pasting between 2 map files:
  1. Start TB, and go to Menu > File > Open... (or press Ctrl+O) and open the map file.
  2. Start another instance of TB, and open the prefab map file.
  3. Select the prefab in the prefab map.
  4. Switch to the TB instance with the project file open and paste the prefab into the project file.

Links

Comments

You must log in to post a comment. You can login or register a new account.

Shoutbox

Log in to add shouts of your own