Once I get that upgrade to 36-hour days, I will tackle that. – Mychaeel
UE2:BrushBuilder (U2XMP)
Object >> BrushBuilder |
Contents
- Package:
- Editor
- Direct subclasses:
- ConeBuilder, CubeBuilder, CurvedStairBuilder, CylinderBuilder, LinearStairBuilder, SheetBuilder, SpiralStairBuilder, TerrainBuilder, TetrahedronBuilder, VolumetricBuilder
- This class in other games:
- UT, U2, UE2Runtime, UT2003, UT2004, UDK, UT3
Base class of UnrealEd brush builders.
Tips for writing brush builders:
Always validate the user-specified parameters and call BadParameters function if anything is wrong, instead of actually building geometry. If you build an invalid brush due to bad user parameters, you'll cause an extraordinary amount of pain for the poor user.
When generating polygons with more than 3 vertices, be sure all the polygon's vertices are coplanar! Out-of-plane polygons will cause geometry to be corrupted.
Properties
Property group 'BrushBuilder'
BitmapFilename
Type: string
File name (without extension) of the brush builder's toolbox icon. The icon should be in 24bit BMP file format with dimensions of 30x30 pixels. UnrealEd will look for the file in the System/EditorRes directory.
Default value: "BBGeneric"
ToolTip
Type: string
The tooltip for the brush builder's toolbox icon.
Default value: "Generic Builder"
Internal variables
These properties store the internal state of the brush builder and are not accessible from within UnrealScript because they are declared as private variables.
Group
Type: name
Modifiers: private
The group name for the generated brush. This value is set with the BeginBrush function's second parameter and will become the final brush's Group name.
MergeCoplanars
Type: bool
Modifiers: private
Whether co-planar faces of the brush should be merged. This value is set with the BeginBrush function's first parameter.
Polys
Type: array<BuilderPoly>
Modifiers: private
The list of polygons for the brush to build. The various Poly* functions add items to this list and the GetPolyCount function returns the number of items in this list.
Vertices
Type: array<Object.Vector>
Modifiers: private
The list of vertices for the brush to build. The functions Vertex3f and Vertexv add new items to this list and return the new item's index. The function GetVertexCount returns the number of items in this list, the function GetVertex returns a specific item.
Structs
BuilderPoly
Description of a polygon for the brush to build.
- array<int> VertexIndices
- The list of vertices defining this polygon.
- int Direction
- The direction of the polygon as specified by the first parameter of the Poly3i, Poly4i and PolyBegin functions.
- name Item
- The item name of the polygon as specified by the optional last parameter of the Poly3i, Poly4i and PolyBegin functions.
- int PolyFlags
- The flags of the polygon as specified by the optional last parameter of the Poly3i, Poly4i and PolyBegin functions.
Functions
Native functions
BadParameters
Displays a simple message box with the msg parameter's value as the message. If the parameter is omitted, a default message about bad brush builder parameters is displayed. This function always returns False.
BeginBrush
Initializes the brush builder. This function should be the first to call after verifying that the user-specified parameters are valid.
EndBrush
Finalizes the brush building process and returns True. This is usually the last function to call during the brush building process.
GetPolyCount
Returns the number of polygons defined so far.
GetVertex
Returns the vertex with the specified index.
GetVertexCount
Returns the number of vertices defined so far.
Poly3i
Defines a triangular polygon. i, j and k are indices of the vertices to use for the polygon. If Direction is negative, the normal of the polygon is reversed.
Poly4i
Defines a quadrangular polygon. i, j, k and l are indices of the vertices to use for the polygon. Make sure all four vertices are on a plane! If Direction is negative, the normal of the polygon is reversed.
PolyBegin
Begins the definition of a polygon consisting of a custom number of vertices. Vertices are specified with the Polyi function and the polygon is finalized with the PolyEnd function. If Direction is negative, the normal of the polygon is reversed.
PolyEnd
Finalizes a polygon started with the PolyBegin function.
Polyi
Specifies the index of a vertex to include in the polygon currently being built with the PolyBegin and PolyEnd functions.
Vertex3f
Creates a vertex with coordinate components corresponding to the three float parameters.
Vertexv
Creates a vertex with coordinates corresponding to the vector parameter.
Events
Build
This function is called when the user left-clicked the brush builder icon or the Build button in the brush builder properties window.
Override this function in your subclass to verify user-specified parameters. If any parameter would result in an invalid brush to be build, call BadParameters and return false, e.g. with return BadParameters();
, to abort the building process. Otherwise call BeginBrush to start defining the brush. Call Vertex* functions to specify vertices and Poly* functions to define polygons. These calls can be mixed in any way you want, just make sure that in the end all vertex indices used in polygon definitions are actually valid. To finalize the brush, call EndBrush and return true, e.g. with return EndBrush();
, to signal success.