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

« back to all changes in this revision

Viewing changes to Externals/MayaDataModel/include/MayaDMAnimCurveUU.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_ANIMCURVEUU_H__
 
11
#define __MayaDM_ANIMCURVEUU_H__
 
12
#include "MayaDMTypes.h"
 
13
#include "MayaDMConnectables.h"
 
14
#include "MayaDMAnimCurve.h"
 
15
namespace MayaDM
 
16
{
 
17
class AnimCurveUU : public AnimCurve
 
18
{
 
19
public:
 
20
        struct KeyTimeValue{
 
21
                double keyTime;
 
22
                double keyValue;
 
23
                void write(FILE* file) const
 
24
                {
 
25
                        fprintf(file,"%f ", keyTime);
 
26
                        fprintf(file,"%f", keyValue);
 
27
                }
 
28
        };
 
29
public:
 
30
 
 
31
        AnimCurveUU():AnimCurve(){}
 
32
        AnimCurveUU(FILE* file,const std::string& name,const std::string& parent="",bool shared=false,bool create=true)
 
33
                :AnimCurve(file, name, parent, "animCurveUU", shared, create){}
 
34
        virtual ~AnimCurveUU(){}
 
35
 
 
36
        void setKeyTimeValue(size_t ktv_i,const KeyTimeValue& ktv)
 
37
        {
 
38
                fprintf(mFile,"\tsetAttr \".ktv[%i]\" ",ktv_i);
 
39
                ktv.write(mFile);
 
40
                fprintf(mFile,";\n");
 
41
        }
 
42
        void setKeyTimeValue(size_t ktv_start,size_t ktv_end,KeyTimeValue* ktv)
 
43
        {
 
44
                fprintf(mFile,"\tsetAttr \".ktv[%i:%i]\" ", ktv_start,ktv_end);
 
45
                size_t size = (ktv_end-ktv_start)*1+1;
 
46
                for(size_t i=0;i<size;++i)
 
47
                {
 
48
                        ktv[i].write(mFile);
 
49
                        fprintf(mFile,"\n");
 
50
                }
 
51
                fprintf(mFile,";\n");
 
52
        }
 
53
        void startKeyTimeValue(size_t ktv_start,size_t ktv_end)const
 
54
        {
 
55
                fprintf(mFile,"\tsetAttr \".ktv[%i:%i]\"",ktv_start,ktv_end);
 
56
                fprintf(mFile," -type \"KeyTimeValue\" ");
 
57
        }
 
58
        void appendKeyTimeValue(const KeyTimeValue& ktv)const
 
59
        {
 
60
                fprintf(mFile," ");
 
61
                ktv.write(mFile);
 
62
        }
 
63
        void endKeyTimeValue()const
 
64
        {
 
65
                fprintf(mFile,";\n");
 
66
        }
 
67
        void setKeyTime(size_t ktv_i,double kt)
 
68
        {
 
69
                if(kt == 0) return;
 
70
                fprintf(mFile,"\tsetAttr \".ktv[%i].kt\" %f;\n", ktv_i,kt);
 
71
        }
 
72
        void setKeyValue(size_t ktv_i,double kv)
 
73
        {
 
74
                if(kv == 0.0) return;
 
75
                fprintf(mFile,"\tsetAttr \".ktv[%i].kv\" %f;\n", ktv_i,kv);
 
76
        }
 
77
        void getInput()const
 
78
        {
 
79
                fprintf(mFile,"\"%s.i\"",mName.c_str());
 
80
        }
 
81
        void getOutput()const
 
82
        {
 
83
                fprintf(mFile,"\"%s.o\"",mName.c_str());
 
84
        }
 
85
protected:
 
86
        AnimCurveUU(FILE* file,const std::string& name,const std::string& parent,const std::string& nodeType,bool shared=false,bool create=true)
 
87
                :AnimCurve(file, name, parent, nodeType, shared, create) {}
 
88
 
 
89
};
 
90
}//namespace MayaDM
 
91
#endif//__MayaDM_ANIMCURVEUU_H__