~ubuntu-branches/ubuntu/wily/opencollada/wily-proposed

« back to all changes in this revision

Viewing changes to Externals/MayaDataModel/include/MayaDMDragField.h

  • Committer: Package Import Robot
  • Author(s): Matteo F. Vescovi
  • Date: 2015-05-14 17:23:27 UTC
  • Revision ID: package-import@ubuntu.com-20150514172327-f862u8envms01fra
Tags: upstream-0.1.0~20140703.ddf8f47+dfsg1
ImportĀ upstreamĀ versionĀ 0.1.0~20140703.ddf8f47+dfsg1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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_DRAGFIELD_H__
 
11
#define __MayaDM_DRAGFIELD_H__
 
12
#include "MayaDMTypes.h"
 
13
#include "MayaDMConnectables.h"
 
14
#include "MayaDMField.h"
 
15
namespace MayaDM
 
16
{
 
17
class DragField : public Field
 
18
{
 
19
public:
 
20
        struct Direction{
 
21
                double directionX;
 
22
                double directionY;
 
23
                double directionZ;
 
24
                void write(FILE* file) const
 
25
                {
 
26
                        fprintf(file,"%f ", directionX);
 
27
                        fprintf(file,"%f ", directionY);
 
28
                        fprintf(file,"%f", directionZ);
 
29
                }
 
30
        };
 
31
public:
 
32
 
 
33
        DragField():Field(){}
 
34
        DragField(FILE* file,const std::string& name,const std::string& parent="",bool shared=false,bool create=true)
 
35
                :Field(file, name, parent, "dragField", shared, create){}
 
36
        virtual ~DragField(){}
 
37
 
 
38
        void setDirection(const Direction& d)
 
39
        {
 
40
                fprintf(mFile,"\tsetAttr \".d\" ");
 
41
                d.write(mFile);
 
42
                fprintf(mFile,";\n");
 
43
        }
 
44
        void setDirectionX(double dx)
 
45
        {
 
46
                if(dx == 0.0) return;
 
47
                fprintf(mFile,"\tsetAttr \".d.dx\" %f;\n", dx);
 
48
        }
 
49
        void setDirectionY(double dy)
 
50
        {
 
51
                if(dy == 0.0) return;
 
52
                fprintf(mFile,"\tsetAttr \".d.dy\" %f;\n", dy);
 
53
        }
 
54
        void setDirectionZ(double dz)
 
55
        {
 
56
                if(dz == 0.0) return;
 
57
                fprintf(mFile,"\tsetAttr \".d.dz\" %f;\n", dz);
 
58
        }
 
59
        void setUseDirection(bool ud)
 
60
        {
 
61
                if(ud == false) return;
 
62
                fprintf(mFile,"\tsetAttr \".ud\" %i;\n", ud);
 
63
        }
 
64
        void setInheritVelocity(double iv)
 
65
        {
 
66
                if(iv == 0) return;
 
67
                fprintf(mFile,"\tsetAttr \".iv\" %f;\n", iv);
 
68
        }
 
69
        void setMotionAttenuation(double mna)
 
70
        {
 
71
                if(mna == 0.0) return;
 
72
                fprintf(mFile,"\tsetAttr \".mna\" %f;\n", mna);
 
73
        }
 
74
        void setSpeedAttenuation(double spa)
 
75
        {
 
76
                if(spa == 0.0) return;
 
77
                fprintf(mFile,"\tsetAttr \".spa\" %f;\n", spa);
 
78
        }
 
79
        void getDirection()const
 
80
        {
 
81
                fprintf(mFile,"\"%s.d\"",mName.c_str());
 
82
        }
 
83
        void getDirectionX()const
 
84
        {
 
85
                fprintf(mFile,"\"%s.d.dx\"",mName.c_str());
 
86
        }
 
87
        void getDirectionY()const
 
88
        {
 
89
                fprintf(mFile,"\"%s.d.dy\"",mName.c_str());
 
90
        }
 
91
        void getDirectionZ()const
 
92
        {
 
93
                fprintf(mFile,"\"%s.d.dz\"",mName.c_str());
 
94
        }
 
95
        void getUseDirection()const
 
96
        {
 
97
                fprintf(mFile,"\"%s.ud\"",mName.c_str());
 
98
        }
 
99
        void getInheritVelocity()const
 
100
        {
 
101
                fprintf(mFile,"\"%s.iv\"",mName.c_str());
 
102
        }
 
103
        void getMotionAttenuation()const
 
104
        {
 
105
                fprintf(mFile,"\"%s.mna\"",mName.c_str());
 
106
        }
 
107
        void getSpeedAttenuation()const
 
108
        {
 
109
                fprintf(mFile,"\"%s.spa\"",mName.c_str());
 
110
        }
 
111
        void getCurrentTime()const
 
112
        {
 
113
                fprintf(mFile,"\"%s.cti\"",mName.c_str());
 
114
        }
 
115
protected:
 
116
        DragField(FILE* file,const std::string& name,const std::string& parent,const std::string& nodeType,bool shared=false,bool create=true)
 
117
                :Field(file, name, parent, nodeType, shared, create) {}
 
118
 
 
119
};
 
120
}//namespace MayaDM
 
121
#endif//__MayaDM_DRAGFIELD_H__