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_VORTEXFIELD_H__
11 #define __MayaDM_VORTEXFIELD_H__
12 #include "MayaDMTypes.h"
13 #include "MayaDMConnectables.h"
14 #include "MayaDMField.h"
15 namespace MayaDM
16 {
17 class VortexField : public Field
18 {
19 public:
20 	struct Axis{
21 		double axisX;
22 		double axisY;
23 		double axisZ;
writeAxis24 		void write(FILE* file) const
25 		{
26 			fprintf(file,"%f ", axisX);
27 			fprintf(file,"%f ", axisY);
28 			fprintf(file,"%f", axisZ);
29 		}
30 	};
31 public:
32 
VortexField()33 	VortexField():Field(){}
34 	VortexField(FILE* file,const std::string& name,const std::string& parent="",bool shared=false,bool create=true)
35 		:Field(file, name, parent, "vortexField", shared, create){}
~VortexField()36 	virtual ~VortexField(){}
37 
setAxis(const Axis & ax)38 	void setAxis(const Axis& ax)
39 	{
40 		fprintf(mFile,"\tsetAttr \".ax\" ");
41 		ax.write(mFile);
42 		fprintf(mFile,";\n");
43 	}
setAxisX(double axx)44 	void setAxisX(double axx)
45 	{
46 		if(axx == 0.0) return;
47 		fprintf(mFile,"\tsetAttr \".ax.axx\" %f;\n", axx);
48 	}
setAxisY(double axy)49 	void setAxisY(double axy)
50 	{
51 		if(axy == 0.0) return;
52 		fprintf(mFile,"\tsetAttr \".ax.axy\" %f;\n", axy);
53 	}
setAxisZ(double axz)54 	void setAxisZ(double axz)
55 	{
56 		if(axz == 0.0) return;
57 		fprintf(mFile,"\tsetAttr \".ax.axz\" %f;\n", axz);
58 	}
getAxis()59 	void getAxis()const
60 	{
61 		fprintf(mFile,"\"%s.ax\"",mName.c_str());
62 	}
getAxisX()63 	void getAxisX()const
64 	{
65 		fprintf(mFile,"\"%s.ax.axx\"",mName.c_str());
66 	}
getAxisY()67 	void getAxisY()const
68 	{
69 		fprintf(mFile,"\"%s.ax.axy\"",mName.c_str());
70 	}
getAxisZ()71 	void getAxisZ()const
72 	{
73 		fprintf(mFile,"\"%s.ax.axz\"",mName.c_str());
74 	}
75 protected:
76 	VortexField(FILE* file,const std::string& name,const std::string& parent,const std::string& nodeType,bool shared=false,bool create=true)
Field(file,name,parent,nodeType,shared,create)77 		:Field(file, name, parent, nodeType, shared, create) {}
78 
79 };
80 }//namespace MayaDM
81 #endif//__MayaDM_VORTEXFIELD_H__
82