Prefabs: Difference between revisions

From The DarkMod Wiki
Jump to navigationJump to search
No edit summary
m (add keys)
Line 5: Line 5:
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 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'''.
To import a prefab, go to <code>File > Import Prefab</code>.


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
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
Line 16: Line 16:


== Rotating Prefabs ==
== Rotating Prefabs ==
Hit ctrl-R to change rotation modes. They'll collectively use a single axis.
Hit {{key-ctrl}}+{{key|name=R}} to change rotation modes. They'll collectively use a single axis.


[[Category:Editing]]
{{editing}}

Revision as of 12:55, 13 October 2007

Originally written by all on http://forums.thedarkmod.com/topic/3008

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 seleciton as prefab' and 'load prefab' buttons in the edit menu.

Rotating Prefabs

Hit CTRL+R to change rotation modes. They'll collectively use a single axis.