1 /* 2 Copyright (c) 2008-2009 NetAllied Systems GmbH 3 4 This file is part of MayaDataModel. 5 6 Licensed under the MIT Open Source License, 7 for details please see LICENSE file or the website 8 http://www.opensource.org/licenses/mit-license.php 9 */ 10 #ifndef __MayaDM_OBJECTFILTER_H__ 11 #define __MayaDM_OBJECTFILTER_H__ 12 #include "MayaDMTypes.h" 13 #include "MayaDMConnectables.h" 14 #include "MayaDMDependNode.h" 15 namespace MayaDM 16 { 17 class ObjectFilter : public DependNode 18 { 19 public: 20 public: 21 ObjectFilter()22 ObjectFilter():DependNode(){} 23 ObjectFilter(FILE* file,const std::string& name,const std::string& parent="",bool shared=false,bool create=true) 24 :DependNode(file, name, parent, "objectFilter", shared, create){} ~ObjectFilter()25 virtual ~ObjectFilter(){} 26 setChild(bool ch)27 void setChild(bool ch) 28 { 29 if(ch == 0) return; 30 fprintf(mFile,"\tsetAttr \".ch\" %i;\n", ch); 31 } setInvert(bool inv)32 void setInvert(bool inv) 33 { 34 if(inv == 0) return; 35 fprintf(mFile,"\tsetAttr \".inv\" %i;\n", inv); 36 } setAnnotation(const string & an)37 void setAnnotation(const string& an) 38 { 39 if(an == "NULL") return; 40 fprintf(mFile,"\tsetAttr \".an\" -type \"string\" "); 41 an.write(mFile); 42 fprintf(mFile,";\n"); 43 } setCategory(const stringArray & cat)44 void setCategory(const stringArray& cat) 45 { 46 fprintf(mFile,"\tsetAttr \".cat\" -type \"stringArray\" "); 47 cat.write(mFile); 48 fprintf(mFile,";\n"); 49 } setDisable(bool dis)50 void setDisable(bool dis) 51 { 52 if(dis == 0) return; 53 fprintf(mFile,"\tsetAttr \".dis\" %i;\n", dis); 54 } setFilterClass(unsigned int fcls)55 void setFilterClass(unsigned int fcls) 56 { 57 if(fcls == 0) return; 58 fprintf(mFile,"\tsetAttr \".fcls\" %i;\n", fcls); 59 } getChild()60 void getChild()const 61 { 62 fprintf(mFile,"\"%s.ch\"",mName.c_str()); 63 } getInvert()64 void getInvert()const 65 { 66 fprintf(mFile,"\"%s.inv\"",mName.c_str()); 67 } getInputList()68 void getInputList()const 69 { 70 fprintf(mFile,"\"%s.in\"",mName.c_str()); 71 } getOutputList()72 void getOutputList()const 73 { 74 fprintf(mFile,"\"%s.out\"",mName.c_str()); 75 } getAnnotation()76 void getAnnotation()const 77 { 78 fprintf(mFile,"\"%s.an\"",mName.c_str()); 79 } getCategory()80 void getCategory()const 81 { 82 fprintf(mFile,"\"%s.cat\"",mName.c_str()); 83 } getDisable()84 void getDisable()const 85 { 86 fprintf(mFile,"\"%s.dis\"",mName.c_str()); 87 } getFilterClass()88 void getFilterClass()const 89 { 90 fprintf(mFile,"\"%s.fcls\"",mName.c_str()); 91 } 92 protected: 93 ObjectFilter(FILE* file,const std::string& name,const std::string& parent,const std::string& nodeType,bool shared=false,bool create=true) DependNode(file,name,parent,nodeType,shared,create)94 :DependNode(file, name, parent, nodeType, shared, create) {} 95 96 }; 97 }//namespace MayaDM 98 #endif//__MayaDM_OBJECTFILTER_H__ 99