This class represents a CaWE "map" document. More...
#include "MapDocument.hpp"
Public Member Functions | |
MapDocumentT (GameConfigT *GameConfig, wxProgressDialog *ProgressDialog, const wxString &FileName) | |
The regular constructor for loading a cmap file from disk. More... | |
~MapDocumentT () | |
The destructor. More... | |
bool | OnSaveDocument (const wxString &FileName, bool IsAutoSave, IntrusivePtrT< cf::GameSys::EntityT > RootEntity=NULL) |
Saves the document. Non-const, as it updates the m_FileName member. More... | |
bool | SaveAs () |
Calls OnSaveDocument(). More... | |
bool | Save () |
Calls OnSaveDocument(). More... | |
void | SetChildFrame (ChildFrameT *ChildFrame) |
ChildFrameT * | GetChildFrame () const |
const wxString & | GetFileName () const |
MapDocAdapterT & | GetAdapter () |
cf::GameSys::WorldT & | GetScriptWorld () |
bool | CompatSubmitCommand (CommandT *Command) |
For compatibility only. This method should be removed. More... | |
IntrusivePtrT < MapEditor::CompMapEntityT > | GetRootMapEntity () const |
Returns the root "map" entity of the map. More... | |
void | GetAllElems (ArrayT< MapElementT * > &Elems) const |
Adds all elements in this map (entity representations and primitives) to the given array. More... | |
void | Insert (IntrusivePtrT< cf::GameSys::EntityT > Entity, IntrusivePtrT< cf::GameSys::EntityT > Parent, unsigned long Pos=0xFFFFFFFF) |
Inserts the given entity into the map. More... | |
void | Insert (MapPrimitiveT *Prim, IntrusivePtrT< MapEditor::CompMapEntityT > ParentEnt) |
Inserts the given primitive into the map, as a child of the given entity (the world or a custom entity). More... | |
void | Remove (IntrusivePtrT< cf::GameSys::EntityT > Entity) |
Removes the given entity from the map. More... | |
void | Remove (MapPrimitiveT *Prim) |
Removes the given primitive from the map. More... | |
ArrayT< MapElementT * > | GetElementsIn (const BoundingBox3fT &Box, bool InsideOnly, bool CenterOnly) const |
void | GetUsedMaterials (ArrayT< EditorMaterialI * > &UsedMaterials) const |
Determines all materials that are currently being used in the world (in brushes, Bezier patches and terrains), and returns the whole list via the UsedMaterials reference parameter. More... | |
OrthoBspTreeT * | GetBspTree () const |
GameConfigT * | GetGameConfig () const |
cf::SceneGraph::LightMapManT & | GetLightMapMan () |
PlantDescrManT & | GetPlantDescrMan () |
const ArrayT< PtsPointT > & | GetPointFilePoints () const |
const ArrayT< wxColour > & | GetPointFileColors () const |
bool | IsSnapEnabled () const |
Returns whether or not grid snap is enabled. Called by the tools and views to determine snap behavior. More... | |
int | GetGridSpacing () const |
bool | Is2DGridEnabled () const |
float | SnapToGrid (float f, bool Toggle) const |
Returns the given number f snapped to the grid if the grid is active, rounded to the nearest integer otherwise. If Toggle is true, the grid activity is considered toggled. More... | |
Vector3fT | SnapToGrid (const Vector3fT &Pos, bool Toggle, int AxisNoSnap) const |
Returns the given vector Pos snapped to the grid if the grid is active, rounded to the nearest integer otherwise. If Toggle is true, the grid activity is considered toggled. If AxisNoSnap is -1, all components of Pos are snapped to the grid. If AxisNoSnap is 0, 1 or 2, the corresponding component of Pos is returned unchanged. More... | |
bool | GetAutoGroupEntities () const |
const ArrayT< GroupT * > & | GetGroups () const |
Methods for managing the groups. More... | |
ArrayT< GroupT * > & | GetGroups () |
ArrayT< GroupT * > | GetAbandonedGroups () const |
Returns only the groups that are empty (have no members). More... | |
![]() | |
void | RegisterObserver (ObserverT *Obs) |
Registers the observer Obs for notification on updates of this class. More... | |
void | UnregisterObserver (ObserverT *Obs) |
Unregisters the observer Obs from further notification on updates of this class. More... | |
void | UpdateAllObservers (MapDocOtherDetailT OtherDetail) |
void | UpdateAllObservers_SelectionChanged (const ArrayT< MapElementT * > &OldSelection, const ArrayT< MapElementT * > &NewSelection) |
void | UpdateAllObservers_GroupsChanged () |
void | UpdateAllObservers_Created (const ArrayT< IntrusivePtrT< cf::GameSys::EntityT > > &Entities) |
void | UpdateAllObservers_Created (const ArrayT< MapPrimitiveT * > &Primitives) |
void | UpdateAllObservers_Deleted (const ArrayT< IntrusivePtrT< cf::GameSys::EntityT > > &Entites) |
void | UpdateAllObservers_Deleted (const ArrayT< MapPrimitiveT * > &Primitives) |
void | UpdateAllObservers_Modified (const ArrayT< MapElementT * > &MapElements, MapElemModDetailE Detail) |
void | UpdateAllObservers_Modified (const ArrayT< MapElementT * > &MapElements, MapElemModDetailE Detail, const ArrayT< BoundingBox3fT > &OldBounds) |
void | UpdateAllObservers_EntChanged (const ArrayT< IntrusivePtrT< MapEditor::CompMapEntityT > > &Entities, EntityModDetailE Detail) |
void | UpdateAllObservers_EntChanged (const ArrayT< IntrusivePtrT< cf::GameSys::EntityT > > &Entities, EntityModDetailE Detail) |
void | UpdateAllObservers_EntChanged (IntrusivePtrT< cf::GameSys::EntityT > Entity, EntityModDetailE Detail) |
void | UpdateAllObservers_VarChanged (const cf::TypeSys::VarBaseT &Var) |
void | UpdateAllObservers_SubjectDies () |
virtual | ~SubjectT () |
The virtual destructor. More... | |
Static Public Member Functions | |
static MapDocumentT * | CreateNew (GameConfigT *GameConfig) |
A named constructor for creating a new, empty map. More... | |
static MapDocumentT * | ImportHalfLife1Map (GameConfigT *GameConfig, wxProgressDialog *ProgressDialog, const wxString &FileName) |
A named constructor for importing a map in HL1 map file format. More... | |
static MapDocumentT * | ImportHalfLife2Vmf (GameConfigT *GameConfig, wxProgressDialog *ProgressDialog, const wxString &FileName) |
A named constructor for importing a map in HL2 vmf file format. More... | |
static MapDocumentT * | ImportDoom3Map (GameConfigT *GameConfig, wxProgressDialog *ProgressDialog, const wxString &FileName) |
A named constructor for importing a map in Doom3 map file format. More... | |
static void | SaveEntities (std::ostream &OutFile, IntrusivePtrT< cf::GameSys::EntityT > RootEntity) |
Static Public Attributes | |
static const unsigned int | CMAP_FILE_VERSION = 14 |
void | SetSelection (const ArrayT< MapElementT * > &NewSelection) |
Methods for managing the set of currently selected map elements. More... | |
const ArrayT< MapElementT * > & | GetSelection () const |
ArrayT< IntrusivePtrT < cf::GameSys::EntityT > > | GetSelectedEntities () const |
const BoundingBox3fT & | GetMostRecentSelBB () const |
Returns the most recent bounding-box of the selection. That is, it returns the bounding-box of the current selection, or (if nothing is selected) the bounding-box of the previous selection. More... | |
IntrusivePtrT < cf::GameSys::EntityT > | GetPasteParent () const |
Returns a suitable parent entity into which new objects from the clipboard should be pasted. More... | |
void | SetPasteParent (unsigned int ID) |
static void | Reduce (ArrayT< MapElementT * > &Elems) |
Reduces the given set of map elements by removing each element whose parent is in the set as well. More... | |
Additional Inherited Members | |
![]() | |
SubjectT () | |
The constructor. It is protected so that only derived classes can create instances of this class. More... | |
This class represents a CaWE "map" document.
MapDocumentT::MapDocumentT | ( | GameConfigT * | GameConfig, |
wxProgressDialog * | ProgressDialog, | ||
const wxString & | FileName | ||
) |
The regular constructor for loading a cmap file from disk.
GameConfig | The game configuration that will be used for the map. |
ProgressDialog | If non-NULL, this dialog is used to show the progress while loading the map. |
FileName | The name of the file to load the map from. |
MapDocumentT::~MapDocumentT | ( | ) |
The destructor.
bool MapDocumentT::CompatSubmitCommand | ( | CommandT * | Command | ) |
For compatibility only. This method should be removed.
|
static |
A named constructor for creating a new, empty map.
GameConfig | The game configuration that will be used for the map. |
Returns only the groups that are empty (have no members).
void MapDocumentT::GetAllElems | ( | ArrayT< MapElementT * > & | Elems | ) | const |
Adds all elements in this map (entity representations and primitives) to the given array.
The MapEntRepresT
instance of the world entity is always the first element that is added to the list.
const BoundingBox3fT & MapDocumentT::GetMostRecentSelBB | ( | ) | const |
Returns the most recent bounding-box of the selection. That is, it returns the bounding-box of the current selection, or (if nothing is selected) the bounding-box of the previous selection.
IntrusivePtrT< cf::GameSys::EntityT > MapDocumentT::GetPasteParent | ( | ) | const |
Returns a suitable parent entity into which new objects from the clipboard should be pasted.
IntrusivePtrT< MapEditor::CompMapEntityT > MapDocumentT::GetRootMapEntity | ( | ) | const |
Returns the root "map" entity of the map.
void MapDocumentT::GetUsedMaterials | ( | ArrayT< EditorMaterialI * > & | UsedMaterials | ) | const |
Determines all materials that are currently being used in the world (in brushes, Bezier patches and terrains), and returns the whole list via the UsedMaterials reference parameter.
|
static |
A named constructor for importing a map in Doom3 map file format.
GameConfig | The game configuration that will be used for the map. |
ProgressDialog | If non-NULL, this dialog is used to show the progress while loading the map. |
FileName | The name of the file to load the map from. |
|
static |
A named constructor for importing a map in HL1 map file format.
GameConfig | The game configuration that will be used for the map. |
ProgressDialog | If non-NULL, this dialog is used to show the progress while loading the map. |
FileName | The name of the file to load the map from. |
|
static |
A named constructor for importing a map in HL2 vmf file format.
GameConfig | The game configuration that will be used for the map. |
ProgressDialog | If non-NULL, this dialog is used to show the progress while loading the map. |
FileName | The name of the file to load the map from. |
void MapDocumentT::Insert | ( | IntrusivePtrT< cf::GameSys::EntityT > | Entity, |
IntrusivePtrT< cf::GameSys::EntityT > | Parent, | ||
unsigned long | Pos = 0xFFFFFFFF |
||
) |
Inserts the given entity into the map.
Callers should never attempt to insert an element into the world in a way other than calling this method, as it also inserts the element into the internal BSP tree that is used for rendering and culling.
void MapDocumentT::Insert | ( | MapPrimitiveT * | Prim, |
IntrusivePtrT< MapEditor::CompMapEntityT > | ParentEnt | ||
) |
Inserts the given primitive into the map, as a child of the given entity (the world or a custom entity).
Callers should never attempt to insert an element into the world in a way other than calling this method, as it also inserts the element into the internal BSP tree that is used for rendering and culling.
|
inline |
Returns whether or not grid snap is enabled. Called by the tools and views to determine snap behavior.
bool MapDocumentT::OnSaveDocument | ( | const wxString & | FileName, |
bool | IsAutoSave, | ||
IntrusivePtrT< cf::GameSys::EntityT > | RootEntity = NULL |
||
) |
Saves the document. Non-const, as it updates the m_FileName member.
|
static |
Reduces the given set of map elements by removing each element whose parent is in the set as well.
This is an important helper method for operations such as delete, copy-to-clipboard, save-as-prefab, etc.
void MapDocumentT::Remove | ( | IntrusivePtrT< cf::GameSys::EntityT > | Entity | ) |
Removes the given entity from the map.
The entity cannot be the root entity (the world).
void MapDocumentT::Remove | ( | MapPrimitiveT * | Prim | ) |
Removes the given primitive from the map.
bool MapDocumentT::Save | ( | ) |
Calls OnSaveDocument().
bool MapDocumentT::SaveAs | ( | ) |
Calls OnSaveDocument().
void MapDocumentT::SetSelection | ( | const ArrayT< MapElementT * > & | NewSelection | ) |
Methods for managing the set of currently selected map elements.
float MapDocumentT::SnapToGrid | ( | float | f, |
bool | Toggle | ||
) | const |
Returns the given number f snapped to the grid if the grid is active, rounded to the nearest integer otherwise. If Toggle is true, the grid activity is considered toggled.
Returns the given vector Pos snapped to the grid if the grid is active, rounded to the nearest integer otherwise. If Toggle is true, the grid activity is considered toggled. If AxisNoSnap is -1, all components of Pos are snapped to the grid. If AxisNoSnap is 0, 1 or 2, the corresponding component of Pos is returned unchanged.