Prefabs: Difference between revisions
No edit summary |
mNo edit summary |
||
Line 1: | Line 1: | ||
{{Original_Reference|all|3008}} | {{Original_Reference|all|3008}} | ||
(see also [[Prefab Comments]]) | |||
A prefab is basically a map file with a different extension ('''.pfb'''). It can be used to pack a collection of brushes/patches and entities into a file so that it can be re-used again. This can be useful for complex setups like doors or entities with a complex Stim/Response setup and might save a bit of work. | A prefab is basically a map file with a different extension ('''.pfb'''). It can be used to pack a collection of brushes/patches and entities into a file so that it can be re-used again. This can be useful for complex setups like doors or entities with a complex Stim/Response setup and might save a bit of work. |
Revision as of 21:24, 28 September 2009
Originally written by all on http://forums.thedarkmod.com/topic/3008
(see also Prefab Comments)
A prefab is basically a map file with a different extension (.pfb). It can be used to pack a collection of brushes/patches and entities into a file so that it can be re-used again. This can be useful for complex setups like doors or entities with a complex Stim/Response setup and might save a bit of work.
To create a prefab, just select your items in DarkRadiant and choose File > Save Selected as Prefab.... It's recommended to save them into the darkmod/prefabs folder which is the default in DarkRadiant.
To import a prefab, go to File > Import Prefab
.
If you want to save a collection of entities as a group, you just select them all, go to file-save selected as... save them as a .map, ideally called something appropriate like prefab_myobject.map
This means I can set up something like a streetlight mesh, two particle effects for the electric, a sound speaker, and the light entity for it, and then save it as one prefab object, so mappers can just drop it into their map.
To open the prefab you use file--load rather than file--open.
Notice there's also a 'save selection as prefab' and 'load prefab' buttons in the edit menu.
When creating prefabs with multiple components of the same name, eg, a cupboard with two doors, don't name them eg, door1 & door2 as although the prefab may insert and work correctly you may find the renumbering confusing, especially if they have handles bound to them and targets. door2 handle may work correctly and be bound to the correct door but it might be named handle1. Instead, name them eg, doorA & doorB so if they then get renumbering on insertion doorA2 & doorB2 with handleA2 & handleB2 then there is no confusion as to what goes where.
See also Prefab Comments
Rotating Prefabs
Hit CTRL+R to change rotation modes. They'll collectively use a single axis.