1/*
2Open Asset Import Library (assimp)
3----------------------------------------------------------------------
4
5Copyright (c) 2006-2017, assimp team
6
7All rights reserved.
8
9Redistribution and use of this software in source and binary forms,
10with or without modification, are permitted provided that the
11following conditions are met:
12
13* Redistributions of source code must retain the above
14 copyright notice, this list of conditions and the
15 following disclaimer.
16
17* Redistributions in binary form must reproduce the above
18 copyright notice, this list of conditions and the
19 following disclaimer in the documentation and/or other
20 materials provided with the distribution.
21
22* Neither the name of the assimp team, nor the names of its
23 contributors may be used to endorse or promote products
24 derived from this software without specific prior
25 written permission of the assimp team.
26
27THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
30A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
31OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
32SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
33LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
34DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
35THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
36(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
37OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38
39----------------------------------------------------------------------
40*/
41
42/** @file FBXNoteAttribute.cpp
43 * @brief Assimp::FBX::NodeAttribute (and subclasses) implementation
44 */
45
46#ifndef ASSIMP_BUILD_NO_FBX_IMPORTER
47
48#include "FBXParser.h"
49#include "FBXDocument.h"
50#include "FBXImporter.h"
51#include "FBXDocumentUtil.h"
52
53namespace Assimp {
54namespace FBX {
55
56using namespace Util;
57
58// ------------------------------------------------------------------------------------------------
59NodeAttribute::NodeAttribute(uint64_t id, const Element& element, const Document& doc, const std::string& name)
60: Object(id,element,name)
61, props()
62{
63 const Scope& sc = GetRequiredScope(element);
64
65 const std::string& classname = ParseTokenAsString(GetRequiredToken(element,2));
66
67 // hack on the deriving type but Null/LimbNode attributes are the only case in which
68 // the property table is by design absent and no warning should be generated
69 // for it.
70 const bool is_null_or_limb = !strcmp(classname.c_str(), "Null") || !strcmp(classname.c_str(), "LimbNode");
71 props = GetPropertyTable(doc,"NodeAttribute.Fbx" + classname,element,sc, is_null_or_limb);
72}
73
74
75// ------------------------------------------------------------------------------------------------
76NodeAttribute::~NodeAttribute()
77{
78 // empty
79}
80
81
82// ------------------------------------------------------------------------------------------------
83CameraSwitcher::CameraSwitcher(uint64_t id, const Element& element, const Document& doc, const std::string& name)
84 : NodeAttribute(id,element,doc,name)
85{
86 const Scope& sc = GetRequiredScope(element);
87 const Element* const CameraId = sc["CameraId"];
88 const Element* const CameraName = sc["CameraName"];
89 const Element* const CameraIndexName = sc["CameraIndexName"];
90
91 if(CameraId) {
92 cameraId = ParseTokenAsInt(GetRequiredToken(*CameraId,0));
93 }
94
95 if(CameraName) {
96 cameraName = GetRequiredToken(*CameraName,0).StringContents();
97 }
98
99 if(CameraIndexName && CameraIndexName->Tokens().size()) {
100 cameraIndexName = GetRequiredToken(*CameraIndexName,0).StringContents();
101 }
102}
103
104// ------------------------------------------------------------------------------------------------
105CameraSwitcher::~CameraSwitcher()
106{
107 // empty
108}
109
110// ------------------------------------------------------------------------------------------------
111Camera::Camera(uint64_t id, const Element& element, const Document& doc, const std::string& name)
112: NodeAttribute(id,element,doc,name)
113{
114 // empty
115}
116
117// ------------------------------------------------------------------------------------------------
118Camera::~Camera()
119{
120 // empty
121}
122
123// ------------------------------------------------------------------------------------------------
124Light::Light(uint64_t id, const Element& element, const Document& doc, const std::string& name)
125: NodeAttribute(id,element,doc,name)
126{
127 // empty
128}
129
130
131// ------------------------------------------------------------------------------------------------
132Light::~Light()
133{
134}
135
136
137// ------------------------------------------------------------------------------------------------
138Null::Null(uint64_t id, const Element& element, const Document& doc, const std::string& name)
139: NodeAttribute(id,element,doc,name)
140{
141
142}
143
144
145// ------------------------------------------------------------------------------------------------
146Null::~Null()
147{
148
149}
150
151
152// ------------------------------------------------------------------------------------------------
153LimbNode::LimbNode(uint64_t id, const Element& element, const Document& doc, const std::string& name)
154: NodeAttribute(id,element,doc,name)
155{
156
157}
158
159
160// ------------------------------------------------------------------------------------------------
161LimbNode::~LimbNode()
162{
163
164}
165
166}
167}
168
169#endif
170