29 #include "../../idlib/precompiled.h"
87 for(
int i = 0;
i <
c;
i++) {
145 if(!
strcmp((*pDoc)->renderMaterial->GetFileName(), filename) && (*pDoc)->applyWaiting)
157 if((*pDoc)->applyWaiting)
169 if(!
strcmp((*pDoc)->renderMaterial->GetFileName(), filename))
284 if(!
strcmp((*pDoc)->renderMaterial->GetFileName(), filename))
316 if(!
strcmp((*pDoc)->renderMaterial->GetFileName(), filename))
345 if(!
strcmp((*pDoc)->renderMaterial->GetFileName(), filename)) {
411 if(!(*pDoc)->name.Icmp(material->
GetName()))
474 char *declText = (
char *) _alloca( material->
GetTextLength() + 1 );
578 for(
int i = 0;
i <
c;
i++) {
614 for(
int i = 0;
i <
c;
i++) {
675 char *declText = (
char *) _alloca( material->
GetTextLength() + 1 );
678 idStr text = declText;
712 if(mat->GetTextLength() < 1)
730 for(
int i = 0;
i <
c;
i++) {
731 va_start( argptr, notifyType );
746 materialViews[
i]->MV_OnMaterialSaveFile(va_arg(argptr,
const char*));
755 materialViews[
i]->MV_OnMaterialStageAdd(materialDoc, va_arg(argptr,
int));
758 materialViews[
i]->MV_OnMaterialStageDelete(materialDoc, va_arg(argptr,
int));
762 int from = va_arg(argptr,
int);
763 int to = va_arg(argptr,
int);
769 int stage = va_arg(argptr,
int);
770 const char* attribName = va_arg(argptr,
const char*);
771 materialViews[
i]->MV_OnMaterialAttributeChanged(materialDoc, stage, attribName);
776 const char* oldName = va_arg(argptr,
const char*);
782 const char* filename = va_arg(argptr,
const char*);
virtual void SetMaterialDocManager(MaterialDocManager *docManager)
Sets the material document manager for this view instance.
bool IsRedoAvailable()
Returns true if a redo operation is available.
MaterialDoc * GetInProgressDoc(idMaterial *material)
Checks the current list of in progress MaterialDoc objects to see if a MaterialDoc object already exi...
bool IsCopyMaterial()
Returns true if there is a material in the copy buffer.
void ClearCopy()
Clears the copy buffer for a material.
Undo/Redo operation for moving materials.
int GetInt(const char *key, const char *defaultString="0") const
bool IsCopyStage()
Returns true if there is a stage in the copy buffer.
assert(prefInfo.fullscreenBtn)
void Delete()
Deletes the material.
void Save()
Saves the material.
idStr GetUniqueMaterialName(idStr name)
Returns a unique material name given a base name.
void DeleteMaterial(MaterialDoc *material, bool addUndo=true)
Deletes a material.
void ApplyAll()
Applies all materials that have been changed.
idMaterial * renderMaterial
idStr GetCopyMaterialName()
Returns the name of the material in the copy buffer.
void SaveAllMaterials()
Saves all materials that have been changed.
virtual void ReloadFile(const char *filename, bool force)=0
Undo/Redo operation for adding materials.
idList< MaterialView * > materialViews
void MaterialSaved(MaterialDoc *materialDoc)
Called when a material has been saved and notifies all views of the save.
void StageDeleted(MaterialDoc *materialDoc, int stageNum)
Called when a stage has been deleted and notifies all views of the change.
void RegisterMaterialView(MaterialView *view)
Registers an object to receive notifications about changes made to materials.
Type * GetIndex(int index) const
const char * GetName(void) const
void GetCopyStageInfo(int &type, idStr &name)
Returns information about the stage in the copy buffer.
virtual idDecl * CreateNewDecl(declType_t type, const char *name, const char *fileName)=0
idList< MaterialModifier * > undoModifiers
Base class for modifications that can be made to a material that can be undone and redone...
void ClearCopyStage()
Clears the copy buffer for copied stages.
void Undo()
Performs the first available undo operation.
GLuint GLuint GLsizei GLenum type
virtual const idMaterial * FindMaterial(const char *name, bool makeDefault=true)=0
void ApplyMaterialChanges(bool force=false)
Applies any changes to the material.
~MaterialDocManager(void)
Destructor for MaterialDocManager.
void NotifyViews(MaterialDoc *materialDoc, int notifyType,...)
Notifies all registered views of a material event.
int Icmp(const char *text) const
bool DoesFileNeedApply(const char *filename)
Returns true if the specified file needs to be applied and false otherwise.
idHashTable< MaterialDoc * > inProgressMaterials
void Set(const char *key, Type &value)
void UnRegisterMaterialView(MaterialView *view)
Tells the MaterialDocManager to stop sending notifications to a view.
Responsible for managing a single material that is being viewed and/or edited.
const char * GetString(const char *key, const char *defaultString="") const
void AddMaterialUndoModifier(MaterialModifier *mod, bool clearRedo=true)
Adds an undo operation to the undo buffer.
void UnRegisterAllMaterialViews()
Unregisters all of the views that are registered to get material change notifications.
void StageAdded(MaterialDoc *materialDoc, int stageNum)
Called when a stage is added and notifies all views of the addition.
virtual const char * DefaultDefinition(void) const
void CopyStage(MaterialDoc *materialDoc, int stageNum)
Prepares a material stage for a copy/paste operation.
void AddStage(int stageType, const char *stageName, bool addUndo=true)
Adds a stage to the material.
void SaveFile(const char *filename)
Saves all materials in the specified file.
idList< MaterialModifier * > redoModifiers
void AddMaterialRedoModifier(MaterialModifier *mod)
Adds a redo operation to the redo buffer.
int GetStageCount()
Returns the number of stages in this material.
MaterialDoc * CreateMaterialDoc(const char *materialName)
Creates a MaterialDoc object for the specified material name.
void PasteStage(MaterialDoc *materialDoc)
Performs a paste operation of the stage in the copy buffer.
void ClearUndo()
Clears the entire undo buffer.
const char * Right(int len, idStr &result) const
bool Remove(const char *key)
int Find(const char c, int start=0, int end=-1) const
void MaterialChanged(MaterialDoc *materialDoc)
Called when a material has been edited and notifies all views of the change.
void SaveMaterial(MaterialDoc *material)
Saves a single material.
void Redo()
Performs the first available redo operation.
void MaterialApplied(MaterialDoc *materialDoc)
Called when a material has been applied and notifies all views of the apply.
MaterialDocManager(void)
Constructor for MaterialDocManager.
void ApplyMaterial(MaterialDoc *materialDoc)
Applys changes to a material.
Structure used to store the user defined search parameters.
void SetText(const char *text)
void SetSelectedMaterial(idMaterial *material)
Tells the MaterialDocManager which material has been selected for editing.
idDeclManager * declManager
void PasteMaterial(const char *name, const char *filename)
Performs a material paste operation for a material in the copy buffer.
bool Get(const char *key, Type **value=NULL) const
void AttributeChanged(MaterialDoc *materialDoc, int stage, const char *attribName)
Called when a material attribute has been edited and notifies all views of the change.
void StageMoved(MaterialDoc *materialDoc, int from, int to)
Called when a stage has been movied and notifies all views of the change.
int Append(const type &obj)
virtual const idDecl * FindDeclWithoutParsing(declType_t type, const char *name, bool makeDefault=true)=0
MaterialDocManager * manager
void SetData(int stage, idDict *data)
Sets the entire dictionary for a material or stage.
bool IsFileModified(const char *filename)
Returns true if the specified file has been modified.
bool RemoveIndex(int index)
void ClearRedo()
Clears the redo buffer.
bool DoesAnyNeedApply()
Returns true if any material needs to be applied.
const char * c_str(void) const
void ReloadFile(const char *filename)
Reloads a specified file.
void SetRenderMaterial(idMaterial *material, bool parseMaterial=true, bool parseRenderMatierial=false)
Initializes the MaterialDoc instance with a specific idMaterial.
MaterialDoc * currentMaterial
Undo/Redo operation for deleting materials.
void ApplyFile(const char *filename)
Applies all materials in the specified filename.
void GetText(char *text) const
void AddMaterial(const char *name, const char *filename, const char *sourceText=NULL, bool addUndo=true)
Adds a material.
bool IsUndoAvailable()
Returns true if an undo operation is available.
void CopyMaterial(MaterialDoc *materialDoc=NULL, bool cut=false)
Prepares a material for a copy/cut and paste operations.
char * va(const char *fmt,...)
MEStage_t GetStage(int stage)
Returns a copy of the specified stage.
bool IsAnyModified()
Returns true if any material has been modified.
void RedoAddMaterial(const char *name, bool clearData=true)
Used to redo an add material and undo a delete material.
int GetTextLength(void) const
bool Remove(const type &obj)
void MaterialNameChanged(const char *oldName, MaterialDoc *materialDoc)
Called when a material name has been changed and notifies all views of the change.
bool FindMaterial(const char *name, MaterialSearchData_t *searchData, bool checkName)
Searches for a material that matches the specified search data.