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_SETRANGE_H__
11 #define __MayaDM_SETRANGE_H__
12 #include "MayaDMTypes.h"
13 #include "MayaDMConnectables.h"
14 #include "MayaDMDependNode.h"
15 namespace MayaDM
16 {
17 class SetRange : public DependNode
18 {
19 public:
20 public:
21 
SetRange()22 	SetRange():DependNode(){}
23 	SetRange(FILE* file,const std::string& name,const std::string& parent="",bool shared=false,bool create=true)
24 		:DependNode(file, name, parent, "setRange", shared, create){}
~SetRange()25 	virtual ~SetRange(){}
26 
setValue(const float3 & v)27 	void setValue(const float3& v)
28 	{
29 		if(v == float3(0.0f,0.0f,0.0f)) return;
30 		fprintf(mFile,"\tsetAttr \".v\" -type \"float3\" ");
31 		v.write(mFile);
32 		fprintf(mFile,";\n");
33 	}
setValueX(float vx)34 	void setValueX(float vx)
35 	{
36 		if(vx == 0.0) return;
37 		fprintf(mFile,"\tsetAttr \".v.vx\" %f;\n", vx);
38 	}
setValueY(float vy)39 	void setValueY(float vy)
40 	{
41 		if(vy == 0.0) return;
42 		fprintf(mFile,"\tsetAttr \".v.vy\" %f;\n", vy);
43 	}
setValueZ(float vz)44 	void setValueZ(float vz)
45 	{
46 		if(vz == 0.0) return;
47 		fprintf(mFile,"\tsetAttr \".v.vz\" %f;\n", vz);
48 	}
setMin(const float3 & n)49 	void setMin(const float3& n)
50 	{
51 		if(n == float3(0.0f,0.0f,0.0f)) return;
52 		fprintf(mFile,"\tsetAttr \".n\" -type \"float3\" ");
53 		n.write(mFile);
54 		fprintf(mFile,";\n");
55 	}
setMinX(float nx)56 	void setMinX(float nx)
57 	{
58 		if(nx == 0.0) return;
59 		fprintf(mFile,"\tsetAttr \".n.nx\" %f;\n", nx);
60 	}
setMinY(float ny)61 	void setMinY(float ny)
62 	{
63 		if(ny == 0.0) return;
64 		fprintf(mFile,"\tsetAttr \".n.ny\" %f;\n", ny);
65 	}
setMinZ(float nz)66 	void setMinZ(float nz)
67 	{
68 		if(nz == 0.0) return;
69 		fprintf(mFile,"\tsetAttr \".n.nz\" %f;\n", nz);
70 	}
setMax(const float3 & m)71 	void setMax(const float3& m)
72 	{
73 		if(m == float3(0.0f,0.0f,0.0f)) return;
74 		fprintf(mFile,"\tsetAttr \".m\" -type \"float3\" ");
75 		m.write(mFile);
76 		fprintf(mFile,";\n");
77 	}
setMaxX(float mx)78 	void setMaxX(float mx)
79 	{
80 		if(mx == 0.0) return;
81 		fprintf(mFile,"\tsetAttr \".m.mx\" %f;\n", mx);
82 	}
setMaxY(float my)83 	void setMaxY(float my)
84 	{
85 		if(my == 0.0) return;
86 		fprintf(mFile,"\tsetAttr \".m.my\" %f;\n", my);
87 	}
setMaxZ(float mz)88 	void setMaxZ(float mz)
89 	{
90 		if(mz == 0.0) return;
91 		fprintf(mFile,"\tsetAttr \".m.mz\" %f;\n", mz);
92 	}
setOldMin(const float3 & on)93 	void setOldMin(const float3& on)
94 	{
95 		if(on == float3(0.0f,0.0f,0.0f)) return;
96 		fprintf(mFile,"\tsetAttr \".on\" -type \"float3\" ");
97 		on.write(mFile);
98 		fprintf(mFile,";\n");
99 	}
setOldMinX(float onx)100 	void setOldMinX(float onx)
101 	{
102 		if(onx == 0.0) return;
103 		fprintf(mFile,"\tsetAttr \".on.onx\" %f;\n", onx);
104 	}
setOldMinY(float ony)105 	void setOldMinY(float ony)
106 	{
107 		if(ony == 0.0) return;
108 		fprintf(mFile,"\tsetAttr \".on.ony\" %f;\n", ony);
109 	}
setOldMinZ(float onz)110 	void setOldMinZ(float onz)
111 	{
112 		if(onz == 0.0) return;
113 		fprintf(mFile,"\tsetAttr \".on.onz\" %f;\n", onz);
114 	}
setOldMax(const float3 & om)115 	void setOldMax(const float3& om)
116 	{
117 		if(om == float3(0.0f,0.0f,0.0f)) return;
118 		fprintf(mFile,"\tsetAttr \".om\" -type \"float3\" ");
119 		om.write(mFile);
120 		fprintf(mFile,";\n");
121 	}
setOldMaxX(float omx)122 	void setOldMaxX(float omx)
123 	{
124 		if(omx == 0.0) return;
125 		fprintf(mFile,"\tsetAttr \".om.omx\" %f;\n", omx);
126 	}
setOldMaxY(float omy)127 	void setOldMaxY(float omy)
128 	{
129 		if(omy == 0.0) return;
130 		fprintf(mFile,"\tsetAttr \".om.omy\" %f;\n", omy);
131 	}
setOldMaxZ(float omz)132 	void setOldMaxZ(float omz)
133 	{
134 		if(omz == 0.0) return;
135 		fprintf(mFile,"\tsetAttr \".om.omz\" %f;\n", omz);
136 	}
getValue()137 	void getValue()const
138 	{
139 		fprintf(mFile,"\"%s.v\"",mName.c_str());
140 	}
getValueX()141 	void getValueX()const
142 	{
143 		fprintf(mFile,"\"%s.v.vx\"",mName.c_str());
144 	}
getValueY()145 	void getValueY()const
146 	{
147 		fprintf(mFile,"\"%s.v.vy\"",mName.c_str());
148 	}
getValueZ()149 	void getValueZ()const
150 	{
151 		fprintf(mFile,"\"%s.v.vz\"",mName.c_str());
152 	}
getMin()153 	void getMin()const
154 	{
155 		fprintf(mFile,"\"%s.n\"",mName.c_str());
156 	}
getMinX()157 	void getMinX()const
158 	{
159 		fprintf(mFile,"\"%s.n.nx\"",mName.c_str());
160 	}
getMinY()161 	void getMinY()const
162 	{
163 		fprintf(mFile,"\"%s.n.ny\"",mName.c_str());
164 	}
getMinZ()165 	void getMinZ()const
166 	{
167 		fprintf(mFile,"\"%s.n.nz\"",mName.c_str());
168 	}
getMax()169 	void getMax()const
170 	{
171 		fprintf(mFile,"\"%s.m\"",mName.c_str());
172 	}
getMaxX()173 	void getMaxX()const
174 	{
175 		fprintf(mFile,"\"%s.m.mx\"",mName.c_str());
176 	}
getMaxY()177 	void getMaxY()const
178 	{
179 		fprintf(mFile,"\"%s.m.my\"",mName.c_str());
180 	}
getMaxZ()181 	void getMaxZ()const
182 	{
183 		fprintf(mFile,"\"%s.m.mz\"",mName.c_str());
184 	}
getOldMin()185 	void getOldMin()const
186 	{
187 		fprintf(mFile,"\"%s.on\"",mName.c_str());
188 	}
getOldMinX()189 	void getOldMinX()const
190 	{
191 		fprintf(mFile,"\"%s.on.onx\"",mName.c_str());
192 	}
getOldMinY()193 	void getOldMinY()const
194 	{
195 		fprintf(mFile,"\"%s.on.ony\"",mName.c_str());
196 	}
getOldMinZ()197 	void getOldMinZ()const
198 	{
199 		fprintf(mFile,"\"%s.on.onz\"",mName.c_str());
200 	}
getOldMax()201 	void getOldMax()const
202 	{
203 		fprintf(mFile,"\"%s.om\"",mName.c_str());
204 	}
getOldMaxX()205 	void getOldMaxX()const
206 	{
207 		fprintf(mFile,"\"%s.om.omx\"",mName.c_str());
208 	}
getOldMaxY()209 	void getOldMaxY()const
210 	{
211 		fprintf(mFile,"\"%s.om.omy\"",mName.c_str());
212 	}
getOldMaxZ()213 	void getOldMaxZ()const
214 	{
215 		fprintf(mFile,"\"%s.om.omz\"",mName.c_str());
216 	}
getOutValue()217 	void getOutValue()const
218 	{
219 		fprintf(mFile,"\"%s.o\"",mName.c_str());
220 	}
getOutValueX()221 	void getOutValueX()const
222 	{
223 		fprintf(mFile,"\"%s.o.ox\"",mName.c_str());
224 	}
getOutValueY()225 	void getOutValueY()const
226 	{
227 		fprintf(mFile,"\"%s.o.oy\"",mName.c_str());
228 	}
getOutValueZ()229 	void getOutValueZ()const
230 	{
231 		fprintf(mFile,"\"%s.o.oz\"",mName.c_str());
232 	}
233 protected:
234 	SetRange(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)235 		:DependNode(file, name, parent, nodeType, shared, create) {}
236 
237 };
238 }//namespace MayaDM
239 #endif//__MayaDM_SETRANGE_H__
240