doom3-gpl
Doom 3 GPL source release
|
Responsible for managing the materials that are being viewed and/or edited. More...
#include <MaterialDocManager.h>
Public Member Functions | |
MaterialDocManager (void) | |
Constructor for MaterialDocManager. More... | |
~MaterialDocManager (void) | |
Destructor for MaterialDocManager. More... | |
void | RegisterMaterialView (MaterialView *view) |
Registers an object to receive notifications about changes made to materials. More... | |
void | UnRegisterMaterialView (MaterialView *view) |
Tells the MaterialDocManager to stop sending notifications to a view. More... | |
void | UnRegisterAllMaterialViews () |
Unregisters all of the views that are registered to get material change notifications. More... | |
void | SetSelectedMaterial (idMaterial *material) |
Tells the MaterialDocManager which material has been selected for editing. More... | |
MaterialDoc * | GetCurrentMaterialDoc () |
bool | DoesFileNeedApply (const char *filename) |
Returns true if the specified file needs to be applied and false otherwise. More... | |
bool | DoesAnyNeedApply () |
Returns true if any material needs to be applied. More... | |
bool | IsFileModified (const char *filename) |
Returns true if the specified file has been modified. More... | |
bool | IsAnyModified () |
Returns true if any material has been modified. More... | |
void | AddMaterial (const char *name, const char *filename, const char *sourceText=NULL, bool addUndo=true) |
Adds a material. More... | |
void | RedoAddMaterial (const char *name, bool clearData=true) |
Used to redo an add material and undo a delete material. More... | |
void | DeleteMaterial (MaterialDoc *material, bool addUndo=true) |
Deletes a material. More... | |
void | ApplyMaterial (MaterialDoc *materialDoc) |
Applys changes to a material. More... | |
void | ApplyFile (const char *filename) |
Applies all materials in the specified filename. More... | |
void | ApplyAll () |
Applies all materials that have been changed. More... | |
void | SaveMaterial (MaterialDoc *material) |
Saves a single material. More... | |
void | SaveFile (const char *filename) |
Saves all materials in the specified file. More... | |
void | SaveAllMaterials () |
Saves all materials that have been changed. More... | |
void | ReloadFile (const char *filename) |
Reloads a specified file. More... | |
MaterialDoc * | CreateMaterialDoc (const char *materialName) |
Creates a MaterialDoc object for the specified material name. More... | |
MaterialDoc * | CreateMaterialDoc (idMaterial *material) |
Creates a MaterialDoc object for the specified material. More... | |
MaterialDoc * | GetInProgressDoc (idMaterial *material) |
Checks the current list of in progress MaterialDoc objects to see if a MaterialDoc object already exists. More... | |
void | CopyMaterial (MaterialDoc *materialDoc=NULL, bool cut=false) |
Prepares a material for a copy/cut and paste operations. More... | |
void | ClearCopy () |
Clears the copy buffer for a material. More... | |
bool | IsCopyMaterial () |
Returns true if there is a material in the copy buffer. More... | |
idStr | GetCopyMaterialName () |
Returns the name of the material in the copy buffer. More... | |
void | PasteMaterial (const char *name, const char *filename) |
Performs a material paste operation for a material in the copy buffer. More... | |
void | CopyStage (MaterialDoc *materialDoc, int stageNum) |
Prepares a material stage for a copy/paste operation. More... | |
void | ClearCopyStage () |
Clears the copy buffer for copied stages. More... | |
bool | IsCopyStage () |
Returns true if there is a stage in the copy buffer. More... | |
void | PasteStage (MaterialDoc *materialDoc) |
Performs a paste operation of the stage in the copy buffer. More... | |
void | GetCopyStageInfo (int &type, idStr &name) |
Returns information about the stage in the copy buffer. More... | |
void | Undo () |
Performs the first available undo operation. More... | |
bool | IsUndoAvailable () |
Returns true if an undo operation is available. More... | |
void | ClearUndo () |
Clears the entire undo buffer. More... | |
void | Redo () |
Performs the first available redo operation. More... | |
bool | IsRedoAvailable () |
Returns true if a redo operation is available. More... | |
void | ClearRedo () |
Clears the redo buffer. More... | |
void | AddMaterialUndoModifier (MaterialModifier *mod, bool clearRedo=true) |
Adds an undo operation to the undo buffer. More... | |
void | AddMaterialRedoModifier (MaterialModifier *mod) |
Adds a redo operation to the redo buffer. More... | |
bool | FindMaterial (const char *name, MaterialSearchData_t *searchData, bool checkName) |
Searches for a material that matches the specified search data. More... | |
idStr | GetUniqueMaterialName (idStr name) |
Returns a unique material name given a base name. More... | |
Protected Types | |
enum | { SELECTION_CHANGE, MATERIAL_CHANGE, MATERIAL_APPLY, MATERIAL_SAVE, MATERIAL_SAVE_FILE, MATERIAL_ADD, MATERIAL_DELETE, MATERIAL_ADD_STAGE, MATERIAL_DELETE_STAGE, MATERIAL_MOVE_STAGE, MATERIAL_ATTRIBUTE_CHANGE, MATERIAL_NAME_CHANGE, FILE_RELOAD } |
View notification types. More... | |
Protected Member Functions | |
void | NotifyViews (MaterialDoc *materialDoc, int notifyType,...) |
Notifies all registered views of a material event. More... | |
void | MaterialChanged (MaterialDoc *materialDoc) |
Called when a material has been edited and notifies all views of the change. More... | |
void | MaterialApplied (MaterialDoc *materialDoc) |
Called when a material has been applied and notifies all views of the apply. More... | |
void | MaterialSaved (MaterialDoc *materialDoc) |
Called when a material has been saved and notifies all views of the save. More... | |
void | MaterialNameChanged (const char *oldName, MaterialDoc *materialDoc) |
Called when a material name has been changed and notifies all views of the change. More... | |
void | StageAdded (MaterialDoc *materialDoc, int stageNum) |
Called when a stage is added and notifies all views of the addition. More... | |
void | StageDeleted (MaterialDoc *materialDoc, int stageNum) |
Called when a stage has been deleted and notifies all views of the change. More... | |
void | StageMoved (MaterialDoc *materialDoc, int from, int to) |
Called when a stage has been movied and notifies all views of the change. More... | |
void | AttributeChanged (MaterialDoc *materialDoc, int stage, const char *attribName) |
Called when a material attribute has been edited and notifies all views of the change. More... | |
Protected Attributes | |
friend | MaterialDoc |
idList< MaterialView * > | materialViews |
MaterialDoc * | currentMaterial |
idHashTable< MaterialDoc * > | inProgressMaterials |
idList< MaterialModifier * > | undoModifiers |
idList< MaterialModifier * > | redoModifiers |
bool | cutMaterial |
idStr | copyMaterial |
idStr | copyStageMaterial |
MEStage_t | copyStage |
Responsible for managing the materials that are being viewed and/or edited.
Definition at line 41 of file MaterialDocManager.h.
|
protected |
View notification types.
Definition at line 120 of file MaterialDocManager.h.
MaterialDocManager::MaterialDocManager | ( | void | ) |
Constructor for MaterialDocManager.
Definition at line 39 of file MaterialDocManager.cpp.
MaterialDocManager::~MaterialDocManager | ( | void | ) |
Destructor for MaterialDocManager.
Definition at line 47 of file MaterialDocManager.cpp.
void MaterialDocManager::AddMaterial | ( | const char * | name, |
const char * | filename, | ||
const char * | sourceText = NULL , |
||
bool | addUndo = true |
||
) |
Adds a material.
name | The name of the material. |
filename | The file to place the material in. |
sourceText | The initial material definition. |
addUndo | Can this operation be undone. |
Definition at line 189 of file MaterialDocManager.cpp.
void MaterialDocManager::AddMaterialRedoModifier | ( | MaterialModifier * | mod | ) |
Adds a redo operation to the redo buffer.
mod | The MaterialModifier object that contains the redo data. |
Definition at line 641 of file MaterialDocManager.cpp.
void MaterialDocManager::AddMaterialUndoModifier | ( | MaterialModifier * | mod, |
bool | clearRedo = true |
||
) |
Adds an undo operation to the undo buffer.
mod | The MaterialModifier object that contains the undo data. |
clearRedo | Should we clear the redo buffer. |
Definition at line 625 of file MaterialDocManager.cpp.
void MaterialDocManager::ApplyAll | ( | ) |
Applies all materials that have been changed.
Definition at line 292 of file MaterialDocManager.cpp.
Applies all materials in the specified filename.
filename | The file to apply. |
Definition at line 280 of file MaterialDocManager.cpp.
void MaterialDocManager::ApplyMaterial | ( | MaterialDoc * | materialDoc | ) |
Applys changes to a material.
materialDoc | The material to be applied. |
Definition at line 271 of file MaterialDocManager.cpp.
|
protected |
Called when a material attribute has been edited and notifies all views of the change.
materialDoc | The material that has changed. |
stage | The stage that contains the changed attribute. |
attribName | The name of the attribute that changed. |
Definition at line 890 of file MaterialDocManager.cpp.
void MaterialDocManager::ClearCopy | ( | ) |
Clears the copy buffer for a material.
Definition at line 436 of file MaterialDocManager.cpp.
void MaterialDocManager::ClearCopyStage | ( | ) |
Clears the copy buffer for copied stages.
Definition at line 510 of file MaterialDocManager.cpp.
void MaterialDocManager::ClearRedo | ( | ) |
Clears the redo buffer.
Definition at line 611 of file MaterialDocManager.cpp.
void MaterialDocManager::ClearUndo | ( | ) |
Clears the entire undo buffer.
Definition at line 575 of file MaterialDocManager.cpp.
void MaterialDocManager::CopyMaterial | ( | MaterialDoc * | materialDoc = NULL , |
bool | cut = false |
||
) |
Prepares a material for a copy/cut and paste operations.
materialDoc | The material to copy. |
cut | Is this a cut operation. |
Definition at line 423 of file MaterialDocManager.cpp.
void MaterialDocManager::CopyStage | ( | MaterialDoc * | materialDoc, |
int | stageNum | ||
) |
Prepares a material stage for a copy/paste operation.
materialDoc | The materialDoc that contains the stage to be copied. |
stageNum | the stage to copy. |
Definition at line 497 of file MaterialDocManager.cpp.
MaterialDoc * MaterialDocManager::CreateMaterialDoc | ( | const char * | materialName | ) |
Creates a MaterialDoc object for the specified material name.
If a MaterialDoc object already exists then it is used.
materialName | The name of the material for which to create a MaterialDoc object. |
Definition at line 367 of file MaterialDocManager.cpp.
MaterialDoc * MaterialDocManager::CreateMaterialDoc | ( | idMaterial * | material | ) |
Creates a MaterialDoc object for the specified material.
If a MaterialDoc object already exists then it is used.
material | The material for which to create a MaterialDoc object. |
Definition at line 378 of file MaterialDocManager.cpp.
void MaterialDocManager::DeleteMaterial | ( | MaterialDoc * | material, |
bool | addUndo = true |
||
) |
Deletes a material.
material | The material to be deleted. |
addUndo | Can this operation be undone. |
Definition at line 252 of file MaterialDocManager.cpp.
bool MaterialDocManager::DoesAnyNeedApply | ( | ) |
Returns true if any material needs to be applied.
Definition at line 154 of file MaterialDocManager.cpp.
Returns true if the specified file needs to be applied and false otherwise.
Definition at line 142 of file MaterialDocManager.cpp.
bool MaterialDocManager::FindMaterial | ( | const char * | name, |
MaterialSearchData_t * | searchData, | ||
bool | checkName | ||
) |
Searches for a material that matches the specified search data.
name | The name of the material to search. |
searchData | The search parameters. |
checkName | If true then the name of the material will be checked along with the material text. |
Definition at line 655 of file MaterialDocManager.cpp.
idStr MaterialDocManager::GetCopyMaterialName | ( | ) |
Returns the name of the material in the copy buffer.
Definition at line 450 of file MaterialDocManager.cpp.
Returns information about the stage in the copy buffer.
type | Holds the type of the stage in the copy buffer. |
name | Hold the name of the stage in the copy buffer. |
Definition at line 542 of file MaterialDocManager.cpp.
|
inline |
Definition at line 54 of file MaterialDocManager.h.
MaterialDoc * MaterialDocManager::GetInProgressDoc | ( | idMaterial * | material | ) |
Checks the current list of in progress MaterialDoc objects to see if a MaterialDoc object already exists.
material | The material to check for. |
Definition at line 405 of file MaterialDocManager.cpp.
Returns a unique material name given a base name.
This is used to resolve materials with the same name.
name | The base name of the material. |
Definition at line 697 of file MaterialDocManager.cpp.
bool MaterialDocManager::IsAnyModified | ( | ) |
Returns true if any material has been modified.
Definition at line 178 of file MaterialDocManager.cpp.
bool MaterialDocManager::IsCopyMaterial | ( | ) |
Returns true if there is a material in the copy buffer.
Definition at line 443 of file MaterialDocManager.cpp.
bool MaterialDocManager::IsCopyStage | ( | ) |
Returns true if there is a stage in the copy buffer.
Definition at line 518 of file MaterialDocManager.cpp.
Returns true if the specified file has been modified.
Definition at line 166 of file MaterialDocManager.cpp.
bool MaterialDocManager::IsRedoAvailable | ( | ) |
Returns true if a redo operation is available.
Definition at line 604 of file MaterialDocManager.cpp.
bool MaterialDocManager::IsUndoAvailable | ( | ) |
Returns true if an undo operation is available.
Definition at line 568 of file MaterialDocManager.cpp.
|
protected |
Called when a material has been applied and notifies all views of the apply.
materialDoc | The material that has been applied. |
Definition at line 810 of file MaterialDocManager.cpp.
|
protected |
Called when a material has been edited and notifies all views of the change.
materialDoc | The material that has changed. |
Definition at line 795 of file MaterialDocManager.cpp.
|
protected |
Called when a material name has been changed and notifies all views of the change.
materialDoc | The material that has changed. |
Definition at line 842 of file MaterialDocManager.cpp.
|
protected |
Called when a material has been saved and notifies all views of the save.
materialDoc | The material that has been saved. |
Definition at line 820 of file MaterialDocManager.cpp.
|
protected |
Notifies all registered views of a material event.
materialDoc | The material that has been affected. |
notifyType | The type of event that has occured. |
... | Notification specific data. See MaterialView. |
Definition at line 725 of file MaterialDocManager.cpp.
Performs a material paste operation for a material in the copy buffer.
name | The new name for the material that is being copied. |
filename | The file to paste the material in. |
Definition at line 459 of file MaterialDocManager.cpp.
void MaterialDocManager::PasteStage | ( | MaterialDoc * | materialDoc | ) |
Performs a paste operation of the stage in the copy buffer.
materialDoc | The materialDoc to paste the stage in. |
Definition at line 526 of file MaterialDocManager.cpp.
Performs the first available redo operation.
Definition at line 587 of file MaterialDocManager.cpp.
Used to redo an add material and undo a delete material.
The undo for adding a material deletes the material. Instead of adding a completely new material RedoAddMaterial finds the one that was just deleted and uses that.
name | The name of the material that was added/deleted. |
clearData | Should the material definition be reset to the default definition. |
Definition at line 224 of file MaterialDocManager.cpp.
void MaterialDocManager::RegisterMaterialView | ( | MaterialView * | view | ) |
Registers an object to receive notifications about changes made to materials.
view | The object that would like to receive material notifications. |
Definition at line 58 of file MaterialDocManager.cpp.
Reloads a specified file.
filename | The file to reload. |
Definition at line 338 of file MaterialDocManager.cpp.
void MaterialDocManager::SaveAllMaterials | ( | ) |
Saves all materials that have been changed.
Definition at line 327 of file MaterialDocManager.cpp.
Saves all materials in the specified file.
filename | The file to save. |
Definition at line 312 of file MaterialDocManager.cpp.
void MaterialDocManager::SaveMaterial | ( | MaterialDoc * | material | ) |
Saves a single material.
material | The material to save. |
Definition at line 303 of file MaterialDocManager.cpp.
void MaterialDocManager::SetSelectedMaterial | ( | idMaterial * | material | ) |
Tells the MaterialDocManager which material has been selected for editing.
material | The material that has been selected. |
Definition at line 97 of file MaterialDocManager.cpp.
|
protected |
Called when a stage is added and notifies all views of the addition.
materialDoc | The material that has changed. |
stageNum | The stage that was added. |
Definition at line 858 of file MaterialDocManager.cpp.
|
protected |
Called when a stage has been deleted and notifies all views of the change.
materialDoc | The material that has changed. |
stageNum | The stage that was deleted. |
Definition at line 868 of file MaterialDocManager.cpp.
|
protected |
Called when a stage has been movied and notifies all views of the change.
materialDoc | The material that has changed. |
from | The original position of the stage. |
to | The new position of the stage. |
Definition at line 879 of file MaterialDocManager.cpp.
Performs the first available undo operation.
Definition at line 552 of file MaterialDocManager.cpp.
void MaterialDocManager::UnRegisterAllMaterialViews | ( | ) |
Unregisters all of the views that are registered to get material change notifications.
Definition at line 83 of file MaterialDocManager.cpp.
void MaterialDocManager::UnRegisterMaterialView | ( | MaterialView * | view | ) |
Tells the MaterialDocManager to stop sending notifications to a view.
view | The view that no longer wants notifications. |
Definition at line 71 of file MaterialDocManager.cpp.
|
protected |
Definition at line 158 of file MaterialDocManager.h.
|
protected |
Definition at line 162 of file MaterialDocManager.h.
|
protected |
Definition at line 161 of file MaterialDocManager.h.
|
protected |
Definition at line 150 of file MaterialDocManager.h.
|
protected |
Definition at line 157 of file MaterialDocManager.h.
|
protected |
Definition at line 151 of file MaterialDocManager.h.
|
protected |
Definition at line 138 of file MaterialDocManager.h.
|
protected |
Definition at line 149 of file MaterialDocManager.h.
|
protected |
Definition at line 154 of file MaterialDocManager.h.
|
protected |
Definition at line 153 of file MaterialDocManager.h.