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_TEXTUREBAKESET_H__ 11 #define __MayaDM_TEXTUREBAKESET_H__ 12 #include "MayaDMTypes.h" 13 #include "MayaDMConnectables.h" 14 #include "MayaDMBakeSet.h" 15 namespace MayaDM 16 { 17 class TextureBakeSet : public BakeSet 18 { 19 public: 20 public: 21 TextureBakeSet()22 TextureBakeSet():BakeSet(){} 23 TextureBakeSet(FILE* file,const std::string& name,const std::string& parent="",bool shared=false,bool create=true) 24 :BakeSet(file, name, parent, "textureBakeSet", shared, create){} ~TextureBakeSet()25 virtual ~TextureBakeSet(){} 26 setSeparation(unsigned int sep)27 void setSeparation(unsigned int sep) 28 { 29 if(sep == 0) return; 30 fprintf(mFile,"\tsetAttr \".sep\" %i;\n", sep); 31 } setXResolution(int xres)32 void setXResolution(int xres) 33 { 34 if(xres == 512) return; 35 fprintf(mFile,"\tsetAttr \".xres\" %i;\n", xres); 36 } setYResolution(int yres)37 void setYResolution(int yres) 38 { 39 if(yres == 512) return; 40 fprintf(mFile,"\tsetAttr \".yres\" %i;\n", yres); 41 } setFileFormat(unsigned int format)42 void setFileFormat(unsigned int format) 43 { 44 if(format == 0) return; 45 fprintf(mFile,"\tsetAttr \".format\" %i;\n", format); 46 } setBitsPerChannel(unsigned int bits)47 void setBitsPerChannel(unsigned int bits) 48 { 49 if(bits == 0) return; 50 fprintf(mFile,"\tsetAttr \".bits\" %i;\n", bits); 51 } setOverrideUvSet(bool overrideuv)52 void setOverrideUvSet(bool overrideuv) 53 { 54 if(overrideuv == 0) return; 55 fprintf(mFile,"\tsetAttr \".overrideuv\" %i;\n", overrideuv); 56 } setUvSetName(const string & set)57 void setUvSetName(const string& set) 58 { 59 if(set == "uvSet1") return; 60 fprintf(mFile,"\tsetAttr \".set\" -type \"string\" "); 61 set.write(mFile); 62 fprintf(mFile,";\n"); 63 } setUvRange(unsigned int range)64 void setUvRange(unsigned int range) 65 { 66 if(range == 0) return; 67 fprintf(mFile,"\tsetAttr \".range\" %i;\n", range); 68 } setUMin(float ul)69 void setUMin(float ul) 70 { 71 if(ul == 1.0) return; 72 fprintf(mFile,"\tsetAttr \".ul\" %f;\n", ul); 73 } setUMax(float uh)74 void setUMax(float uh) 75 { 76 if(uh == 1.0) return; 77 fprintf(mFile,"\tsetAttr \".uh\" %f;\n", uh); 78 } setVMin(float vl)79 void setVMin(float vl) 80 { 81 if(vl == 1.0) return; 82 fprintf(mFile,"\tsetAttr \".vl\" %f;\n", vl); 83 } setVMax(float vh)84 void setVMax(float vh) 85 { 86 if(vh == 1.0) return; 87 fprintf(mFile,"\tsetAttr \".vh\" %f;\n", vh); 88 } setBackgroundMode(unsigned int bmode)89 void setBackgroundMode(unsigned int bmode) 90 { 91 if(bmode == 0) return; 92 fprintf(mFile,"\tsetAttr \".bmode\" %i;\n", bmode); 93 } setBackgroundColor(const float3 & bgc)94 void setBackgroundColor(const float3& bgc) 95 { 96 if(bgc == float3(0.0f,0.0f,0.0f)) return; 97 fprintf(mFile,"\tsetAttr \".bgc\" -type \"float3\" "); 98 bgc.write(mFile); 99 fprintf(mFile,";\n"); 100 } setBackgroundColorR(float bgr)101 void setBackgroundColorR(float bgr) 102 { 103 if(bgr == 0.0) return; 104 fprintf(mFile,"\tsetAttr \".bgc.bgr\" %f;\n", bgr); 105 } setBackgroundColorG(float bgg)106 void setBackgroundColorG(float bgg) 107 { 108 if(bgg == 0.0) return; 109 fprintf(mFile,"\tsetAttr \".bgc.bgg\" %f;\n", bgg); 110 } setBackgroundColorB(float bgb)111 void setBackgroundColorB(float bgb) 112 { 113 if(bgb == 0.0) return; 114 fprintf(mFile,"\tsetAttr \".bgc.bgb\" %f;\n", bgb); 115 } setFillTextureSeams(float fillseams)116 void setFillTextureSeams(float fillseams) 117 { 118 if(fillseams == 1.0) return; 119 fprintf(mFile,"\tsetAttr \".fillseams\" %f;\n", fillseams); 120 } setFinalGatherQuality(float fgq)121 void setFinalGatherQuality(float fgq) 122 { 123 if(fgq == 1) return; 124 fprintf(mFile,"\tsetAttr \".fgq\" %f;\n", fgq); 125 } setFinalGatherReflect(float fgr)126 void setFinalGatherReflect(float fgr) 127 { 128 if(fgr == 0) return; 129 fprintf(mFile,"\tsetAttr \".fgr\" %f;\n", fgr); 130 } setBakeToOneMap(bool one)131 void setBakeToOneMap(bool one) 132 { 133 if(one == 0) return; 134 fprintf(mFile,"\tsetAttr \".one\" %i;\n", one); 135 } setSamples(int nsp)136 void setSamples(int nsp) 137 { 138 if(nsp == 1) return; 139 fprintf(mFile,"\tsetAttr \".nsp\" %i;\n", nsp); 140 } getSeparation()141 void getSeparation()const 142 { 143 fprintf(mFile,"\"%s.sep\"",mName.c_str()); 144 } getPrefix()145 void getPrefix()const 146 { 147 fprintf(mFile,"\"%s.pre\"",mName.c_str()); 148 } getXResolution()149 void getXResolution()const 150 { 151 fprintf(mFile,"\"%s.xres\"",mName.c_str()); 152 } getYResolution()153 void getYResolution()const 154 { 155 fprintf(mFile,"\"%s.yres\"",mName.c_str()); 156 } getFileFormat()157 void getFileFormat()const 158 { 159 fprintf(mFile,"\"%s.format\"",mName.c_str()); 160 } getBitsPerChannel()161 void getBitsPerChannel()const 162 { 163 fprintf(mFile,"\"%s.bits\"",mName.c_str()); 164 } getOverrideUvSet()165 void getOverrideUvSet()const 166 { 167 fprintf(mFile,"\"%s.overrideuv\"",mName.c_str()); 168 } getUvSetName()169 void getUvSetName()const 170 { 171 fprintf(mFile,"\"%s.set\"",mName.c_str()); 172 } getUvRange()173 void getUvRange()const 174 { 175 fprintf(mFile,"\"%s.range\"",mName.c_str()); 176 } getUMin()177 void getUMin()const 178 { 179 fprintf(mFile,"\"%s.ul\"",mName.c_str()); 180 } getUMax()181 void getUMax()const 182 { 183 fprintf(mFile,"\"%s.uh\"",mName.c_str()); 184 } getVMin()185 void getVMin()const 186 { 187 fprintf(mFile,"\"%s.vl\"",mName.c_str()); 188 } getVMax()189 void getVMax()const 190 { 191 fprintf(mFile,"\"%s.vh\"",mName.c_str()); 192 } getBackgroundMode()193 void getBackgroundMode()const 194 { 195 fprintf(mFile,"\"%s.bmode\"",mName.c_str()); 196 } getBackgroundColor()197 void getBackgroundColor()const 198 { 199 fprintf(mFile,"\"%s.bgc\"",mName.c_str()); 200 } getBackgroundColorR()201 void getBackgroundColorR()const 202 { 203 fprintf(mFile,"\"%s.bgc.bgr\"",mName.c_str()); 204 } getBackgroundColorG()205 void getBackgroundColorG()const 206 { 207 fprintf(mFile,"\"%s.bgc.bgg\"",mName.c_str()); 208 } getBackgroundColorB()209 void getBackgroundColorB()const 210 { 211 fprintf(mFile,"\"%s.bgc.bgb\"",mName.c_str()); 212 } getFillTextureSeams()213 void getFillTextureSeams()const 214 { 215 fprintf(mFile,"\"%s.fillseams\"",mName.c_str()); 216 } getFillScale()217 void getFillScale()const 218 { 219 fprintf(mFile,"\"%s.fillscale\"",mName.c_str()); 220 } getFinalGatherQuality()221 void getFinalGatherQuality()const 222 { 223 fprintf(mFile,"\"%s.fgq\"",mName.c_str()); 224 } getFinalGatherReflect()225 void getFinalGatherReflect()const 226 { 227 fprintf(mFile,"\"%s.fgr\"",mName.c_str()); 228 } getBakeToOneMap()229 void getBakeToOneMap()const 230 { 231 fprintf(mFile,"\"%s.one\"",mName.c_str()); 232 } getSamples()233 void getSamples()const 234 { 235 fprintf(mFile,"\"%s.nsp\"",mName.c_str()); 236 } 237 protected: 238 TextureBakeSet(FILE* file,const std::string& name,const std::string& parent,const std::string& nodeType,bool shared=false,bool create=true) BakeSet(file,name,parent,nodeType,shared,create)239 :BakeSet(file, name, parent, nodeType, shared, create) {} 240 241 }; 242 }//namespace MayaDM 243 #endif//__MayaDM_TEXTUREBAKESET_H__ 244