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_POLYMOVEEDGE_H__
11 #define __MayaDM_POLYMOVEEDGE_H__
12 #include "MayaDMTypes.h"
13 #include "MayaDMConnectables.h"
14 #include "MayaDMPolyMoveVertex.h"
15 namespace MayaDM
16 {
17 class PolyMoveEdge : public PolyMoveVertex
18 {
19 public:
20 public:
21 
PolyMoveEdge()22 	PolyMoveEdge():PolyMoveVertex(){}
23 	PolyMoveEdge(FILE* file,const std::string& name,const std::string& parent="",bool shared=false,bool create=true)
24 		:PolyMoveVertex(file, name, parent, "polyMoveEdge", shared, create){}
~PolyMoveEdge()25 	virtual ~PolyMoveEdge(){}
26 
setLocalRotate(const double3 & lr)27 	void setLocalRotate(const double3& lr)
28 	{
29 		if(lr == double3(0.0, 0.0, 0.0)) return;
30 		fprintf(mFile,"\tsetAttr \".lr\" -type \"double3\" ");
31 		lr.write(mFile);
32 		fprintf(mFile,";\n");
33 	}
setLocalRotateX(double lrx)34 	void setLocalRotateX(double lrx)
35 	{
36 		if(lrx == 0) return;
37 		fprintf(mFile,"\tsetAttr \".lr.lrx\" %f;\n", lrx);
38 	}
setLocalRotateY(double lry)39 	void setLocalRotateY(double lry)
40 	{
41 		if(lry == 0) return;
42 		fprintf(mFile,"\tsetAttr \".lr.lry\" %f;\n", lry);
43 	}
setLocalRotateZ(double lrz)44 	void setLocalRotateZ(double lrz)
45 	{
46 		if(lrz == 0) return;
47 		fprintf(mFile,"\tsetAttr \".lr.lrz\" %f;\n", lrz);
48 	}
setLocalScale(const double3 & ls)49 	void setLocalScale(const double3& ls)
50 	{
51 		if(ls == double3(1.0, 1.0, 1.0)) return;
52 		fprintf(mFile,"\tsetAttr \".ls\" -type \"double3\" ");
53 		ls.write(mFile);
54 		fprintf(mFile,";\n");
55 	}
setLocalScaleX(double lsx)56 	void setLocalScaleX(double lsx)
57 	{
58 		if(lsx == 0.0) return;
59 		fprintf(mFile,"\tsetAttr \".ls.lsx\" %f;\n", lsx);
60 	}
setLocalScaleY(double lsy)61 	void setLocalScaleY(double lsy)
62 	{
63 		if(lsy == 0.0) return;
64 		fprintf(mFile,"\tsetAttr \".ls.lsy\" %f;\n", lsy);
65 	}
setLocalScaleZ(double lsz)66 	void setLocalScaleZ(double lsz)
67 	{
68 		if(lsz == 0.0) return;
69 		fprintf(mFile,"\tsetAttr \".ls.lsz\" %f;\n", lsz);
70 	}
setLocalCenter(unsigned int lc)71 	void setLocalCenter(unsigned int lc)
72 	{
73 		if(lc == 0) return;
74 		fprintf(mFile,"\tsetAttr \".lc\" %i;\n", lc);
75 	}
getLocalRotate()76 	void getLocalRotate()const
77 	{
78 		fprintf(mFile,"\"%s.lr\"",mName.c_str());
79 	}
getLocalRotateX()80 	void getLocalRotateX()const
81 	{
82 		fprintf(mFile,"\"%s.lr.lrx\"",mName.c_str());
83 	}
getLocalRotateY()84 	void getLocalRotateY()const
85 	{
86 		fprintf(mFile,"\"%s.lr.lry\"",mName.c_str());
87 	}
getLocalRotateZ()88 	void getLocalRotateZ()const
89 	{
90 		fprintf(mFile,"\"%s.lr.lrz\"",mName.c_str());
91 	}
getLocalScale()92 	void getLocalScale()const
93 	{
94 		fprintf(mFile,"\"%s.ls\"",mName.c_str());
95 	}
getLocalScaleX()96 	void getLocalScaleX()const
97 	{
98 		fprintf(mFile,"\"%s.ls.lsx\"",mName.c_str());
99 	}
getLocalScaleY()100 	void getLocalScaleY()const
101 	{
102 		fprintf(mFile,"\"%s.ls.lsy\"",mName.c_str());
103 	}
getLocalScaleZ()104 	void getLocalScaleZ()const
105 	{
106 		fprintf(mFile,"\"%s.ls.lsz\"",mName.c_str());
107 	}
getLocalCenter()108 	void getLocalCenter()const
109 	{
110 		fprintf(mFile,"\"%s.lc\"",mName.c_str());
111 	}
112 protected:
113 	PolyMoveEdge(FILE* file,const std::string& name,const std::string& parent,const std::string& nodeType,bool shared=false,bool create=true)
PolyMoveVertex(file,name,parent,nodeType,shared,create)114 		:PolyMoveVertex(file, name, parent, nodeType, shared, create) {}
115 
116 };
117 }//namespace MayaDM
118 #endif//__MayaDM_POLYMOVEEDGE_H__
119