Defining custom Filters in DarkRadiant: Difference between revisions

From The DarkMod Wiki
Jump to navigationJump to search
mNo edit summary
Line 31: Line 31:
* '''entityclass''': Filters certain entity classes (like light_torchflame, worldspawn, etc.)
* '''entityclass''': Filters certain entity classes (like light_torchflame, worldspawn, etc.)
* '''texture''': This affects all shader names (on primitives as well as on models)
* '''texture''': This affects all shader names (on primitives as well as on models)
* '''object''': This can be used to filter patches for instance.
* '''object''': This can be used to filter patches.


== How to display Patches only ==
== How to display Patches only ==

Revision as of 21:16, 29 April 2007

Filters can be used to hide certain parts of your map file in DarkRadiant. The filtersystem works independently from the regioning or show/hide commands. This affects the model preview window as well. The defined Filters can be toggled through the Filters menu in the menubar. You can have multiple filters active at the same time.

Defining Filters

The stock filters are defined in the file games/doom3.game in your DarkRadiant installation folder (where the EXE is located in). The general tag structure is:

<filtersystem>
	<filter name="...">
	 	<filterCriterion>...</filterCriterion>
	 	<filterCriterion>...</filterCriterion>
	</filter>
</filtersystem>

There is one global <filtersystem> tag with several filters defined beneath it. Each <filter> tag can have one or more <filterCriterion> elements which describe the rules of the filter.

An easy example is the caulk filter:

<filter name="Caulk">
	<filterCriterion type="texture" match="textures/common/caulk" action="hide" />
</filter>

It has only one criterion which evaluates the texture of the visited object. If the texture matches the regex "textures/common/caulk" the element is hidden. Simple as that.

Regular expressions (regex) can be used within the match attribute of a certain filter, which can be really powerful.

More complex Filters

It's perfectly possible to define multiple criterions for a filter, the <filterCriterion> tags are evaluated one after the other. Take a look at the "All Entities" filter:

<filter name="All entities">
	<filterCriterion type="entityclass" match=".*" action="hide" />
	<filterCriterion type="entityclass" match="worldspawn" action="show" />
</filter>

The first criterion filters all entities with the match .* (matches everything). As worldspawn is also an entity, this criterion alone would hide everything, that's why the second criterion overrules the first one by showing the worldspawn entity.

What filter types do exist?

You can filter the following types:

  • entityclass: Filters certain entity classes (like light_torchflame, worldspawn, etc.)
  • texture: This affects all shader names (on primitives as well as on models)
  • object: This can be used to filter patches.

How to display Patches only

The following filter can be used to show patches only:

<filter name="Display Patches Only">
	<filterCriterion type="texture" match=".*" action="hide" />
	<filterCriterion type="entityclass" match=".*" action="hide" />
	<filterCriterion type="entityclass" match="worldspawn" action="show" />
	<filterCriterion type="object" match="patch" action="show" />
</filter>

How to display Brushes only

Use this filter to display brushes only (type="object" match="brush" doesn't work).

<filter name="Display Brushes Only">
	<filterCriterion type="entityclass" match=".*" action="hide" />
	<filterCriterion type="entityclass" match="worldspawn" " action="show" />
	<filterCriterion type="object" match="patch" action="hide" />
</filter>