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

« back to all changes in this revision

Viewing changes to Externals/MayaDataModel/include/MayaDMDependNode.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_DEPENDNODE_H__
 
11
#define __MayaDM_DEPENDNODE_H__
 
12
#include "MayaDMTypes.h"
 
13
#include "MayaDMConnectables.h"
 
14
namespace MayaDM
 
15
{
 
16
class DependNode
 
17
{
 
18
public:
 
19
public:
 
20
protected:
 
21
        FILE* mFile;
 
22
        std::string mName;
 
23
        std::string mParent;
 
24
        std::string mNodeType;
 
25
        bool mShared;
 
26
public:
 
27
        const std::string& getName()const
 
28
        {
 
29
                return mName;
 
30
        }
 
31
        const std::string& getParent()const
 
32
        {
 
33
                return mParent;
 
34
        }
 
35
        bool getShared()const
 
36
        {
 
37
                return mShared;
 
38
        }
 
39
        const std::string& getType()const
 
40
        {
 
41
                return mNodeType;
 
42
        }
 
43
        void setFile(FILE* file)
 
44
        {
 
45
                mFile = file;
 
46
        }
 
47
        void setName(const std::string& name)
 
48
        {
 
49
                mName = name;
 
50
        }
 
51
        void setParent(const std::string& parent)
 
52
        {
 
53
                mParent = parent;
 
54
        }
 
55
        void setShared(bool shared)
 
56
        {
 
57
                mShared = shared;
 
58
        }
 
59
public:
 
60
 
 
61
        DependNode(){}
 
62
        virtual ~DependNode(){}
 
63
 
 
64
        void setIsHistoricallyInteresting(unsigned char ihi)
 
65
        {
 
66
                if(ihi == 2) return;
 
67
                fprintf(mFile,"\tsetAttr \".ihi\" %i;\n", ihi);
 
68
        }
 
69
        void setCaching(bool cch)
 
70
        {
 
71
                if(cch == false) return;
 
72
                fprintf(mFile,"\tsetAttr \".cch\" %i;\n", cch);
 
73
        }
 
74
        void setNodeState(unsigned int nds)
 
75
        {
 
76
                if(nds == 0) return;
 
77
                fprintf(mFile,"\tsetAttr \".nds\" %i;\n", nds);
 
78
        }
 
79
        void setBinMembership(const string& bnm)
 
80
        {
 
81
                if(bnm == "NULL") return;
 
82
                fprintf(mFile,"\tsetAttr \".bnm\" -type \"string\" ");
 
83
                bnm.write(mFile);
 
84
                fprintf(mFile,";\n");
 
85
        }
 
86
        void getMessage()const
 
87
        {
 
88
                fprintf(mFile,"\"%s.msg\"",mName.c_str());
 
89
        }
 
90
        void getIsHistoricallyInteresting()const
 
91
        {
 
92
                fprintf(mFile,"\"%s.ihi\"",mName.c_str());
 
93
        }
 
94
        void getCaching()const
 
95
        {
 
96
                fprintf(mFile,"\"%s.cch\"",mName.c_str());
 
97
        }
 
98
        void getNodeState()const
 
99
        {
 
100
                fprintf(mFile,"\"%s.nds\"",mName.c_str());
 
101
        }
 
102
protected:
 
103
        DependNode(FILE* file,const std::string& name,const std::string& parent,const std::string& nodeType,bool shared=false,bool create=true)
 
104
                :mFile(file), mName(name), mParent(parent), mNodeType(nodeType), mShared(shared) 
 
105
        {
 
106
                if(create)
 
107
                        createNode();
 
108
        }
 
109
private:
 
110
        void createNode()const
 
111
        {
 
112
                if(mShared)
 
113
                        fprintf(mFile, "createNode %s -s -n \"%s\"", mNodeType.c_str(),mName.c_str());
 
114
                else
 
115
                        fprintf(mFile, "createNode %s -n \"%s\"", mNodeType.c_str(),mName.c_str());
 
116
                if(mParent != "") 
 
117
                        fprintf(mFile, " -p \"%s\"", mParent.c_str());
 
118
                fprintf(mFile, ";\n");
 
119
        }
 
120
 
 
121
};
 
122
}//namespace MayaDM
 
123
#endif//__MayaDM_DEPENDNODE_H__