doom3-gpl
Doom 3 GPL source release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
MaterialDocManager.cpp
Go to the documentation of this file.
1 /*
2 ===========================================================================
3 
4 Doom 3 GPL Source Code
5 Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
6 
7 This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
8 
9 Doom 3 Source Code is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13 
14 Doom 3 Source Code is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
21 
22 In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
23 
24 If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
25 
26 ===========================================================================
27 */
28 
29 #include "../../idlib/precompiled.h"
30 #pragma hdrstop
31 
32 #include "MaterialDocManager.h"
33 #include "MaterialView.h"
34 
35 
41  cutMaterial = false;
42 }
43 
49 
50  ClearUndo();
51  ClearRedo();
52 }
53 
59  ASSERT(view);
61  materialViews.Append(view);
62 
63  //Notify the view of myself
64  view->SetMaterialDocManager(this);
65 }
66 
72  ASSERT(view);
73  materialViews.Remove(view);
74 
75  //Remove the reference to myself
77 }
78 
84 
85  //Remove the reference to myself
86  int c = materialViews.Num();
87  for(int i = 0; i < c; i++) {
88  materialViews[i]->SetMaterialDocManager(NULL);
89  }
91 }
92 
98 
99  bool change = false;
100 
101  //Do we need to change the material
102  if(material) {
103  if(currentMaterial) {
104  if(strcmp(material->GetName(), currentMaterial->renderMaterial->GetName())) {
105  change = true;
106  }
107  } else {
108  change = true;
109  }
110  } else {
111  if(currentMaterial) {
112  change = true;
113  }
114  }
115 
116  //Now make the change
117  if(change) {
118  if(currentMaterial) {
119 
120  //Delete the material unless it has been changed
122  delete currentMaterial;
124  }
125  }
126 
127  MaterialDoc** tempDoc;
128  if(material && inProgressMaterials.Get(material->GetName(), &tempDoc)) {
129  currentMaterial = *tempDoc;
130 
131  } else {
133  }
134 
136  }
137 }
138 
142 bool MaterialDocManager::DoesFileNeedApply(const char* filename) {
143  for(int i = 0; i < inProgressMaterials.Num(); i++) {
145  if(!strcmp((*pDoc)->renderMaterial->GetFileName(), filename) && (*pDoc)->applyWaiting)
146  return true;
147  }
148  return false;
149 }
150 
155  for(int i = 0; i < inProgressMaterials.Num(); i++) {
157  if((*pDoc)->applyWaiting)
158  return true;
159  }
160  return false;
161 }
162 
166 bool MaterialDocManager::IsFileModified(const char* filename) {
167  for(int i = 0; i < inProgressMaterials.Num(); i++) {
169  if(!strcmp((*pDoc)->renderMaterial->GetFileName(), filename))
170  return true;
171  }
172  return false;
173 }
174 
179  return (inProgressMaterials.Num() > 0);
180 }
181 
189 void MaterialDocManager::AddMaterial(const char* name, const char* filename, const char* sourceText, bool addUndo) {
190 
191  if(addUndo) {
192  AddMaterialModifier* mod = new AddMaterialModifier(this, name, filename);
194  }
195 
196  MaterialDoc* newDoc = new MaterialDoc();
197  newDoc->manager = this;
198  newDoc->modified = true;
199 
200  idMaterial* rendMat = (idMaterial*)declManager->CreateNewDecl(DECL_MATERIAL, name, filename);
201 
202  if(sourceText) {
203  rendMat->SetText(sourceText);
204  }
205 
206  newDoc->SetRenderMaterial(rendMat, true, sourceText ? true : false);
207 
208  inProgressMaterials.Set(newDoc->name.c_str(), newDoc);
209 
210  NotifyViews(newDoc, MATERIAL_ADD);
211 
212  //Force an apply so the text will be generated to match the new file
213  newDoc->applyWaiting = true;
214  newDoc->ApplyMaterialChanges();
215 }
216 
224 void MaterialDocManager::RedoAddMaterial(const char* name, bool clearData) {
225 
226  MaterialDoc* newDoc = new MaterialDoc();
227  newDoc->manager = this;
228  newDoc->modified = true;
229 
230  idMaterial* rendMat = const_cast<idMaterial *>(declManager->FindMaterial(name, false));
231 
232  if(clearData) {
233  rendMat->SetText(rendMat->DefaultDefinition());
234  }
235 
236  newDoc->SetRenderMaterial(rendMat, true, true);
237 
238  inProgressMaterials.Set(newDoc->name.c_str(), newDoc);
239 
240  NotifyViews(newDoc, MATERIAL_ADD);
241 
242  //Force an apply so the text will be generated to match the new file
243  newDoc->applyWaiting = true;
244  newDoc->ApplyMaterialChanges();
245 }
246 
252 void MaterialDocManager::DeleteMaterial(MaterialDoc* material, bool addUndo) {
253 
254  assert(material);
255 
256  //This will just flag for delete. The actual delete will happen during the save
257  material->Delete();
258 
259  if(addUndo) {
260  DeleteMaterialModifier* mod = new DeleteMaterialModifier(this, material->name);
262  }
263 
264  NotifyViews(material, MATERIAL_DELETE);
265 }
266 
272  assert(materialDoc);
273  materialDoc->ApplyMaterialChanges();
274 }
275 
280 void MaterialDocManager::ApplyFile(const char* filename) {
281 
282  for(int i = 0; i < inProgressMaterials.Num(); i++) {
284  if(!strcmp((*pDoc)->renderMaterial->GetFileName(), filename))
285  (*pDoc)->ApplyMaterialChanges();
286  }
287 }
288 
293  for(int i = 0; i < inProgressMaterials.Num(); i++) {
295  (*pDoc)->ApplyMaterialChanges();
296  }
297 }
298 
304  assert(material);
305  material->Save();
306 }
307 
312 void MaterialDocManager::SaveFile(const char* filename) {
313 
314  for(int i = inProgressMaterials.Num()-1; i >= 0; i--) {
316  if(!strcmp((*pDoc)->renderMaterial->GetFileName(), filename))
317  (*pDoc)->Save();
318  }
319 
320  //Notify everyone
321  NotifyViews(NULL, MATERIAL_SAVE_FILE, filename);
322 }
323 
328  for(int i = inProgressMaterials.Num()-1; i >= 0; i--) {
330  (*pDoc)->Save();
331  }
332 }
333 
338 void MaterialDocManager::ReloadFile(const char *filename) {
339 
340  declManager->ReloadFile(filename, true);
341 
342  //purge the changes of any in progress materials
343  for(int j = inProgressMaterials.Num()-1; j >= 0; j--) {
345  if(!strcmp((*pDoc)->renderMaterial->GetFileName(), filename)) {
346  (*pDoc)->SetRenderMaterial((*pDoc)->renderMaterial);
347  inProgressMaterials.Remove((*pDoc)->name);
348  }
349  }
350 
351  //Reparse the current material
352  if(currentMaterial) {
354 
355  //Trigger all the views to refresh
357  }
358 
359  NotifyViews(NULL, FILE_RELOAD, filename);
360 }
361 
368 
369  const idMaterial* material = declManager->FindMaterial(materialName);
370  return CreateMaterialDoc(const_cast<idMaterial *>(material));
371 }
372 
379 
380  MaterialDoc* existingDoc = GetInProgressDoc(material);
381  if(existingDoc) {
382  return existingDoc;
383  }
384 
385  if(currentMaterial && material && !currentMaterial->name.Icmp(material->GetName())) {
386  return currentMaterial;
387  }
388 
389  if(material) {
390  MaterialDoc* newDoc = new MaterialDoc();
391  newDoc->manager = this;
392  newDoc->SetRenderMaterial(material);
393 
394  return newDoc;
395  }
396 
397  return NULL;
398 }
399 
406 
407  if(material) {
408  for(int i = 0; i < inProgressMaterials.Num(); i++) {
410 
411  if(!(*pDoc)->name.Icmp(material->GetName()))
412  return *pDoc;
413  }
414  }
415  return NULL;
416 }
417 
423 void MaterialDocManager::CopyMaterial(MaterialDoc* materialDoc, bool cut) {
424 
425  cutMaterial = cut;
426 
427  if(materialDoc)
428  copyMaterial = materialDoc->name;
429  else
430  ClearCopy();
431 }
432 
438 }
439 
444  return (copyMaterial.Length() ) ? true : false;
445 }
446 
451  return copyMaterial;
452 }
453 
459 void MaterialDocManager::PasteMaterial(const char* name, const char* filename) {
460 
461  if(!IsCopyMaterial()) {
462  return;
463  }
464 
465  //Apply the material if there are some changes
467  if(copyMat->applyWaiting) {
468  copyMat->ApplyMaterialChanges();
469  }
470  //Paste the material
471  idMaterial* material = copyMat->renderMaterial;
472 
473  //Add a material with the existing source text
474  char *declText = (char *) _alloca( material->GetTextLength() + 1 );
475  material->GetText( declText );
476 
477  AddMaterial(name, filename, declText, !cutMaterial);
478 
479  //If this is a cut then remove the original
480  if(cutMaterial) {
482  DeleteMaterial(cutMaterial, false);
483 
484  MoveMaterialModifier* mod = new MoveMaterialModifier(this, name, filename, copyMaterial);
486 
487  ClearCopy();
488  }
489 
490 }
491 
497 void MaterialDocManager::CopyStage(MaterialDoc* materialDoc, int stageNum) {
498 
499  assert(materialDoc);
500 
501  copyStageMaterial = materialDoc->name;
502  copyStage = materialDoc->GetStage(stageNum);
503 
504  idStr stageName = copyStage.stageData.GetString("name");
505 }
506 
513 }
514 
519  return (copyStageMaterial.Length() ) ? true : false;
520 }
521 
527 
528  assert(materialDoc);
529 
530  int stageType = copyStage.stageData.GetInt("stagetype");
531 
532  //Create a new stage and copy the data
533  materialDoc->AddStage(stageType, copyStage.stageData.GetString("name"));
534  materialDoc->SetData(materialDoc->GetStageCount()-1, &copyStage.stageData);
535 }
536 
543  if(IsCopyStage()) {
544  type = copyStage.stageData.GetInt("stagetype");
545  name = copyStage.stageData.GetString("name");
546  }
547 }
548 
553 
554  if(IsUndoAvailable()) {
557 
558  mod->Undo();
559 
560  //Add this modifier to the redo list
562  }
563 }
564 
569  return (undoModifiers.Num() > 0);
570 }
571 
576 
577  int c = undoModifiers.Num();
578  for(int i = 0; i < c; i++) {
579  delete undoModifiers[i];
580  }
582 }
583 
588 
589  if(IsRedoAvailable()) {
592 
593  mod->Redo();
594 
595  //Done with the mod because the redo process will set
596  //attributes and create the appropriate redo modifier
597  AddMaterialUndoModifier(mod, false);
598  }
599 }
600 
605  return (redoModifiers.Num() > 0);
606 }
607 
612 
613  int c = redoModifiers.Num();
614  for(int i = 0; i < c; i++) {
615  delete redoModifiers[i];
616  }
618 }
619 
626  undoModifiers.Append(mod);
627 
628  while(undoModifiers.Num() > MAX_UNDOREDO) {
630  }
631 
632  if(clearRedo) {
633  ClearRedo();
634  }
635 }
636 
642  redoModifiers.Append(mod);
643 
644  while(redoModifiers.Num() > MAX_UNDOREDO) {
646  }
647 }
648 
655 bool MaterialDocManager::FindMaterial(const char* name, MaterialSearchData_t* searchData, bool checkName) {
656 
657  //Fast way of finding the material without parsing
658  const idMaterial* material = static_cast<const idMaterial *>(declManager->FindDeclWithoutParsing(DECL_MATERIAL, name, false));
659 
660  if(material) {
661 
662  int findPos;
663 
664  if(checkName) {
665  //Check the name
666  idStr name = material->GetName();
667 
668  findPos = name.Find(searchData->searchText, false);
669  if(findPos != -1) {
670  return true;
671  }
672  }
673 
674  //Skip to the open braket so the name is not checked
675  char *declText = (char *) _alloca( material->GetTextLength() + 1 );
676  material->GetText( declText );
677 
678  idStr text = declText;
679  int start = text.Find("{");
680  if(start != -1) {
681  text = text.Right(text.Length()-start);
682  }
683 
684  findPos = text.Find(searchData->searchText, false);
685  if(findPos != -1) {
686  //Todo: Include match whole word
687  return true;
688  }
689  }
690  return false;
691 }
692 
698  int num = 0;
699  while(1) {
700  idStr testName;
701  if(num == 0)
702  testName = name;
703  else
704  testName = va("%s%d", name.c_str(), num);
705 
706  const idMaterial* mat = declManager->FindMaterial(testName.c_str(), false);
707  if(!mat) {
708  return testName;
709  } else {
710 
711  //We can reuse delete material names
712  if(mat->GetTextLength() < 1)
713  return testName;
714  }
715  num++;
716  }
717 }
718 
725 void MaterialDocManager::NotifyViews(MaterialDoc* materialDoc, int notifyType, ... ) {
726 
727  va_list argptr;
728 
729  int c = materialViews.Num();
730  for(int i = 0; i < c; i++) {
731  va_start( argptr, notifyType );
732  switch(notifyType) {
733  case SELECTION_CHANGE:
734  materialViews[i]->MV_OnMaterialSelectionChange(materialDoc);
735  break;
736  case MATERIAL_CHANGE:
737  materialViews[i]->MV_OnMaterialChange(materialDoc);
738  break;
739  case MATERIAL_APPLY:
740  materialViews[i]->MV_OnMaterialApply(materialDoc);
741  break;
742  case MATERIAL_SAVE:
743  materialViews[i]->MV_OnMaterialSaved(materialDoc);
744  break;
745  case MATERIAL_SAVE_FILE:
746  materialViews[i]->MV_OnMaterialSaveFile(va_arg(argptr, const char*));
747  break;
748  case MATERIAL_ADD:
749  materialViews[i]->MV_OnMaterialAdd(materialDoc);
750  break;
751  case MATERIAL_DELETE:
752  materialViews[i]->MV_OnMaterialDelete(materialDoc);
753  break;
754  case MATERIAL_ADD_STAGE:
755  materialViews[i]->MV_OnMaterialStageAdd(materialDoc, va_arg(argptr, int));
756  break;
758  materialViews[i]->MV_OnMaterialStageDelete(materialDoc, va_arg(argptr, int));
759  break;
760  case MATERIAL_MOVE_STAGE:
761  {
762  int from = va_arg(argptr, int);
763  int to = va_arg(argptr, int);
764  materialViews[i]->MV_OnMaterialStageMove(materialDoc, from, to);
765  }
766  break;
768  {
769  int stage = va_arg(argptr, int);
770  const char* attribName = va_arg(argptr, const char*);
771  materialViews[i]->MV_OnMaterialAttributeChanged(materialDoc, stage, attribName);
772  }
773  break;
775  {
776  const char* oldName = va_arg(argptr, const char*);
777  materialViews[i]->MV_OnMaterialNameChanged(materialDoc, oldName);
778  }
779  break;
780  case FILE_RELOAD:
781  {
782  const char* filename = va_arg(argptr, const char*);
783  materialViews[i]->MV_OnFileReload(filename);
784  }
785  break;
786  }
787  va_end( argptr );
788  }
789 }
790 
796 
797  //Make sure this material is in our list of changed materials
798  if(!inProgressMaterials.Get(materialDoc->name.c_str())) {
799  inProgressMaterials.Set(materialDoc->name.c_str(), materialDoc);
800  }
801 
802  //Notify everyone
803  NotifyViews(materialDoc, MATERIAL_CHANGE);
804 }
805 
811 
812  //Notify everyone
813  NotifyViews(materialDoc, MATERIAL_APPLY);
814 }
815 
821 
822  MaterialDoc** tempDoc;
823  if(inProgressMaterials.Get(materialDoc->name.c_str(), &tempDoc)) {
824 
825  idStr name = materialDoc->name.c_str();
826 
827  //Remove this file from our in progress list
829 
830  //Notify everyone
831  NotifyViews(materialDoc, MATERIAL_SAVE);
832 
833  if(materialDoc != currentMaterial)
834  delete materialDoc;
835  }
836 }
837 
842 void MaterialDocManager::MaterialNameChanged(const char* oldName, MaterialDoc* materialDoc) {
843 
844  MaterialDoc** tempDoc;
845  if(inProgressMaterials.Get(oldName, &tempDoc)) {
846  inProgressMaterials.Set(materialDoc->name, *tempDoc);
847  inProgressMaterials.Remove(oldName);
848  }
849 
850  NotifyViews(materialDoc, MATERIAL_NAME_CHANGE, oldName);
851 }
852 
858 void MaterialDocManager::StageAdded(MaterialDoc* materialDoc, int stageNum) {
859  //Notify everyone
860  NotifyViews(materialDoc, MATERIAL_ADD_STAGE, stageNum);
861 }
862 
868 void MaterialDocManager::StageDeleted(MaterialDoc* materialDoc, int stageNum) {
869  //Notify everyone
870  NotifyViews(materialDoc, MATERIAL_DELETE_STAGE, stageNum);
871 }
872 
879 void MaterialDocManager::StageMoved(MaterialDoc* materialDoc, int from, int to) {
880  //Notify everyone
881  NotifyViews(materialDoc, MATERIAL_MOVE_STAGE, from, to);
882 }
883 
890 void MaterialDocManager::AttributeChanged(MaterialDoc* materialDoc, int stage, const char* attribName) {
891  //Notify everyone
892  NotifyViews(materialDoc, MATERIAL_ATTRIBUTE_CHANGE, stage, attribName);
893 }
virtual void SetMaterialDocManager(MaterialDocManager *docManager)
Sets the material document manager for this view instance.
Definition: MaterialView.h:57
bool IsRedoAvailable()
Returns true if a redo operation is available.
#define strcmp
Definition: Str.h:41
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
Definition: Dict.h:252
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.
bool modified
Definition: MaterialDoc.h:75
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
Definition: MaterialDoc.h:72
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.
int Length(void) const
Definition: Str.h:702
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
Definition: HashTable.h:248
const char * GetName(void) const
Definition: DeclManager.h:140
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
Definition: glext.h:2845
virtual const idMaterial * FindMaterial(const char *name, bool makeDefault=true)=0
bool applyWaiting
Definition: MaterialDoc.h:76
void ApplyMaterialChanges(bool force=false)
Applies any changes to the material.
int i
Definition: process.py:33
GLuint GLuint num
Definition: glext.h:5390
~MaterialDocManager(void)
Destructor for MaterialDocManager.
void NotifyViews(MaterialDoc *materialDoc, int notifyType,...)
Notifies all registered views of a material event.
virtual void Redo()=0
int Icmp(const char *text) const
Definition: Str.h:667
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)
Definition: HashTable.h:186
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.
Definition: MaterialDoc.h:67
const GLubyte * c
Definition: glext.h:4677
const char * GetString(const char *key, const char *defaultString="") const
Definition: Dict.h:240
void AddMaterialUndoModifier(MaterialModifier *mod, bool clearRedo=true)
Adds an undo operation to the undo buffer.
virtual void Undo()=0
void Empty(void)
Definition: Str.h:714
MaterialView Interface.
Definition: MaterialView.h:38
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
Definition: Material.cpp:2693
void CopyStage(MaterialDoc *materialDoc, int stageNum)
Prepares a material stage for a copy/paste operation.
#define NULL
Definition: Lib.h:88
idStr name
Definition: MaterialDoc.h:71
void AddStage(int stageType, const char *stageName, bool addUndo=true)
Adds a stage to the material.
void Clear(void)
Definition: Dict.cpp:201
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.
Definition: MaterialDoc.cpp:93
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
Definition: Str.h:896
bool Remove(const char *key)
Definition: HashTable.h:277
#define MAX_UNDOREDO
int Find(const char c, int start=0, int end=-1) const
Definition: Str.h:874
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)
Definition: DeclManager.h:180
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
Definition: HashTable.h:214
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 Num(void) const
Definition: HashTable.h:361
int Append(const type &obj)
Definition: List.h:646
virtual const idDecl * FindDeclWithoutParsing(declType_t type, const char *name, bool makeDefault=true)=0
MaterialDocManager * manager
Definition: MaterialDoc.h:70
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.
int Num(void) const
Definition: List.h:265
bool RemoveIndex(int index)
Definition: List.h:849
void ClearRedo()
Clears the redo buffer.
const GLcharARB * name
Definition: glext.h:3629
idDict stageData
Definition: MaterialDoc.h:38
Definition: Str.h:116
bool DoesAnyNeedApply()
Returns true if any material needs to be applied.
const char * c_str(void) const
Definition: Str.h:487
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.
Definition: MaterialDoc.cpp:58
MaterialDoc * currentMaterial
Undo/Redo operation for deleting materials.
void ApplyFile(const char *filename)
Applies all materials in the specified filename.
GLint j
Definition: qgl.h:264
void GetText(char *text) const
Definition: DeclManager.h:174
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,...)
Definition: Str.cpp:1568
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
Definition: DeclManager.h:177
GLuint start
Definition: glext.h:2845
bool Remove(const type &obj)
Definition: List.h:878
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.
void Clear(void)
Definition: List.h:184